dep_upgrade 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa3439155a791a6b748918b619404d3573e1e2dd0f4cefc9632323ff93ec2866
4
- data.tar.gz: 3db0970d427ba42e5df945bf0cbdab080f655794d62352684d4c92acfbf02405
3
+ metadata.gz: e7097a4a3ff76a5c723ea01ba53e0437d65904e53392b261044525126e481e18
4
+ data.tar.gz: 75a3e741f8a653ddf70ce67e19ea42183aa1430bdca8ccdf3aaeb21f99d48a83
5
5
  SHA512:
6
- metadata.gz: 41d6a858afa878464a39bc478bd58ed411e43b6fce7cdbd158d703f810330df4db543948e3cfb43cd6beba78f01d4888edac6c5abb4b52c6b132ce680c0c5813
7
- data.tar.gz: 1f76dfd0514c68d6a9762113d3dcef20d6934a3c705e29be709b2e883c279991af57785805cbc7cf321387b37151ee3fdb5429edb104ff69fc6549ce29054e33
6
+ metadata.gz: ad6c8ddb7b123ef9501a9269aacf8c82236d400d5909f1533da5f3d16ac3a51007ba2aeb63b6081396f8a7a2bbd710f759a0f1693a20c8344623e070b4e48f80
7
+ data.tar.gz: f11c45ce9eb6e461b04b9eac84a58b10a01de4ba989d09873b227f30882bc2f221cbf235233fab3a08ec3ad4e0ca31ad45de71d07364f868b84d8281ebc19c59
data/CHANGELOG.md CHANGED
@@ -1,7 +1,12 @@
1
1
  # Change Log
2
- ## [0.1.0](https://github.com/blacktangent/dep_upgrade/tree/0.1.0)
2
+ ## [0.2.0](https://github.com/blacktangent/dep_upgrade/tree/0.2.0)
3
3
 
