bundle_outdated_formatter 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4b3dde0537afc9e0b41231b98bffc5a06c999606
4
+ data.tar.gz: a09cc4304d66a60814b7d4a5207a6c413656cabc
5
+ SHA512:
6
+ metadata.gz: aff545d992a1538144e298782be897a0aace41f06b215816649478cf6ec15a0a3d5c9e2920ea1008ac34ce8b1a9e978dee293f202e76e9f3660f925b699d87b2
7
+ data.tar.gz: 25f5195074d504e5a9e5e5433eb98ec9464bfe3806281df5438ab110103ff9055d68d8be96fe28e1cebf696c9e6c66c07c702dfc3cbd9df07067a50b984642db
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,16 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ DisplayCopNames: true
5
+
6
+ Layout/IndentHeredoc:
7
+ Enabled: false
8
+
9
+ Layout/TrailingWhitespace:
10
+ Exclude:
11
+ - 'spec/**/*.rb'
12
+
13
+ Metrics/BlockLength:
14
+ Exclude:
15
+ - 'spec/**/*.rb'
16
+ - '*.gemspec'
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,82 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2017-06-10 17:56:18 +0900 using RuboCop version 0.49.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Cop supports --auto-correct.
11
+ Layout/EmptyLineAfterMagicComment:
12
+ Exclude:
13
+ - 'bundle_outdated_formatter.gemspec'
14
+
15
+ # Offense count: 1
16
+ # Cop supports --auto-correct.
17
+ # Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
18
+ Layout/ExtraSpacing:
19
+ Exclude:
20
+ - 'bundle_outdated_formatter.gemspec'
21
+
22
+ # Offense count: 1
23
+ # Cop supports --auto-correct.
24
+ # Configuration parameters: AllowForAlignment.
25
+ Layout/SpaceAroundOperators:
26
+ Exclude:
27
+ - 'bundle_outdated_formatter.gemspec'
28
+
29
+ # Offense count: 1
30
+ Metrics/AbcSize:
31
+ Max: 23
32
+
33
+ # Offense count: 5
34
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
35
+ # URISchemes: http, https
36
+ Metrics/LineLength:
37
+ Max: 126
38
+
39
+ # Offense count: 1
40
+ # Configuration parameters: CountComments.
41
+ Metrics/MethodLength:
42
+ Max: 20
43
+
44
+ # Offense count: 1
45
+ Style/Documentation:
46
+ Exclude:
47
+ - 'spec/**/*'
48
+ - 'test/**/*'
49
+ - 'lib/bundle_outdated_formatter/cli.rb'
50
+
51
+ # Offense count: 1
52
+ # Cop supports --auto-correct.
53
+ # Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
54
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
55
+ Style/HashSyntax:
56
+ Exclude:
57
+ - 'Rakefile'
58
+
59
+ # Offense count: 1
60
+ # Cop supports --auto-correct.
61
+ Style/MutableConstant:
62
+ Exclude:
63
+ - 'lib/bundle_outdated_formatter/version.rb'
64
+
65
+ # Offense count: 2
66
+ # Cop supports --auto-correct.
67
+ # Configuration parameters: PreferredDelimiters.
68
+ Style/PercentLiteralDelimiters:
69
+ Exclude:
70
+ - 'bundle_outdated_formatter.gemspec'
71
+
72
+ # Offense count: 5
73
+ # Cop supports --auto-correct.
74
+ Style/RedundantFreeze:
75
+ Exclude:
76
+ - 'lib/bundle_outdated_formatter/cli.rb'
77
+
78
+ # Offense count: 2
79
+ # Cop supports --auto-correct.
80
+ Style/UnneededPercentQ:
81
+ Exclude:
82
+ - 'bundle_outdated_formatter.gemspec'
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.0.0
5
+ - 2.1.10
6
+ - 2.2.7
7
+ - 2.3.4
8
+ - 2.4.1
9
+ - ruby-head
10
+ before_install:
11
+ - stty cols 160
12
+ - gem install bundler -v 1.15.1
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Change Log
2
+
3
+ ## 0.1.0 (2017-06-15)
4
+
5
+ ### Features
6
+
7
+ * Add `output` command (default)
8
+ * Support Markdown format (default)
9
+ * Add `version`, `--version`, and `-v` commands
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bundle_outdated_formatter.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 emsk
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.
data/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # BundleOutdatedFormatter
2
+
3
+ [![Build Status](https://travis-ci.org/emsk/bundle_outdated_formatter.svg?branch=master)](https://travis-ci.org/emsk/bundle_outdated_formatter)
4
+ [![Coverage Status](https://coveralls.io/repos/github/emsk/bundle_outdated_formatter/badge.svg?branch=master)](https://coveralls.io/github/emsk/bundle_outdated_formatter)
5
+ [![Code Climate](https://codeclimate.com/github/emsk/bundle_outdated_formatter/badges/gpa.svg)](https://codeclimate.com/github/emsk/bundle_outdated_formatter)
6
+ [![Dependency Status](https://gemnasium.com/badges/github.com/emsk/bundle_outdated_formatter.svg)](https://gemnasium.com/github.com/emsk/bundle_outdated_formatter)
7
+ [![Inline docs](http://inch-ci.org/github/emsk/bundle_outdated_formatter.svg?branch=master)](http://inch-ci.org/github/emsk/bundle_outdated_formatter)
8
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.txt)
9
+
10
+ BundleOutdatedFormatter is a command-line tool to format output of `bundle outdated`.
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'bundle_outdated_formatter'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ ```sh
23
+ $ bundle
24
+ ```
25
+
26
+ Or install it yourself as:
27
+
28
+ ```sh
29
+ $ gem install bundle_outdated_formatter
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ ### Convert to Markdown
35
+
36
+ ```sh
37
+ $ bundle outdated | bof
38
+ ```
39
+
40
+ ## Examples
41
+
42
+ Output of `bundle outdated`:
43
+
44
+ ```
45
+ Fetching gem metadata from https://rubygems.org/..........
46
+ Fetching version metadata from https://rubygems.org/...
47
+ Fetching dependency metadata from https://rubygems.org/..
48
+ Resolving dependencies...
49
+
50
+ Outdated gems included in the bundle:
51
+ * faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test"
52
+ * hashie (newest 3.4.6, installed 1.2.0, requested = 1.2.0) in groups "default"
53
+ * headless (newest 2.3.1, installed 2.2.3)
54
+ ```
55
+
56
+ ### Convert to Markdown
57
+
58
+ ```
59
+ | gem | newest | installed | requested | groups |
60
+ | --- | --- | --- | --- | --- |
61
+ | faker | 1.6.6 | 1.6.5 | ~> 1.4 | development, test |
62
+ | hashie | 3.4.6 | 1.2.0 | = 1.2.0 | default |
63
+ | headless | 2.3.1 | 2.2.3 | | |
64
+ ```
65
+
66
+ ## Supported Ruby Versions
67
+
68
+ * Ruby 2.0.0
69
+ * Ruby 2.1
70
+ * Ruby 2.2
71
+ * Ruby 2.3
72
+ * Ruby 2.4
73
+
74
+ ## Contributing
75
+
76
+ Bug reports and pull requests are welcome.
77
+
78
+ ## License
79
+
80
+ [MIT](LICENSE.txt)
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'bundle_outdated_formatter'
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(__FILE__)
data/bin/setup ADDED
@@ -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,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bundle_outdated_formatter/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'bundle_outdated_formatter'
8
+ spec.version = BundleOutdatedFormatter::VERSION
9
+ spec.authors = ['emsk']
10
+ spec.email = ['emsk1987@gmail.com']
11
+
12
+ spec.summary = %q{Formatter for `bundle outdated`}
13
+ spec.description = %q{BundleOutdatedFormatter is a command-line tool to format output of `bundle outdated`}
14
+ spec.homepage = 'https://github.com/emsk/bundle_outdated_formatter'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = 'exe'
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_runtime_dependency 'thor', '~> 0.19'
25
+ spec.add_development_dependency 'bundler', '~> 1.15'
26
+ spec.add_development_dependency 'coveralls', '~> 0.8'
27
+ spec.add_development_dependency 'rake', '~> 12.0'
28
+ spec.add_development_dependency 'rspec', '~> 3.6'
29
+ spec.add_development_dependency 'rubocop', '~> 0.49'
30
+ spec.add_development_dependency 'simplecov', '~> 0.14'
31
+ end
data/exe/bof ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundle_outdated_formatter'
4
+
5
+ BundleOutdatedFormatter::CLI.start
@@ -0,0 +1,74 @@
1
+ require 'thor'
2
+
3
+ module BundleOutdatedFormatter
4
+ class CLI < Thor
5
+ NAME_REGEXP = /\A(\* )*(?<name>.+) \(/.freeze
6
+ NEWEST_REGEXP = /newest (?<newest>[\d\.]+)/.freeze
7
+ INSTALLED_REGEXP = /installed (?<installed>[\d\.]+)/.freeze
8
+ REQUESTED_REGEXP = /requested (?<requested>.+)\)/.freeze
9
+ GROUPS_REGEXP = /in groups "(?<groups>.+)"/.freeze
10
+
11
+ MARKDOWN_HEADER = <<-EOS.freeze
12
+ | gem | newest | installed | requested | groups |
13
+ | --- | --- | --- | --- | --- |
14
+ EOS
15
+
16
+ default_command :output
17
+
18
+ desc 'output', 'Format output of `bundle outdated`'
19
+ option :format, type: :string, aliases: '-f', default: 'markdown'
20
+
21
+ def output
22
+ return if STDIN.tty?
23
+
24
+ puts format_markdown(outdated_gems_in_stdin) if options[:format] == 'markdown'
25
+ end
26
+
27
+ desc 'version, -v, --version', 'Print the version'
28
+ map %w[-v --version] => :version
29
+
30
+ def version
31
+ puts "bundle_outdated_formatter #{BundleOutdatedFormatter::VERSION}"
32
+ end
33
+
34
+ private
35
+
36
+ def outdated_gems_in_stdin
37
+ outdated_gems = STDIN.each.to_a.map(&:strip).reject(&:empty?)
38
+
39
+ outdated_gems.map! do |line|
40
+ matched_name = NAME_REGEXP.match(line)
41
+ matched_newest = NEWEST_REGEXP.match(line)
42
+ matched_installed = INSTALLED_REGEXP.match(line)
43
+ matched_requested = REQUESTED_REGEXP.match(line)
44
+ matched_groups = GROUPS_REGEXP.match(line)
45
+
46
+ if matched_name.nil? && matched_newest.nil? && matched_installed.nil? && matched_requested.nil? && matched_groups.nil?
47
+ nil
48
+ else
49
+ {
50
+ name: gem_text(matched_name, :name),
51
+ newest: gem_text(matched_newest, :newest),
52
+ installed: gem_text(matched_installed, :installed),
53
+ requested: gem_text(matched_requested, :requested),
54
+ groups: gem_text(matched_groups, :groups)
55
+ }
56
+ end
57
+ end
58
+
59
+ outdated_gems.compact
60
+ end
61
+
62
+ def gem_text(text, name)
63
+ text ? text[name] : ''
64
+ end
65
+
66
+ def format_markdown(outdated_gems)
67
+ outdated_gems.map! do |gem|
68
+ "| #{[gem[:name], gem[:newest], gem[:installed], gem[:requested], gem[:groups]].join(' | ')} |".gsub(/ /, ' ')
69
+ end
70
+
71
+ MARKDOWN_HEADER + outdated_gems.join("\n")
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,3 @@
1
+ module BundleOutdatedFormatter
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,2 @@
1
+ require 'bundle_outdated_formatter/version'
2
+ require 'bundle_outdated_formatter/cli'
metadata ADDED
@@ -0,0 +1,161 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bundle_outdated_formatter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - emsk
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-06-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.19'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.19'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.15'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.15'
41
+ - !ruby/object:Gem::Dependency
42
+ name: coveralls
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.8'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.8'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '12.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '12.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.6'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.6'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.49'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.49'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.14'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.14'
111
+ description: BundleOutdatedFormatter is a command-line tool to format output of `bundle
112
+ outdated`
113
+ email:
114
+ - emsk1987@gmail.com
115
+ executables:
116
+ - bof
117
+ extensions: []
118
+ extra_rdoc_files: []
119
+ files:
120
+ - ".gitignore"
121
+ - ".rspec"
122
+ - ".rubocop.yml"
123
+ - ".rubocop_todo.yml"
124
+ - ".travis.yml"
125
+ - CHANGELOG.md
126
+ - Gemfile
127
+ - LICENSE.txt
128
+ - README.md
129
+ - Rakefile
130
+ - bin/console
131
+ - bin/setup
132
+ - bundle_outdated_formatter.gemspec
133
+ - exe/bof
134
+ - lib/bundle_outdated_formatter.rb
135
+ - lib/bundle_outdated_formatter/cli.rb
136
+ - lib/bundle_outdated_formatter/version.rb
137
+ homepage: https://github.com/emsk/bundle_outdated_formatter
138
+ licenses:
139
+ - MIT
140
+ metadata: {}
141
+ post_install_message:
142
+ rdoc_options: []
143
+ require_paths:
144
+ - lib
145
+ required_ruby_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ required_rubygems_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ requirements: []
156
+ rubyforge_project:
157
+ rubygems_version: 2.6.10
158
+ signing_key:
159
+ specification_version: 4
160
+ summary: Formatter for `bundle outdated`
161
+ test_files: []