gem_check_updates 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0c947a224aae8d3c682bb9597f6f1f47b05a160e43b416d71b2bf0adb014a21
4
- data.tar.gz: e78aaa5f5e0772f74ce9c49f4ef0e391b1197e37245635a0fe6c096ae5cd0cef
3
+ metadata.gz: 30706586c049f5a9bfef5c1025e0632f75bf3bc802bdae6bd3053946fc46d3f2
4
+ data.tar.gz: 7625384f0f1ca312276741e20f3ce4973f6d9bba3780ef95f1e56bb44eb7b3cf
5
5
  SHA512:
6
- metadata.gz: 1f4e6d7b361f8250c3d464b26cab0b97f22e0112158f7b8cd9b8bd5df8a68d06bc761d9bb28eea55738a8be03788b67efdc7bd3f91eb00b1e2ca6095549386e9
7
- data.tar.gz: cf6a3236dc051a4dd051cd55c37ef22480ec3779663ee1d7c6b3b060775f9091851fc7acf1d226b0a80613b8f04122e5c8302d3104443bcced1a634a314246c2
6
+ metadata.gz: 76cf669e9666bcbaa483f80334cf96820732f5ffeaaf3dd64d09e60b1b7e3b398c8d4b2ef6b927c4f05d5bdf67f930be82696fa3f4f9298daf7d40a17acdbb95
7
+ data.tar.gz: 3b0a2ed7044394fd98e1b773b73d1823930e91ab4a3d278af4f80c0b93a10cdea6a34dd06f88a2e3ca243535d7167eebf7727ad17d0c74bbd9103a8abb34992e
data/.gitignore CHANGED
@@ -1,12 +1,106 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
1
+
2
+ # Created by https://www.gitignore.io/api/vim,ruby,macos
3
+
4
+ ### macOS ###
5
+ # General
6
+ .DS_Store
7
+ .AppleDouble
8
+ .LSOverride
9
+
10
+ # Icon must end with two \r
11
+ Icon
12
+
13
+ # Thumbnails
14
+ ._*
15
+
16
+ # Files that might appear in the root of a volume
17
+ .DocumentRevisions-V100
18
+ .fseventsd
19
+ .Spotlight-V100
20
+ .TemporaryItems
21
+ .Trashes
22
+ .VolumeIcon.icns
23
+ .com.apple.timemachine.donotpresent
24
+
25
+ # Directories potentially created on remote AFP share
26
+ .AppleDB
27
+ .AppleDesktop
28
+ Network Trash Folder
29
+ Temporary Items
30
+ .apdisk
31
+
32
+ ### Ruby ###
33
+ *.gem
34
+ *.rbc
35
+ /.config
4
36
  /coverage/
5
- /doc/
37
+ /InstalledFiles
6
38
  /pkg/
7
39
  /spec/reports/
40
+ /spec/examples.txt
41
+ /test/tmp/
42
+ /test/version_tmp/
8
43
  /tmp/
44
+
45
+ # Used by dotenv library to load environment variables.
46
+ # .env
47
+
48
+ ## Specific to RubyMotion:
49
+ .dat*
50
+ .repl_history
51
+ build/
52
+ *.bridgesupport
53
+ build-iPhoneOS/
54
+ build-iPhoneSimulator/
55
+
56
+ ## Specific to RubyMotion (use of CocoaPods):
57
+ #
58
+ # We recommend against adding the Pods directory to your .gitignore. However
59
+ # you should judge for yourself, the pros and cons are mentioned at:
60
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
61
+ #
62
+ # vendor/Pods/
63
+
64
+ ## Documentation cache and generated files:
65
+ /.yardoc/
66
+ /_yardoc/
67
+ /doc/
68
+ /rdoc/
69
+
70
+ ## Environment normalization:
71
+ /.bundle/
9
72
  /vendor/bundle