4
- [Full Changelog](https://github.com/blacktangent/dep_upgrade/compare/b8ca43cbe...0.1.0)
4
+ [Full Changelog](https://github.com/blacktangent/dep_upgrade/compare/v0.1.0...0.2.0)
5
+ * 2017-12-03 - Detect Gemfile, package.json and run commands accordingly [#4](https://github.com/blacktangent/dep_upgrade/pull/4)
6
+
7
+ ## [v0.1.0](https://github.com/blacktangent/dep_upgrade/tree/v0.1.0)
8
+
9
+ [Full Changelog](https://github.com/blacktangent/dep_upgrade/compare/b8ca43cbe...v0.1.0)
5
10
  * 2017-12-03 - Check in Gemfile.lock [#3](https://github.com/blacktangent/dep_upgrade/pull/3)
6
11
  * 2017-12-03 - Update gemspec info and readme [#2](https://github.com/blacktangent/dep_upgrade/pull/2)
7
12
  * 2017-12-03 - Add rake task dep:upgrade [#1](https://github.com/blacktangent/dep_upgrade/pull/1)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dep_upgrade (0.1.0)
4
+ dep_upgrade (0.2.0)
5
5
  bundler
6
6
  bundler-audit
7
7
  rake
data/dep_upgrade.gemspec CHANGED
@@ -10,9 +10,9 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["teohuiming@gmail.com"]
11
11
 
12
12
  spec.summary = %q{Keep your app dependencies up-to-date with rails dep:upgrade}
13
- spec.description = "`rails dep:upgrade` runs `bundle update`," \
14
- " `bundle audit`, `yarn upgrade` and generates a markdown-style summary" \
15
- " of what have changed that you can paste into a pull/merge request."
13
+ spec.description = "`rails dep:upgrade` runs `bundle update`, " \
14
+ "`bundle audit`, `yarn upgrade` to update your app dependencies, " \
15
+ "then generates a markdown summary for your pull/merge request."
16
16
  spec.homepage = "https://github.com/blacktangent/dep_upgrade"
17
17
  spec.license = "MIT"
18
18
 
@@ -9,6 +9,8 @@ module DepUpgrade
9
9
  :yarn_outdated_output
10
10
 
11
11
  def call
12
+ detect_dependency_files
13
+
12
14
  bundle_outdated
13
15
  yarn_outdated
14
16
 
@@ -20,39 +22,69 @@ module DepUpgrade
20
22
  print_summary
21
23
  end
22
24
 
25
+ def detect_dependency_files
26
+ puts "\n== Detect dependency config files =="
27
+ @_has_gemfile = File.exist?("Gemfile")
28
+ @_has_package_json = File.exist?("package.json")
29
+
30
+ puts "Gemfile#{ " not" unless has_gemfile? } found."
31
+ puts "package.json#{ " not" unless has_package_json? } found."
32
+ end
33
+
34
+ def has_gemfile?
35
+ @_has_gemfile
36
+ end
37
+
38
+ def has_package_json?
39
+ @_has_package_json
40
+ end
41
+
23
42
  def system!(*args)
24
43
  system(*args) || abort("\n== Command #{args} failed ==")
25
44
  end
26
45
 
27
46
  def bundle_outdated
47
+ return unless has_gemfile?
48
+
28
49
  puts "\n== Analyze outdated gems =="
29
50
  self.bundler_outdated_output = `bundle outdated --strict --parseable`
30
51
  puts "Done."
31
52
  end
32
53
 
33
54
  def yarn_outdated
55
+ return unless has_package_json?
56
+
34
57
  puts "\n== Analyze outdated yarn packages =="
35
- self.yarn_outdated_output = JSON.parse(`yarn outdated --json`.split("\n").last)
58
+ self.yarn_outdated_output = JSON
59
+ .parse(`yarn outdated --json`.split("\n").last)
36
60
  puts "Done."
37
61
  end
38
62
 
39
63
  def bundle_update
64
+ return unless has_gemfile?
65
+
40
66
  puts "\n== Update all gems =="
41
67
  system!("bundle update --all")
42
68
  end
43
69
 
44
70
  def bundle_audit_update
71
+ return unless has_gemfile?
72
+
45
73
  puts "\n== Update gems advisory database =="
46
74
  system!("bundle exec bundle audit update")
47
75
  end
48
76
 
49
77
  def bundle_audit
78
+ return unless has_gemfile?
79
+
50
80
  puts "\n== Audit all gems =="
51
81
  self.bundler_audit_output = `bundle exec bundle audit`.strip
52
82
  puts "Done."
53
83
  end
54
84
 
55
85
  def yarn_upgrade
86
+ return unless has_package_json?
87
+
56
88
  puts "\n== Update all yarn packages =="
57
89
  system!("yarn upgrade")
58
90
  end
@@ -70,6 +102,8 @@ module DepUpgrade
70
102
  end
71
103
 
72
104
  def print_bundle_update_summary
105
+ return unless has_gemfile?
106
+
73
107
  puts "\nbundle update:"
74
108
  self.bundler_outdated_output
75
109
  .split("\n")
@@ -90,6 +124,8 @@ module DepUpgrade
90
124
  end
91
125
 
92
126
  def print_yarn_upgrade_summary
127
+ return unless has_package_json?
128
+
93
129
  puts "\nyarn upgrade:"
94
130
  self.yarn_outdated_output["data"]["body"]
95
131
  .select { |package| package[1] != package[2] } # Current != Wanted
@@ -98,6 +134,8 @@ module DepUpgrade
98
134
  end
99
135
 
100
136
  def print_bundle_audit_summary
137
+ return unless has_gemfile?
138
+
101
139
  puts "\nbundle audit:"
102
140
  puts self.bundler_audit_output
103
141
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DepUpgrade
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dep_upgrade
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
  - Huiming Teo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-02 00:00:00.000000000 Z
11
+ date: 2017-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -109,8 +109,8 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  description: "`rails dep:upgrade` runs `bundle update`, `bundle audit`, `yarn upgrade`
112
- and generates a markdown-style summary of what have changed that you can paste into
113
- a pull/merge request."
112
+ to update your app dependencies, then generates a markdown summary for your pull/merge
113
+ request."
114
114
  email:
115
115
  - teohuiming@gmail.com
116
116
  executables: []