jira_report 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/.gitignore +14 -14
- data/.travis.yml +9 -0
- data/Gemfile +4 -4
- data/LICENSE.txt +22 -22
- data/README.md +59 -56
- data/Rakefile +7 -2
- data/bin/jira-report +7 -7
- data/{examples → example}/jira-report.sample +6 -6
- data/jira_report.gemspec +26 -25
- data/lib/jira_report.rb +97 -89
- data/lib/jira_report/cli.rb +31 -31
- data/lib/jira_report/settings.rb +48 -48
- data/lib/jira_report/version.rb +3 -3
- data/spec/jira_report_spec.rb +64 -0
- data/spec/spec_helper.rb +1 -0
- metadata +36 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 426236177e3ecba31533d4d70783a02fd3c1a39e
|
|
4
|
+
data.tar.gz: ce26fba802985e9781a037643e0effcc6e7d5742
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e1dd5d086623cb5d271349b13a309eb10f7102f4c68b3dcd02af887d8b83ba7163d1a6ebe58d230e25e9e5ace310e5e3ef696e30f634476cf3c401c3fd7a903
|
|
7
|
+
data.tar.gz: 4b5fe161b7e8af39ad69008f5ecbd0ed4bcc9c076c95c22cf9f127e5a245141fb623c98904992415f5955d799e5be5429723018d5a6f58acca48072d002266f2
|
data/.gitignore
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/.bundle/
|
|
2
|
-
/.yardoc
|
|
3
|
-
/Gemfile.lock
|
|
4
|
-
/_yardoc/
|
|
5
|
-
/coverage/
|
|
6
|
-
/doc/
|
|
7
|
-
/pkg/
|
|
8
|
-
/spec/reports/
|
|
9
|
-
/tmp/
|
|
10
|
-
*.bundle
|
|
11
|
-
*.so
|
|
12
|
-
*.o
|
|
13
|
-
*.a
|
|
14
|
-
mkmf.log
|
|
1
|
+
/.bundle/
|
|
2
|
+
/.yardoc
|
|
3
|
+
/Gemfile.lock
|
|
4
|
+
/_yardoc/
|
|
5
|
+
/coverage/
|
|
6
|
+
/doc/
|
|
7
|
+
/pkg/
|
|
8
|
+
/spec/reports/
|
|
9
|
+
/tmp/
|
|
10
|
+
*.bundle
|
|
11
|
+
*.so
|
|
12
|
+
*.o
|
|
13
|
+
*.a
|
|
14
|
+
mkmf.log
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
|
|
3
|
-
# Specify your gem's dependencies in jira_report.gemspec
|
|
4
|
-
gemspec
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# Specify your gem's dependencies in jira_report.gemspec
|
|
4
|
+
gemspec
|
data/LICENSE.txt
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
Copyright (c) 2015 Vitalii Elenhaupt
|
|
2
|
-
|
|
3
|
-
MIT License
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
a copy of this software and associated documentation files (the
|
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
-
the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
|
14
|
-
included in all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
Copyright (c) 2015 Vitalii Elenhaupt
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,56 +1,59 @@
|
|
|
1
|
-
jira_report
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Usage
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
TST-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
TST-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
period_from
|
|
55
|
-
|
|
56
|
-
```
|
|
1
|
+
[](https://rubygems.org/gems/jira_report)
|
|
2
|
+
[](https://travis-ci.org/veelenga/jira_report)
|
|
3
|
+
|
|
4
|
+
Jira Report
|
|
5
|
+
===========================
|
|
6
|
+
|
|
7
|
+
Queries user activities for specified period of time and prints it to console.
|
|
8
|
+
|
|
9
|
+
##Installation
|
|
10
|
+
```
|
|
11
|
+
$gem install jira_report
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
##Usage
|
|
15
|
+
```sh
|
|
16
|
+
$jira-report -h
|
|
17
|
+
Usage: jira-report [options]
|
|
18
|
+
-u, --username username Username to query activity report.
|
|
19
|
+
-c, --config config Path to config file. USER_HOME/.jira-report is default.
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
$jira-report -u admin
|
|
24
|
+
Querying jira...
|
|
25
|
+
Jira activity report for [admin]:
|
|
26
|
+
|
|
27
|
+
Created: 2
|
|
28
|
+
WFM-7180 - Provide static context for log property in BasicHashAnalyzer
|
|
29
|
+
TST-5862 - Unable to install Nginx on HP-UX with Java 6
|
|
30
|
+
|
|
31
|
+
Resolved: 8
|
|
32
|
+
GSM-364 - Migration of existing scenario
|
|
33
|
+
WFM-5865 - NullPointerException while finding categories
|
|
34
|
+
TST-5864 - Some NGinx installation improvements
|
|
35
|
+
TST-5863 - NGinx minimal dependency
|
|
36
|
+
SDK-7139 - Move common interfaces and classes from into individual jar
|
|
37
|
+
SDK-7138 - Move common interfaces and classes from into individual dll
|
|
38
|
+
TST-7111 - Event.getDonotNotify doesn't indicate about agent's state
|
|
39
|
+
TST-6985 - TST classes should have static Log fields
|
|
40
|
+
|
|
41
|
+
Reopened: 0
|
|
42
|
+
|
|
43
|
+
Closed: 5
|
|
44
|
+
TST-6943 - Remove redundant org.apache.log4j dependcy from common part
|
|
45
|
+
TST-5862 - Unable to install NGinx on HP-UX with Java 6
|
|
46
|
+
TST-5857 - Put back support for Jdk 1.6
|
|
47
|
+
TST-5840 - NGinx fails to handle interaction initiated
|
|
48
|
+
GSM-364 - Migration of existing units
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
##Configuration
|
|
52
|
+
Default path to configuration file is `~/.jira-report`. All settings are optional and may be read from user input. See [sample](example/jira-report.sample).
|
|
53
|
+
|
|
54
|
+
Period is set by two options `period_from` and `period_till`. Both options support [advanced jira searching](https://confluence.atlassian.com/display/JIRA/Advanced+Searching) and accept dates, jira functions, aliasing. For example:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
period_from=-3w
|
|
58
|
+
period_till=now()
|
|
59
|
+
```
|
data/Rakefile
CHANGED
data/bin/jira-report
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'jira_report'
|
|
4
|
-
|
|
5
|
-
parameters = JiraReport::Cli.new
|
|
6
|
-
settings = JiraReport::Settings.new(parameters.ini)
|
|
7
|
-
JiraReport::JiraReport.new(settings, parameters.username).report
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'jira_report'
|
|
4
|
+
|
|
5
|
+
parameters = JiraReport::Cli.new
|
|
6
|
+
settings = JiraReport::Settings.new(parameters.ini)
|
|
7
|
+
JiraReport::JiraReport.new(settings, parameters.username).report
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
url=jira.company.com
|
|
2
|
-
username=jira_username
|
|
3
|
-
password=s3cr3t
|
|
4
|
-
|
|
5
|
-
period_from=-1w
|
|
6
|
-
period_till=now()
|
|
1
|
+
url=jira.company.com
|
|
2
|
+
username=jira_username
|
|
3
|
+
password=s3cr3t
|
|
4
|
+
|
|
5
|
+
period_from=-1w
|
|
6
|
+
period_till=now()
|
data/jira_report.gemspec
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require 'jira_report/version'
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name = 'jira_report'
|
|
8
|
-
spec.version = JiraReport::VERSION
|
|
9
|
-
spec.authors = ['Vitalii Elenhaupt']
|
|
10
|
-
spec.email = ['velenhaupt@gmail.com']
|
|
11
|
-
spec.summary = %q{Jira activity report generator.}
|
|
12
|
-
spec.description = %q{Generates a productivity report base on activities in jira.}
|
|
13
|
-
spec.homepage = 'https://github.com/veelenga/jira_report.git'
|
|
14
|
-
spec.license = 'MIT'
|
|
15
|
-
|
|
16
|
-
spec.files = `
|
|
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_runtime_dependency 'inifile', '~> 3.0'
|
|
22
|
-
spec.add_runtime_dependency 'rest-client', '~> 1.7'
|
|
23
|
-
spec.add_development_dependency 'bundler', '~> 1.7'
|
|
24
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
|
25
|
-
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'jira_report/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = 'jira_report'
|
|
8
|
+
spec.version = JiraReport::VERSION
|
|
9
|
+
spec.authors = ['Vitalii Elenhaupt']
|
|
10
|
+
spec.email = ['velenhaupt@gmail.com']
|
|
11
|
+
spec.summary = %q{Jira activity report generator.}
|
|
12
|
+
spec.description = %q{Generates a productivity report base on activities in jira.}
|
|
13
|
+
spec.homepage = 'https://github.com/veelenga/jira_report.git'
|
|
14
|
+
spec.license = 'MIT'
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
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_runtime_dependency 'inifile', '~> 3.0'
|
|
22
|
+
spec.add_runtime_dependency 'rest-client', '~> 1.7'
|
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
|
24
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
26
|
+
end
|
data/lib/jira_report.rb
CHANGED
|
@@ -1,89 +1,97 @@
|
|
|
1
|
-
require 'rest_client'
|
|
2
|
-
require 'json'
|
|
3
|
-
require 'uri'
|
|
4
|
-
|
|
5
|
-
require 'jira_report/settings'
|
|
6
|
-
require 'jira_report/cli'
|
|
7
|
-
|
|
8
|
-
module JiraReport
|
|
9
|
-
# Base class that generate jira activity report
|
|
10
|
-
class JiraReport
|
|
11
|
-
attr_accessor :from, :till, :username
|
|
12
|
-
|
|
13
|
-
def initialize(init_set, username)
|
|
14
|
-
@username = username ? username : init_set.username
|
|
15
|
-
@search_url = jira_search_url(init_set.url,
|
|
16
|
-
init_set.username,
|
|
17
|
-
init_set.password)
|
|
18
|
-
|
|
19
|
-
@from = init_set.period_from
|
|
20
|
-
@till = init_set.period_till
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def report
|
|
24
|
-
puts "\nQuerying jira..."
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"AND
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"AND
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"AND 'First
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
end
|
|
1
|
+
require 'rest_client'
|
|
2
|
+
require 'json'
|
|
3
|
+
require 'uri'
|
|
4
|
+
|
|
5
|
+
require 'jira_report/settings'
|
|
6
|
+
require 'jira_report/cli'
|
|
7
|
+
|
|
8
|
+
module JiraReport
|
|
9
|
+
# Base class that generate jira activity report
|
|
10
|
+
class JiraReport
|
|
11
|
+
attr_accessor :from, :till, :username
|
|
12
|
+
|
|
13
|
+
def initialize(init_set, username)
|
|
14
|
+
@username = username ? username : init_set.username
|
|
15
|
+
@search_url = jira_search_url(init_set.url,
|
|
16
|
+
init_set.username,
|
|
17
|
+
init_set.password)
|
|
18
|
+
|
|
19
|
+
@from = init_set.period_from
|
|
20
|
+
@till = init_set.period_till
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def report
|
|
24
|
+
puts "\nQuerying jira..."
|
|
25
|
+
|
|
26
|
+
begin
|
|
27
|
+
created = query(jql_created)
|
|
28
|
+
resolved = query(jql_resolved)
|
|
29
|
+
reopened = query(jql_reopened)
|
|
30
|
+
closed = query(jql_closed)
|
|
31
|
+
|
|
32
|
+
puts "\nJira activity report for [#{@username}]:"
|
|
33
|
+
|
|
34
|
+
puts "\nCreated: #{created.length}"
|
|
35
|
+
print_issues(created)
|
|
36
|
+
|
|
37
|
+
puts "\nResolved: #{resolved.length}"
|
|
38
|
+
print_issues(resolved)
|
|
39
|
+
|
|
40
|
+
puts "\nReopened: #{reopened.length}"
|
|
41
|
+
print_issues(reopened)
|
|
42
|
+
|
|
43
|
+
puts "\nClosed: #{closed.length}"
|
|
44
|
+
print_issues(closed)
|
|
45
|
+
|
|
46
|
+
rescue SocketError => e
|
|
47
|
+
puts "Unable to connect to jira: '#{e.message}'"
|
|
48
|
+
rescue Exception => e
|
|
49
|
+
puts "Unable to prepare activity report: '#{e.message}'"
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
private
|
|
54
|
+
|
|
55
|
+
def jira_search_url(url, username, password)
|
|
56
|
+
"http://#{username}:#{password}@#{url}/rest/api/2/search?"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def jql_created
|
|
60
|
+
"jql=created>=#{@from} " \
|
|
61
|
+
"AND created<=#{@till} "\
|
|
62
|
+
"AND reporter=#{@username}"
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def jql_resolved
|
|
66
|
+
"jql=resolved>=#{@from} " \
|
|
67
|
+
"AND resolved<=#{@till} "\
|
|
68
|
+
"AND 'First Resolution User'=#{@username}"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def jql_closed
|
|
72
|
+
"jql='First Closed Date'>=#{@from} " \
|
|
73
|
+
"AND 'First Closed Date'<=#{@till} "\
|
|
74
|
+
"AND 'First Closed User'=#{@username}"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def jql_reopened
|
|
78
|
+
"jql='First Reopened Date'>=#{@from} " \
|
|
79
|
+
"AND 'First Reopened Date'<=#{@till} "\
|
|
80
|
+
"AND 'First Reopened User'=#{@username}"
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def query(jql)
|
|
84
|
+
response = RestClient.get(@search_url + URI.escape(jql))
|
|
85
|
+
unless response.code == 200
|
|
86
|
+
fail "Got wrong response code: #{response.code}"
|
|
87
|
+
end
|
|
88
|
+
JSON.parse(response.body)['issues']
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def print_issues(issues)
|
|
92
|
+
issues.each do |issue|
|
|
93
|
+
puts " #{issue['key']} - #{issue['fields']['summary']}"
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
data/lib/jira_report/cli.rb
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
require 'optparse'
|
|
2
|
-
|
|
3
|
-
module JiraReport
|
|
4
|
-
# Prepares command line parameters using OptionParser
|
|
5
|
-
class Cli
|
|
6
|
-
attr_reader :username, :ini
|
|
7
|
-
|
|
8
|
-
def initialize
|
|
9
|
-
options = parse
|
|
10
|
-
@username = options[:username]
|
|
11
|
-
@ini = options[:ini] ? options[:ini] : "~/.jira-report"
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
def parse
|
|
17
|
-
options = {}
|
|
18
|
-
OptionParser.new do |opts|
|
|
19
|
-
opts.banner = 'Usage: jira-report [options]'
|
|
20
|
-
opts.on('-u', '--username username', 'Username to query activity report.') do |u|
|
|
21
|
-
options[:username] = u
|
|
22
|
-
end
|
|
23
|
-
opts.on('-c', '--config config', 'Path to config file. ' \
|
|
24
|
-
'USER_HOME/.jira-report is default.') do |s|
|
|
25
|
-
options[:ini] = s
|
|
26
|
-
end
|
|
27
|
-
end.parse!
|
|
28
|
-
options
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
1
|
+
require 'optparse'
|
|
2
|
+
|
|
3
|
+
module JiraReport
|
|
4
|
+
# Prepares command line parameters using OptionParser
|
|
5
|
+
class Cli
|
|
6
|
+
attr_reader :username, :ini
|
|
7
|
+
|
|
8
|
+
def initialize
|
|
9
|
+
options = parse
|
|
10
|
+
@username = options[:username]
|
|
11
|
+
@ini = options[:ini] ? options[:ini] : "~/.jira-report"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def parse
|
|
17
|
+
options = {}
|
|
18
|
+
OptionParser.new do |opts|
|
|
19
|
+
opts.banner = 'Usage: jira-report [options]'
|
|
20
|
+
opts.on('-u', '--username username', 'Username to query activity report.') do |u|
|
|
21
|
+
options[:username] = u
|
|
22
|
+
end
|
|
23
|
+
opts.on('-c', '--config config', 'Path to config file. ' \
|
|
24
|
+
'USER_HOME/.jira-report is default.') do |s|
|
|
25
|
+
options[:ini] = s
|
|
26
|
+
end
|
|
27
|
+
end.parse!
|
|
28
|
+
options
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
data/lib/jira_report/settings.rb
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
require 'inifile'
|
|
2
|
-
require 'io/console'
|
|
3
|
-
|
|
4
|
-
# Initializes JiraReport settings.
|
|
5
|
-
module JiraReport
|
|
6
|
-
class Settings
|
|
7
|
-
attr_reader :username, :password, :url,\
|
|
8
|
-
:period_from, :period_till
|
|
9
|
-
|
|
10
|
-
def initialize(path)
|
|
11
|
-
read(path)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
def read(path)
|
|
17
|
-
loaded = IniFile.load(File.expand_path(path))
|
|
18
|
-
|
|
19
|
-
global = loaded[:global] if loaded
|
|
20
|
-
global ||= {}
|
|
21
|
-
|
|
22
|
-
@url = global['url']
|
|
23
|
-
@username = global['username']
|
|
24
|
-
@password = global['password']
|
|
25
|
-
@period_from = global['period_from']
|
|
26
|
-
@period_till = global['period_till']
|
|
27
|
-
|
|
28
|
-
@url = ask('Jira url in [jira.company.com] format: ') unless @url
|
|
29
|
-
@username = ask('Jira username: ') unless @username
|
|
30
|
-
@password = ask('Jira password: '){
|
|
31
|
-
STDIN.noecho(&:gets).chomp!
|
|
32
|
-
} unless @password
|
|
33
|
-
@period_from = '-1w' unless @period_from
|
|
34
|
-
@period_till = 'now()' unless @period_till
|
|
35
|
-
|
|
36
|
-
# TODO: attributes verification
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def ask(message, &block)
|
|
40
|
-
print message
|
|
41
|
-
if block
|
|
42
|
-
yield block
|
|
43
|
-
else
|
|
44
|
-
gets.chomp!
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
1
|
+
require 'inifile'
|
|
2
|
+
require 'io/console'
|
|
3
|
+
|
|
4
|
+
# Initializes JiraReport settings.
|
|
5
|
+
module JiraReport
|
|
6
|
+
class Settings
|
|
7
|
+
attr_reader :username, :password, :url,\
|
|
8
|
+
:period_from, :period_till
|
|
9
|
+
|
|
10
|
+
def initialize(path)
|
|
11
|
+
read(path)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def read(path)
|
|
17
|
+
loaded = IniFile.load(File.expand_path(path))
|
|
18
|
+
|
|
19
|
+
global = loaded[:global] if loaded
|
|
20
|
+
global ||= {}
|
|
21
|
+
|
|
22
|
+
@url = global['url']
|
|
23
|
+
@username = global['username']
|
|
24
|
+
@password = global['password']
|
|
25
|
+
@period_from = global['period_from']
|
|
26
|
+
@period_till = global['period_till']
|
|
27
|
+
|
|
28
|
+
@url = ask('Jira url in [jira.company.com] format: ') unless @url
|
|
29
|
+
@username = ask('Jira username: ') unless @username
|
|
30
|
+
@password = ask('Jira password: '){
|
|
31
|
+
STDIN.noecho(&:gets).chomp!
|
|
32
|
+
} unless @password
|
|
33
|
+
@period_from = '-1w' unless @period_from
|
|
34
|
+
@period_till = 'now()' unless @period_till
|
|
35
|
+
|
|
36
|
+
# TODO: attributes verification
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def ask(message, &block)
|
|
40
|
+
print message
|
|
41
|
+
if block
|
|
42
|
+
yield block
|
|
43
|
+
else
|
|
44
|
+
gets.chomp!
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
data/lib/jira_report/version.rb
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module JiraReport
|
|
2
|
-
VERSION = "0.0.
|
|
3
|
-
end
|
|
1
|
+
module JiraReport
|
|
2
|
+
VERSION = "0.0.2"
|
|
3
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module JiraReport
|
|
4
|
+
|
|
5
|
+
class InitSet
|
|
6
|
+
attr_accessor :url,
|
|
7
|
+
:username, :password,
|
|
8
|
+
:period_from, :period_till
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
describe JiraReport do
|
|
12
|
+
let(:init) { InitSet.new }
|
|
13
|
+
let(:jrep) { JiraReport.new(init, 'username') }
|
|
14
|
+
|
|
15
|
+
describe '#jira_search_url' do
|
|
16
|
+
def jira_search_url(url=nil, user=nil, pass=nil)
|
|
17
|
+
jrep.send(:jira_search_url, url, user, pass)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'is an http url' do
|
|
21
|
+
url = jira_search_url
|
|
22
|
+
expect(url).not_to be nil
|
|
23
|
+
expect(url).to start_with 'http'
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'uses rest api' do
|
|
27
|
+
expect(jira_search_url).to include('rest/api/2/search')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
context 'when we use url and username' do
|
|
31
|
+
let(:usr) { 'admin_username' }
|
|
32
|
+
let(:url) { 'jira.mycompany.url' }
|
|
33
|
+
it 'contains url and username' do
|
|
34
|
+
url = jira_search_url(url, usr, nil)
|
|
35
|
+
expect(url).to include(url)
|
|
36
|
+
expect(url).to include(usr)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
describe '#jql_*' do
|
|
41
|
+
describe '#jql_created' do
|
|
42
|
+
it 'returns query' do
|
|
43
|
+
expect(jrep.send(:jql_created)).not_to be nil
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
describe '#jql_resolved' do
|
|
47
|
+
it 'returns query' do
|
|
48
|
+
expect(jrep.send(:jql_resolved)).not_to be nil
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
describe '#jql_closed' do
|
|
52
|
+
it 'returns query' do
|
|
53
|
+
expect(jrep.send(:jql_closed)).not_to be nil
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
describe '#jql_reopened' do
|
|
57
|
+
it 'returns query' do
|
|
58
|
+
expect(jrep.send(:jql_reopened)).not_to be nil
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'jira_report'
|
metadata
CHANGED
|
@@ -1,71 +1,85 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jira_report
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vitalii Elenhaupt
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-02-
|
|
11
|
+
date: 2015-02-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: inifile
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - ~>
|
|
17
|
+
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '3.0'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - ~>
|
|
24
|
+
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '3.0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rest-client
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- - ~>
|
|
31
|
+
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
33
|
version: '1.7'
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- - ~>
|
|
38
|
+
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '1.7'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: bundler
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- - ~>
|
|
45
|
+
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
47
|
version: '1.7'
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
|
-
- - ~>
|
|
52
|
+
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '1.7'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: rake
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
|
-
- - ~>
|
|
59
|
+
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
61
|
version: '10.0'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
|
-
- - ~>
|
|
66
|
+
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '10.0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rspec
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '3.0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '3.0'
|
|
69
83
|
description: Generates a productivity report base on activities in jira.
|
|
70
84
|
email:
|
|
71
85
|
- velenhaupt@gmail.com
|
|
@@ -74,18 +88,21 @@ executables:
|
|
|
74
88
|
extensions: []
|
|
75
89
|
extra_rdoc_files: []
|
|
76
90
|
files:
|
|
77
|
-
- .gitignore
|
|
91
|
+
- ".gitignore"
|
|
92
|
+
- ".travis.yml"
|
|
78
93
|
- Gemfile
|
|
79
94
|
- LICENSE.txt
|
|
80
95
|
- README.md
|
|
81
96
|
- Rakefile
|
|
82
97
|
- bin/jira-report
|
|
83
|
-
-
|
|
98
|
+
- example/jira-report.sample
|
|
84
99
|
- jira_report.gemspec
|
|
85
100
|
- lib/jira_report.rb
|
|
86
101
|
- lib/jira_report/cli.rb
|
|
87
102
|
- lib/jira_report/settings.rb
|
|
88
103
|
- lib/jira_report/version.rb
|
|
104
|
+
- spec/jira_report_spec.rb
|
|
105
|
+
- spec/spec_helper.rb
|
|
89
106
|
homepage: https://github.com/veelenga/jira_report.git
|
|
90
107
|
licenses:
|
|
91
108
|
- MIT
|
|
@@ -96,18 +113,21 @@ require_paths:
|
|
|
96
113
|
- lib
|
|
97
114
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
115
|
requirements:
|
|
99
|
-
- -
|
|
116
|
+
- - ">="
|
|
100
117
|
- !ruby/object:Gem::Version
|
|
101
118
|
version: '0'
|
|
102
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
120
|
requirements:
|
|
104
|
-
- -
|
|
121
|
+
- - ">="
|
|
105
122
|
- !ruby/object:Gem::Version
|
|
106
123
|
version: '0'
|
|
107
124
|
requirements: []
|
|
108
125
|
rubyforge_project:
|
|
109
|
-
rubygems_version: 2.
|
|
126
|
+
rubygems_version: 2.4.5
|
|
110
127
|
signing_key:
|
|
111
128
|
specification_version: 4
|
|
112
129
|
summary: Jira activity report generator.
|
|
113
|
-
test_files:
|
|
130
|
+
test_files:
|
|
131
|
+
- spec/jira_report_spec.rb
|
|
132
|
+
- spec/spec_helper.rb
|
|
133
|
+
has_rdoc:
|