anticuado 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/anticuado.gemspec +4 -0
- data/lib/anticuado.rb +1 -0
- data/lib/anticuado/base.rb +4 -0
- data/lib/anticuado/elixir/hex.rb +3 -4
- data/lib/anticuado/github.rb +86 -0
- data/lib/anticuado/ios/carthage.rb +17 -0
- data/lib/anticuado/ios/cocoapods.rb +16 -12
- data/lib/anticuado/java/gradle.rb +3 -4
- data/lib/anticuado/javascript/npm.rb +3 -4
- data/lib/anticuado/javascript/yarn.rb +3 -4
- data/lib/anticuado/ruby/bundler.rb +26 -8
- data/lib/anticuado/version.rb +1 -1
- metadata +45 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9003493beb4251006f238455230ffe51e943508
|
4
|
+
data.tar.gz: ad214b8164369be14c71276d4218dba521ded9ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a52b5559d63ed03d3ea8bc1fb676651ae39706cbca35e7d27543e670763124532dbfabdf0a86055404d38fc099aef264c4594f6cf8a8f107b86bf5b4328a829
|
7
|
+
data.tar.gz: '08fb598f6543aca1f1c4bc32fbce26f7d66ee471a4319d642b8d5c111148d696b2c3ebfb7f330f6603f6bf80a46f2ceeca90d7f7e7ac60b0e91327d86c3a8f53'
|
data/README.md
CHANGED
data/anticuado.gemspec
CHANGED
@@ -20,7 +20,11 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
+
spec.add_runtime_dependency "git", "~> 1.3.0"
|
24
|
+
spec.add_runtime_dependency "octokit", "~> 4.8.0"
|
25
|
+
|
23
26
|
spec.add_development_dependency "bundler", "~> 1.12"
|
24
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
28
|
spec.add_development_dependency "minitest", "~> 5.0"
|
29
|
+
spec.add_development_dependency "pry"
|
26
30
|
end
|
data/lib/anticuado.rb
CHANGED
data/lib/anticuado/base.rb
CHANGED
data/lib/anticuado/elixir/hex.rb
CHANGED
@@ -7,10 +7,9 @@ module Anticuado
|
|
7
7
|
`mix local.hex --force`
|
8
8
|
|
9
9
|
if @project_dir
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
Dir.chdir current_dir
|
10
|
+
Dir.chdir(@project_dir) do
|
11
|
+
@outdated_libraries = `mix hex.outdated`
|
12
|
+
end
|
14
13
|
else
|
15
14
|
@outdated_libraries = `mix hex.outdated`
|
16
15
|
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'git'
|
2
|
+
require 'octokit'
|
3
|
+
|
4
|
+
module Anticuado
|
5
|
+
class GitHub
|
6
|
+
attr_reader :repo_uri, :repo_name, :git, :client
|
7
|
+
|
8
|
+
def initialize(repository_name, enterprise: true)
|
9
|
+
@repo_name = repository_name
|
10
|
+
|
11
|
+
@client = if enterprise
|
12
|
+
::Octokit::Client.new(
|
13
|
+
access_token: ENV['GHE_ACCESS_TOKEN'] || 'dummy_token',
|
14
|
+
api_endpoint: ENV['GHE_HOST'],
|
15
|
+
)
|
16
|
+
else
|
17
|
+
::Octokit::Client.new(:access_token => ENV['GITHUB_TOKEN'])
|
18
|
+
end
|
19
|
+
@repo_uri = "git@#{URI.parse(enterprise ? @client.api_endpoint : @client.web_endpoint).host}:#{@repo_name}.git"
|
20
|
+
end
|
21
|
+
|
22
|
+
def clone_or_open_to(target_path)
|
23
|
+
@git = begin
|
24
|
+
::Git.clone(@repo_uri, target_path)
|
25
|
+
rescue
|
26
|
+
g = ::Git.open(target_path)
|
27
|
+
g.pull
|
28
|
+
g
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def create_a_new_pull_request(base_branch:, head_branch: (Time.now.strftime '%Y%m%d-%H%M%S'), update_libraries: nil)
|
33
|
+
remote_name = 'origin'
|
34
|
+
|
35
|
+
begin
|
36
|
+
create_a_branch_local head_branch
|
37
|
+
commit_all_changes
|
38
|
+
|
39
|
+
git_push_to_remote remote_name, head_branch
|
40
|
+
create_pull_request(base_branch: base_branch, head_branch: head_branch, title: github_pr_title(head_branch), body: github_pr_body(update_libraries))
|
41
|
+
|
42
|
+
delete_a_branch_local head_branch
|
43
|
+
rescue Git::GitExecuteError => e
|
44
|
+
puts "no changes: #{e}, #{e.message}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def github_pr_title(message)
|
51
|
+
"update #{message}"
|
52
|
+
end
|
53
|
+
|
54
|
+
def github_pr_body(update_libraries)
|
55
|
+
return 'update libraries' if update_libraries.nil?
|
56
|
+
update_libraries.reduce("# Update libraries\n") do |acc, library|
|
57
|
+
acc << "- #{library}\n"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def commit_all_changes_message
|
62
|
+
"update libraries"
|
63
|
+
end
|
64
|
+
|
65
|
+
def commit_all_changes
|
66
|
+
@git.commit_all(commit_all_changes_message)
|
67
|
+
end
|
68
|
+
|
69
|
+
def create_a_branch_local(branch_name)
|
70
|
+
@git.branch(branch_name).checkout
|
71
|
+
end
|
72
|
+
|
73
|
+
def delete_a_branch_local(branch_name)
|
74
|
+
@git.checkout # We should change current branch first
|
75
|
+
@git.branch(branch_name).delete
|
76
|
+
end
|
77
|
+
|
78
|
+
def git_push_to_remote(remote_name, head_branch)
|
79
|
+
@git.push(remote_name, head_branch)
|
80
|
+
end
|
81
|
+
|
82
|
+
def create_pull_request(base_branch:, head_branch:, title:, body:)
|
83
|
+
@client.create_pull_request @repo_name, base_branch, head_branch, title, body
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end # module Anticuado
|
@@ -44,6 +44,23 @@ module Anticuado
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
47
|
+
|
48
|
+
# @param [Array] target_names: Name of library.
|
49
|
+
def update_lock(target_names = nil)
|
50
|
+
return puts "have no pod command" if `which pod`.empty?
|
51
|
+
do_update_lock target_names
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def do_update_lock(target_names = nil)
|
57
|
+
if target_names.nil?
|
58
|
+
`carthage update --project-directory=#{@project_dir}`
|
59
|
+
else
|
60
|
+
raise ArgumentError, "An argument should be Array like ['Result']" unless target_names.is_a? Array
|
61
|
+
`carthage update #{target_names.join(' ')} --project-directory=#{@project_dir}`
|
62
|
+
end
|
63
|
+
end
|
47
64
|
end # class Carthage
|
48
65
|
end # module IOS
|
49
66
|
end # module Anticuado
|
@@ -1,18 +1,6 @@
|
|
1
1
|
module Anticuado
|
2
2
|
module IOS
|
3
3
|
class CocoaPods < Anticuado::Base
|
4
|
-
# @param [String] library: Name of library.
|
5
|
-
# @return [String] The result of command `pod outdated`.
|
6
|
-
def update_lock(library: nil)
|
7
|
-
return puts "have no pod command" if `which pod`.empty?
|
8
|
-
|
9
|
-
if library
|
10
|
-
`pod update #{library}`
|
11
|
-
else
|
12
|
-
`pod update`
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
4
|
# @return [String] The result of command `pod outdated`.
|
17
5
|
def outdated
|
18
6
|
return puts "have no pod command" if `which pod`.empty?
|
@@ -50,6 +38,13 @@ module Anticuado
|
|
50
38
|
}.compact
|
51
39
|
end
|
52
40
|
|
41
|
+
# @param [Array] target_names: Name of library.
|
42
|
+
def update_lock(target_names = nil)
|
43
|
+
return puts "have no pod command" if `which pod`.empty?
|
44
|
+
do_update_lock target_names
|
45
|
+
end
|
46
|
+
|
47
|
+
# TODO: Should fix. (Not used)
|
53
48
|
# @param [String] pod_file_in The file path to Podfile you'd like to update
|
54
49
|
# @param [String] pod_file_out The file path to new Podfile updated. Default is nil and then `pod_file_in` is used
|
55
50
|
# as the file path
|
@@ -62,6 +57,15 @@ module Anticuado
|
|
62
57
|
|
63
58
|
private
|
64
59
|
|
60
|
+
def do_update_lock(target_names = nil)
|
61
|
+
if target_names.nil?
|
62
|
+
`pod update --project-directory=#{@project_dir}`
|
63
|
+
else
|
64
|
+
raise ArgumentError, "An argument should be Array like ['PromisesObjC']" unless target_names.is_a? Array
|
65
|
+
`pod update #{target_names.join(' ')} --project-directory=#{@project_dir}`
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
65
69
|
def update_with_prefix(pod_file_in:, pod_file_out: nil, libraries:, prefix:)
|
66
70
|
pod_file_out = pod_file_in if pod_file_out.nil?
|
67
71
|
current_pod = File.read(pod_file_in)
|
@@ -14,10 +14,9 @@ module Anticuado
|
|
14
14
|
return puts "have no gradle command" if !wrapper && `which gradle`.empty?
|
15
15
|
|
16
16
|
if @project_dir
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
Dir.chdir current_dir
|
17
|
+
Dir.chdir(@project_dir) do
|
18
|
+
`#{gradle(wrapper)} dependencyUpdates -Drevision=#{revision} -DoutputFormatter=#{format} -DoutputDir=#{outdir}`
|
19
|
+
end
|
21
20
|
else
|
22
21
|
`#{gradle(wrapper)} dependencyUpdates -Drevision=#{revision} -DoutputFormatter=#{format} -DoutputDir=#{outdir}`
|
23
22
|
end
|
@@ -6,10 +6,9 @@ module Anticuado
|
|
6
6
|
return puts "have no npm command" if `which npm`.empty?
|
7
7
|
|
8
8
|
if @project_dir
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
Dir.chdir current_dir
|
9
|
+
Dir.chdir(@project_dir) do
|
10
|
+
@outdated_libraries = run_outdated
|
11
|
+
end
|
13
12
|
else
|
14
13
|
@outdated_libraries = run_outdated
|
15
14
|
end
|
@@ -6,10 +6,9 @@ module Anticuado
|
|
6
6
|
return puts "have no yarn command" if `which yarn`.empty?
|
7
7
|
|
8
8
|
if @project_dir
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
Dir.chdir current_dir
|
9
|
+
Dir.chdir(@project_dir) do
|
10
|
+
@outdated_libraries = run_outdated
|
11
|
+
end
|
13
12
|
else
|
14
13
|
@outdated_libraries = run_outdated
|
15
14
|
end
|
@@ -1,16 +1,15 @@
|
|
1
1
|
module Anticuado
|
2
2
|
module Ruby
|
3
3
|
class Bundler < Anticuado::Base
|
4
|
-
def outdated
|
4
|
+
def outdated(option = '')
|
5
5
|
return puts "have no bundle command" if `which bundle`.empty?
|
6
6
|
|
7
7
|
if @project_dir
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
Dir.chdir current_dir
|
8
|
+
Dir.chdir(@project_dir) do
|
9
|
+
@outdated_libraries = run_outdated option
|
10
|
+
end
|
12
11
|
else
|
13
|
-
@outdated_libraries = run_outdated
|
12
|
+
@outdated_libraries = run_outdated option
|
14
13
|
end
|
15
14
|
@outdated_libraries
|
16
15
|
end
|
@@ -39,10 +38,29 @@ module Anticuado
|
|
39
38
|
}.compact
|
40
39
|
end
|
41
40
|
|
41
|
+
def update_lock(target_names = nil)
|
42
|
+
if @project_dir
|
43
|
+
Dir.chdir(@project_dir) do
|
44
|
+
do_update_lock target_names
|
45
|
+
end
|
46
|
+
else
|
47
|
+
do_update_lock target_names
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
42
51
|
private
|
43
52
|
|
44
|
-
def
|
45
|
-
|
53
|
+
def do_update_lock(target_names = nil)
|
54
|
+
if target_names.nil?
|
55
|
+
`bundle update`
|
56
|
+
else
|
57
|
+
raise ArgumentError, "An argument should be Array like ['cocoapod']" unless target_names.is_a? Array
|
58
|
+
`bundle update #{target_names.join(' ')}`
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def run_outdated(option)
|
63
|
+
`bundle install #{option}`
|
46
64
|
`bundle outdated`
|
47
65
|
end
|
48
66
|
end # class Bundler
|
data/lib/anticuado/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anticuado
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
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-05-
|
11
|
+
date: 2018-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: git
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.3.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.3.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: octokit
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.8.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 4.8.0
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: bundler
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +80,20 @@ dependencies:
|
|
52
80
|
- - "~>"
|
53
81
|
- !ruby/object:Gem::Version
|
54
82
|
version: '5.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
55
97
|
description: Collect and arrange some outdated libraries for several platforms
|
56
98
|
email:
|
57
99
|
- fly.49.89.over@gmail.com
|
@@ -72,6 +114,7 @@ files:
|
|
72
114
|
- lib/anticuado.rb
|
73
115
|
- lib/anticuado/base.rb
|
74
116
|
- lib/anticuado/elixir/hex.rb
|
117
|
+
- lib/anticuado/github.rb
|
75
118
|
- lib/anticuado/ios/carthage.rb
|
76
119
|
- lib/anticuado/ios/cocoapods.rb
|
77
120
|
- lib/anticuado/java/gradle.rb
|