Module: OptimisWorkflow::Common
- Included in:
- OptimisWorkflow::Commands::Base
- Defined in:
- lib/optimis-workflow/common.rb
Overview
This module gets included into OptimisWorkflow::Commands::Base
Instance Method Summary collapse
- #current_dir ⇒ Object
- #mark_as_started_on_pivotal ⇒ Object
- #payload ⇒ Object
- #settings ⇒ Object
- #settings_file ⇒ Object
- #start_feature ⇒ Object
Instance Method Details
#current_dir ⇒ Object
10 11 12 |
# File 'lib/optimis-workflow/common.rb', line 10 def current_dir @current_dir ||= `pwd`.chomp end |
#mark_as_started_on_pivotal ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/optimis-workflow/common.rb', line 25 def mark_as_started_on_pivotal unless settings.nil? url = URI.parse("http://www.pivotaltracker.com/services/v3/projects/#{settings['project_id']}/stories/#{story_id}") net = Net::HTTP.new url.host, url.port net.start do |http| req = Net::HTTP::Put.new(url.request_uri, {'Content-type' => 'application/xml', 'X-TrackerToken' => settings['token']}) http.request(req, payload) end end end |
#payload ⇒ Object
14 15 16 |
# File 'lib/optimis-workflow/common.rb', line 14 def payload '<story><current_state>started</current_state></story>' end |
#settings ⇒ Object
38 39 40 |
# File 'lib/optimis-workflow/common.rb', line 38 def settings @tracker_settings ||= YAML.load_file(settings_file) if File.exists?(settings_file) end |
#settings_file ⇒ Object
6 7 8 |
# File 'lib/optimis-workflow/common.rb', line 6 def settings_file @settings_file ||= current_dir + '/.tracker_settings.yml' end |
#start_feature ⇒ Object
18 19 20 21 22 23 |
# File 'lib/optimis-workflow/common.rb', line 18 def start_feature story_id = args[0].chomp current_dir = `pwd`.chomp mark_as_started end |