From a52f9619358520ca72a09f12d8abfd4771e2bbb7 Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Tue, 4 Nov 2014 19:45:10 +0200 Subject: [PATCH] Wrap in if __FILE__ == $0 --- changelog_generator.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/changelog_generator.rb b/changelog_generator.rb index d18ba78..a174a52 100755 --- a/changelog_generator.rb +++ b/changelog_generator.rb @@ -3,14 +3,16 @@ require_relative 'log_generator' -generator = LogGenerator.new +if __FILE__ == $0 + generator = LogGenerator.new -tag_time = generator.findPrevTagDate -pull_requests = generator.getAllClosedPullRequests + tag_time = generator.findPrevTagDate + pull_requests = generator.getAllClosedPullRequests -pull_requests.delete_if { |req| - t = Time.parse(req[:closed_at]).utc - t < tag_time -} + pull_requests.delete_if { |req| + t = Time.parse(req[:closed_at]).utc + t < tag_time + } -generator.compund_changelog(tag_time, pull_requests) \ No newline at end of file + generator.compund_changelog(tag_time, pull_requests) +end \ No newline at end of file