foreman 0.77.0 → 0.78.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
  SHA1:
3
- metadata.gz: 8ace00c61e2302bb26cb004552b600bf0c791f3b
4
- data.tar.gz: d9d96a049154dcac4402f72a4251bcd5ac21daf5
3
+ metadata.gz: 61aa36818c7a0458ef2d9c2036bd212a82e2d7d1
4
+ data.tar.gz: 99520a0b2ddbeb2d1fb598889d6e872eb92d1e09
5
5
  SHA512:
6
- metadata.gz: 1d6f953545ff47dc24a7dd19739fd4cf5b5a898830180bed8f953b9d5fa2e953339163a86040ce1a7589b9dd9b66f5e065bfbc6a2555462fccca6645073d59a2
7
- data.tar.gz: 2ffde5cf550f9ae2f2c14e7b6f5ed06bdccbbad46b65b8bb7d6d37e41c7328e193391a0df5156fcb6575164ad708ffeec87cba89684a1c60951925f6e8adddce
6
+ metadata.gz: f6087790b0cd0f11bdde14756b74caba08458bd199e59674a1a2e850dc81a6042c17758b6fc5c6e914c7d1144f7a34eab2cd7229b5d7496eb8904625bb0f014e
7
+ data.tar.gz: 6233777b4f9f42fd29bbbe63967e790095faa9c797b69a16c478d3ce22a5f784ecf6f4afdbb4596fba7bb840dbae4b45f2e20f95a4d9ac1db196fd4fb1e922f0
@@ -74,6 +74,7 @@ class Foreman::CLI < Thor
74
74
  desc "run COMMAND [ARGS...]", "Run a command using your application's environment"
75
75
 
76
76
  method_option :env, :type => :string, :aliases => "-e", :desc => "Specify an environment file to load, defaults to .env"
77
+ stop_on_unknown_option! :run
77
78
 
78
79
  def run(*args)
79
80
  load_environment!
@@ -1,7 +1,7 @@
1
1
  require "foreman"
2
+ require "foreman/env"
2
3
  require "foreman/process"
3
4
  require "foreman/procfile"
4
- require "dotenv"
5
5
  require "tempfile"
6
6
  require "timeout"
7
7
  require "fileutils"
@@ -169,7 +169,9 @@ class Foreman::Engine
169
169
  # @param [String] filename A .env file to load into the environment
170
170
  #
171
171
  def load_env(filename)
172
- @env.update Dotenv::Environment.new(filename)
172
+ Foreman::Env.new(filename).entries do |name, value|
173
+ @env[name] = value
174
+ end
173
175
  end
174
176
 
175
177
  # Send a signal to all processes started by this +Engine+
@@ -0,0 +1,29 @@
1
+ require "foreman"
2
+
3
+ class Foreman::Env
4
+
5
+ attr_reader :entries
6
+
7
+ def initialize(filename)
8
+ @entries = File.read(filename).gsub("\r\n","\n").split("\n").inject({}) do |ax, line|
9
+ if line =~ /\A([A-Za-z_0-9]+)=(.*)\z/
10
+ key = $1
11
+ case val = $2
12
+ # Remove single quotes
13
+ when /\A'(.*)'\z/ then ax[key] = $1
14
+ # Remove double quotes and unescape string preserving newline characters
15
+ when /\A"(.*)"\z/ then ax[key] = $1.gsub('\n', "\n").gsub(/\\(.)/, '\1')
16
+ else ax[key] = val
17
+ end
18
+ end
19
+ ax
20
+ end
21
+ end
22
+
23
+ def entries
24
+ @entries.each do |key, value|
25
+ yield key, value
26
+ end
27
+ end
28
+
29
+ end
@@ -1,5 +1,5 @@
1
1
  module Foreman
2
2
 
3
- VERSION = "0.77.0"
3
+ VERSION = "0.78.0"
4
4
 
5
5
  end
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "FOREMAN" "1" "January 2015" "Foreman 0.77.0" "Foreman Manual"
4
+ .TH "FOREMAN" "1" "January 2015" "Foreman 0.78.0" "Foreman Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBforeman\fR \- manage Procfile\-based applications
@@ -46,6 +46,10 @@ Specify an alternate Procfile to load, implies \fB\-d\fR at the Procfile root\.
46
46
  \fB\-p\fR, \fB\-\-port\fR
47
47
  Specify which port to use as the base for this application\. Should be a multiple of 1000\.
48
48
  .
49
+ .TP
50
+ \fB\-t\fR, \fB\-\-timeout\fR
51
+ Specify the amount of time (in seconds) processes have to shutdown gracefully before receiving a SIGKILL, defaults to 5\.
52
+ .
49
53
  .P
50
54
  \fBforeman run\fR is used to run one\-off commands using the same environment as your defined processes\.
51
55
  .
@@ -76,8 +76,12 @@ describe "Foreman::CLI", :fakefs do
76
76
  expect(forked_foreman("run echo 1")).to eq("1\n")
77
77
  end
78
78
 
79
+ it "doesn't parse options for the command" do
80
+ expect(forked_foreman("run grep -e FOO #{resource_path(".env")}")).to eq("FOO=bar\n")
81
+ end
82
+
79
83
  it "includes the environment" do
80
- expect(forked_foreman("run #{resource_path("bin/env FOO")} -e #{resource_path(".env")}")).to eq("bar\n")
84
+ expect(forked_foreman("run -e #{resource_path(".env")} #{resource_path("bin/env FOO")}")).to eq("bar\n")
81
85
  end
82
86
 
83
87
  it "can run a command from the Procfile" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.77.0
4
+ version: 0.78.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Dollar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-02 00:00:00.000000000 Z
11
+ date: 2015-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.19.1
27
- - !ruby/object:Gem::Dependency
28
- name: dotenv
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 1.0.2
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 1.0.2
41
27
  description: Process manager for applications with multiple components
42
28
  email: ddollar@gmail.com
43
29
  executables:
@@ -75,6 +61,7 @@ files:
75
61
  - lib/foreman/distribution.rb
76
62
  - lib/foreman/engine.rb
77
63
  - lib/foreman/engine/cli.rb
64
+ - lib/foreman/env.rb
78
65
  - lib/foreman/export.rb
79
66
  - lib/foreman/export/base.rb
80
67
  - lib/foreman/export/bluepill.rb