73
+ /lib/bundler/man/
74
+
75
+ # for a library or gem, you might want to ignore these files since the code is
76
+ # intended to run in multiple environments; otherwise, check them in:
77
+ # Gemfile.lock
78
+ # .ruby-version
79
+ # .ruby-gemset
80
+
81
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
82
+ .rvmrc
83
+
84
+ ### Vim ###
85
+ # Swap
86
+ [._]*.s[a-v][a-z]
87
+ [._]*.sw[a-p]
88
+ [._]s[a-rt-v][a-z]
89
+ [._]ss[a-gi-z]
90
+ [._]sw[a-p]
91
+
92
+ # Session
93
+ Session.vim
94
+
95
+ # Temporary
96
+ .netrwhist
97
+ *~
98
+ # Auto-generated tag files
99
+ tags
100
+ # Persistent undo
101
+ [._]*.un~
102
+
103
+
104
+ # End of https://www.gitignore.io/api/vim,ruby,macos
10
105
 
11
- # rspec failure tracking
12
- .rspec_status
106
+ .rspec_status
data/.rubocop.yml CHANGED
@@ -8,4 +8,8 @@ MethodLength:
8
8
  Enabled: false
9
9
  BlockLength:
10
10
  Enabled: false
11
+ Metrics/AbcSize:
12
+ Max: 30
13
+ Style/Documentation:
14
+ Enabled: no
11
15
 
data/.travis.yml CHANGED
@@ -2,8 +2,20 @@ sudo: false
2
2
  language: ruby
3
3
  cache: bundler
4
4
  rvm:
5
- - 2.5.1
5
+ - 2.5.1
6
+ env:
7
+ global:
8
+ - CC_TEST_REPORTER_ID=bd103456b9581249a1b35fcee59e86b542bdd3babdd6e85181a1faefcd01d23f
6
9
  before_install: gem install bundler -v 1.16.3
10
+ before_script:
11
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
12
+ - chmod +x ./cc-test-reporter
13
+ - ./cc-test-reporter before-build
14
+ script:
15
+ - bundle exec rake spec
16
+ - bundle exec rubocop --fail-level=W
17
+ after_script:
18
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
7
19
  deploy:
8
20
  provider: rubygems
9
21
  api_key:
@@ -13,12 +25,8 @@ deploy:
13
25
  branch: master
14
26
  tags: true
15
27
  repo: mukopikmin/gem_check_updates
16
- addons:
17
- code_climate:
18
- repo_token: bd103456b9581249a1b35fcee59e86b542bdd3babdd6e85181a1faefcd01d23f
19
- after_success:
20
- - bundle exec codeclimate-test-reporter
21
28
  notifications:
22
29
  email: false
23
30
  slack:
24
31
  secure: cWL+X3N1obm/mk3PsuH2JdahiVUEFuqn/k+FvWCK1awpWIJj9YFpJjDBN5BWr62SW3X0EMzxA7xvl8SLvaF9VgcCfMTxGCHK+nKXUvH6Hzs0g/HzJM1vDouRNpOGPIz3i4y4caGnmR1S/R5E6ed5w3htIf1mBCf1KaLpV2l3Dfjcov9iGEu5BFWgu8L0Y2kcxFrZZNmNR6ZDffrN3odY3etZzHgxJok9Z4wV8sivcgvncClfSSSKMTBL594h5QMC8ozwv+Aw5z5wG2OloKSw2FFrJshjkgQAxcf+b4I9YuMFQnzLNje0wHp/4YOtNvECmeEa3eemQaEo6aMTSpmsvrmm6BKjJhPQcPo0AQWMpQBQqezXRzF7j3aEwiAq1S3xnqm7a4iydwBk7Qn6VaqCsGgDrh/4qs+Q0slMPVxeTpUB4vZnJ1Gjk8QTHqguPY8K5PjKhsik2+Om5byc9/GqGp2N/s0nym8jBfCFWUVuti9j2ACq+uqMyqPxbsTqnVPYyU7kTFiTCi1VfM99fwkOiMRN4wD/KbtGB7ZmcU+svmgT7gtES8QZlTg5MnSyo1Z2sK1UJdzP8F6JKSAIosqZuw+lY5hsS/eY+pVkdwGKLNI3tE4Zrg9rNFPmfVS0iCVtHkydVckYphWtZ+XkYY6JLQWzXTPdRlIcvWlESyNySAQ=
