jigit 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +1 -0
  3. data/.gitignore +60 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +117 -0
  6. data/.travis.yml +20 -0
  7. data/CHANGELOG.md +5 -0
  8. data/Dangerfile +22 -0
  9. data/Gemfile +7 -0
  10. data/Gemfile.lock +138 -0
  11. data/LICENSE +21 -0
  12. data/README.md +66 -0
  13. data/Rakefile +32 -0
  14. data/bin/jigit +5 -0
  15. data/jigit.gemspec +35 -0
  16. data/lib/jigit.rb +12 -0
  17. data/lib/jigit/commands/init.rb +309 -0
  18. data/lib/jigit/commands/issue.rb +56 -0
  19. data/lib/jigit/commands/runner.rb +22 -0
  20. data/lib/jigit/commands/start_issue.rb +58 -0
  21. data/lib/jigit/commands/stop_issue.rb +53 -0
  22. data/lib/jigit/core/jigitfile.rb +31 -0
  23. data/lib/jigit/core/jigitfile_constants.rb +15 -0
  24. data/lib/jigit/core/jigitfile_generator.rb +34 -0
  25. data/lib/jigit/git/git_hook.rb +11 -0
  26. data/lib/jigit/git/git_hook_installer.rb +60 -0
  27. data/lib/jigit/git/git_ignore_updater.rb +20 -0
  28. data/lib/jigit/git/post_checkout_hook.rb +23 -0
  29. data/lib/jigit/helpers/informator.rb +131 -0
  30. data/lib/jigit/helpers/keychain_storage.rb +19 -0
  31. data/lib/jigit/jira/jira_api_client.rb +80 -0
  32. data/lib/jigit/jira/jira_api_client_error.rb +10 -0
  33. data/lib/jigit/jira/jira_config.rb +16 -0
  34. data/lib/jigit/jira/jira_transition_finder.rb +16 -0
  35. data/lib/jigit/jira/resources/jira_issue.rb +34 -0
  36. data/lib/jigit/jira/resources/jira_status.rb +18 -0
  37. data/lib/jigit/jira/resources/jira_transition.rb +18 -0
  38. data/lib/jigit/version.rb +4 -0
  39. data/spec/fixtures/jigitfile_invalid.yaml +2 -0
  40. data/spec/fixtures/jigitfile_valid.yaml +5 -0
  41. data/spec/lib/integration/jigit/core/jigitfile_generator_spec.rb +27 -0
  42. data/spec/lib/integration/jigit/core/keychain_storage_spec.rb +35 -0
  43. data/spec/lib/integration/jigit/git/git_hook_installer_spec.rb +66 -0
  44. data/spec/lib/integration/jigit/git/git_ignore_updater_spec.rb +45 -0
  45. data/spec/lib/integration/jigit/jira/jira_api_client_spec.rb +154 -0
  46. data/spec/lib/unit/jigit/core/jigitfile_spec.rb +33 -0
  47. data/spec/lib/unit/jigit/git/post_checkout_hook_spec.rb +22 -0
  48. data/spec/lib/unit/jigit/git_hooks/post_checkout_hook_spec.rb +22 -0
  49. data/spec/lib/unit/jigit/jira/jira_config_spec.rb +23 -0
  50. data/spec/lib/unit/jigit/jira/jira_issue_spec.rb +101 -0
  51. data/spec/lib/unit/jigit/jira/jira_status_spec.rb +62 -0
  52. data/spec/lib/unit/jigit/jira/jira_transition_finder_spec.rb +70 -0
  53. data/spec/lib/unit/jigit/jira/jira_transition_spec.rb +64 -0
  54. data/spec/mock_responses/issue.json +1108 -0
  55. data/spec/mock_responses/issue_1002_transitions.json +49 -0
  56. data/spec/mock_responses/statuses.json +37 -0
  57. data/spec/spec_helper.rb +17 -0
  58. data/tasks/generate_jira_localhost.rake +20 -0
  59. metadata +293 -0
