toolshed 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/toolshed.rb +28 -2
- data/lib/toolshed.rb +2 -0
- data/lib/toolshed/base.rb +13 -1
- data/lib/toolshed/cli.rb +2 -2
- data/lib/toolshed/commands/get_daily_time_update.rb +13 -3
- data/lib/toolshed/commands/ticket_information.rb +79 -0
- data/lib/toolshed/git/git.rb +8 -24
- data/lib/toolshed/time_tracking/harvest.rb +44 -7
- data/lib/toolshed/version.rb +1 -1
- data/toolshed.gemspec +4 -2
- metadata +32 -3
- data/lib/toolshed/commands/get_pivotal_tracker_story_information.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2735e0a05ef49646976753969a095916a4f00324
|
4
|
+
data.tar.gz: aa781e23427a9534108d1d0727ea3b27fa90f142
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aae5bc491f329b09cf07dd0768ae979b8f7883b5b67e3db2a57c26a11419ccb3da8538f8b8907a0b30627c30a6973bf16a357ba3855c7dd7c45cbc7b164def0d
|
7
|
+
data.tar.gz: 473ce7fb64bf9394874fc726fe5b8730297c3604d7a6ebdc8e761f06f6d790905cf1e536bd6e00337c157aa6f2e8301958cfb5cc7f218f2ec40d694cca6ea81a
|
data/bin/toolshed.rb
CHANGED
@@ -52,7 +52,12 @@ create_pull_request [ # create a github pull request based on
|
|
52
52
|
--title "Pull Request Title" # Title you want to use with the pull request
|
53
53
|
--body "Pull Request Body" # Body you want to use with the pull request
|
54
54
|
]
|
55
|
-
|
55
|
+
ticket_information [ # Get the ticket information from a story based on ticket system configuration
|
56
|
+
--use-defaults="true|false" # If you want to use defaults ticket_id is taken from branch_name otherwise configuration is used
|
57
|
+
--clipboard="true|false" # Copy the output to the system clipboard (Mac OSx) tested
|
58
|
+
--field="field_name" # The field you want to either output or copy to your clipboard
|
59
|
+
--formatted-string="{name} - {url} # Pass a formatted string in ticket name and url and it will return that string replaced by the actual value
|
60
|
+
]
|
56
61
|
create_pivotal_tracker_note # Create a note for a specific PivotalTracker story based on project_id and story_id
|
57
62
|
update_pivotal_tracker_story_status # Update the status of PivotalTracker story
|
58
63
|
create_branch [ # Create a branch default (git) and push it to your local repository
|
@@ -66,7 +71,9 @@ push_branch [ # Push your current working branch to yo
|
|
66
71
|
--force # Push your current working branch up with --force after
|
67
72
|
--branch-name "another" # Push this specific branch up instead of your current working branch
|
68
73
|
]
|
69
|
-
get_daily_time_update
|
74
|
+
get_daily_time_update [ # Get a daily update from your time tracking toolset currently harvest is supported
|
75
|
+
--format="html|text" # Format you want if you want html it will open html page in broswer otherwise puts out plain text
|
76
|
+
]
|
70
77
|
list_branches [ # List branches for your remote repository
|
71
78
|
--repository-name "depot" # The repository name you want to list branches for if not passed pull_from_repository_name is used
|
72
79
|
]
|
@@ -149,6 +156,25 @@ if $0.split("/").last == 'toolshed'
|
|
149
156
|
options[:branch_name] = opt
|
150
157
|
end
|
151
158
|
end,
|
159
|
+
'get_daily_time_update' => OptionParser.new do |opts|
|
160
|
+
opts.on("--format [ARG]") do |opt|
|
161
|
+
options[:format] = opt
|
162
|
+
end
|
163
|
+
end,
|
164
|
+
'ticket_information' => OptionParser.new do |opts|
|
165
|
+
opts.on("--use-defaults [ARG]") do |opt|
|
166
|
+
options[:use_defaults] = opt
|
167
|
+
end
|
168
|
+
opts.on("--clipboard [ARG]") do |opt|
|
169
|
+
options[:clipboard] = opt
|
170
|
+
end
|
171
|
+
opts.on("--field [ARG]") do |opt|
|
172
|
+
options[:field] = opt
|
173
|
+
end
|
174
|
+
opts.on("--formatted-string [ARG]") do |opt|
|
175
|
+
options[:formatted_string] = opt
|
176
|
+
end
|
177
|
+
end,
|
152
178
|
}
|
153
179
|
|
154
180
|
global.order!
|
data/lib/toolshed.rb
CHANGED
data/lib/toolshed/base.rb
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
module Toolshed
|
2
2
|
class Base
|
3
|
-
|
3
|
+
def self.wait_for_command(command, seconds=10)
|
4
|
+
begin
|
5
|
+
Timeout::timeout(seconds) {
|
6
|
+
until (system(command))
|
7
|
+
sleep 1
|
8
|
+
end
|
9
|
+
return
|
10
|
+
}
|
11
|
+
rescue Timeout::Error => e
|
12
|
+
puts "Unable to execute command after #{seconds} seconds"
|
13
|
+
return
|
14
|
+
end
|
15
|
+
end
|
4
16
|
end
|
5
17
|
end
|
6
18
|
|
data/lib/toolshed/cli.rb
CHANGED
@@ -23,7 +23,7 @@ module Toolshed
|
|
23
23
|
{
|
24
24
|
'create_pull_request' => Toolshed::Commands::CreatePullRequest,
|
25
25
|
'create_pivotal_tracker_note' => Toolshed::Commands::CreatePivotalTrackerNote,
|
26
|
-
'
|
26
|
+
'ticket_information' => Toolshed::Commands::TicketInformation,
|
27
27
|
'update_pivotal_tracker_story_status' => Toolshed::Commands::UpdatePivotalTrackerStoryStatus,
|
28
28
|
'create_branch' => Toolshed::Commands::CreateBranch,
|
29
29
|
'checkout_branch' => Toolshed::Commands::CheckoutBranch,
|
@@ -38,7 +38,7 @@ end
|
|
38
38
|
|
39
39
|
require 'toolshed/commands/create_pull_request'
|
40
40
|
require 'toolshed/commands/create_pivotal_tracker_note'
|
41
|
-
require 'toolshed/commands/
|
41
|
+
require 'toolshed/commands/ticket_information'
|
42
42
|
require 'toolshed/commands/update_pivotal_tracker_story_status'
|
43
43
|
require 'toolshed/commands/create_branch'
|
44
44
|
require 'toolshed/commands/checkout_branch'
|
@@ -3,14 +3,24 @@ module Toolshed
|
|
3
3
|
class GetDailyTimeUpdate
|
4
4
|
def execute(args, options = {})
|
5
5
|
if (Toolshed::Client.time_tracking_tool == 'harvest')
|
6
|
-
harvest = Toolshed::TimeTracking::Harvest.new
|
6
|
+
harvest = Toolshed::TimeTracking::Harvest.new(options)
|
7
7
|
|
8
8
|
puts "Getting time entries:"
|
9
9
|
|
10
10
|
notes = harvest.previous
|
11
|
-
notes = "#{notes}
|
11
|
+
notes = "#{notes}#{harvest.line_break}#{harvest.line_break}#{harvest.today}"
|
12
|
+
notes = "#{notes}#{harvest.brought_to_you_by_message}"
|
12
13
|
|
13
|
-
|
14
|
+
if (harvest.format == 'html')
|
15
|
+
FileUtils.rm_rf(Toolshed::TimeTracking::Harvest::GENERATED_HTML_FILE_LOCATION)
|
16
|
+
File.open(Toolshed::TimeTracking::Harvest::GENERATED_HTML_FILE_LOCATION, 'w') {|f| f.write(notes) }
|
17
|
+
Launchy.open( Toolshed::TimeTracking::Harvest::GENERATED_HTML_FILE_LOCATION ) do |exception|
|
18
|
+
puts "Attempted to open #{uri} and failed because #{exception}"
|
19
|
+
end
|
20
|
+
puts "Checkout out your default or open browser!"
|
21
|
+
else
|
22
|
+
puts notes
|
23
|
+
end
|
14
24
|
else
|
15
25
|
puts "Time tracking tool is undefined implementation needed"
|
16
26
|
exit
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module Toolshed
|
2
|
+
module Commands
|
3
|
+
class TicketInformation
|
4
|
+
def execute(args, options = {})
|
5
|
+
begin
|
6
|
+
ticket_tracker_class = Object.const_get("Toolshed::TicketTracking::#{Toolshed::Client.ticket_tracking_tool.camel_case}")
|
7
|
+
|
8
|
+
if Object.const_get("#{ticket_tracker_class}::USE_PROJECT_ID")
|
9
|
+
ticket_tracker_project_id = read_user_input_project_id("Project ID (Default: #{Toolshed::Client.default_pivotal_tracker_project_id}):", options.merge!({ default: Toolshed::Client.default_pivotal_tracker_project_id }))
|
10
|
+
options.merge!({ project_id: ticket_tracker_project_id })
|
11
|
+
end
|
12
|
+
|
13
|
+
ticket_tracker = ticket_tracker_class.create_instance(options)
|
14
|
+
|
15
|
+
default_ticket_id = Toolshed::TicketTracking::PivotalTracker::story_id_from_branch_name(Toolshed::Git::Base.branch_name)
|
16
|
+
ticket_id = read_user_input_ticket_id("Story ID (Default: #{default_ticket_id}):", options.merge!({ default: default_ticket_id }))
|
17
|
+
|
18
|
+
if Object.const_get("#{ticket_tracker_class}::USE_PROJECT_ID")
|
19
|
+
puts "Using Project: #{ticket_tracker_project_id}"
|
20
|
+
end
|
21
|
+
puts "Using Ticket: #{ticket_id}"
|
22
|
+
|
23
|
+
result = ticket_tracker.story_information(ticket_id)
|
24
|
+
|
25
|
+
if (options[:field])
|
26
|
+
field_value = result.send(options[:field])
|
27
|
+
if (options[:clipboard])
|
28
|
+
Clipboard.copy field_value
|
29
|
+
end
|
30
|
+
|
31
|
+
puts field_value
|
32
|
+
elsif(options[:formatted_string])
|
33
|
+
formatted_string = options[:formatted_string].gsub(/\{(.*?)\}/) { |m| result.send(m.gsub("{", "").gsub("}", "")) }
|
34
|
+
if (options[:clipboard])
|
35
|
+
Clipboard.copy formatted_string
|
36
|
+
end
|
37
|
+
|
38
|
+
puts formatted_string
|
39
|
+
else
|
40
|
+
result.instance_variables.each do |name, value|
|
41
|
+
puts "#{name}: #{result.instance_variable_get(name).inspect}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
return
|
46
|
+
rescue => e
|
47
|
+
puts e.message
|
48
|
+
exit
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def read_user_input_project_id(message, options)
|
53
|
+
return options[:default] if (options.has_key?(:use_defaults))
|
54
|
+
|
55
|
+
puts message
|
56
|
+
value = $stdin.gets.chomp
|
57
|
+
|
58
|
+
if (value.empty?)
|
59
|
+
value = options[:default]
|
60
|
+
end
|
61
|
+
|
62
|
+
value
|
63
|
+
end
|
64
|
+
|
65
|
+
def read_user_input_ticket_id(message, options)
|
66
|
+
return options[:default] if (options.has_key?(:use_defaults))
|
67
|
+
|
68
|
+
puts message
|
69
|
+
value = $stdin.gets.chomp
|
70
|
+
|
71
|
+
if (value.empty?)
|
72
|
+
value = options[:default]
|
73
|
+
end
|
74
|
+
|
75
|
+
value
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/lib/toolshed/git/git.rb
CHANGED
@@ -17,14 +17,10 @@ module Toolshed
|
|
17
17
|
|
18
18
|
def checkout(branch_name)
|
19
19
|
branch_name = Toolshed::Git::Base.branch_name_from_id(branch_name)
|
20
|
-
|
21
|
-
sleep 1
|
22
|
-
end
|
20
|
+
Toolshed::Base.wait_for_command("git checkout #{branch_name} #{Toolshed::Client.git_quiet}")
|
23
21
|
|
24
22
|
unless (Toolshed::Git::Base.git_submodule_command.empty?)
|
25
|
-
|
26
|
-
sleep 1
|
27
|
-
end
|
23
|
+
Toolshed::Base.wait_for_command(Toolshed::Git::Base.git_submodule_command)
|
28
24
|
end
|
29
25
|
|
30
26
|
branch_name
|
@@ -38,9 +34,7 @@ module Toolshed
|
|
38
34
|
Toolshed::Git::Base.checkout('master')
|
39
35
|
end
|
40
36
|
|
41
|
-
|
42
|
-
sleep 1
|
43
|
-
end
|
37
|
+
Toolshed::Base.wait_for_command("git push #{Toolshed::Client.push_to_remote_name} :#{branch_name}; git branch -D #{branch_name}")
|
44
38
|
|
45
39
|
branch_name
|
46
40
|
end
|
@@ -62,9 +56,7 @@ module Toolshed
|
|
62
56
|
branch_name = (options.has_key?(:branch_name)) ? Toolshed::Git::Base.branch_name_from_id(options[:branch_name]) : Toolshed::Git::Base.branch_name
|
63
57
|
force_command = (options.has_key?(:force_command)) ? '--force' : ''
|
64
58
|
|
65
|
-
|
66
|
-
sleep 1
|
67
|
-
end
|
59
|
+
Toolshed::Base.wait_for_command("git push #{Toolshed::Client.push_to_remote_name} #{branch_name} #{force_command}")
|
68
60
|
|
69
61
|
branch_name
|
70
62
|
end
|
@@ -111,23 +103,15 @@ module Toolshed
|
|
111
103
|
self.validator.validate!(self)
|
112
104
|
|
113
105
|
new_branch_name = Toolshed::Git::Base.clean_branch_name(self.to_remote_branch_name)
|
114
|
-
|
115
|
-
sleep 1
|
116
|
-
end
|
106
|
+
Toolshed::Base.wait_for_command("git remote update #{Toolshed::Client.git_quiet}")
|
117
107
|
|
118
|
-
|
119
|
-
sleep 1
|
120
|
-
end
|
108
|
+
Toolshed::Base.wait_for_command("git checkout -b #{new_branch_name} #{self.from_remote_name}/#{self.from_remote_branch_name} #{Toolshed::Client.git_quiet}")
|
121
109
|
|
122
110
|
unless (Toolshed::Git::Base.git_submodule_command.empty?)
|
123
|
-
|
124
|
-
sleep 1
|
125
|
-
end
|
111
|
+
Toolshed::Base.wait_for_command(Toolshed::Git::Base.git_submodule_command)
|
126
112
|
end
|
127
113
|
|
128
|
-
|
129
|
-
sleep 1
|
130
|
-
end
|
114
|
+
Toolshed::Base.wait_for_command("git push #{self.to_remote_name} #{new_branch_name} #{Toolshed::Client.git_quiet}")
|
131
115
|
end
|
132
116
|
end
|
133
117
|
end
|
@@ -4,8 +4,9 @@ module Toolshed
|
|
4
4
|
extend TimeTracking
|
5
5
|
|
6
6
|
MAX_ATTEMPTS = 10
|
7
|
+
GENERATED_HTML_FILE_LOCATION = '/tmp/toolshed_generated_time_sheet.html'
|
7
8
|
|
8
|
-
attr_accessor :harvest_client, :project_id
|
9
|
+
attr_accessor :harvest_client, :project_id, :line_break, :start_list_item, :end_list_item, :start_unorder_list, :end_unorder_list, :format
|
9
10
|
|
10
11
|
def initialize(options={})
|
11
12
|
username = Toolshed::Client::time_tracking_username
|
@@ -24,18 +25,27 @@ module Toolshed
|
|
24
25
|
owner = options[:sub_domain]
|
25
26
|
end
|
26
27
|
|
27
|
-
self.harvest_client = ::Harvest.client(
|
28
|
+
self.harvest_client = ::Harvest.client(owner, username, password)
|
28
29
|
self.project_id = self.get_project_id
|
30
|
+
|
31
|
+
# setup formatting
|
32
|
+
formatter(options)
|
29
33
|
end
|
30
34
|
|
31
|
-
def previous(days_ago=1)
|
32
|
-
|
35
|
+
def previous(days_ago=1, options={})
|
36
|
+
|
37
|
+
notes = "Previous:#{self.line_break}"
|
33
38
|
|
34
39
|
time_entries = self.harvest_client.time.all((DateTime.now - days_ago), self.project_id)
|
35
40
|
if (time_entries.size > 0 || days_ago == Toolshed::TimeTracking::Harvest::MAX_ATTEMPTS)
|
41
|
+
notes = "#{notes}#{self.start_unorder_list}"
|
36
42
|
time_entries.each do |time_entry|
|
37
|
-
notes = "#{notes}#{time_entry.notes}
|
43
|
+
notes = "#{notes}#{self.start_list_item}#{time_entry.notes}#{self.end_list_item}"
|
44
|
+
if (self.end_list_item == '')
|
45
|
+
notes = "#{notes}#{self.line_break}"
|
46
|
+
end
|
38
47
|
end
|
48
|
+
notes = "#{notes}#{self.end_unorder_list}"
|
39
49
|
else
|
40
50
|
notes = self.previous(days_ago + 1)
|
41
51
|
end
|
@@ -44,12 +54,17 @@ module Toolshed
|
|
44
54
|
end
|
45
55
|
|
46
56
|
def today
|
47
|
-
notes = "Today
|
57
|
+
notes = "Today:#{self.line_break}"
|
48
58
|
|
49
59
|
time_entries = self.harvest_client.time.all(Time.now, self.project_id)
|
60
|
+
notes = "#{notes}#{self.start_unorder_list}"
|
50
61
|
time_entries.each do |time_entry|
|
51
|
-
notes = "#{notes}#{time_entry.notes}
|
62
|
+
notes = "#{notes}#{self.start_list_item}#{time_entry.notes}#{self.end_list_item}"
|
63
|
+
if (self.end_list_item == '')
|
64
|
+
notes = "#{notes}#{self.line_break}"
|
65
|
+
end
|
52
66
|
end
|
67
|
+
notes = "#{notes}#{self.end_unorder_list}"
|
53
68
|
|
54
69
|
notes
|
55
70
|
end
|
@@ -63,6 +78,28 @@ module Toolshed
|
|
63
78
|
|
64
79
|
project_id
|
65
80
|
end
|
81
|
+
|
82
|
+
def brought_to_you_by_message
|
83
|
+
"#{self.line_break}Provided by Toolshed https://rubygems.org/gems/toolshed#{self.line_break}"
|
84
|
+
end
|
85
|
+
|
86
|
+
def formatter(options={})
|
87
|
+
if (options[:format] && options[:format] == 'html')
|
88
|
+
self.format = 'html'
|
89
|
+
self.line_break = "<br>"
|
90
|
+
self.start_list_item = "<li>"
|
91
|
+
self.end_list_item = "</li>"
|
92
|
+
self.start_unorder_list = "<ul>"
|
93
|
+
self.end_unorder_list = "</ul>"
|
94
|
+
else
|
95
|
+
self.format = 'text'
|
96
|
+
self.line_break = "\n"
|
97
|
+
self.start_list_item = ""
|
98
|
+
self.end_list_item = ""
|
99
|
+
self.start_unorder_list = ""
|
100
|
+
self.end_unorder_list = ""
|
101
|
+
end
|
102
|
+
end
|
66
103
|
end
|
67
104
|
end
|
68
105
|
end
|
data/lib/toolshed/version.rb
CHANGED
data/toolshed.gemspec
CHANGED
@@ -14,8 +14,8 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
17
|
-
spec.executables = ["toolshed"]
|
18
|
-
|
17
|
+
#spec.executables = ["toolshed"]
|
18
|
+
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
@@ -24,6 +24,8 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_dependency "pivotal-tracker"
|
25
25
|
spec.add_dependency "harvested"
|
26
26
|
spec.add_dependency "veto"
|
27
|
+
spec.add_dependency "launchy"
|
28
|
+
spec.add_dependency "clipboard"
|
27
29
|
|
28
30
|
spec.add_development_dependency "bundler", "~> 1.3"
|
29
31
|
spec.add_development_dependency "rake"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toolshed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- test
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -80,6 +80,34 @@ dependencies:
|
|
80
80
|
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: launchy
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: clipboard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
112
|
name: bundler
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,6 +226,7 @@ email:
|
|
198
226
|
- test@gmail.com
|
199
227
|
executables:
|
200
228
|
- toolshed
|
229
|
+
- toolshed.rb
|
201
230
|
extensions: []
|
202
231
|
extra_rdoc_files: []
|
203
232
|
files:
|
@@ -219,9 +248,9 @@ files:
|
|
219
248
|
- lib/toolshed/commands/create_pull_request.rb
|
220
249
|
- lib/toolshed/commands/delete_branch.rb
|
221
250
|
- lib/toolshed/commands/get_daily_time_update.rb
|
222
|
-
- lib/toolshed/commands/get_pivotal_tracker_story_information.rb
|
223
251
|
- lib/toolshed/commands/list_branches.rb
|
224
252
|
- lib/toolshed/commands/push_branch.rb
|
253
|
+
- lib/toolshed/commands/ticket_information.rb
|
225
254
|
- lib/toolshed/commands/update_pivotal_tracker_story_status.rb
|
226
255
|
- lib/toolshed/error.rb
|
227
256
|
- lib/toolshed/git/git.rb
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module Toolshed
|
2
|
-
module Commands
|
3
|
-
class GetPivotalTrackerStoryInformation
|
4
|
-
def execute(args, options = {})
|
5
|
-
begin
|
6
|
-
print "Project ID (Default: #{Toolshed::Client.default_pivotal_tracker_project_id})? "
|
7
|
-
project_id = $stdin.gets.chomp.strip
|
8
|
-
if (project_id == '')
|
9
|
-
project_id = Toolshed::Client.default_pivotal_tracker_project_id
|
10
|
-
end
|
11
|
-
|
12
|
-
pivotal_tracker = Toolshed::TicketTracking::PivotalTracker.new({
|
13
|
-
project_id: project_id,
|
14
|
-
username: Toolshed::TicketTracking::PivotalTracker.username,
|
15
|
-
password: Toolshed::TicketTracking::PivotalTracker.password,
|
16
|
-
})
|
17
|
-
|
18
|
-
default_story_id = Toolshed::TicketTracking::PivotalTracker::story_id_from_branch_name(Toolshed::Git::Base.branch_name)
|
19
|
-
print "Story ID (Default: #{default_story_id})? "
|
20
|
-
story_id = $stdin.gets.chomp.strip
|
21
|
-
if (story_id == '')
|
22
|
-
story_id = default_story_id
|
23
|
-
end
|
24
|
-
|
25
|
-
result = pivotal_tracker.story_information(story_id)
|
26
|
-
result.instance_variables.each do |name, value|
|
27
|
-
puts "#{name}: #{result.instance_variable_get(name).inspect}"
|
28
|
-
end
|
29
|
-
exit
|
30
|
-
rescue => e
|
31
|
-
puts e.message
|
32
|
-
exit
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|