32
+
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gem_check_updates (0.1.0)
4
+ gem_check_updates (0.2.0)
5
5
  colored (~> 1.2)
6
6
  rest-client (~> 2.0)
7
7
 
@@ -10,6 +10,7 @@ GEM
10
10
  specs:
11
11
  addressable (2.5.2)
12
12
  public_suffix (>= 2.0.2, < 4.0)
13
+ ast (2.4.0)
13
14
  codeclimate-test-reporter (1.0.8)
14
15
  simplecov (<= 0.13)
15
16
  colored (1.2)
@@ -22,13 +23,19 @@ GEM
22
23
  hashdiff (0.3.7)
23
24
  http-cookie (1.0.3)
24
25
  domain_name (~> 0.5)
26
+ jaro_winkler (1.5.1)
25
27
  json (2.1.0)
26
28
  mime-types (3.2.2)
27
29
  mime-types-data (~> 3.2015)
28
30
  mime-types-data (3.2018.0812)
29
31
  netrc (0.11.0)
32
+ parallel (1.12.1)
33
+ parser (2.5.1.2)
34
+ ast (~> 2.4.0)
35
+ powerpack (0.1.2)
30
36
  public_suffix (3.0.3)
31
- rake (10.5.0)
37
+ rainbow (3.0.0)
38
+ rake (12.3.1)
32
39
  rest-client (2.0.2)
33
40
  http-cookie (>= 1.0.2, < 2.0)
34
41
  mime-types (>= 1.16, < 4.0)
@@ -46,6 +53,15 @@ GEM
46
53
  diff-lcs (>= 1.2.0, < 2.0)
47
54
  rspec-support (~> 3.8.0)
48
55
  rspec-support (3.8.0)
56
+ rubocop (0.59.1)
57
+ jaro_winkler (~> 1.5.1)
58
+ parallel (~> 1.10)
59
+ parser (>= 2.5, != 2.5.1.1)
60
+ powerpack (~> 0.1)
61
+ rainbow (>= 2.2.2, < 4.0)
62
+ ruby-progressbar (~> 1.7)
63
+ unicode-display_width (~> 1.0, >= 1.0.1)
64
+ ruby-progressbar (1.10.0)
49
65
  safe_yaml (1.0.4)
50
66
  simplecov (0.13.0)
51
67
  docile (~> 1.1.0)
@@ -55,6 +71,7 @@ GEM
55
71
  unf (0.1.4)
56
72
  unf_ext
57
73
  unf_ext (0.0.7.5)
74
+ unicode-display_width (1.4.0)
58
75
  webmock (3.4.2)
59
76
  addressable (>= 2.3.6)
60
77
  crack (>= 0.3.2)
@@ -64,12 +81,13 @@ PLATFORMS
64
81
  ruby
65
82
 
66
83
  DEPENDENCIES
67
- bundler (~> 1.16)
68
- codeclimate-test-reporter (~> 1.0)
84
+ bundler (~> 1.16.5)
85
+ codeclimate-test-reporter (~> 1.0.8)
69
86
  gem_check_updates!
70
- rake (~> 10.0)
71
- rspec (~> 3.0)
72
- webmock (~> 3.4)
87
+ rake (~> 12.3.1)
88
+ rspec (~> 3.8.0)
89
+ rubocop (~> 0.59.1)
90
+ webmock (~> 3.4.2)
73
91
 
74
92
  BUNDLED WITH