@@ -0,0 +1,49 @@
1
+ {
2
+ "expand": "transitions",
3
+ "transitions": [
4
+ {
5
+ "id": "41",
6
+ "name": "Review",
7
+ "to": {
8
+ "self": "http://localhost:2990/rest/api/2/status/10006",
9
+ "description": "",
10
+ "iconUrl": "http://localhost:2990/images/icons/statuses/generic.png",
11
+ "name": "Reviewable",
12
+ "id": "10006"
13
+ }
14
+ },
15
+ {
16
+ "id": "101",
17
+ "name": "Stop Progress",
18
+ "to": {
19
+ "self": "http://localhost:2990/rest/api/2/status/10017",
20
+ "description": "Mapping for Accepted in Pivotal Tracker",
21
+ "iconUrl": "http://localhost:2990/images/icons/statuses/closed.png",
22
+ "name": "Accepted",
23
+ "id": "10017"
24
+ }
25
+ },
26
+ {
27
+ "id": "21",
28
+ "name": "Remove from Backlog",
29
+ "to": {
30
+ "self": "http://localhost:2990/rest/api/2/status/1",
31
+ "description": "The issue is open and ready for the assignee to start work on it.",
32
+ "iconUrl": "http://localhost:2990/images/icons/statuses/open.png",
33
+ "name": "Open",
34
+ "id": "1"
35
+ }
36
+ },
37
+ {
38
+ "id": "71",
39
+ "name": "Resolve",
40
+ "to": {
41
+ "self": "http://localhost:2990/rest/api/2/status/5",
42
+ "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.",
43
+ "iconUrl": "http://localhost:2990/images/icons/statuses/resolved.png",
44
+ "name": "Resolved",
45
+ "id": "5"
46
+ }
47
+ }
48
+ ]
49
+ }
@@ -0,0 +1,37 @@
1
+ [
2
+ {
3
+ "self": "http://localhost:2990/jira/rest/api/2/status/1",
4
+ "description": "The issue is open and ready for the assignee to start work on it.",
5
+ "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif",
6
+ "name": "Open",
7
+ "id": "1"
8
+ },
9
+ {
10
+ "self": "http://localhost:2990/jira/rest/api/2/status/3",
11
+ "description": "This issue is being actively worked on at the moment by the assignee.",
12
+ "iconUrl": "http://localhost:2990/jira/images/icons/status_inprogress.gif",
13
+ "name": "In Progress",
14
+ "id": "3"
15
+ },
16
+ {
17
+ "self": "http://localhost:2990/jira/rest/api/2/status/4",
18
+ "description": "This issue was once resolved, but the resolution was deemed incorrect. From here issues are either marked assigned or resolved.",
19
+ "iconUrl": "http://localhost:2990/jira/images/icons/status_reopened.gif",
20
+ "name": "Reopened",
21
+ "id": "4"
22
+ },
23
+ {
24
+ "self": "http://localhost:2990/jira/rest/api/2/status/5",
25
+ "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.",
26
+ "iconUrl": "http://localhost:2990/jira/images/icons/status_resolved.gif",
27
+ "name": "Resolved",
28
+ "id": "5"
29
+ },
30
+ {
31
+ "self": "http://localhost:2990/jira/rest/api/2/status/6",
32
+ "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.",
33
+ "iconUrl": "http://localhost:2990/jira/images/icons/status_closed.gif",
34
+ "name": "Closed",
35
+ "id": "6"
36
+ }
37
+ ]
@@ -0,0 +1,17 @@
1
+ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
2
+
3
+ # Needs to be required and started before danger
4
+ require "simplecov"
5
+ require 'simplecov-json'
6
+ SimpleCov.start do
7
+ add_filter "/spec/"
8
+ end
9
+ SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter
10
+
11
+ def get_mock_response(file, value_if_file_not_found = false)
12
+ file.sub!("?", "_") # we have to replace this character on Windows machine
13
+ File.read(File.join(File.dirname(__FILE__), "mock_responses/", file))
14
+ rescue Errno::ENOENT => e
15
+ raise e if value_if_file_not_found == false
16
+ value_if_file_not_found
17
+ end
@@ -0,0 +1,20 @@
1
+ # This task is copied from the https://github.com/sumoheavy/jira-ruby/blob/master/lib/tasks/generate.rake
2
+
3
+ require "securerandom"
4
+
5
+ namespace :jira do
6
+ desc "Generate a consumer key for your application"
7
+ task :generate_consumer_key do
8
+ key = SecureRandom.hex(16)
9
+ puts "You can use this as your consumer key: #{key}"
10
+ end
11
+
12
+ desc "Run the system call to generate a RSA public certificate"
13
+ task :generate_public_cert do
14
+ puts "Executing 'openssl req -x509 -nodes -newkey rsa:1024 -sha1 -keyout rsakey.pem -out rsacert.pem'"
15
+ system('openssl req -x509 -subj "/C=US/ST=New York/L=New York/O=SUMO Heavy Industries/CN=www.sumoheavy.com" -nodes -newkey rsa:1024 -sha1 -keyout rsakey.pem -out rsacert.pem')
16
+ puts "Done. The RSA-SHA1 private keyfile is in the current directory: \'rsakey.pem\'."
17
+ puts "You will need to copy the following certificate into your application link configuration in Jira:"
18
+ system("cat rsacert.pem")
19
+ end
20
+ end
metadata ADDED
@@ -0,0 +1,293 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jigit
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Anton Domashnev
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-11-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ruby-keychain
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: claide
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: cork
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: jira-ruby
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.18'
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: 1.18.0
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - "~>"
84
+ - !ruby/object:Gem::Version
85
+ version: '1.18'
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 1.18.0
89
+ - !ruby/object:Gem::Dependency
90
+ name: rubocop
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '0.42'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '0.42'
103
+ - !ruby/object:Gem::Dependency
104
+ name: bundler
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '1.3'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '1.3'
117
+ - !ruby/object:Gem::Dependency
118
+ name: rspec
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '3.0'
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: 3.0.0
127
+ type: :development
128
+ prerelease: false
129
+ version_requirements: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - "~>"
132
+ - !ruby/object:Gem::Version
133
+ version: '3.0'
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: 3.0.0
137
+ - !ruby/object:Gem::Dependency
138
+ name: simplecov-json
139
+ requirement: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - "~>"
142
+ - !ruby/object:Gem::Version
143
+ version: '0.2'
144
+ type: :development
145
+ prerelease: false
146
+ version_requirements: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - "~>"
149
+ - !ruby/object:Gem::Version
150
+ version: '0.2'
151
+ - !ruby/object:Gem::Dependency
152
+ name: rake
153
+ requirement: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - "~>"
156
+ - !ruby/object:Gem::Version
157
+ version: '10.3'
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: 10.3.2
161
+ type: :development
162
+ prerelease: false
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - "~>"
166
+ - !ruby/object:Gem::Version
167
+ version: '10.3'
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: 10.3.2
171
+ - !ruby/object:Gem::Dependency
172
+ name: simplecov
173
+ requirement: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - "~>"
176
+ - !ruby/object:Gem::Version
177
+ version: 0.12.0
178
+ type: :development
179
+ prerelease: false
180
+ version_requirements: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - "~>"
183
+ - !ruby/object:Gem::Version
184
+ version: 0.12.0
185
+ description: Keep you JIRA issue statuses in sync with what you're doing actually.
186
+ email:
187
+ - antondomashnev@gmail.com
188
+ executables:
189
+ - jigit
190
+ extensions: []
191
+ extra_rdoc_files: []
192
+ files:
193
+ - ".gitattributes"
194
+ - ".gitignore"
195
+ - ".rspec"
196
+ - ".rubocop.yml"
197
+ - ".travis.yml"
198
+ - CHANGELOG.md
199
+ - Dangerfile
200
+ - Gemfile
201
+ - Gemfile.lock
202
+ - LICENSE
203
+ - README.md
204
+ - Rakefile
205
+ - bin/jigit
206
+ - jigit.gemspec
207
+ - lib/jigit.rb
208
+ - lib/jigit/commands/init.rb
209
+ - lib/jigit/commands/issue.rb
210
+ - lib/jigit/commands/runner.rb
211
+ - lib/jigit/commands/start_issue.rb
212
+ - lib/jigit/commands/stop_issue.rb
213
+ - lib/jigit/core/jigitfile.rb
214
+ - lib/jigit/core/jigitfile_constants.rb
215
+ - lib/jigit/core/jigitfile_generator.rb
216
+ - lib/jigit/git/git_hook.rb
217
+ - lib/jigit/git/git_hook_installer.rb
218
+ - lib/jigit/git/git_ignore_updater.rb
219
+ - lib/jigit/git/post_checkout_hook.rb
220
+ - lib/jigit/helpers/informator.rb
221
+ - lib/jigit/helpers/keychain_storage.rb
222
+ - lib/jigit/jira/jira_api_client.rb
223
+ - lib/jigit/jira/jira_api_client_error.rb
224
+ - lib/jigit/jira/jira_config.rb
225
+ - lib/jigit/jira/jira_transition_finder.rb
226
+ - lib/jigit/jira/resources/jira_issue.rb
227
+ - lib/jigit/jira/resources/jira_status.rb
228
+ - lib/jigit/jira/resources/jira_transition.rb
229
+ - lib/jigit/version.rb
230
+ - spec/fixtures/jigitfile_invalid.yaml
231
+ - spec/fixtures/jigitfile_valid.yaml
232
+ - spec/lib/integration/jigit/core/jigitfile_generator_spec.rb
233
+ - spec/lib/integration/jigit/core/keychain_storage_spec.rb
234
+ - spec/lib/integration/jigit/git/git_hook_installer_spec.rb
235
+ - spec/lib/integration/jigit/git/git_ignore_updater_spec.rb
236
+ - spec/lib/integration/jigit/jira/jira_api_client_spec.rb
237
+ - spec/lib/unit/jigit/core/jigitfile_spec.rb
238
+ - spec/lib/unit/jigit/git/post_checkout_hook_spec.rb
239
+ - spec/lib/unit/jigit/git_hooks/post_checkout_hook_spec.rb
240
+ - spec/lib/unit/jigit/jira/jira_config_spec.rb
241
+ - spec/lib/unit/jigit/jira/jira_issue_spec.rb
242
+ - spec/lib/unit/jigit/jira/jira_status_spec.rb
243
+ - spec/lib/unit/jigit/jira/jira_transition_finder_spec.rb
244
+ - spec/lib/unit/jigit/jira/jira_transition_spec.rb
245
+ - spec/mock_responses/issue.json
246
+ - spec/mock_responses/issue_1002_transitions.json
247
+ - spec/mock_responses/statuses.json
248
+ - spec/spec_helper.rb
249
+ - tasks/generate_jira_localhost.rake
250
+ homepage: https://github.com/Antondomashnev/jigit
251
+ licenses:
252
+ - MIT
253
+ metadata: {}
254
+ post_install_message:
255
+ rdoc_options: []
256
+ require_paths:
257
+ - lib
258
+ required_ruby_version: !ruby/object:Gem::Requirement
259
+ requirements:
260
+ - - ">="
261
+ - !ruby/object:Gem::Version
262
+ version: 2.0.0
263
+ required_rubygems_version: !ruby/object:Gem::Requirement
264
+ requirements:
265
+ - - ">="
266
+ - !ruby/object:Gem::Version
267
+ version: '0'
268
+ requirements: []
269
+ rubyforge_project:
270
+ rubygems_version: 2.5.1
271
+ signing_key:
272
+ specification_version: 4
273
+ summary: Keep the status of the JIRA issue always in sync with your local git
274
+ test_files:
275
+ - spec/fixtures/jigitfile_invalid.yaml
276
+ - spec/fixtures/jigitfile_valid.yaml
277
+ - spec/lib/integration/jigit/core/jigitfile_generator_spec.rb
278
+ - spec/lib/integration/jigit/core/keychain_storage_spec.rb
279
+ - spec/lib/integration/jigit/git/git_hook_installer_spec.rb
280
+ - spec/lib/integration/jigit/git/git_ignore_updater_spec.rb
281
+ - spec/lib/integration/jigit/jira/jira_api_client_spec.rb
282
+ - spec/lib/unit/jigit/core/jigitfile_spec.rb
283
+ - spec/lib/unit/jigit/git/post_checkout_hook_spec.rb
284
+ - spec/lib/unit/jigit/git_hooks/post_checkout_hook_spec.rb
285
+ - spec/lib/unit/jigit/jira/jira_config_spec.rb
286
+ - spec/lib/unit/jigit/jira/jira_issue_spec.rb
287
+ - spec/lib/unit/jigit/jira/jira_status_spec.rb
288
+ - spec/lib/unit/jigit/jira/jira_transition_finder_spec.rb
289
+ - spec/lib/unit/jigit/jira/jira_transition_spec.rb
290
+ - spec/mock_responses/issue.json
291
+ - spec/mock_responses/issue_1002_transitions.json
292
+ - spec/mock_responses/statuses.json
293
+ - spec/spec_helper.rb