jiraa 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +19 -0
- data/Gemfile +2 -0
- data/README.rdoc +6 -0
- data/Rakefile +44 -0
- data/bin/jiraa +232 -0
- data/features/jiraa.feature +8 -0
- data/features/step_definitions/jiraa_steps.rb +6 -0
- data/features/support/env.rb +15 -0
- data/jiraa.gemspec +28 -0
- data/jiraa.rdoc +5 -0
- data/lib/jiraa.rb +4 -0
- data/lib/jiraa/version.rb +3 -0
- data/test/default_test.rb +14 -0
- data/test/test_helper.rb +9 -0
- metadata +164 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubygems/package_task'
|
4
|
+
require 'rdoc/task'
|
5
|
+
require 'cucumber'
|
6
|
+
require 'cucumber/rake/task'
|
7
|
+
Rake::RDocTask.new do |rd|
|
8
|
+
rd.main = "README.rdoc"
|
9
|
+
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
10
|
+
rd.title = 'Your application title'
|
11
|
+
end
|
12
|
+
|
13
|
+
spec = eval(File.read('jiraa.gemspec'))
|
14
|
+
|
15
|
+
Gem::PackageTask.new(spec) do |pkg|
|
16
|
+
end
|
17
|
+
CUKE_RESULTS = 'results.html'
|
18
|
+
CLEAN << CUKE_RESULTS
|
19
|
+
desc 'Run features'
|
20
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
21
|
+
opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
|
22
|
+
opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
|
23
|
+
t.cucumber_opts = opts
|
24
|
+
t.fork = false
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Run features tagged as work-in-progress (@wip)'
|
28
|
+
Cucumber::Rake::Task.new('features:wip') do |t|
|
29
|
+
tag_opts = ' --tags ~@pending'
|
30
|
+
tag_opts = ' --tags @wip'
|
31
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
|
32
|
+
t.fork = false
|
33
|
+
end
|
34
|
+
|
35
|
+
task :cucumber => :features
|
36
|
+
task 'cucumber:wip' => 'features:wip'
|
37
|
+
task :wip => 'features:wip'
|
38
|
+
require 'rake/testtask'
|
39
|
+
Rake::TestTask.new do |t|
|
40
|
+
t.libs << "test"
|
41
|
+
t.test_files = FileList['test/*_test.rb']
|
42
|
+
end
|
43
|
+
|
44
|
+
task :default => [:test,:features]
|
data/bin/jiraa
ADDED
@@ -0,0 +1,232 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'gli'
|
3
|
+
require 'jira_client'
|
4
|
+
require 'yaml'
|
5
|
+
begin # XXX: Remove this begin/rescue before distributing your app
|
6
|
+
require 'jiraa'
|
7
|
+
rescue LoadError
|
8
|
+
STDERR.puts "In development, you need to use `bundle exec bin/jiraa` to run your app"
|
9
|
+
STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
|
10
|
+
STDERR.puts "Feel free to remove this message from bin/jiraa now"
|
11
|
+
exit 64
|
12
|
+
end
|
13
|
+
|
14
|
+
include GLI::App
|
15
|
+
|
16
|
+
program_desc 'Command line application for accessing the Jira 5 API'
|
17
|
+
|
18
|
+
version Jiraa::VERSION
|
19
|
+
|
20
|
+
desc 'The base URL of your Jira instance (e.g. https://jira.company.com)'
|
21
|
+
arg_name 'URL'
|
22
|
+
flag [:U,:url]
|
23
|
+
|
24
|
+
desc 'The port your Jira instance is running on'
|
25
|
+
arg_name 'PORT'
|
26
|
+
flag [:P, :port]
|
27
|
+
|
28
|
+
desc 'Your Jira username (if using HTTP basic authentication)'
|
29
|
+
arg_name 'USERNAME'
|
30
|
+
flag [:u,:username]
|
31
|
+
|
32
|
+
desc 'Your Jira password (if using HTTP basic authentication)'
|
33
|
+
arg_name 'PASSWORD'
|
34
|
+
flag [:p,:password]
|
35
|
+
|
36
|
+
desc 'Your Jira certificate (if using SSL authentication)'
|
37
|
+
arg_name 'CERTIFICATE'
|
38
|
+
flag [:C,:certificate]
|
39
|
+
|
40
|
+
desc 'Resolve an issue'
|
41
|
+
arg_name 'ISSUE'
|
42
|
+
command :resolve do |c|
|
43
|
+
c.desc 'Specify the issue resolution'
|
44
|
+
c.default_value 'Fixed'
|
45
|
+
c.arg_name 'RESOLUTION'
|
46
|
+
c.flag [:a, "resolve-as"]
|
47
|
+
|
48
|
+
c.desc 'Comment on the resolution'
|
49
|
+
c.arg_name 'COMMENT'
|
50
|
+
c.flag [:c, :comment]
|
51
|
+
|
52
|
+
c.desc 'Log work on the issue before resolving'
|
53
|
+
c.arg_name 'TIME'
|
54
|
+
c.flag [:l, "log-work"]
|
55
|
+
|
56
|
+
c.desc 'Set remaining estimate to zero'
|
57
|
+
c.switch :Z
|
58
|
+
|
59
|
+
c.action do |global_options,options,args|
|
60
|
+
help_now! "Missing issue key" if args.length == 0
|
61
|
+
params = {
|
62
|
+
:as => options[:a]
|
63
|
+
}
|
64
|
+
params[:comment] = options[:comment] unless options[:comment].nil?
|
65
|
+
if options["log-work"]
|
66
|
+
if options[:Z]
|
67
|
+
params = {
|
68
|
+
:remaining_estimate => 0
|
69
|
+
}
|
70
|
+
end
|
71
|
+
JiraClient.create_worklog args[0], options["log-work"], params
|
72
|
+
puts "Logged #{options['log-work']} on #{args[0]}"
|
73
|
+
end
|
74
|
+
JiraClient.resolve_issue args[0], params
|
75
|
+
puts "Resolved #{args[0]} as #{options[:a]}"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
desc 'Close an issue'
|
80
|
+
arg_name 'ISSUE'
|
81
|
+
command :close do |c|
|
82
|
+
c.desc 'Comment on the resolution'
|
83
|
+
c.arg_name 'COMMENT'
|
84
|
+
c.flag [:c, :comment]
|
85
|
+
|
86
|
+
c.action do |global_options,options,args|
|
87
|
+
help_now! "Missing issue key" if args.length == 0
|
88
|
+
params = {}
|
89
|
+
params[:comment] = options[:comment] unless options[:comment].nil?
|
90
|
+
JiraClient.close_issue args[0], params
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
desc 'Re-open an issue'
|
95
|
+
arg_name 'ISSUE'
|
96
|
+
command :reopen do |c|
|
97
|
+
c.desc 'Comment on the resolution'
|
98
|
+
c.arg_name 'COMMENT'
|
99
|
+
c.flag [:c, :comment]
|
100
|
+
|
101
|
+
c.action do |global_options,options,args|
|
102
|
+
help_now! "Missing issue key" if args.length == 0
|
103
|
+
params = {}
|
104
|
+
params[:comment] = options[:comment] unless options[:comment].nil?
|
105
|
+
JiraClient.reopen_issue args[0], params
|
106
|
+
puts "#{args[0]} re-opened"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
desc 'Start progress on an issue'
|
111
|
+
arg_name 'ISSUE'
|
112
|
+
command "start-progress" do |c|
|
113
|
+
c.action do |global_options,options,args|
|
114
|
+
help_now! "Missing issue key" if args.length == 0
|
115
|
+
JiraClient.start_progress_on_issue args[0]
|
116
|
+
"Progress started on #{args[0]}"
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
desc 'Log work on an issue'
|
121
|
+
arg_name 'ISSUE TIME'
|
122
|
+
command "log-work" do |c|
|
123
|
+
c.desc 'Comment on the resolution'
|
124
|
+
c.arg_name 'COMMENT'
|
125
|
+
c.flag [:c, :comment]
|
126
|
+
|
127
|
+
c.desc 'Set remaining estimate'
|
128
|
+
c.arg_name 'TIME'
|
129
|
+
c.flag [:r, "remaining-estimate"]
|
130
|
+
|
131
|
+
c.action do |global_options, options, args|
|
132
|
+
help_now! "Missing issue key" if args.length == 0
|
133
|
+
help_now! "Missing time" if args.length == 1
|
134
|
+
params = {}
|
135
|
+
params[:comment] = options[:comment] unless options[:comment].nil?
|
136
|
+
params[:remaining_estimate] = options["remaining-estimate"] unless options["remaining-estimate"].nil?
|
137
|
+
JiraClient.create_worklog(args[0], args[1], params)
|
138
|
+
print "Logged #{args[1]} on #{args[0]}"
|
139
|
+
puts " and set remaining estimate to #{params[:remaining_estimate]}" if params.has_key? :remaining_estimate
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
desc 'Display information about the Jira server'
|
144
|
+
command :server do |c|
|
145
|
+
c.action do |global_options,options,args|
|
146
|
+
info = JiraClient.server_info
|
147
|
+
puts "Server: #{info.server_title}"
|
148
|
+
puts "URL: #{info.base_url}"
|
149
|
+
puts "Version: #{info.version}"
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
desc 'Display detailed information about an issue'
|
154
|
+
arg_name 'ISSUE'
|
155
|
+
command :show do |c|
|
156
|
+
c.action do |global_options,options,args|
|
157
|
+
help_now! "Missing issue key" if args.length == 0
|
158
|
+
issue = JiraClient.find_issue_by_key(args[0], :fields => [:summary, :status, :description])
|
159
|
+
header = "#{issue.key}\t#{issue.summary}"
|
160
|
+
puts header
|
161
|
+
puts "Status: #{issue.status.name}"
|
162
|
+
puts
|
163
|
+
puts
|
164
|
+
puts "#{issue.description}"
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
desc 'Search for issues using JQL'
|
169
|
+
arg_name 'JQL'
|
170
|
+
command :search do |c|
|
171
|
+
c.action do |global_options,options,args|
|
172
|
+
help_now! "Missing JQL statement" if args.length == 0
|
173
|
+
issues = JiraClient.find_issues(:jql => args[0], :fields => [:summary, :status])
|
174
|
+
issues.each do |issue|
|
175
|
+
puts "#{issue.key}\t#{issue.summary}"
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
pre do |global,command,options,args|
|
181
|
+
config = load_config(global)
|
182
|
+
configure_client(config)
|
183
|
+
true
|
184
|
+
end
|
185
|
+
|
186
|
+
def load_config(global_config)
|
187
|
+
config_filename = File.join(ENV['HOME'], ".jiraa")
|
188
|
+
|
189
|
+
config = if File.exists?(config_filename)
|
190
|
+
read_config_file(config_filename)
|
191
|
+
else
|
192
|
+
create_config_file(config_filename)
|
193
|
+
end
|
194
|
+
|
195
|
+
config.merge! global_config
|
196
|
+
end
|
197
|
+
|
198
|
+
def read_config_file(filename)
|
199
|
+
YAML.load_file(filename) || {}
|
200
|
+
end
|
201
|
+
|
202
|
+
def create_config_file(filename)
|
203
|
+
File.open(filename, 'w') do |file|
|
204
|
+
file.write <<-EOF
|
205
|
+
---
|
206
|
+
# Enter the URL of your Jira instance here:
|
207
|
+
# url: https://jira.example.com
|
208
|
+
|
209
|
+
# If your Jira server uses HTTP basic authentication then fill in your username and password:
|
210
|
+
# username: my_username
|
211
|
+
# password: my_password
|
212
|
+
|
213
|
+
# If your Jira server users SSL certificate authentication then provide a path to your certificate:
|
214
|
+
# certificate: /usr/local/certificates/my_cert.pem
|
215
|
+
EOF
|
216
|
+
{}
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
def configure_client(config)
|
221
|
+
JiraClient.configure do |c|
|
222
|
+
c.base_url = config["url"]
|
223
|
+
c.certificate = config["certificate"]
|
224
|
+
c.username = config["username"]
|
225
|
+
c.password = config["password"]
|
226
|
+
c.port = config["port"]
|
227
|
+
c.proxy = ENV['https_proxy']
|
228
|
+
c.api_path = "/jira/rest/api/2"
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
exit run(ARGV)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'aruba/cucumber'
|
2
|
+
|
3
|
+
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
4
|
+
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
|
5
|
+
|
6
|
+
Before do
|
7
|
+
# Using "announce" causes massive warnings on 1.9.2
|
8
|
+
@puts = true
|
9
|
+
@original_rubylib = ENV['RUBYLIB']
|
10
|
+
ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
|
11
|
+
end
|
12
|
+
|
13
|
+
After do
|
14
|
+
ENV['RUBYLIB'] = @original_rubylib
|
15
|
+
end
|
data/jiraa.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jiraa/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jiraa"
|
8
|
+
spec.version = Jiraa::VERSION
|
9
|
+
spec.authors = ["Matthew Williams"]
|
10
|
+
spec.email = ["m.williams@me.com"]
|
11
|
+
spec.description = %q{A CLI for the Jira 5 REST API}
|
12
|
+
spec.summary = %q{A CLI for the Jira 5 REST API...}
|
13
|
+
spec.homepage = "https://github.com/mrwillihog/jiraa"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "aruba"
|
24
|
+
spec.add_development_dependency "cucumber"
|
25
|
+
|
26
|
+
spec.add_runtime_dependency "jira_client", "1.0.0"
|
27
|
+
spec.add_runtime_dependency "gli", "2.5.6"
|
28
|
+
end
|
data/jiraa.rdoc
ADDED
data/lib/jiraa.rb
ADDED
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jiraa
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Matthew Williams
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.3'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: aruba
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: cucumber
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: jira_client
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - '='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 1.0.0
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - '='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.0.0
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: gli
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - '='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 2.5.6
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - '='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.5.6
|
110
|
+
description: A CLI for the Jira 5 REST API
|
111
|
+
email:
|
112
|
+
- m.williams@me.com
|
113
|
+
executables:
|
114
|
+
- jiraa
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- .gitignore
|
119
|
+
- Gemfile
|
120
|
+
- Gemfile.lock
|
121
|
+
- README.rdoc
|
122
|
+
- Rakefile
|
123
|
+
- bin/jiraa
|
124
|
+
- features/jiraa.feature
|
125
|
+
- features/step_definitions/jiraa_steps.rb
|
126
|
+
- features/support/env.rb
|
127
|
+
- jiraa.gemspec
|
128
|
+
- jiraa.rdoc
|
129
|
+
- lib/jiraa.rb
|
130
|
+
- lib/jiraa/version.rb
|
131
|
+
- test/default_test.rb
|
132
|
+
- test/test_helper.rb
|
133
|
+
homepage: https://github.com/mrwillihog/jiraa
|
134
|
+
licenses:
|
135
|
+
- MIT
|
136
|
+
post_install_message:
|
137
|
+
rdoc_options: []
|
138
|
+
require_paths:
|
139
|
+
- lib
|
140
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
141
|
+
none: false
|
142
|
+
requirements:
|
143
|
+
- - ! '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
|
+
none: false
|
148
|
+
requirements:
|
149
|
+
- - ! '>='
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
requirements: []
|
153
|
+
rubyforge_project:
|
154
|
+
rubygems_version: 1.8.23
|
155
|
+
signing_key:
|
156
|
+
specification_version: 3
|
157
|
+
summary: A CLI for the Jira 5 REST API...
|
158
|
+
test_files:
|
159
|
+
- features/jiraa.feature
|
160
|
+
- features/step_definitions/jiraa_steps.rb
|
161
|
+
- features/support/env.rb
|
162
|
+
- test/default_test.rb
|
163
|
+
- test/test_helper.rb
|
164
|
+
has_rdoc:
|