75
- 1.16.3
93
+ 1.16.5
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/README.md CHANGED
@@ -16,12 +16,54 @@ This gem is inspired by [tjunnone/npm-check-updates](https://github.com/tjunnone
16
16
 
17
17
  See references with option `-h` or `--help`.
18
18
 
19
- $ gem-check-updates
19
+ $ gem-check-updates -h
20
+
21
+ Usage: run [options]
22
+ -f, --file Gemfile Path to Gemfile (default: ./Gemfile)
23
+ -a, --apply Apply updates (default: false)
24
+ --major Update major version (default: true)
25
+ --minor Update minor version (default: false)
26
+ --patch Update patch version (default: false)
27
+ -i, --include-beta Check updates of beta release, including alpha or release candidate (Default: false)
20
28
 
21
29
  Also you can run command as follows.
22
30
 
23
31
  $ gcu
24
32
 
33
+ ### Examples
34
+
35
+ Check updates for the specified Gemfile in current working directory.
36
+
37
+ $ gcm -f path/to/Gemfile
38
+
39
+ ....
40
+
41
+ Checking major updates are completed.
42
+
43
+ You can update following newer gems.
44
+ If you want to apply these updates, run command with option --apply.
45
+ Running with --apply option will overwrite your Gemfile.
46
+
47
+ rails "~> 5.1.0" → "~> 5.2.1"
48
+ puma "~> 3.10" → "~> 3.9.1"
49
+ byebug "~> 10.0.0" → "~> 9.1.0"
50
+ rspec-rails "~> 3.7.2" → "~> 3.8.0"
51
+
52
+ Check and overwrite existing Gemfile.
53
+
54
+ $ gcm -f path/to/Gemfile --apply
55
+
56
+ ....
57
+
58
+ Checking major updates are completed.
59
+
60
+ Following gems have been updated!
61
+
62
+ rails "~> 5.1.0" → "~> 5.2.1"
63
+ puma "~> 3.10" → "~> 3.9.1"
64
+ byebug "~> 10.0.0" → "~> 9.1.0"
65
+ rspec-rails "~> 3.7.2" → "~> 3.8.0"
66
+
25
67
  ## Development
26
68
 
27
69
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
data/Rakefile CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
  require 'bundler/gem_tasks'
4
4
  require 'rspec/core/rake_task'
5
+ require 'rubocop/rake_task'
5
6
 
6
7
  RSpec::Core::RakeTask.new(:spec)
8
+ RuboCop::RakeTask.new
9
+
10
+ Dir['tasks/**/*.rake'].each { |t| load t }
7
11
 
8
12
  task default: :spec
@@ -24,11 +24,12 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ['lib']
26
26
 
27
- spec.add_development_dependency 'bundler', '~> 1.16'
28
- spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0'
29
- spec.add_development_dependency 'rake', '~> 10.0'
30
- spec.add_development_dependency 'rspec', '~> 3.0'
31
- spec.add_development_dependency 'webmock', '~> 3.4'
27
+ spec.add_development_dependency 'bundler', '~> 1.16.5'
28
+ spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0.8'
29
+ spec.add_development_dependency 'rake', '~> 12.3.1'
30
+ spec.add_development_dependency 'rspec', '~> 3.8.0'
31
+ spec.add_development_dependency 'rubocop', '~> 0.59.1'
32
+ spec.add_development_dependency 'webmock', '~> 3.4.2'
32
33
 
33
34
  spec.add_dependency 'colored', '~> 1.2'
34
35
  spec.add_dependency 'rest-client', '~> 2.0'
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GemCheckUpdates
4
- RUBYGEMS_API = 'https://rubygems.org/api/v1/versions'
5
-
6
4
  class Gem
5
+ RUBYGEMS_API = 'https://rubygems.org/api/v1/versions'
6
+
7
7
  attr_reader :name,
8
8
  :latest_version,
9
9
  :current_version,
@@ -16,6 +16,7 @@ module GemCheckUpdates
16
16
  @name = name
17
17
  @current_version = current_version
18
18
  @version_range = version_range
19
+ @latest_version = nil
19
20
 
20
21
  check_update!(update_scope)
21
22
  end
@@ -35,27 +36,40 @@ module GemCheckUpdates
35
36
 
36
37
  self
37
38
  rescue StandardError => e
38
- @latest_version = nil
39
-
40
39
  GemCheckUpdates::Message.out("Failed to check version \"#{@name}\".".red)
40
+ GemCheckUpdates::Message.out("\n\n")
41
+ GemCheckUpdates::Message.out(e.message.red)
41
42
  end
42
43
 
43
44
  def scoped_latest_version(versions, scope)
45
+ # Ignore pre release version (ex. beta, rc), and sort desc
44
46
  numbers = versions.map { |v| v['number'] }
47
+ .select { |v| v.split('.').size < 4 }
48
+ .sort_by { |v| v.split('.').map(&:to_i)[0, 3] }
49
+ .reverse
45
50
  current_major, current_minor = @current_version.split('.')
46
51
 
47
52
  case scope
48
53
  when GemCheckUpdates::VersionScope::MINOR
49
- numbers.select { |n| n.split('.').first == current_major }.max
54
+ numbers.select { |n| n.split('.').first == current_major }.first
50
55
  when GemCheckUpdates::VersionScope::PATCH
51
56
  numbers.select do |n|
52
57
  major, minor = n.split('.')
53
58
  major == current_major && minor == current_minor
54
- end.max
59
+ end.first
55
60
  else
56
61
  # This branch is equal to specifying major updates
57
- numbers.max
62
+ numbers.first
58
63
  end
59
64
  end
65
+
66
+ def highlighted_latest_version
67
+ Array.new(3) do |i|
68
+ c = @current_version.split('.')[i]
69
+ l = @latest_version.split('.')[i]
70
+
71
+ c == l ? l : l.green
72
+ end.join('.')
73
+ end
60
74
  end
61
75
  end
@@ -2,20 +2,20 @@
2
2
 
3
3
  module GemCheckUpdates
4
4
  class Gemfile
5
- attr_reader :file, :file_backup, :gems
5
+ attr_reader :option, :file_backup, :gems
6
6
 
7
- def initialize(file, update_scope)
8
- @file = file
9
- @file_backup = "#{@file}.backup"
10
- @gems = parse(update_scope)
7
+ def initialize(option = GemCheckUpdates::Option.new)
8
+ @option = option
9
+ @file_backup = "#{option.file}.backup"
10
+ @gems = parse(option.update_scope)
11
11
  end
12
12
 
13
13
  def backup
14
- FileUtils.cp(@file, @file_backup)
14
+ FileUtils.cp(@option.file, @file_backup)
15
15
  end
16
16
 
17
17
  def restore
18
- FileUtils.mv(@file_backup, @file)
18
+ FileUtils.mv(@file_backup, @option.file)
19
19
  end
20
20
 
21
21
  def remove_backup
@@ -23,7 +23,7 @@ module GemCheckUpdates
23
23
  end
24
24
 
25
25
  def parse(update_scope)
26
- gems = Bundler::Definition.build(@file, nil, nil).dependencies.map do |gem|
26
+ gems = Bundler::Definition.build(@option.file, nil, nil).dependencies.map do |gem|
27
27
  GemCheckUpdates::Message.out('.')
28
28
 
29
29
  name = gem.name
@@ -42,15 +42,17 @@ module GemCheckUpdates
42
42
 
43
43
  def update
44
44
  gemfile_lines = []
45
- File.open(@file) do |current|
45
+ File.open(@option.file) do |current|
46
46
  current.each_line do |line|
47
47
  gemfile_lines << line
48
48
  end
49
49
  end
50
50
 
51
- File.open(@file, 'w') do |updated|
51
+ File.open(@option.file, 'w') do |updated|
52
52
  gemfile_lines.each do |line|
53
- if matcher = line.match(/gem ['"](.+?)['"]\s*,\s*['"][>=|~>]*\s+(.+?)['"]/)
53
+ matcher = line.match(/gem ['"](.+?)['"]\s*,\s*['"][>=|~>]*\s+(.+?)['"]/)
54
+
55
+ if matcher
54
56
  _, name, old_version = *matcher
55
57
  target = @gems.find { |gem| gem.name == name }
56
58
 
@@ -8,36 +8,47 @@ module GemCheckUpdates
8
8
  print str
9
9
  end
10
10
 
11
- def self.updatable_gems(gemfile, scope)
12
- out <<~VERSIONS
13
- Checking #{scope.green} updates are completed.
11
+ def self.updatable_gems(gemfile)
12
+ out <<~MSG
13
+ Checking #{gemfile.option.update_scope.green} updates are completed.
14
14
 
15
15
  You can update following newer gems.
16
- If you want to apply these updates, run command with option \'-a\'.
17
- #{'(Caution: This option will overwrite your Gemfile)'.red}
16
+ If you want to apply these updates, run command with option #{'--apply'.green}.
17
+
18
+ #{'Running with --apply option will overwrite your Gemfile.'.red}
18
19
 
19
20
  #{gems_version_diff(gemfile)}
20
21
 
21
22
 
22
- VERSIONS
23
+ MSG
23
24
  end
24
25
 
25
- def self.update_completed(gemfile, scope)
26
- out <<~VERSIONS
27
- Checking #{scope.green} updates are completed.
26
+ def self.update_completed(gemfile)
27
+ out <<~MSG
28
+ Checking #{gemfile.option.update_scope.green} updates are completed.
28
29
 
29
30
  Following gems have been updated!
30
31
 
31
32
  #{gems_version_diff(gemfile)}
32
33
 
33
34
 
34
- VERSIONS
35
+ MSG
35
36
  end
36
37
 
37
38
  def self.gems_version_diff(gemfile)
38
- gemfile.gems
39
- .select(&:update_available?)
40
- .map { |gem| " #{gem.name} \"#{gem.version_range} #{gem.current_version}\" → \"#{gem.version_range} #{gem.latest_version.green}\"" }.join("\n")
39
+ updatable_gems = gemfile.gems.select(&:update_available?)
40
+
41
+ if updatable_gems.empty?
42
+ 'There are no updates.'.green
43
+ else
44
+ updatable_gems.map do |gem|
45
+ name = gem.name
46
+ current = "#{gem.version_range} #{gem.current_version}"
47
+ latest = "#{gem.version_range} #{gem.highlighted_latest_version}"
48
+
49
+ " #{name.ljust(30)} #{current.ljust(15)} #{'→'.ljust(7)} #{latest}"
50
+ end.join("\n")
51
+ end
41
52
  end
42
53
  end
43
54
  end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GemCheckUpdates
4
+ class Option
5
+ attr_reader :apply
6
+ attr_accessor :file, :major, :minor, :patch
7
+
8
+ def initialize(file: './Gemfile')
9
+ @file = file
10
+ @apply = false
11
+ @major = true
12
+ @minor = false
13
+ @patch = false
14
+ end
15
+
16
+ def self.parse(argv)
17
+ option = new
18
+
19
+ OptionParser.new do |opt|
20
+ opt.version = GemCheckUpdates::VERSION
21
+
22
+ opt.on('-f Gemfile', '--file', "Path to Gemfile (default: #{option.file})") { |v| option.file = v }
23
+ opt.on('-a', '--apply', "Apply updates (default: #{option.apply})") { |v| option.apply = v }
24
+ opt.on('--major', "Update major version (default: #{option.major})") do |v|
25
+ option.major = v
26
+ option.minor = !v
27
+ option.patch = !v
28
+ end
29
+ opt.on('--minor', "Update minor version (default: #{option.minor})") do |v|
30
+ option.major = !v
31
+ option.minor = v
32
+ option.patch = !v
33
+ end
34
+ opt.on('--patch', "Update patch version (default: #{option.patch})") do |v|
35
+ option.major = !v
36
+ option.minor = !v
37
+ option.patch = v
38
+ end
39
+
40
+ opt.parse!(argv)
41
+ end
42
+
43
+ option
44
+ end
45
+
46
+ def update_scope
47
+ if !@major && @minor
48
+ GemCheckUpdates::VersionScope::MINOR
49
+ elsif !@major && !@minor && @patch
50
+ GemCheckUpdates::VersionScope::PATCH
51
+ else
52
+ GemCheckUpdates::VersionScope::MAJOR
53
+ end
54
+ end
55
+ end
56
+ end
@@ -3,72 +3,23 @@
3
3
  module GemCheckUpdates
4
4
  class Runner
5
5
  def self.run(argv)
6
- options = parse_options(argv)
7
- scope = update_scope(options)
8
- gemfile = Gemfile.new(options[:file], scope)
6
+ option = Option.parse(argv)
7
+ gemfile = Gemfile.new(option)
9
8
 
10
- if options[:apply]
9
+ if option.apply
11
10
  begin
12
11
  gemfile.backup
13
12
  gemfile.update
14
13
  gemfile.remove_backup
15
14
 
16
- GemCheckUpdates::Message.update_completed(gemfile, scope)
15
+ GemCheckUpdates::Message.update_completed(gemfile)
17
16
  rescue StandardError => e
18
17
  gemfile.restore
19
18
 
20
- print e.message.red
19
+ GemCheckUpdates::Message.out(e.message.red)
21
20
  end
22
21
  else
23
- GemCheckUpdates::Message.updatable_gems(gemfile, scope)
24
- end
25
- end
26
-
27
- def self.parse_options(argv)
28
- options = {
29
- file: './Gemfile',
30
- apply: false,
31
- major: true,
32
- minor: true,
33
- patch: true
34
- # keep_backup: false,
35
- # verbose: false
36
- }
37
-
38
- OptionParser.new do |opt|
39
- opt.version = GemCheckUpdates::VERSION
40
-
41
- opt.on('-f Gemfile', '--file', "Path to Gemfile (default: #{options[:file]})") { |v| options[:file] = v }
42
- opt.on('-a', '--apply', "Apply updates (default: #{options[:apply]})") { |v| options[:apply] = v }
43
- opt.on('--major', "Update major version (default: #{options[:major]})") do |v|
44
- options[:major] = v
45
- options[:minor] = !v
46
- options[:patch] = !v
47
- end
48
- opt.on('--minor', "Update minor version (default: #{options[:minor]})") do |v|
49
- options[:major] = !v
50
- options[:minor] = v
51
- options[:patch] = !v
52
- end
53
- opt.on('--patch', "Update patch version (default: #{options[:patch]})") do |v|
54
- options[:major] = !v
55
- options[:minor] = !v
56
- options[:patch] = v
57
- end
58
-
59
- opt.parse!(argv)
60
- end
61
-
62
- options
63
- end
64
-
65
- def self.update_scope(options)
66
- if !options[:major] && options[:minor]
67
- GemCheckUpdates::VersionScope::MINOR
68
- elsif !options[:major] && !options[:minor] && options[:patch]
69
- GemCheckUpdates::VersionScope::PATCH
70
- else
71
- GemCheckUpdates::VersionScope::MAJOR
22
+ GemCheckUpdates::Message.updatable_gems(gemfile)
72
23
  end
73
24
  end
74
25
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GemCheckUpdates
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
@@ -9,6 +9,7 @@ require 'json'
9
9
 
10
10
  require 'gem_check_updates/version'
11
11
  require 'gem_check_updates/version_scope'
12
+ require 'gem_check_updates/option'
12
13
  require 'gem_check_updates/message'
13
14
  require 'gem_check_updates/gemfile'
14
15
  require 'gem_check_updates/gem'
data/tasks/gcu.rake ADDED
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'gem_check_updates'
4
+
5
+ desc 'Check new versions of rubygems'
6
+ task :gcu do
7
+ GemCheckUpdates::Runner.run([])
8
+ end
9
+
10
+ namespace :gcu do
11
+ desc 'Check major updates of rubygems'
12
+ task :major do
13
+ GemCheckUpdates::Runner.run(['--major'])
14
+ end
15
+
16
+ namespace :major do
17
+ desc 'Check major updates of rubygems, and apply to Gemfile'
18
+ task :apply do
19
+ argv = [
20
+ '--major',
21
+ '--apply'
22
+ ]
23
+ GemCheckUpdates::Runner.run(argv)
24
+ end
25
+ end
26
+
27
+ desc 'Check minor updates of rubygems'
28
+ task :minor do
29
+ GemCheckUpdates::Runner.run(['--minor'])
30
+ end
31
+
32
+ namespace :minor do
33
+ desc 'Check minor updates of rubygems, and apply to Gemfile'
34
+ task :apply do
35
+ argv = [
36
+ '--minor',
37
+ '--apply'
38
+ ]
39
+ GemCheckUpdates::Runner.run(argv)
40
+ end
41
+ end
42
+
43
+ desc 'Check patch updates of rubygems'
44
+ task :patch do
45
+ GemCheckUpdates::Runner.run(['--patch'])
46
+ end
47
+
48
+ namespace :patch do
49
+ desc 'Check patch updates of rubygems, and apply to Gemfile'
50
+ task :apply do
51
+ argv = [
52
+ '--patch',
53
+ '--apply'
54
+ ]
55
+ GemCheckUpdates::Runner.run(argv)
56
+ end
57
+ end
58
+ end
59
+
60
+ desc 'Check major updates of rubygems, and apply to Gemfile'
61
+ task 'gcu:apply': 'gcu:major:apply'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem_check_updates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke Mukai
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-16 00:00:00.000000000 Z
11
+ date: 2018-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,70 +16,84 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: 1.16.5
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: 1.16.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: codeclimate-test-reporter
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.0'
33
+ version: 1.0.8
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.0'
40
+ version: 1.0.8
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: 12.3.1
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
- version: '10.0'
54
+ version: 12.3.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.0'
61
+ version: 3.8.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
- version: '3.0'
68
+ version: 3.8.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.59.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.59.1
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: webmock
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '3.4'
89
+ version: 3.4.2
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '3.4'
96
+ version: 3.4.2
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: colored
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -123,6 +137,7 @@ files:
123
137
  - ".travis.yml"
124
138
  - Gemfile
125
139
  - Gemfile.lock
140
+ - LICENSE
126
141
  - README.md
127
142
  - Rakefile
128
143
  - bin/console
@@ -130,16 +145,15 @@ files:
130
145
  - exe/gcu
131
146
  - exe/gem-check-updates
132
147
  - gem_check_updates.gemspec
133
- - lib/.DS_Store
134
148
  - lib/gem_check_updates.rb
135
- - lib/gem_check_updates/.DS_Store
136
149
  - lib/gem_check_updates/gem.rb
137
150
  - lib/gem_check_updates/gemfile.rb
138
151
  - lib/gem_check_updates/message.rb
152
+ - lib/gem_check_updates/option.rb
139
153
  - lib/gem_check_updates/runner.rb
140
154
  - lib/gem_check_updates/version.rb
141
155
  - lib/gem_check_updates/version_scope.rb
142
- - run.rb
156
+ - tasks/gcu.rake
143
157
  homepage: https://github.com/mukopikmin/gem_check_updates
144
158
  licenses:
145
159
  - MIT
data/lib/.DS_Store DELETED
Binary file
Binary file
data/run.rb DELETED
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require './lib/gem_check_updates'
4
-
5
- GemCheckUpdates::Runner.run(ARGV)