anticuado 0.2.14 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -12
- data/lib/anticuado/base.rb +9 -25
- data/lib/anticuado/elixir/hex.rb +11 -11
- data/lib/anticuado/ios/carthage.rb +11 -10
- data/lib/anticuado/ios/cocoapods.rb +41 -17
- data/lib/anticuado/java/gradle.rb +12 -10
- data/lib/anticuado/javascript/npm.rb +18 -11
- data/lib/anticuado/javascript/yarn.rb +18 -11
- data/lib/anticuado/ruby/bundler.rb +19 -12
- data/lib/anticuado/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94937328011c841e4d73a586e4d95ac5ac8aae15
|
4
|
+
data.tar.gz: 2906547a86e69147f5d7e229da97054989f30de4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94c7e5595012ef8b6efcbee5dc629d012a7bc61954b7087d548dfd9133148f395d8b0635b6d93ada0ae35983d0f56878eb064ca5623cc136ab0c74b729c5c66d
|
7
|
+
data.tar.gz: 002ab59f1d2d80e74c72789225f3e8f42a643a02ba0ea359a9236b2ce714e74200f89db8117152186f351609e32db9190e96c4ca88615d19ed554abb4070c0eb
|
data/README.md
CHANGED
@@ -64,8 +64,9 @@ This library's results are like the following format:
|
|
64
64
|
```ruby
|
65
65
|
require "anticuado"
|
66
66
|
|
67
|
-
|
68
|
-
|
67
|
+
cocoadpos = ::Anticuado::IOS::CocoaPods.new "path/to/project"
|
68
|
+
outdated = cocoadpos.outdated
|
69
|
+
cocoadpos.format outdated
|
69
70
|
```
|
70
71
|
|
71
72
|
#### Carthage
|
@@ -75,8 +76,9 @@ outdated = ::Anticuado::IOS::CocoaPods.outdated "path/to/project"
|
|
75
76
|
```ruby
|
76
77
|
require "anticuado"
|
77
78
|
|
78
|
-
|
79
|
-
|
79
|
+
carthage = ::Anticuado::IOS::Carthage.new "path/to/project"
|
80
|
+
outdated = carthage.outdated
|
81
|
+
carthage.format outdated
|
80
82
|
```
|
81
83
|
|
82
84
|
### Android
|
@@ -91,9 +93,10 @@ https://github.com/ben-manes/gradle-versions-plugin
|
|
91
93
|
```ruby
|
92
94
|
require "anticuado"
|
93
95
|
|
94
|
-
::Anticuado::Java::Gradle.
|
95
|
-
outdated
|
96
|
-
|
96
|
+
gradle = ::Anticuado::Java::Gradle.new "path/to/project"
|
97
|
+
gradle.outdated # Writes the result to "build/dependencyUpdates" by defaylt
|
98
|
+
outdated = gradle.parse_json "build/dependencyUpdates"
|
99
|
+
gradle.format outdated
|
97
100
|
```
|
98
101
|
|
99
102
|
### Elixir
|
@@ -104,8 +107,9 @@ outdated = ::Anticuado::Java::Gradle.parse_json "build/dependencyUpdates"
|
|
104
107
|
```ruby
|
105
108
|
require "anticuado"
|
106
109
|
|
107
|
-
|
108
|
-
|
110
|
+
hex = ::Anticuado::Elixir::Hex.new "path/to/project"
|
111
|
+
outdated = hex.outdated
|
112
|
+
hex.format outdated
|
109
113
|
```
|
110
114
|
|
111
115
|
### Ruby
|
@@ -116,8 +120,9 @@ outdated = ::Anticuado::Elixir::Hex.outdated "path/to/project"
|
|
116
120
|
```ruby
|
117
121
|
require "anticuado"
|
118
122
|
|
119
|
-
|
120
|
-
|
123
|
+
bundler = ::Anticuado::Ruby::Bundler.new "path/to/project"
|
124
|
+
outdated = bundler.outdated
|
125
|
+
bundler.format outdated
|
121
126
|
```
|
122
127
|
|
123
128
|
## In advance
|
@@ -125,7 +130,7 @@ outdated = ::Anticuado::Ruby::Bundler.outdated "path/to/project"
|
|
125
130
|
|
126
131
|
## Contributing
|
127
132
|
|
128
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
133
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Kazu_cocoa/anticuado. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
129
134
|
|
130
135
|
|
131
136
|
## License
|
data/lib/anticuado/base.rb
CHANGED
@@ -1,35 +1,19 @@
|
|
1
1
|
module Anticuado
|
2
2
|
class Base
|
3
|
-
|
4
|
-
raise NotImplementedError
|
5
|
-
end
|
3
|
+
attr_reader :project_dir, :outdated_libraries, :formatted_outdated_libraries
|
6
4
|
|
7
|
-
def
|
8
|
-
|
5
|
+
def initialize(project_dir = nil)
|
6
|
+
@project_dir = project_dir
|
7
|
+
@outdated_libraries = ''
|
8
|
+
@formatted_outdated_libraries = []
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
def self.update_with_prefix(pod_file_in:, pod_file_out: nil, libraries:, prefix:)
|
14
|
-
pod_file_out = pod_file_in if pod_file_out.nil?
|
15
|
-
current_pod = File.read(pod_file_in)
|
16
|
-
|
17
|
-
result = current_pod.each_line.reduce("") do |memo, line|
|
18
|
-
memo << if line.strip.start_with?(prefix)
|
19
|
-
key = get_key libraries, line
|
20
|
-
key.nil? ? line : line.sub(/[0-9|.]+/, libraries[key])
|
21
|
-
else
|
22
|
-
line
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
File.write(pod_file_out, result)
|
27
|
-
result
|
11
|
+
def outdated(_project)
|
12
|
+
raise NotImplementedError
|
28
13
|
end
|
29
14
|
|
30
|
-
def
|
31
|
-
|
32
|
-
nil
|
15
|
+
def format(_outdated)
|
16
|
+
raise NotImplementedError
|
33
17
|
end
|
34
18
|
end
|
35
19
|
end
|
data/lib/anticuado/elixir/hex.rb
CHANGED
@@ -1,34 +1,34 @@
|
|
1
1
|
module Anticuado
|
2
2
|
module Elixir
|
3
3
|
class Hex < Anticuado::Base
|
4
|
-
# @param [String] project Path to project directory.
|
5
4
|
# @return [String] The result of command `mix hex.outdated`.
|
6
|
-
def
|
5
|
+
def outdated
|
7
6
|
return puts "have no mix command" if `which mix`.empty?
|
8
7
|
`mix local.hex --force`
|
9
8
|
|
10
|
-
if
|
9
|
+
if @project_dir
|
11
10
|
current_dir = Anticuado.current_dir
|
12
|
-
Dir.chdir Anticuado.project_dir(
|
13
|
-
|
11
|
+
Dir.chdir Anticuado.project_dir(@project_dir)
|
12
|
+
@outdated_libraries = `mix hex.outdated`
|
14
13
|
Dir.chdir current_dir
|
15
14
|
else
|
16
|
-
|
15
|
+
@outdated_libraries = `mix hex.outdated`
|
17
16
|
end
|
18
|
-
|
19
|
-
outdated_str
|
17
|
+
@outdated_libraries
|
20
18
|
end
|
21
19
|
|
22
20
|
# @param [String] outdated The result of command `mix hex.outdated`
|
23
21
|
# @return [Array] Array include outdated data.
|
24
22
|
# If target project have no outdated data, then return blank array such as `[]`
|
25
|
-
def
|
26
|
-
|
23
|
+
def format(outdated = nil)
|
24
|
+
@outdated_libraries = outdated unless outdated.nil?
|
25
|
+
|
26
|
+
array = @outdated_libraries.split(/\R/).map(&:strip)
|
27
27
|
index = array.find_index { |line| line.scan(/\ADependency\s+Current\s+/) != [] }
|
28
28
|
|
29
29
|
return [] if index.nil?
|
30
30
|
|
31
|
-
array[index + 1..array.size].reduce([]) do |acc, library|
|
31
|
+
@formatted_outdated_libraries = array[index + 1..array.size].reduce([]) do |acc, library|
|
32
32
|
break acc if library.empty?
|
33
33
|
|
34
34
|
array_lib = library.split(/\s+/)
|
@@ -1,28 +1,29 @@
|
|
1
1
|
module Anticuado
|
2
2
|
module IOS
|
3
3
|
class Carthage < Anticuado::Base
|
4
|
-
# @param [String] project Path to project directory.
|
5
4
|
# @return [String] The result of command `carthage outdated`.
|
6
|
-
def
|
5
|
+
def outdated
|
7
6
|
return puts "have no carthage command" if `which carthage`.empty?
|
8
7
|
|
9
|
-
if
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
@outdated_libraries = if @project_dir
|
9
|
+
`carthage outdated --project-directory #{@project_dir}`
|
10
|
+
else
|
11
|
+
`carthage outdated`
|
12
|
+
end
|
14
13
|
end
|
15
14
|
|
16
15
|
# @param [String] outdated The result of command `carthage outdated`
|
17
16
|
# @return [Array] Array include outdated data.
|
18
17
|
# If target project have no outdated data, then return blank array such as `[]`
|
19
|
-
def
|
20
|
-
|
18
|
+
def format(outdated = nil)
|
19
|
+
@outdated_libraries = outdated unless outdated.nil?
|
20
|
+
|
21
|
+
array = @outdated_libraries.split(/\R/).map(&:strip)
|
21
22
|
index = array.find_index("The following dependencies are outdated:")
|
22
23
|
|
23
24
|
return [] if index.nil?
|
24
25
|
|
25
|
-
array[index + 1..array.size].map do |library|
|
26
|
+
@formatted_outdated_libraries = array[index + 1..array.size].map do |library|
|
26
27
|
versions = library.split(/[\s|"]/)
|
27
28
|
if versions[8] =~ /Latest/
|
28
29
|
# e.g. ["RxSwift", "", "4.1.0", "", "->", "", "4.1.2", "", "(Latest:", "", "4.1.2", ")"]
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Anticuado
|
2
2
|
module IOS
|
3
3
|
class CocoaPods < Anticuado::Base
|
4
|
-
# @param [String]
|
4
|
+
# @param [String] library: Name of library.
|
5
5
|
# @return [String] The result of command `pod outdated`.
|
6
|
-
def
|
6
|
+
def update_lock(library: nil)
|
7
7
|
return puts "have no pod command" if `which pod`.empty?
|
8
8
|
|
9
9
|
if library
|
@@ -13,31 +13,31 @@ module Anticuado
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
# @param [String] project Path to project directory.
|
17
16
|
# @return [String] The result of command `pod outdated`.
|
18
|
-
def
|
17
|
+
def outdated
|
19
18
|
return puts "have no pod command" if `which pod`.empty?
|
20
19
|
|
21
|
-
if
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
20
|
+
@outdated_libraries = if @project_dir
|
21
|
+
`pod install --project-directory=#{@project_dir}`
|
22
|
+
`pod outdated --project-directory=#{@project_dir}`
|
23
|
+
else
|
24
|
+
`pod install`
|
25
|
+
`pod outdated`
|
26
|
+
end
|
29
27
|
end
|
30
28
|
|
31
29
|
# @param [String] outdated The result of command `pod outdated`
|
32
30
|
# @return [Array] Array include outdated data.
|
33
31
|
# If target project have no outdated data, then return blank array such as `[]`
|
34
|
-
def
|
35
|
-
|
32
|
+
def format(outdated = nil)
|
33
|
+
@outdated_libraries = outdated unless outdated.nil?
|
34
|
+
|
35
|
+
array = @outdated_libraries.split(/\R/).map(&:strip)
|
36
36
|
index = array.find_index("The following pod updates are available:")
|
37
37
|
|
38
38
|
return [] if index.nil?
|
39
39
|
|
40
|
-
array[index + 1..array.size].map { |library|
|
40
|
+
@formatted_outdated_libraries = array[index + 1..array.size].map { |library|
|
41
41
|
versions = library.split(/\s/) # e.g. ["-", "AFNetworking", "2.5.4", "->", "3.1.0", "(latest", "version", "3.1.0)"]
|
42
42
|
if versions[0] == "-"
|
43
43
|
{
|
@@ -53,12 +53,36 @@ module Anticuado
|
|
53
53
|
# @param [String] pod_file_in The file path to Podfile you'd like to update
|
54
54
|
# @param [String] pod_file_out The file path to new Podfile updated. Default is nil and then `pod_file_in` is used
|
55
55
|
# as the file path
|
56
|
-
# @param [Hash]
|
56
|
+
# @param [Hash] libraries The library name you'd like to update
|
57
57
|
# {library_name: "version", library_name2: "version"}
|
58
58
|
# @return [String] new Podfile
|
59
|
-
def
|
59
|
+
def update(pod_file_in:, pod_file_out: nil, libraries:)
|
60
60
|
update_with_prefix(pod_file_in: pod_file_in, pod_file_out: pod_file_out, libraries: libraries, prefix: "pod ")
|
61
61
|
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def update_with_prefix(pod_file_in:, pod_file_out: nil, libraries:, prefix:)
|
66
|
+
pod_file_out = pod_file_in if pod_file_out.nil?
|
67
|
+
current_pod = File.read(pod_file_in)
|
68
|
+
|
69
|
+
result = current_pod.each_line.reduce("") do |memo, line|
|
70
|
+
memo << if line.strip.start_with?(prefix)
|
71
|
+
key = get_key libraries, line
|
72
|
+
key.nil? ? line : line.sub(/[0-9|.]+/, libraries[key])
|
73
|
+
else
|
74
|
+
line
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
File.write(pod_file_out, result)
|
79
|
+
result
|
80
|
+
end
|
81
|
+
|
82
|
+
def get_key(libraries, line)
|
83
|
+
libraries.each_key { |k| return k if line.include?(k.to_s) }
|
84
|
+
nil
|
85
|
+
end
|
62
86
|
end # class CocoaPods
|
63
87
|
end # module IOS
|
64
88
|
end # module Anticuado
|
@@ -10,12 +10,12 @@ module Anticuado
|
|
10
10
|
# @param [Bool] wrapper Use gradle wrapper or use gradle directory.
|
11
11
|
# @param [String] format "plain", "json" or "xml". Default is "json".
|
12
12
|
# @param [String] outdir Path to output the result. Default is "build/dependencyUpdates".
|
13
|
-
def
|
13
|
+
def outdated(wrapper = false, revision = "release", format = "json", outdir = "build/dependencyUpdates")
|
14
14
|
return puts "have no gradle command" if !wrapper && `which gradle`.empty?
|
15
15
|
|
16
|
-
if
|
16
|
+
if @project_dir
|
17
17
|
current_dir = Anticuado.current_dir
|
18
|
-
Dir.chdir Anticuado.project_dir(
|
18
|
+
Dir.chdir Anticuado.project_dir(@project_dir)
|
19
19
|
`#{gradle(wrapper)} dependencyUpdates -Drevision=#{revision} -DoutputFormatter=#{format} -DoutputDir=#{outdir}`
|
20
20
|
Dir.chdir current_dir
|
21
21
|
else
|
@@ -27,20 +27,22 @@ module Anticuado
|
|
27
27
|
|
28
28
|
# @param [String] file_path The result of command `gradle dependencyUpdates` with json format
|
29
29
|
# @return [JSON] JSON data
|
30
|
-
def
|
30
|
+
def parse_json(file_path)
|
31
31
|
str = File.read(file_path)
|
32
|
-
JSON.parse(str)
|
32
|
+
@outdated_libraries = JSON.parse(str)
|
33
33
|
end
|
34
34
|
|
35
35
|
# @param [String] outdated_parsed_json The result of command `gradle dependencyUpdates` and json parsed data
|
36
36
|
# @return [Array] Array include outdated data.
|
37
37
|
# If target project have no outdated data, then return blank array such as `[]`
|
38
|
-
def
|
39
|
-
|
38
|
+
def format(outdated_parsed_json = nil, filter = %w(alpha beta rc cr m))
|
39
|
+
@outdated_libraries = outdated_parsed_json unless outdated_parsed_json.nil?
|
40
|
+
|
41
|
+
outdted = @outdated_libraries["outdated"]
|
40
42
|
return [] if outdted.nil?
|
41
43
|
return [] if outdted["dependencies"].nil?
|
42
44
|
|
43
|
-
outdted["dependencies"].map { |library|
|
45
|
+
@formatted_outdated_libraries = outdted["dependencies"].map { |library|
|
44
46
|
available_version = filter(filter, library["available"]["release"])
|
45
47
|
latest_version = filter(filter, library["available"]["release"])
|
46
48
|
|
@@ -58,12 +60,12 @@ module Anticuado
|
|
58
60
|
|
59
61
|
private
|
60
62
|
|
61
|
-
def
|
63
|
+
def gradle(wrapper = false)
|
62
64
|
return "./gradlew" if wrapper
|
63
65
|
"gradle"
|
64
66
|
end
|
65
67
|
|
66
|
-
def
|
68
|
+
def filter(revisions, string)
|
67
69
|
result = revisions.find { |qualifier| string.match(/(?i).*[.-]#{qualifier}[.\d-]*/) }
|
68
70
|
return NO_VERSION if result
|
69
71
|
string
|
@@ -1,33 +1,33 @@
|
|
1
1
|
module Anticuado
|
2
2
|
module JavaScript
|
3
3
|
class Npm < Anticuado::Base
|
4
|
-
# @param [String] project Path to project directory.
|
5
4
|
# @return [String] The result of command `npm outdated`.
|
6
|
-
def
|
5
|
+
def outdated
|
7
6
|
return puts "have no npm command" if `which npm`.empty?
|
8
7
|
|
9
|
-
if
|
8
|
+
if @project_dir
|
10
9
|
current_dir = Anticuado.current_dir
|
11
|
-
Dir.chdir Anticuado.project_dir(
|
12
|
-
|
13
|
-
outdated_str = `npm outdated`
|
10
|
+
Dir.chdir Anticuado.project_dir(@project_dir)
|
11
|
+
@outdated_libraries = run_outdated
|
14
12
|
Dir.chdir current_dir
|
15
13
|
else
|
16
|
-
|
14
|
+
@outdated_libraries = run_outdated
|
17
15
|
end
|
18
|
-
|
16
|
+
@outdated_libraries
|
19
17
|
end
|
20
18
|
|
21
19
|
# @param [String] outdated The result of command `npm outdated`
|
22
20
|
# @return [Array] Array include outdated data.
|
23
21
|
# If target project have no outdated data, then return blank array such as `[]`
|
24
|
-
def
|
25
|
-
|
22
|
+
def format(outdated = nil)
|
23
|
+
@outdated_libraries = outdated unless outdated.nil?
|
24
|
+
|
25
|
+
array = @outdated_libraries.split(/\R/).map(&:strip)
|
26
26
|
index = array.find_index { |line| line.scan(/\APackage\s+Current\s+Wanted\s+Latest\s+Location\z/) != [] }
|
27
27
|
|
28
28
|
return [] if index.nil?
|
29
29
|
|
30
|
-
array[index + 1...array.size].map do |library|
|
30
|
+
@formatted_outdated_libraries = array[index + 1...array.size].map do |library|
|
31
31
|
versions = library.split(/\s+/) # e.g. ["babel-brunch", "6.0.2", "6.0.6", "6.0.6"]
|
32
32
|
{
|
33
33
|
library_name: versions[0],
|
@@ -37,6 +37,13 @@ module Anticuado
|
|
37
37
|
}
|
38
38
|
end
|
39
39
|
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def run_outdated
|
44
|
+
`npm install`
|
45
|
+
`npm outdated`
|
46
|
+
end
|
40
47
|
end # class Npm
|
41
48
|
end # module JavaScript
|
42
49
|
end # module Anticuado
|
@@ -1,33 +1,33 @@
|
|
1
1
|
module Anticuado
|
2
2
|
module JavaScript
|
3
3
|
class Yarn < Anticuado::Base
|
4
|
-
# @param [String] project Path to project directory.
|
5
4
|
# @return [String] The result of command `yarn outdated`.
|
6
|
-
def
|
5
|
+
def outdated
|
7
6
|
return puts "have no yarn command" if `which yarn`.empty?
|
8
7
|
|
9
|
-
if
|
8
|
+
if @project_dir
|
10
9
|
current_dir = Anticuado.current_dir
|
11
|
-
Dir.chdir Anticuado.project_dir(
|
12
|
-
|
13
|
-
outdated_str = `yarn outdated`
|
10
|
+
Dir.chdir Anticuado.project_dir(@project_dir)
|
11
|
+
@outdated_libraries = run_outdated
|
14
12
|
Dir.chdir current_dir
|
15
13
|
else
|
16
|
-
|
14
|
+
@outdated_libraries = run_outdated
|
17
15
|
end
|
18
|
-
|
16
|
+
@outdated_libraries
|
19
17
|
end
|
20
18
|
|
21
19
|
# @param [String] outdated The result of command `yarn outdated`
|
22
20
|
# @return [Array] Array include outdated data.
|
23
21
|
# If target project have no outdated data, then return blank array such as `[]`
|
24
|
-
def
|
25
|
-
|
22
|
+
def format(outdated = nil)
|
23
|
+
@outdated_libraries = outdated unless outdated.nil?
|
24
|
+
|
25
|
+
array = @outdated_libraries.split(/\R/).map(&:strip)
|
26
26
|
index = array.find_index { |line| line.scan(/Package\s+Current\s+Wanted\s+Latest/) != [] }
|
27
27
|
|
28
28
|
return [] if index.nil?
|
29
29
|
|
30
|
-
array[index + 1...(array.size - 1)].map do |library|
|
30
|
+
@formatted_outdated_libraries = array[index + 1...(array.size - 1)].map do |library|
|
31
31
|
versions = library.split(/\s+/) # e.g. ["babel-brunch", "6.0.2", "6.0.6", "6.0.6"]
|
32
32
|
{
|
33
33
|
library_name: versions[0],
|
@@ -37,6 +37,13 @@ module Anticuado
|
|
37
37
|
}
|
38
38
|
end
|
39
39
|
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def run_outdated
|
44
|
+
`yarn install`
|
45
|
+
`yarn outdated`
|
46
|
+
end
|
40
47
|
end # class Yarn
|
41
48
|
end # module JavaScript
|
42
49
|
end # module Anticuado
|
@@ -1,32 +1,32 @@
|
|
1
1
|
module Anticuado
|
2
2
|
module Ruby
|
3
3
|
class Bundler < Anticuado::Base
|
4
|
-
def
|
4
|
+
def outdated
|
5
5
|
return puts "have no bundle command" if `which bundle`.empty?
|
6
6
|
|
7
|
-
if
|
7
|
+
if @project_dir
|
8
8
|
current_dir = Anticuado.current_dir
|
9
|
-
Dir.chdir Anticuado.project_dir(
|
10
|
-
|
11
|
-
outdated_str = `bundle outdated`
|
9
|
+
Dir.chdir Anticuado.project_dir(@project_dir)
|
10
|
+
@outdated_libraries = run_outdated
|
12
11
|
Dir.chdir current_dir
|
13
12
|
else
|
14
|
-
|
15
|
-
outdated_str = `bundle outdated`
|
13
|
+
@outdated_libraries = run_outdated
|
16
14
|
end
|
17
|
-
|
15
|
+
@outdated_libraries
|
18
16
|
end
|
19
17
|
|
20
|
-
# @param [String] outdated The result of command `bundle outdated`
|
18
|
+
# @param [String] outdated The result of command `bundle outdated`. If it's no argument, the method use the result of `outdated`.
|
21
19
|
# @return [Array] Array include outdated data.
|
22
20
|
# If target project have no outdated data, then return blank array such as `[]`
|
23
|
-
def
|
24
|
-
|
21
|
+
def format(outdated = nil)
|
22
|
+
@outdated_libraries = outdated unless outdated.nil?
|
23
|
+
|
24
|
+
array = @outdated_libraries.split(/\R/).map(&:strip)
|
25
25
|
index = array.find_index("Outdated gems included in the bundle:")
|
26
26
|
|
27
27
|
return [] if index.nil?
|
28
28
|
|
29
|
-
array[index + 1..array.size].map { |library|
|
29
|
+
@formatted_outdated_libraries = array[index + 1..array.size].map { |library|
|
30
30
|
versions = library.split(/\s/) # e.g. ["*", "jwt", "(newest", "1.5.6,", "installed", "1.5.5)"]
|
31
31
|
if versions[0] == "*"
|
32
32
|
{
|
@@ -38,6 +38,13 @@ module Anticuado
|
|
38
38
|
end
|
39
39
|
}.compact
|
40
40
|
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def run_outdated
|
45
|
+
`bundle install`
|
46
|
+
`bundle outdated`
|
47
|
+
end
|
41
48
|
end # class Bundler
|
42
49
|
end # module Ruby
|
43
50
|
end # module Anticuado
|
data/lib/anticuado/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anticuado
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuaki MATSUO
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03
|
11
|
+
date: 2018-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|