bundler-native-gems 0.2.0 → 1.0.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
  SHA1:
3
- metadata.gz: 3bea8400c96f4d4e1e517947e030c155bb365d54
4
- data.tar.gz: 7a40489608c509525cf4a87a80fa7e96736c1b69
3
+ metadata.gz: e5833d7bfd6fde1876c0e3d97fa60f02c4b85cd2
4
+ data.tar.gz: f9b245483d12bd7dac9e87c73c884b0439aa2996
5
5
  SHA512:
6
- metadata.gz: dc79bfad18e735ef7431eb2e80dd1ecd8c7fe3a37e10ff74560cfcbe0985457cb45b017e8f03593765c3814223c800c5c681944e16724453524d60a457f4fae6
7
- data.tar.gz: bff91a20d55959d6114360f2542624226614fcf1ec57557cc7f171a704661daf73bfcbc8f6c369d72e515e3f2d03b96b09f24aa69a35d7e9975bd13d084c0af1
6
+ metadata.gz: d8b7d2a6359fffefc5b43cfbe62dfd5af0ebb6ef509fc3a8e283bfe1bd69069b7b1b47454c5b654bb68dd80f12410dc2a96da2f35c72772f41673ece3ae8a8d2
7
+ data.tar.gz: cfd7b6b3542748a4a2733acf1c82ec1d185123b6d1427dfd6d96e064d8f7341e15f05a0949d6bde00b65a1111d51c63d1cbb852da0b923b34c4b9ab34d41b42f
@@ -17,7 +17,6 @@ Gem::Specification.new do |spec|
17
17
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_development_dependency "bundler", "~> 1.11"
21
-
22
- spec.add_dependency "tty", "~> 0.4.0"
20
+ spec.add_dependency "bundler", "~> 1.11"
21
+ spec.add_dependency "terminal-table", "~> 1.5"
23
22
  end
@@ -1,19 +1,64 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- begin
4
- require "tty"
5
- rescue LoadError
6
- puts "Install the `tty` gem please"
7
- exit 1
3
+ if ARGV.include?("--help") || ARGV.include?("-h")
4
+ $stderr.puts <<-HELP
5
+ USAGE: bundler native-gems [OPTIONS]
6
+
7
+ OPTIONS:
8
+ --with group1 [group2, etc] - include gems from these bundler groups
9
+ --with group1 [group2, etc] - exclude gems from these bundler groups
10
+ --help - You're looking at it
11
+ HELP
12
+ exit 0
8
13
  end
9
14
 
10
- require "bundler/setup"
15
+ require "bundler/cli"
16
+ require "terminal-table"
17
+
18
+ class NativeGems
19
+
20
+ attr_reader :with, :without
21
+
22
+ def initialize(options)
23
+ @with = Array(options["with"]).map(&:to_sym)
24
+ @without = Array(options["without"]).map(&:to_sym)
25
+ end
26
+
27
+ def run
28
+ groups = definition.groups - without + with
29
+ resolved_specs = definition.specs_for(groups).to_a
30
+ native_specs = resolved_specs.select { |spec| spec.extensions.any? }
11
31
 
12
- native_specs = Bundler.definition.resolve.to_a.select { |spec| spec.__materialize__.extensions.any? }
32
+ output = if $stdout.tty?
33
+ rows = [["Name", "Version"]]
34
+ output = Terminal::Table.new do |t|
35
+ t << ["Name", "Version"]
36
+ t << :separator
37
+ native_specs.each do |spec|
38
+ t << [spec.name, spec.version]
39
+ end
40
+ end
41
+ else
42
+ native_specs.map { |spec| "#{spec.name}\t#{spec.version}" }
43
+ end
13
44
 
14
- table = TTY::Table.new(
15
- header: ["Gem Name", "Version"],
16
- rows: native_specs.sort_by(&:name).map {|spec| [spec.name, spec.version] }
17
- )
45
+ $stdout.puts output
46
+ end
47
+
48
+ private
49
+
50
+ def definition
51
+ Bundler.definition
52
+ end
53
+ end
54
+
55
+ class CLI < Bundler::CLI
56
+ desc "native_gems [OPTIONS]", "Lists the gems with native extensions"
57
+ method_option "without", :type => :array, :banner => "Exclude gems that are part of the specified named group."
58
+ method_option "with", :type => :array, :banner => "Include gems that are part of the specified named group."
59
+ def native_gems
60
+ NativeGems.new(options).run
61
+ end
62
+ end
18
63
 
19
- puts table.render(:ascii, padding: [0, 1, 0, 1])
64
+ CLI.start(ARGV.dup.unshift("native_gems"), :debug => true)
@@ -1,3 +1,3 @@
1
1
  module BundlerNativeGems
2
- VERSION = "0.2.0"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler-native-gems
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caius Durling
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-19 00:00:00.000000000 Z
11
+ date: 2016-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -17,7 +17,7 @@ dependencies:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.11'
20
- type: :development
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.11'
27
27
  - !ruby/object:Gem::Dependency
28
- name: tty
28
+ name: terminal-table
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.4.0
33
+ version: '1.5'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.4.0
40
+ version: '1.5'
41
41
  description:
42
42
  email:
43
43
  - dev@caius.name
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  version: '0'
75
75
  requirements: []
76
76
  rubyforge_project:
77
- rubygems_version: 2.6.2
77
+ rubygems_version: 2.6.3
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Inspect your Gemfile to list gems with native extensions