jigit 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.
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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 219ee3dcb02fd9cba4681cad6c3558ee21ad0ce0
4
+ data.tar.gz: d41f7b21ab36d8046b93534a7cb01b52e8f347a9
5
+ SHA512:
6
+ metadata.gz: 9c792a07f083891f54989173518e21fe6fb32861723e62983fef893f734a80938c1832cbb2c18fb877fb738f7c82024b0b2699034d8e3c0e71553fe7ba899d20
7
+ data.tar.gz: b2767e448ffddcc16db2532173f70d14e4d630b7d5c31fe3538ef7f7f8d5c6a8a9b0a3a25829f9e3630f6d2eea3b2ac6497cddb60d056ff46922272b6d0ccac6
@@ -0,0 +1 @@
1
+ CHANGELOG.md merge=union
@@ -0,0 +1,60 @@
1
+ .DS_Store
2
+
3
+ *.gem
4
+ *.rbc
5
+ /.config
6
+ /coverage/
7
+ /InstalledFiles
8
+ /pkg/
9
+ /spec/reports/
10
+ /spec/examples.txt
11
+ /test/tmp/
12
+ /test/version_tmp/
13
+ /tmp/
14
+
15
+ # Used by dotenv library to load environment variables.
16
+ # .env
17
+
18
+ ## Specific to RubyMotion:
19
+ .dat*
20
+ .repl_history
21
+ build/
22
+ *.bridgesupport
23
+ build-iPhoneOS/
24
+ build-iPhoneSimulator/
25
+
26
+ ## Specific to RubyMotion (use of CocoaPods):
27
+ #
28
+ # We recommend against adding the Pods directory to your .gitignore. However
29
+ # you should judge for yourself, the pros and cons are mentioned at:
30
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
31
+ #
32
+ # vendor/Pods/
33
+
34
+ ## Documentation cache and generated files:
35
+ /.yardoc/
36
+ /_yardoc/
37
+ /doc/
38
+ /rdoc/
39
+
40
+ ## Environment normalization:
41
+ /.bundle/
42
+ /vendor/bundle
43
+ /lib/bundler/man/
44
+
45
+ # for a library or gem, you might want to ignore these files since the code is
46
+ # intended to run in multiple environments; otherwise, check them in:
47
+ # Gemfile.lock
48
+ # .ruby-version
49
+ # .ruby-gemset
50
+
51
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
52
+ .rvmrc
53
+
54
+ # jira related
55
+ rsacert.pem
56
+ rsakey.pem
57
+
58
+ # simplecov
59
+ coverage
60
+ junit-results.xml
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
@@ -0,0 +1,117 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.0
3
+ Exclude:
4
+ - 'spec/fixtures/**/*'
5
+
6
+ Style/StringLiterals:
7
+ EnforcedStyle: double_quotes
8
+ Enabled: true
9
+
10
+ # kind_of? is a good way to check a type
11
+ Style/ClassCheck:
12
+ EnforcedStyle: kind_of?
13
+
14
+ # It's better to be more explicit about the type
15
+ Style/BracesAroundHashParameters:
16
+ Enabled: false
17
+
18
+ # specs sometimes have useless assignments, which is fine
19
+ Lint/UselessAssignment:
20
+ Exclude:
21
+ - '**/spec/**/*'
22
+
23
+ # We could potentially enable the 2 below:
24
+ Style/IndentHash:
25
+ Enabled: false
26
+
27
+ Style/AlignHash:
28
+ Enabled: false
29
+
30
+ # HoundCI doesn't like this rule
31
+ Style/DotPosition:
32
+ Enabled: false
33
+
34
+ # We allow !! as it's an easy way to convert ot boolean
35
+ Style/DoubleNegation:
36
+ Enabled: false
37
+
38
+ # Cop supports --auto-correct.
39
+ Lint/UnusedBlockArgument:
40
+ Enabled: false
41
+
42
+ # We want to allow class Fastlane::Class
43
+ Style/ClassAndModuleChildren:
44
+ Enabled: false
45
+
46
+ Metrics/AbcSize:
47
+ Max: 60
48
+
49
+ # The %w might be confusing for new users
50
+ Style/WordArray:
51
+ MinSize: 19
52
+
53
+ # raise and fail are both okay
54
+ Style/SignalException:
55
+ Enabled: false
56
+
57
+ # Better too much 'return' than one missing
58
+ Style/RedundantReturn:
59
+ Enabled: false
60
+
61
+ # Having if in the same line might not always be good
62
+ Style/IfUnlessModifier:
63
+ Enabled: false
64
+
65
+ # and and or is okay
66
+ Style/AndOr:
67
+ Enabled: false
68
+
69
+ # Configuration parameters: CountComments.
70
+ Metrics/ClassLength:
71
+ Max: 320
72
+
73
+ Metrics/CyclomaticComplexity:
74
+ Max: 17
75
+
76
+ # Configuration parameters: AllowURI, URISchemes.
77
+ Metrics/LineLength:
78
+ Max: 370
79
+
80
+ # Configuration parameters: CountKeywordArgs.
81
+ Metrics/ParameterLists:
82
+ Max: 10
83
+
84
+ Metrics/PerceivedComplexity:
85
+ Max: 18
86
+
87
+ # Sometimes it's easier to read without guards
88
+ Style/GuardClause:
89
+ Enabled: false
90
+
91
+ # something = if something_else
92
+ # that's confusing
93
+ Style/ConditionalAssignment:
94
+ Enabled: false
95
+
96
+ # Better to have too much self than missing a self
97
+ Style/RedundantSelf:
98
+ Enabled: false
99
+
100
+ Metrics/MethodLength:
101
+ Max: 60
102
+
103
+ # We're not there yet
104
+ Style/Documentation:
105
+ Enabled: false
106
+
107
+ # Adds complexity
108
+ Style/IfInsideElse:
109
+ Enabled: false
110
+
111
+ # danger specific
112
+
113
+ Style/BlockComments:
114
+ Enabled: false
115
+
116
+ Style/MultilineMethodCallIndentation:
117
+ EnforcedStyle: indented
@@ -0,0 +1,20 @@
1
+ language: ruby
2
+ os:
3
+ - osx
4
+ cache:
5
+ directories:
6
+ - bundle
7
+
8
+ rvm:
9
+ - 2.2.2
10
+ - 2.3.1
11
+
12
+ bundler_args: "--without documentation --path bundle"
13
+
14
+ before_install:
15
+ - gem install bundler
16
+
17
+ script:
18
+ - bundle install
19
+ - bundle exec rake spec
20
+ - bundle exec danger --verbose
@@ -0,0 +1,5 @@
1
+ ## master
2
+
3
+ ## 1.0.0
4
+
5
+ * [#15](https://github.com/Antondomashnev/jigit/pull/15): Initial release 🎉 - [@antondomashnev](https://github.com/antondomashnev).
@@ -0,0 +1,22 @@
1
+ # We all want to know that =)
2
+ simplecov.report 'coverage/coverage.json'
3
+
4
+ has_app_changes = !git.modified_files.grep(/lib/).empty?
5
+ has_test_changes = !git.modified_files.grep(/spec/).empty?
6
+
7
+ if has_app_changes && !has_test_changes
8
+ warn("Tests were not updated")
9
+ end
10
+
11
+ # People are curious about what you've done
12
+ if github.pr_title.length < 5
13
+ fail "Please provide a meaningful Pull Request title"
14
+ end
15
+
16
+ if github.pr_body.length < 5
17
+ fail "Please provide a summary in the Pull Request description"
18
+ end
19
+
20
+ # Changelog is important
21
+ declared_trivial = (github.pr_title + github.pr_body).include?("#trivial") || !has_app_changes
22
+ changelog.check unless declared_trivial
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in jira_api.gemspec
4
+ gemspec
5
+
6
+ gem "danger", "~> 4.0"
7
+ gem "danger-simplecov_json", "~> 0.2"
@@ -0,0 +1,138 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jigit (0.1.0)
5
+ claide (~> 1.0)
6
+ cork (~> 0.1)
7
+ jira-ruby (~> 1.0)
8
+ ruby-keychain (~> 0.3)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ activesupport (5.0.0.1)
14
+ concurrent-ruby (~> 1.0, >= 1.0.2)
15
+ i18n (~> 0.7)
16
+ minitest (~> 5.1)
17
+ tzinfo (~> 1.1)
18
+ addressable (2.4.0)
19
+ ast (2.3.0)
20
+ builder (3.2.2)
21
+ claide (1.0.1)
22
+ claide-plugins (0.9.2)
23
+ cork
24
+ nap
25
+ open4 (~> 1.3)
26
+ colored (1.2)
27
+ concurrent-ruby (1.0.2)
28
+ corefoundation (0.2.0)
29
+ ffi
30
+ cork (0.2.0)
31
+ colored (~> 1.2)
32
+ crack (0.4.3)
33
+ safe_yaml (~> 1.0.0)
34
+ danger (4.0.0)
35
+ claide (~> 1.0)
36
+ claide-plugins (>= 0.9.2)
37
+ colored (~> 1.2)
38
+ cork (~> 0.1)
39
+ faraday (~> 0.9)
40
+ faraday-http-cache (~> 1.0)
41
+ git (~> 1)
42
+ kramdown (~> 1.5)
43
+ octokit (~> 4.2)
44
+ terminal-table (~> 1)
45
+ danger-junit (0.7.1)
46
+ danger (> 2.0)
47
+ ox (~> 2.0)
48
+ diff-lcs (1.2.5)
49
+ docile (1.1.5)
50
+ faraday (0.9.2)
51
+ multipart-post (>= 1.2, < 3)
52
+ faraday-http-cache (1.3.1)
53
+ faraday (~> 0.8)
54
+ ffi (1.9.14)
55
+ git (1.3.0)
56
+ hashdiff (0.3.0)
57
+ i18n (0.7.0)
58
+ jira-ruby (1.1.2)
59
+ activesupport
60
+ oauth (~> 0.5, >= 0.5.0)
61
+ json (1.8.3)
62
+ kramdown (1.12.0)
63
+ minitest (5.9.1)
64
+ multipart-post (2.0.0)
65
+ nap (1.1.0)
66
+ oauth (0.5.1)
67
+ octokit (4.6.0)
68
+ sawyer (~> 0.8.0, >= 0.5.3)
69
+ open4 (1.3.4)
70
+ ox (2.4.5)
71
+ parser (2.3.1.4)
72
+ ast (~> 2.2)
73
+ powerpack (0.1.1)
74
+ rainbow (2.1.0)
75
+ rake (10.5.0)
76
+ rspec (3.5.0)
77
+ rspec-core (~> 3.5.0)
78
+ rspec-expectations (~> 3.5.0)
79
+ rspec-mocks (~> 3.5.0)
80
+ rspec-core (3.5.4)
81
+ rspec-support (~> 3.5.0)
82
+ rspec-expectations (3.5.0)
83
+ diff-lcs (>= 1.2.0, < 2.0)
84
+ rspec-support (~> 3.5.0)
85
+ rspec-mocks (3.5.0)
86
+ diff-lcs (>= 1.2.0, < 2.0)
87
+ rspec-support (~> 3.5.0)
88
+ rspec-support (3.5.0)
89
+ rspec_junit_formatter (0.2.3)
90
+ builder (< 4)
91
+ rspec-core (>= 2, < 4, != 2.12.0)
92
+ rubocop (0.44.1)
93
+ parser (>= 2.3.1.1, < 3.0)
94
+ powerpack (~> 0.1)
95
+ rainbow (>= 1.99.1, < 3.0)
96
+ ruby-progressbar (~> 1.7)
97
+ unicode-display_width (~> 1.0, >= 1.0.1)
98
+ ruby-keychain (0.3.2)
99
+ corefoundation (~> 0.2.0)
100
+ ffi
101
+ ruby-progressbar (1.8.1)
102
+ safe_yaml (1.0.4)
103
+ sawyer (0.8.0)
104
+ addressable (>= 2.3.5, < 2.6)
105
+ faraday (~> 0.8, < 0.10)
106
+ simplecov (0.12.0)
107
+ docile (~> 1.1.0)
108
+ json (>= 1.8, < 3)
109
+ simplecov-html (~> 0.10.0)
110
+ simplecov-html (0.10.0)
111
+ terminal-table (1.7.3)
112
+ unicode-display_width (~> 1.1.1)
113
+ thread_safe (0.3.5)
114
+ tzinfo (1.2.2)
115
+ thread_safe (~> 0.1)
116
+ unicode-display_width (1.1.1)
117
+ webmock (1.24.6)
118
+ addressable (>= 2.3.6)
119
+ crack (>= 0.3.2)
120
+ hashdiff
121
+
122
+ PLATFORMS
123
+ ruby
124
+
125
+ DEPENDENCIES
126
+ bundler (~> 1.3)
127
+ danger (~> 4.0)
128
+ danger-junit (~> 0.7)
129
+ jigit!
130
+ rake (~> 10.3, >= 10.3.2)
131
+ rspec (~> 3.0, >= 3.0.0)
132
+ rspec_junit_formatter (~> 0.2)
133
+ rubocop (~> 0.42)
134
+ simplecov (~> 0.12.0)
135
+ webmock (~> 1.18, >= 1.18.0)
136
+
137
+ BUNDLED WITH
138
+ 1.13.2
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016 Anton
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,66 @@
1
+ ## jigit
2
+
3
+ [![Build Status](https://travis-ci.org/Antondomashnev/jigit.svg?branch=master)](https://travis-ci.org/Antondomashnev/jigit)
4
+ [![codebeat badge](https://codebeat.co/badges/05115118-11ff-49bb-9b84-73070afb0f3c)](https://codebeat.co/projects/github-com-antondomashnev-jigit)
5
+
6
+ Keep you JIRA issue statuses in sync with what you're doing actually.
7
+
8
+ ### How it works?
9
+
10
+ If you're as lazy as me and in the same time working with JIRA for quite a time on a daily basis,
11
+ `jigit` may save you some time and make the process a bit better :wink
12
+ Let's say you've just cloned a project and
13
+ have 2 JIRA issues in `TO DO` in our list: `CNI-1798`, `CNI-1799`.
14
+
15
+ * You're on `master` branch or whatever you have as a default after cloning;
16
+ * You're going to work on `CNI-1798` first;
17
+ * `git checkout -b CNI-1798`;
18
+ * `jigit` will change the status of `CNI-1798` on JIRA to `In Progress`
19
+ or whatever you set up as a `work in progress` status 🎉;
20
+ * Suddenly you have to switch to the higher priority `CNI-1799`;
21
+ * `git checkout -b CNI-1799`;
22
+ * `jigit` will ask you for a new status for `CNI-1798`, which I suppose a kind of `To Do`,
23
+ and update status of `CNI-1799`;
24
+
25
+ And you can jump between branches as much as you want, but you will never ever have the wrong status for you JIRA issue :rocket.
26
+ You are 😀, a project manager is 😀 - the world becomes a bit better 🙌
27
+
28
+ ### Example
29
+
30
+ If you want to see `jigit` in action, here we are:
31
+
32
+ ![Alt text](https://monosnap.com/file/N55dJTlNbz3j3SP1KHBaO6gtwV20OM.png)
33
+
34
+ ### Installation
35
+
36
+ ```sh
37
+ $ [sudo] gem install jigit
38
+ ```
39
+
40
+ Or via bundler:
41
+
42
+ ```ruby
43
+ gem 'jigit', '~> 1.0'
44
+ ```
45
+
46
+ The `jigit` gem requires `ruby-2.2.3` and currently can be installed
47
+ only on `OS X` because of a tight couple to `OS X keychain`.
48
+
49
+ ### Getting started
50
+
51
+ The `jigit` configuration is guided by a friendly interviewer by the following command:
52
+
53
+ ```sh
54
+ $ bundle exec jigit init
55
+ ```
56
+
57
+ After that step, you're set 🚀
58
+
59
+ ### Limitation
60
+
61
+ Currently, `jigit` works only on `OS X`, requires `ruby-2.2.3`. Also, it's based on the git hooks
62
+ and therefore doesn't work with the source control UI app, but only with by using `git` in the command line.
63
+
64
+ ### License
65
+
66
+ This gem is available under the MIT license.