procodile 1.0.23 → 1.0.24
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 +5 -5
- data/lib/procodile/cli.rb +21 -11
- data/lib/procodile/config.rb +10 -1
- data/lib/procodile/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8c569df8d2c6c6856ccafe238692a99dea26e8a995e71ea1b0d8c091a89d11e2
|
4
|
+
data.tar.gz: 51160b5b73404487af17a384d06effe2c68b9e080ce0f46e036a4a883402c9bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75c724357246a55bb06154b517d94d99bf67b9e8a35d87544a24f459a446241b983bd4434dedd971d98f987b96089243ae5e16bf9d88285e346f59e51b2049d6
|
7
|
+
data.tar.gz: 7a44a64b4800fa54f6487cd2a9b02e4451d16dd7fa1c9663fa0a545efd7c775eb8f0b945237b3504c631e1964109246840acb93fea4d2261fab2186caa06eb7a
|
data/lib/procodile/cli.rb
CHANGED
@@ -55,7 +55,9 @@ module Procodile
|
|
55
55
|
puts "The following commands are supported:"
|
56
56
|
puts
|
57
57
|
self.class.commands.sort_by { |k,v| k.to_s }.each do |method, options|
|
58
|
-
|
58
|
+
if options[:description]
|
59
|
+
puts " \e[34m#{method.to_s.ljust(18, ' ')}\e[0m #{options[:description]}"
|
60
|
+
end
|
59
61
|
end
|
60
62
|
puts
|
61
63
|
puts "For details for the options available for each command, use the --help option."
|
@@ -362,19 +364,32 @@ module Procodile
|
|
362
364
|
#
|
363
365
|
# Run a command with a procodile environment
|
364
366
|
#
|
365
|
-
desc "
|
366
|
-
command def
|
367
|
-
desired_command = ARGV.drop(1).join(' ')
|
367
|
+
desc "Execute a command within the environment"
|
368
|
+
command def exec(command = nil)
|
369
|
+
desired_command = command || ARGV.drop(1).join(' ')
|
370
|
+
|
371
|
+
if prefix = @config.exec_prefix
|
372
|
+
desired_command = "#{prefix} #{desired_command}"
|
373
|
+
end
|
374
|
+
|
368
375
|
if desired_command.length == 0
|
369
376
|
raise Error, "You need to specify a command to run (e.g. procodile run -- rake db:migrate)"
|
370
377
|
else
|
378
|
+
environment = @config.environment_variables
|
379
|
+
puts "Running with #{desired_command.color(33)}"
|
380
|
+
for key, value in environment
|
381
|
+
puts " #{key.color(34)} #{value}"
|
382
|
+
end
|
383
|
+
|
371
384
|
begin
|
372
|
-
exec(
|
385
|
+
Kernel.exec(environment, desired_command)
|
373
386
|
rescue Errno::ENOENT => e
|
374
387
|
raise Error, e.message
|
375
388
|
end
|
376
389
|
end
|
377
390
|
end
|
391
|
+
alias run exec
|
392
|
+
command :run
|
378
393
|
|
379
394
|
#
|
380
395
|
# Run the configured console command
|
@@ -382,12 +397,7 @@ module Procodile
|
|
382
397
|
desc "Open a console within the environment"
|
383
398
|
command def console
|
384
399
|
if cmd = @config.console_command
|
385
|
-
|
386
|
-
begin
|
387
|
-
exec(environment, cmd)
|
388
|
-
rescue Errno::ENOENT => e
|
389
|
-
raise Error, e.message
|
390
|
-
end
|
400
|
+
exec(cmd)
|
391
401
|
else
|
392
402
|
raise Error, "No console command has been configured in the Procfile"
|
393
403
|
end
|
data/lib/procodile/config.rb
CHANGED
@@ -40,6 +40,7 @@ module Procodile
|
|
40
40
|
@local_options = nil
|
41
41
|
@local_process_options = nil
|
42
42
|
@loaded_at = nil
|
43
|
+
@environment_variables = nil
|
43
44
|
|
44
45
|
if @processes
|
45
46
|
process_list.each do |name, command|
|
@@ -89,6 +90,10 @@ module Procodile
|
|
89
90
|
local_options['console_command'] || options['console_command']
|
90
91
|
end
|
91
92
|
|
93
|
+
def exec_prefix
|
94
|
+
local_options['exec_prefix'] || options['exec_prefix']
|
95
|
+
end
|
96
|
+
|
92
97
|
def processes
|
93
98
|
@processes ||= {}
|
94
99
|
end
|
@@ -118,7 +123,11 @@ module Procodile
|
|
118
123
|
end
|
119
124
|
|
120
125
|
def environment_variables
|
121
|
-
|
126
|
+
@environment_variables ||= begin
|
127
|
+
(options['env'] || {}).merge(local_options['env'] || {}).each_with_object({}) do |(key, value), hash|
|
128
|
+
hash[key.to_s] = value.to_s
|
129
|
+
end
|
130
|
+
end
|
122
131
|
end
|
123
132
|
|
124
133
|
def pid_root
|
data/lib/procodile/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: procodile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Cooke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -69,8 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
|
-
|
73
|
-
rubygems_version: 2.5.2.3
|
72
|
+
rubygems_version: 3.0.6
|
74
73
|
signing_key:
|
75
74
|
specification_version: 4
|
76
75
|
summary: This gem will help you run processes from a Procfile on Linux/macOS machines
|