gem_paths 0.1.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e3d058c9c410d4ea5dc5cb24eafb7dbf7ddca4370f19931e8efe2c85be0b178
4
- data.tar.gz: 9372762550102ec570e2b2d4b438ba9b35159de9d872339e0a270d909293757c
3
+ metadata.gz: 0af38f91de340f196826c8212eafc801241008f627182ce51becf3b26bd9ba17
4
+ data.tar.gz: 8efb380d6348e099c8e135a945a7ed80e6a8bff3f86529b25d6977001957a9e5
5
5
  SHA512:
6
- metadata.gz: 3b6a76a7da04548498ab5a70e1f24878abacb554efa5e043828a8ed20365cbb71f739d72aa514df706177443c90efd22ed09523e37d1653b5f9b81d4d63cb7f8
7
- data.tar.gz: 34f371a1d60d58fafa8c436907a9d989e845c5a4d4254b2b5f92c6f220f945bce4060d4ff03fbb82adac036c00b01e960f157461ded2d349f98bb0fd24fbe0b6
6
+ metadata.gz: caa09523b18893a0428510b9341b3e7c323d5db6792b3aa46cb72b37d19e373a9c47e1bdf423d240526c3eb9a5d9c7e1ef7e66cc15ed18be01e27c658c4eb62c
7
+ data.tar.gz: dd90dc7224da6b5e146393b1c1019262d01fa13186da3229fa6b64eccd1f2a33829ba1d70bf1cd60c7ada25f008d16d8ff725d01ab0a6f5d25977fb177e414fb
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source "https://rubygems.org"
2
+ ruby "2.7.2"
2
3
 
3
4
  # Specify your gem's dependencies in gem_paths.gemspec
4
5
  gemspec
data/Gemfile.lock CHANGED
@@ -1,26 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gem_paths (0.1.0)
4
+ gem_paths (0.3.1)
5
5
  bundler (~> 2.0)
