Class: GitPivotalTracker::Base
- Inherits:
-
Object
- Object
- GitPivotalTracker::Base
- Defined in:
- lib/git_pivotal_tracker/base.rb
Constant Summary collapse
- GIT_DIR =
ENV['GIT_DIR'] || '.git'
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Base
constructor
A new instance of Base.
- #run! ⇒ Object
Constructor Details
#initialize(*args) ⇒ Base
Returns a new instance of Base.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/git_pivotal_tracker/base.rb', line 7 def initialize(*args) directories = Dir.pwd.split(::File::SEPARATOR) begin break if File.directory?(File.join(directories, GIT_DIR)) end while directories.pop raise "No #{GIT_DIR} directory found" if directories.empty? root = File.join(directories, GIT_DIR) @repository = Grit::Repo.new(root) new_hook_path = File.join(root, 'hooks', 'commit-msg') unless File.executable?(new_hook_path) puts "Installing commit-msg hook..." old_hook_path = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'commit-msg') FileUtils.cp(old_hook_path, new_hook_path, :preserve => true) end @options = {} parse_gitconfig parse_argv(*args) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/git_pivotal_tracker/base.rb', line 5 def @options end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
5 6 7 |
# File 'lib/git_pivotal_tracker/base.rb', line 5 def repository @repository end |
Instance Method Details
#run! ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/git_pivotal_tracker/base.rb', line 29 def run! unless [:api_token] && [:project_id] puts "Pivotal Tracker API Token and Project ID are required" return 1 end PivotalTracker::Client.token = [:api_token] PivotalTracker::Client.use_ssl = [:use_ssl] nil end |