From c735d783f4ada412128f9b725fa8bc7eb138598b Mon Sep 17 00:00:00 2001 From: Christopher-Steel Date: Tue, 27 Oct 2015 14:28:12 +0000 Subject: [PATCH] fixed code to work when called from other directories and even from a symlink --- file_json_provider.rb | 2 +- generate_release_notes.rb | 3 ++- release.rb | 2 +- stdout_confluence_reporter.rb | 4 ++-- stdout_reporter.rb | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/file_json_provider.rb b/file_json_provider.rb index 7077944..006df93 100644 --- a/file_json_provider.rb +++ b/file_json_provider.rb @@ -1,5 +1,5 @@ require "json" -require "./issue_provider" +require_relative "./issue_provider" class FileJSONProvider < IssueProvider VERSION_PATH = "./version.json" diff --git a/generate_release_notes.rb b/generate_release_notes.rb index ceba85b..8b730d7 100755 --- a/generate_release_notes.rb +++ b/generate_release_notes.rb @@ -10,7 +10,8 @@ exit -1 end -project_root = File.dirname(File.absolute_path(__FILE__)) +path = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__ +project_root = File.dirname(File.absolute_path(path)) Jira::Utils::load_config("#{project_root}/jira/config.yaml") version = Jira::Version::by_name(ARGV[0]) diff --git a/release.rb b/release.rb index 0c46184..a523dbd 100644 --- a/release.rb +++ b/release.rb @@ -1,4 +1,4 @@ -require "./json_issue" +require_relative "./json_issue" class Release STORIES_LABEL="Changes" diff --git a/stdout_confluence_reporter.rb b/stdout_confluence_reporter.rb index 0043468..b15891e 100644 --- a/stdout_confluence_reporter.rb +++ b/stdout_confluence_reporter.rb @@ -1,5 +1,5 @@ -require "./release_reporter" -require "./json_issue" +require_relative "./release_reporter" +require_relative "./json_issue" class StdOutConfluenceReporter < ReleaseReporter def open_section(name) diff --git a/stdout_reporter.rb b/stdout_reporter.rb index f1b2f2e..1dbb9df 100644 --- a/stdout_reporter.rb +++ b/stdout_reporter.rb @@ -1,5 +1,5 @@ -require "./release_reporter" -require "./json_issue" +require_relative "./release_reporter" +require_relative "./json_issue" class StdOutReporter < ReleaseReporter def open_section(name)