6
- thor (~> 0.20)
6
+ thor (~> 1.0, > 1.0.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- aruba (0.14.8)
12
- childprocess (>= 0.6.3, < 1.1.0)
11
+ aruba (0.14.14)
12
+ childprocess (>= 0.6.3, < 4.0.0)
13
13
  contracts (~> 0.9)
14
14
  cucumber (>= 1.3.19)
15
15
  ffi (~> 1.9)
16
16
  rspec-expectations (>= 2.99)
17
- thor (~> 0.19)
18
- backports (3.12.0)
19
- builder (3.2.3)
20
- childprocess (1.0.1)
21
- rake (< 13.0)
22
- contracts (0.16.0)
23
- cucumber (3.1.2)
17
+ thor (>= 0.19, < 2.0)
18
+ backports (3.21.0)
19
+ builder (3.2.4)
20
+ childprocess (3.0.0)
21
+ contracts (0.16.1)
22
+ cucumber (3.2.0)
24
23
  builder (>= 2.1.2)
25
24
  cucumber-core (~> 3.2.0)
26
25
  cucumber-expressions (~> 6.0.1)
@@ -36,26 +35,26 @@ GEM
36
35
  cucumber-expressions (6.0.1)
37
36
  cucumber-tag_expressions (1.1.1)
38
37
  cucumber-wire (0.0.1)
39
- diff-lcs (1.3)
40
- ffi (1.10.0)
38
+ diff-lcs (1.4.4)
39
+ ffi (1.15.4)
41
40
  gherkin (5.1.0)
42
- multi_json (1.13.1)
41
+ multi_json (1.15.0)
43
42
  multi_test (0.1.2)
44
- rake (10.5.0)
45
- rspec (3.8.0)
46
- rspec-core (~> 3.8.0)
47
- rspec-expectations (~> 3.8.0)
48
- rspec-mocks (~> 3.8.0)
49
- rspec-core (3.8.0)
50
- rspec-support (~> 3.8.0)
51
- rspec-expectations (3.8.2)
43
+ rake (13.0.6)
44
+ rspec (3.10.0)
45
+ rspec-core (~> 3.10.0)
46
+ rspec-expectations (~> 3.10.0)
47
+ rspec-mocks (~> 3.10.0)
48
+ rspec-core (3.10.1)
49
+ rspec-support (~> 3.10.0)
50
+ rspec-expectations (3.10.1)
52
51
  diff-lcs (>= 1.2.0, < 2.0)
53
- rspec-support (~> 3.8.0)
54
- rspec-mocks (3.8.0)
52
+ rspec-support (~> 3.10.0)
53
+ rspec-mocks (3.10.2)
55
54
  diff-lcs (>= 1.2.0, < 2.0)
56
- rspec-support (~> 3.8.0)
57
- rspec-support (3.8.0)
58
- thor (0.20.3)
55
+ rspec-support (~> 3.10.0)
56
+ rspec-support (3.10.2)
57
+ thor (1.1.0)
59
58
 
60
59
  PLATFORMS
61
60
  ruby
@@ -64,8 +63,11 @@ DEPENDENCIES
64
63
  aruba (~> 0.14)
65
64
  cucumber (~> 3.1)
66
65
  gem_paths!
67
- rake (~> 10.0)
66
+ rake (>= 12.3.3)
68
67
  rspec (~> 3.0)
69
68
 
69
+ RUBY VERSION
70
+ ruby 2.7.2p137
71
+
70
72
  BUNDLED WITH
71
- 2.0.1
73
+ 2.1.4
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # GemPaths
2
+
3
+ GemPaths can display the paths to the gems Bundler has/will install. It can display the paths in different formats (currently GNU Make, YAML and JSON format) and optionally display a warning if one or more of the gems have not yet been installed.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'gem_paths'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install gem_paths
20
+
21
+ ## Usage
22
+
23
+ To display a help text, do:
24
+
25
+ $ gempaths
26
+
27
+ To display the path for each installed gem, do:
28
+
29
+ $ gempaths list
30
+
31
+ ## Development
32
+
33
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run :
34
+
35
+ $ bundle exec rspec
36
+ $ bundle exec cucumber features
37
+
38
+ to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
39
+
40
+ To install your local copy of this gem onto your local machine, run `bundle exec rake install`.
41
+
42
+ ## Contributing
43
+
44
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ic-factory/gem_paths
data/exe/gem_paths ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'gem_paths/cli'
4
+
5
+ GemPaths::CLI.start
data/exe/gempaths CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ #Legacy command name. It will be removed in version 1.0.0.
4
+ #Use 'gem_paths' command instead
3
5
  require 'gem_paths/cli'
4
6
 
5
7
  GemPaths::CLI.start
data/gem_paths.gemspec CHANGED
@@ -23,8 +23,8 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ["lib"]
24
24
 
25
25
  spec.add_dependency "bundler", "~> 2.0"
26
- spec.add_dependency "thor", "~> 0.20"
27
- spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_dependency "thor", "~> 1.0", "> 1.0.0"
27
+ spec.add_development_dependency "rake", ">= 12.3.3"
28
28
  spec.add_development_dependency "rspec", "~> 3.0"
29
29
  spec.add_development_dependency "cucumber", "~> 3.1"
30
30
  spec.add_development_dependency "aruba", "~> 0.14"
@@ -0,0 +1,15 @@
1
+ require 'gem_paths/list'
2
+ require 'fileutils'
3
+
4
+ module Bundler
5
+ class Command
6
+ Plugin::API.command('gem_paths', self)
7
+
8
+ def exec(command_name, args)
9
+ gem_paths_make_file = (Bundler::SharedHelpers.root + '.bundle' + 'gem_paths.make')
10
+ puts "Updating #{gem_paths_make_file} ..."
11
+ FileUtils.mkdir_p gem_paths_make_file.dirname unless File.directory?(gem_paths_make_file.dirname)
12
+ File.write(gem_paths_make_file, GemPaths::List.to_make.join("\n") + "\n")
13
+ end
14
+ end
15
+ end
data/lib/gem_paths/cli.rb CHANGED
@@ -5,9 +5,28 @@ module GemPaths
5
5
  class CLI < Thor
6
6
 
7
7
  desc "list", "List path of each gem"
8
- # option :format, :type => :string, :banner => 'text|make', :desc => 'Specify the output format'
8
+ option :format, :type => :string, :banner => 'yaml|json|make', :default => "make", :desc => 'Specify the output format'
9
9
  def list
10
- puts GemPaths::List.to_make
10
+ defaults = {"format" => "make"}
11
+ opt = defaults.merge(options)
12
+ begin
13
+ case opt['format']
14
+ when 'yaml'
15
+ say GemPaths::List.to_yaml
16
+ when 'json'
17
+ puts GemPaths::List.to_json
18
+ when 'make'
19
+ puts GemPaths::List.to_make
20
+ when 'sh'
21
+ say GemPaths::List.to_sh
22
+ else
23
+ shell.error set_color("Invalid value for --format option. Try 'gempaths help list' for more info.", Thor::Shell::Color::RED)
24
+ exit(2)
25
+ end
26
+ rescue
27
+ shell.error set_color("Unexpected error occurred. Please make sure you have a Gemfile.lock file in your project.", Thor::Shell::Color::RED)
28
+ exit(3)
29
+ end
11
30
  end
12
31
 
13
32
  end
@@ -4,18 +4,32 @@ module GemPaths
4
4
 
5
5
  def self.gem_name_path_map
6
6
  Bundler.load.specs.sort_by(&:name).map { |s|
7
- [
8
- s.name,
9
- s.full_gem_path,
10
- ]
7
+ [s.name, s.full_gem_path]
11
8
  }
12
9
  end
13
10
  private_class_method :gem_name_path_map
14
11
 
15
12
 
16
13
  def self.to_make
17
- gem_name_path_map.map { |pair| "gempath(#{pair[0]}) := #{pair[1]}" }
14
+ gem_name_path_map.map { |pair| "export gem-path-#{pair[0]} := #{pair[1]}" }
18
15
  end
16
+
17
+ def self.to_sh
18
+ gem_name_path_map.map { |pair| "export gem-path-#{pair[0]}=#{pair[1]}" }
19
+ end
20
+
21
+ def self.to_yaml
22
+ str = "---\n"
23
+ str << "gem:\n"
24
+ str << " path:\n"
25
+ str << gem_name_path_map.map { |pair| " #{pair[0]}: #{pair[1]}" }.join("\n")
26
+ end
27
+
28
+ def self.to_json
29
+ require 'json'
30
+ JSON.pretty_generate(Hash[*gem_name_path_map.flatten])
31
+ end
32
+
19
33
  end
20
34
 
21
35
  end
@@ -0,0 +1,23 @@
1
+ require 'gem_paths/list'
2
+ require 'fileutils'
3
+
4
+ module GemPaths
5
+ module Plugin
6
+
7
+ class << self
8
+ # Registers the plugin and adds all needed hooks
9
+ # Will call troubleshoot via the `after-install` hook if the install does not succeed
10
+ def register
11
+ return if defined?(@registered) && @registered
12
+ @registered = true
13
+ Bundler::Plugin.add_hook('after-install-all') do |spec_install|
14
+ gem_paths_make_file = (Bundler::SharedHelpers.root + '.bundle' + 'gem_paths.make')
15
+ puts "Updating #{gem_paths_make_file} ..."
16
+ FileUtils.mkdir_p gem_paths_make_file.dirname unless File.directory?(gem_paths_make_file.dirname)
17
+ File.write(gem_paths_make_file, GemPaths::List.to_make.join("\n") + "\n")
18
+ end
19
+ end
20
+ end
21
+
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module GemPaths
2
- VERSION = "0.1.0"
2
+ VERSION = "0.4.0"
3
3
  end
data/plugins.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'bundler/command'
2
+ require 'gem_paths/plugin'
3
+ GemPaths::Plugin.register
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem_paths
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Torben Jacobsen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-12 00:00:00.000000000 Z
11
+ date: 2021-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,28 +30,34 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.20'
33
+ version: '1.0'
34
+ - - ">"
35
+ - !ruby/object:Gem::Version
36
+ version: 1.0.0
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
41
  - - "~>"
39
42
  - !ruby/object:Gem::Version
40
- version: '0.20'
43
+ version: '1.0'
44
+ - - ">"
45
+ - !ruby/object:Gem::Version
46
+ version: 1.0.0
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: rake
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - "~>"
51
+ - - ">="
46
52
  - !ruby/object:Gem::Version
47
- version: '10.0'
53
+ version: 12.3.3
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - "~>"
58
+ - - ">="
53
59
  - !ruby/object:Gem::Version
54
- version: '10.0'
60
+ version: 12.3.3
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: rspec
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -99,6 +105,7 @@ description: This gem is used to get the paths for all gems known to Bundler in
99
105
  email:
100
106
  - torben@ic-factory.com
101
107
  executables:
108
+ - gem_paths
102
109
  - gempaths
103
110
  extensions: []
104
111
  extra_rdoc_files: []
@@ -109,20 +116,25 @@ files:
109
116
  - Gemfile
110
117
  - Gemfile.lock
111
118
  - LICENSE
119
+ - README.md
112
120
  - Rakefile
113
121
  - bin/console
114
122
  - bin/setup
123
+ - exe/gem_paths
115
124
  - exe/gempaths
116
125
  - gem_paths.gemspec
126
+ - lib/bundler/command.rb
117
127
  - lib/gem_paths.rb
118
128
  - lib/gem_paths/cli.rb
119
129
  - lib/gem_paths/list.rb
130
+ - lib/gem_paths/plugin.rb
120
131
  - lib/gem_paths/version.rb
132
+ - plugins.rb
121
133
  homepage: https://github.com/ic-factory/gem_paths
122
134
  licenses:
123
135
  - LGPL-3.0
124
136
  metadata: {}
125
- post_install_message:
137
+ post_install_message:
126
138
  rdoc_options: []
127
139
  require_paths:
128
140
  - lib
@@ -137,9 +149,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
149
  - !ruby/object:Gem::Version
138
150
  version: '0'
139
151
  requirements: []
140
- rubyforge_project:
141
- rubygems_version: 2.7.7
142
- signing_key:
152
+ rubygems_version: 3.1.4
153
+ signing_key:
143
154
  specification_version: 4
144
155
  summary: Gem to be used in plugin for Bundler, which can list gem paths in various
145
156
  output formats, eg. GNU Make.