anticuado 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e0469e4e67a364e053c8de4379427e1e5610f3a4
4
+ data.tar.gz: e9824fbc11df2db98a643bdf00f2c8fdffad0fc7
5
+ SHA512:
6
+ metadata.gz: 8b2ac1f420560bf3ca7e98e2307f144fa81d86fd4a4bc81dbb8e75c707bdd268150878233d060a9d4453f5f9819c01f9b24a64aaa075251afd70ddd944ea2028
7
+ data.tar.gz: ec5e6f176f41de99cf8f038964615b80a7bed9ff7053cb6df2813ae901a1b9c1a470187327432e0bbb088eddbfe338bbef9039db74906c8ea1b04f78a26aea48
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .idea
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.0
5
+ before_install: gem install bundler -v 1.12.5
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at fly.49.89.over@gmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in anticuado.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Kazuaki MATSUO
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
13
+ all 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
21
+ THE SOFTWARE.
@@ -0,0 +1,117 @@
1
+ # Anticuado
2
+
3
+ This library collect output
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'anticuado'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install anticuado
20
+
21
+ ## Usage
22
+
23
+ This library's results are like the following format:
24
+
25
+ ```ruby
26
+ [
27
+ {
28
+ library_name: "AFNetworking",
29
+ current_version: "2.5.0",
30
+ available_version: "3.1.0",
31
+ latest_version: "3.1.0"
32
+ },
33
+ {
34
+ library_name: "OHHTTPStubs",
35
+ current_version: "4.1.0",
36
+ available_version: "5.0.0",
37
+ latest_version: "5.0.0"
38
+ }
39
+ ]
40
+ ```
41
+
42
+ ### iOS
43
+ #### CocoaPods
44
+ 1. install `cocoadpos`. Read [official document](https://cocoapods.org/).
45
+ 2. Run as the following script.
46
+
47
+ ```ruby
48
+ require "anticuado"
49
+
50
+ outdated = ::Anticuado::IOS::CocoaPods.outdated project: "path/to/project"
51
+ ::Anticuado::IOS::CocoaPods.format outdated
52
+ ```
53
+
54
+ #### Carthage
55
+ 1. install `carthage`. Read [official document](https://github.com/Carthage/Carthage).
56
+ 2. Run as the following script.
57
+
58
+ ```ruby
59
+ require "anticuado"
60
+
61
+ outdated = ::Anticuado::IOS::Carthage.outdated project: "path/to/project"
62
+ ::Anticuado::IOS::Carthage.format outdated
63
+ ```
64
+
65
+ ### Android
66
+ #### Gradle
67
+
68
+ This library require the following plugin to collect library versions.
69
+ https://github.com/ben-manes/gradle-versions-plugin
70
+
71
+ 1. install `mix`. Read [official document](http://elixir-lang.org/install.html).
72
+ 2. Run as the following script.
73
+
74
+ ```ruby
75
+ require "anticuado"
76
+
77
+ ::Anticuado::Java::Gradle.outdated project: "path/to/project"
78
+ outdated = ::Anticuado::Java::Gradle.parse_json "build/dependencyUpdates"
79
+ ::Anticuado::Java::Gradle.format outdated
80
+ ```
81
+
82
+ ### Elixir
83
+ #### Hex
84
+ 1. install `mix`. Read [official document](http://elixir-lang.org/install.html).
85
+ 2. Run as the following script.
86
+
87
+ ```ruby
88
+ require "anticuado"
89
+
90
+ outdated = ::Anticuado::Elixir::Hex.outdated project: "path/to/project"
91
+ ::Anticuado::Elixir::Hex.format outdated
92
+ ```
93
+
94
+ ### Ruby
95
+ #### Bundler
96
+ 1. install `bundler`. Read [official document](http://bundler.io/).
97
+ 2. Run as the following script.
98
+
99
+ ```ruby
100
+ require "anticuado"
101
+
102
+ outdated = ::Anticuado::Ruby::Bundler.outdated project: "path/to/project"
103
+ ::Anticuado::Ruby::Bundler.format outdated
104
+ ```
105
+
106
+ ## In advance
107
+
108
+
109
+ ## Contributing
110
+
111
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/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.
112
+
113
+
114
+ ## License
115
+
116
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
117
+
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'anticuado/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "anticuado"
8
+ spec.version = Anticuado::VERSION
9
+ spec.authors = ["Kazuaki MATSUO"]
10
+ spec.email = ["fly.49.89.over@gmail.com"]
11
+
12
+ spec.summary = %q{Collect and arrange some outdated libraries for several platforms}
13
+ spec.description = %q{Collect and arrange some outdated libraries for several platforms}
14
+ spec.homepage = "https://github.com/KazuCocoa/anticuado"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.12"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "minitest", "~> 5.0"
25
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "anticuado"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,14 @@
1
+ require "anticuado/version"
2
+
3
+ require "anticuado/ios/carthage"
4
+ require "anticuado/ios/cocoapods"
5
+
6
+ require "anticuado/java/gradle"
7
+
8
+ require "anticuado/elixir/hex"
9
+
10
+ require "anticuado/ruby/bundler"
11
+
12
+ module Anticuado
13
+ # Your code goes here...
14
+ end
@@ -0,0 +1,49 @@
1
+ module Anticuado
2
+ module Elixir
3
+ module Hex
4
+ # @param [String] project Path to project directory.
5
+ # @return [String] The result of command `mix hex.outdated`.
6
+ def self.outdated(project: nil)
7
+ return puts "have no mix command" if `which mix`.empty?
8
+
9
+ if project
10
+ current_dir = Dir.pwd
11
+ Dir.chdir project
12
+ outdated_str = `mix hex.outdated`
13
+ Dir.chdir current_dir
14
+ else
15
+ outdated_str = `mix hex.outdated`
16
+ end
17
+
18
+ outdated_str
19
+ end
20
+
21
+ # @param [String] outdated The result of command `mix hex.outdated`
22
+ # @return [Array] Array include outdated data.
23
+ # If target project have no outdated data, then return blank array such as `[]`
24
+ def self.format(outdated)
25
+ array = outdated.split(/\R/)
26
+ index = array.find_index("Dependency Current Latest Requirement")
27
+
28
+ return [] if index.nil?
29
+
30
+ array[index + 1..array.size].reduce([]) do |acc, library|
31
+ array_lib = library.split(/\s+/)
32
+ current_version = array_lib[1]
33
+ last_version = array_lib[2]
34
+
35
+ if current_version != last_version
36
+ acc.push({
37
+ library_name: array_lib[0],
38
+ current_version: current_version,
39
+ available_version: last_version,
40
+ latest_version: last_version
41
+ })
42
+ end
43
+
44
+ acc
45
+ end
46
+ end
47
+ end # module Hex
48
+ end # module Elixir
49
+ end # module Anticuado
@@ -0,0 +1,37 @@
1
+ module Anticuado
2
+ module IOS
3
+ module Carthage
4
+ # @param [String] project Path to project directory.
5
+ # @return [String] The result of command `carthage outdated`.
6
+ def self.outdated(project: nil)
7
+ return puts "have no carthage command" if `which carthage`.empty?
8
+
9
+ if project
10
+ `carthage outdated --project-directory #{project}`
11
+ else
12
+ `carthage outdated`
13
+ end
14
+ end
15
+
16
+ # @param [String] outdated The result of command `carthage outdated`
17
+ # @return [Array] Array include outdated data.
18
+ # If target project have no outdated data, then return blank array such as `[]`
19
+ def self.format(outdated)
20
+ array = outdated.split(/\R/)
21
+ index = array.find_index("The following dependencies are outdated:")
22
+
23
+ return [] if index.nil?
24
+
25
+ array[index + 1..array.size].map do |library|
26
+ versions = library.split(/[\s|"]/) # e.g. ["Result", "", "2.0.0", "", "->", "", "2.1.3"]
27
+ {
28
+ library_name: versions[0],
29
+ current_version: versions[2],
30
+ available_version: versions[6],
31
+ latest_version: versions[6]
32
+ }
33
+ end
34
+ end
35
+ end # module Carthage
36
+ end # module IOS
37
+ end # module Anticuado
@@ -0,0 +1,39 @@
1
+ module Anticuado
2
+ module IOS
3
+ module CocoaPods
4
+ # @param [String] project Path to project directory.
5
+ # @return [String] The result of command `pod outdated`.
6
+ def self.outdated(project: nil)
7
+ return puts "have no pod command" if `which pod`.empty?
8
+
9
+ if project
10
+ `pod outdated --project-directory=#{project}`
11
+ else
12
+ `pod outdated`
13
+ end
14
+ end
15
+
16
+ # @param [String] outdated The result of command `pod outdated`
17
+ # @return [Array] Array include outdated data.
18
+ # If target project have no outdated data, then return blank array such as `[]`
19
+ def self.format(outdated)
20
+ array = outdated.split(/\R/)
21
+ index = array.find_index("The following pod updates are available:")
22
+
23
+ return [] if index.nil?
24
+
25
+ array[index + 1..array.size].map { |library|
26
+ versions = library.split(/\s/) # e.g. ["-", "AFNetworking", "2.5.4", "->", "3.1.0", "(latest", "version", "3.1.0)"]
27
+ if versions[0] == "-"
28
+ {
29
+ library_name: versions[1],
30
+ current_version: versions[2],
31
+ available_version: versions[4],
32
+ latest_version: versions[7].delete(")")
33
+ }
34
+ end
35
+ }.compact
36
+ end
37
+ end # module CocoaPods
38
+ end # module IOS
39
+ end # module Anticuado
@@ -0,0 +1,59 @@
1
+ require "json"
2
+
3
+ module Anticuado
4
+ module Java
5
+ class Gradle
6
+ # require: https://github.com/ben-manes/gradle-versions-plugin
7
+ # @param [Bool] wrapper Use gradle wrapper or use gradle directory.
8
+ # @param [String] revision "release", "milestone" or "integration". Default is "release".
9
+ # @param [String] format "plain", "json" or "xml". Default is "json".
10
+ # @param [String] outdir Path to output the result. Default is "build/dependencyUpdates".
11
+ def self.outdated(wrapper: false, project: nil, revision: "release", format: "json", outdir: "build/dependencyUpdates")
12
+ return puts "have no gradle command" if !wrapper && `which gradle`.empty?
13
+
14
+ if project
15
+ current_dir = Dir.pwd
16
+ Dir.chdir project
17
+ `#{gradle(wrapper)} dependencyUpdates -Drevision=#{revision} -DoutputFormatter=#{format} -DoutputDir=#{outdir}`
18
+ Dir.chdir current_dir
19
+ else
20
+ `#{gradle(wrapper)} dependencyUpdates -Drevision=#{revision} -DoutputFormatter=#{format} -DoutputDir=#{outdir}`
21
+ end
22
+
23
+ puts "output file is #{outdir}"
24
+ end
25
+
26
+ # @param [String] file_path The result of command `gradle dependencyUpdates` with json format
27
+ # @return [JSON] JSON data
28
+ def self.parse_json(file_path)
29
+ str = File.read(file_path)
30
+ JSON.parse(str)
31
+ end
32
+
33
+ # @param [String] outdated_parsed_json The result of command `gradle dependencyUpdates` and json parsed data
34
+ # @return [Array] Array include outdated data.
35
+ # If target project have no outdated data, then return blank array such as `[]`
36
+ def self.format(outdated_parsed_json)
37
+ outdted = outdated_parsed_json["outdated"]
38
+ return [] if outdted.nil?
39
+ return [] if outdted["dependencies"].nil?
40
+
41
+ outdted["dependencies"].map { |library|
42
+ {
43
+ library_name: library["name"],
44
+ current_version: library["version"],
45
+ available_version: library["available"]["release"],
46
+ latest_version: library["available"]["release"]
47
+ }
48
+ }
49
+ end
50
+
51
+ private
52
+
53
+ def self.gradle(wrapper = false)
54
+ return "./gradlew" if wrapper
55
+ "gradle"
56
+ end
57
+ end # module Gradle
58
+ end # module Android
59
+ end # module Anticuado
@@ -0,0 +1,41 @@
1
+ module Anticuado
2
+ module Ruby
3
+ module Bundler
4
+ def self.outdated(project: nil)
5
+ return puts "have no bundle command" if `which bundle`.empty?
6
+
7
+ if project
8
+ current_dir = Dir.pwd
9
+ Dir.chdir project
10
+ outdated_str = `bundle outdated`
11
+ Dir.chdir current_dir
12
+ else
13
+ outdated_str = `bundle outdated`
14
+ end
15
+ outdated_str
16
+ end
17
+
18
+ # @param [String] outdated The result of command `bundle outdated`
19
+ # @return [Array] Array include outdated data.
20
+ # If target project have no outdated data, then return blank array such as `[]`
21
+ def self.format(outdated)
22
+ array = outdated.split(/\R/)
23
+ index = array.find_index("Outdated gems included in the bundle:")
24
+
25
+ return [] if index.nil?
26
+
27
+ array[index + 1..array.size].map { |library|
28
+ versions = library.split(/\s/) # e.g. ["*", "jwt", "(newest", "1.5.6,", "installed", "1.5.5)"]
29
+ if versions[0] == "*"
30
+ {
31
+ library_name: versions[1],
32
+ current_version: versions[5].delete(")"),
33
+ available_version: versions[3].delete(","),
34
+ latest_version: versions[3].delete(",")
35
+ }
36
+ end
37
+ }.compact
38
+ end
39
+ end # module Bundler
40
+ end # module Ruby
41
+ end # module Anticuado
@@ -0,0 +1,3 @@
1
+ module Anticuado
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: anticuado
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Kazuaki MATSUO
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-10-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.12'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ description: Collect and arrange some outdated libraries for several platforms
56
+ email:
57
+ - fly.49.89.over@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".travis.yml"
64
+ - CODE_OF_CONDUCT.md
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - anticuado.gemspec
70
+ - bin/console
71
+ - bin/setup
72
+ - lib/anticuado.rb
73
+ - lib/anticuado/elixir/hex.rb
74
+ - lib/anticuado/ios/carthage.rb
75
+ - lib/anticuado/ios/cocoapods.rb
76
+ - lib/anticuado/java/gradle.rb
77
+ - lib/anticuado/ruby/bundler.rb
78
+ - lib/anticuado/version.rb
79
+ homepage: https://github.com/KazuCocoa/anticuado
80
+ licenses:
81
+ - MIT
82
+ metadata: {}
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.6.6
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: Collect and arrange some outdated libraries for several platforms
103
+ test_files: []
104
+ has_rdoc: