devpack 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/README.md +11 -1
- data/exe/devpack +11 -23
- data/lib/devpack/exec.rb +31 -0
- data/lib/devpack/gem_glob.rb +2 -2
- data/lib/devpack/gems.rb +1 -0
- data/lib/devpack/install.rb +17 -0
- data/lib/devpack/messages.rb +5 -0
- data/lib/devpack/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc62279883bef6f044e47c419b853c89b33e76f699d7106575cd87869967b36d
|
4
|
+
data.tar.gz: 48a959cbd1004dce6752b6fb723905ad40f92c02cf73cd8432b969309d94f5a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a473937535208f922c6ceed0e137cfa758bf806bb39516e6f01906d748ef219c0fcb69fba33e195c49e95f045cf335267b7b997f300c30e6311792becba6a4ea
|
7
|
+
data.tar.gz: 5e4247975b02ec3432344755432bb887ca7036cdb9792a3c8377d3a091dc5c92a464e0e8cf5dcda82248f2039e4c6ca0efedacf4761bec870d0d2fe6101cd254
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.5.
|
1
|
+
2.5.9
|
data/README.md
CHANGED
@@ -49,10 +49,20 @@ When using a per-project configuration, `.devpack` files should be added to `.gi
|
|
49
49
|
|
50
50
|
A convenience command is provided to install all gems listed in `.devpack` file that are not already installed:
|
51
51
|
|
52
|
-
```
|
52
|
+
```bash
|
53
53
|
bundle exec devpack install
|
54
54
|
```
|
55
55
|
|
56
|
+
### Executing Commands Provided by DevPack Gems
|
57
|
+
|
58
|
+
Use the `exec` command to run a command provided by a gem installed via _Devpack_.
|
59
|
+
|
60
|
+
An example use case of this is the [Guard](https://github.com/guard/guard) gem:
|
61
|
+
|
62
|
+
```bash
|
63
|
+
bundle exec devpack exec guard
|
64
|
+
```
|
65
|
+
|
56
66
|
### Initializers
|
57
67
|
|
58
68
|
Custom initializers can be loaded by creating a directory named `.devpack_initializers` containing a set of `.rb` files.
|
data/exe/devpack
CHANGED
@@ -1,32 +1,20 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
4
|
+
command = ARGV[0]
|
5
|
+
|
6
|
+
ENV['DEVPACK_DISABLE'] = '1' if command == 'install'
|
5
7
|
|
6
8
|
require 'open3'
|
7
9
|
|
8
10
|
require 'devpack'
|
9
11
|
|
10
|
-
command
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
warn "[devpack] [exec] #{install_command}"
|
19
|
-
output, status = Open3.capture2e(install_command)
|
20
|
-
puts output
|
21
|
-
puts status
|
22
|
-
if status.success?
|
23
|
-
warn '[devpack] Installation complete.'
|
24
|
-
else
|
25
|
-
warn "[devpack] Installation failed. Manually verify this command: #{install_command}"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
exit 0
|
12
|
+
case command
|
13
|
+
when 'install'
|
14
|
+
require 'devpack/install'
|
15
|
+
when 'exec'
|
16
|
+
require 'devpack/exec'
|
17
|
+
else
|
18
|
+
warn "[devpack] Unknown command: #{command}"
|
19
|
+
exit 1
|
29
20
|
end
|
30
|
-
|
31
|
-
warn "[devpack] Unknown command: #{command}"
|
32
|
-
exit 1
|
data/lib/devpack/exec.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gem.module_eval do
|
4
|
+
def self.devpack_bin_path(gem_name, command, _version = nil)
|
5
|
+
File.join(Gem.loaded_specs[gem_name].full_gem_path, Gem.loaded_specs[gem_name].bindir, command)
|
6
|
+
end
|
7
|
+
|
8
|
+
class << self
|
9
|
+
alias_method :_orig_activate_bin_path, :activate_bin_path
|
10
|
+
alias_method :_orig_bin_path, :bin_path
|
11
|
+
|
12
|
+
def activate_bin_path(*args)
|
13
|
+
_orig_activate_bin_path(*args)
|
14
|
+
rescue Gem::Exception
|
15
|
+
devpack_bin_path(*args)
|
16
|
+
end
|
17
|
+
|
18
|
+
def bin_path(*args)
|
19
|
+
_orig_bin_path(*args)
|
20
|
+
rescue Gem::Exception
|
21
|
+
devpack_bin_path(*args)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def devpack_exec(args)
|
27
|
+
options = Bundler::Thor::CoreExt::HashWithIndifferentAccess.new({ 'keep_file_descriptors' => true })
|
28
|
+
Bundler::CLI::Exec.new(options, args).run
|
29
|
+
end
|
30
|
+
|
31
|
+
devpack_exec(ARGV[1..-1])
|
data/lib/devpack/gem_glob.rb
CHANGED
@@ -44,8 +44,8 @@ module Devpack
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def gem_path
|
47
|
-
return ENV
|
48
|
-
return ENV
|
47
|
+
return ENV.fetch('GEM_PATH', nil) if ENV.key?('GEM_PATH')
|
48
|
+
return ENV.fetch('GEM_HOME', nil) if ENV.key?('GEM_HOME')
|
49
49
|
|
50
50
|
nil
|
51
51
|
end
|
data/lib/devpack/gems.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
missing = Devpack::Gems.new(Devpack.config).tap { |gems| gems.load(silent: true) }.missing
|
4
|
+
install_command = "bundle exec gem install -V #{missing.map(&:required_version).join(' ')}" unless missing.empty?
|
5
|
+
if install_command.nil?
|
6
|
+
Devpack.warn(:info, Devpack::Messages.no_gems_to_install)
|
7
|
+
else
|
8
|
+
Devpack.warn(:info, install_command)
|
9
|
+
output, status = Open3.capture2e(install_command)
|
10
|
+
if status.success?
|
11
|
+
Devpack.warn(:success, 'Installation complete.')
|
12
|
+
else
|
13
|
+
Devpack.warn(:error, "Installation failed. Manually verify this command: #{install_command}")
|
14
|
+
puts output
|
15
|
+
end
|
16
|
+
end
|
17
|
+
exit 0
|
data/lib/devpack/messages.rb
CHANGED
@@ -52,6 +52,11 @@ module Devpack
|
|
52
52
|
alert_incompatible_message(grouped_dependencies)
|
53
53
|
end
|
54
54
|
|
55
|
+
def no_gems_to_install
|
56
|
+
"No gems to install: #{Devpack::Messages.color(:green) { Devpack.config.requested_gems.size.to_s }} "\
|
57
|
+
"gems already installed from #{Devpack::Messages.color(:cyan) { Devpack.config.devpack_path }}"
|
58
|
+
end
|
59
|
+
|
55
60
|
def test
|
56
61
|
puts "#{color(:green) { 'green' }} #{color(:red) { 'red' }} #{color(:blue) { 'blue' }}"
|
57
62
|
puts "#{color(:cyan) { 'cyan' }} #{color(:yellow) { 'yellow' }} #{color(:magenta) { 'magenta' }}"
|
data/lib/devpack/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -119,10 +119,12 @@ files:
|
|
119
119
|
- exe/devpack
|
120
120
|
- lib/devpack.rb
|
121
121
|
- lib/devpack/config.rb
|
122
|
+
- lib/devpack/exec.rb
|
122
123
|
- lib/devpack/gem_glob.rb
|
123
124
|
- lib/devpack/gem_spec.rb
|
124
125
|
- lib/devpack/gems.rb
|
125
126
|
- lib/devpack/initializers.rb
|
127
|
+
- lib/devpack/install.rb
|
126
128
|
- lib/devpack/messages.rb
|
127
129
|
- lib/devpack/railtie.rb
|
128
130
|
- lib/devpack/timeable.rb
|
@@ -150,8 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
152
|
- !ruby/object:Gem::Version
|
151
153
|
version: '0'
|
152
154
|
requirements: []
|
153
|
-
|
154
|
-
rubygems_version: 2.7.6.2
|
155
|
+
rubygems_version: 3.2.3
|
155
156
|
signing_key:
|
156
157
|
specification_version: 4
|
157
158
|
summary: Conveniently tailor your development environment
|