foreplay 0.2.0 → 0.2.1

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: 6a871af7ae274b786c2187f8ad0e350ffd7de0f5
4
- data.tar.gz: 2be85bd0359759db0c8aceff3f35717c082b7e3d
3
+ metadata.gz: 97f18a0731191cf469fba1995ee53ecd33c2fbc2
4
+ data.tar.gz: b4bcb4397858d6d851eeac32b87efd65077e1c20
5
5
  SHA512:
6
- metadata.gz: 2e3d7affb047792f2395255f826a6756648ee84495844156fecbb82161888dc1ab43f641c7fce07aeaa8d3521709bba573fc444e89cb5f88116e0bbcd6f18803
7
- data.tar.gz: c033baf78141a6a16fdd757599459e89c7c04951d84f62aa7e4ff83414419e4ffe2f1ed9d4c0080b5ba21c8ed9f05beb27185c21c22f447f8906a616a6cd1cb8
6
+ metadata.gz: b02466199c0278fc600d582027ad50969ae558e6ba4cdc37508065fb4d11f0ff0ffeb62c27226f582629f85ef5dd4ea1f979721bfe793fa473353ac266e9d303
7
+ data.tar.gz: 83471c6f9631f3158a64e32fce3d82d1648a8341e7d1cd2aaa064ebbeb4380e566515509e2a5f3164946526aa6bdf38911de194bd5f1f8f35eb8e4c5cd61362a
@@ -145,6 +145,11 @@ module Foreplay
145
145
  instructions[:foreman]['user'] = user
146
146
  instructions[:foreman]['log'] = "$HOME/#{path}/#{current_port}/log"
147
147
 
148
+ # Contents of .env file
149
+ instructions[:env]['HOME'] = '$HOME'
150
+ instructions[:env]['SHELL'] = '$SHELL'
151
+ instructions[:env]['PATH'] = '$PATH:`which bundle`'
152
+
148
153
  # Commands to execute on remote server
149
154
  steps = [
150
155
  { command: "mkdir -p #{path} && cd #{path} && rm -rf #{current_port} && git clone #{repository} #{current_port}",
@@ -153,7 +158,7 @@ module Foreplay
153
158
  commentary: 'Trusting the .rvmrc file for the new instance' },
154
159
  { command: "rvm rvmrc warning ignore #{current_port}",
155
160
  commentary: 'Ignoring the .rvmrc warning for the new instance' },
156
- { command: "cd #{current_port}",
161
+ { command: "cd #{current_port} && mkdir -p log",
157
162
  commentary: 'If you have a .rvmrc file there may be a delay now while we install a new ruby' },
158
163
  { command: 'if [ -f .ruby-version ] ; then rvm install `cat .ruby-version` ; else echo "No .ruby-version file found" ; fi',
159
164
  commentary: 'If you have a .ruby-version file there may be a delay now while we install a new ruby' },
@@ -184,12 +189,6 @@ module Foreplay
184
189
  commentary: 'Using bundler to install the required gems in deployment mode' },
185
190
  { command: 'sudo ln -f `which foreman` /usr/bin/foreman || echo Using default version of foreman',
186
191
  commentary: 'Setting the current version of foreman to be the default' },
187
- { command: 'echo HOME="$HOME" >> .env',
188
- commentary: 'Adding home path to .env (foreplay issue #443)' },
189
- { command: 'echo SHELL="$SHELL" >> .env',
190
- commentary: 'Adding shell path to .env (foreplay issue #443)' },
191
- { command: 'echo PATH="$PATH:`which bundle`" >> .env',
192
- commentary: 'Adding bundler path to .env (foreplay issue #443)' },
193
192
  { command: 'sudo foreman export upstart /etc/init',
194
193
  commentary: "Converting #{current_service} to an upstart service" },
195
194
  { command: "sudo start #{current_service} || sudo restart #{current_service}",
@@ -1,3 +1,3 @@
1
1
  module Foreplay
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
@@ -11,7 +11,7 @@ describe Foreplay::Deploy do
11
11
  before :each do
12
12
  # Setup foreplay
13
13
  `rm -f config/foreplay.yml`
14
- `foreplay setup -r git@github.com:Xenapto/foreplay.git -s web.example.com -f apps/%a -u fred --password trollope`
14
+ `foreplay setup -r git@github.com:Xenapto/foreplay.git -s web1.example.com web2.example.com -f apps/%a -u fred --password trollope`
15
15
 
16
16
  # Stub all the things
17
17
  Net::SSH.stub(:start).and_yield(session)
@@ -40,7 +40,7 @@ describe Foreplay::Deploy do
40
40
  expect { Foreplay::Deploy.start([:deploy, 'production', '']) }
41
41
  .to raise_error(
42
42
  RuntimeError,
43
- /.*No authentication methods supplied. You must supply a private key, key file or password in the configuration file*/
43
+ /.*No authentication methods supplied. You must supply a private key, key file or password in the configuration file.*/
44
44
  )
45
45
  end
46
46
 
@@ -48,18 +48,36 @@ describe Foreplay::Deploy do
48
48
  `rm -f config/foreplay.yml`
49
49
  `foreplay setup -r git@github.com:Xenapto/foreplay.git -s web.example.com -f apps/%a -u fred --keyfile "/home/fred/no-such-file"`
50
50
  expect { Foreplay::Deploy.start([:deploy, 'production', '']) }
51
- .to raise_error(Errno::ENOENT, %r{.*No such file or directory @ rb_sysopen - /home/fred/no-such-file*})
51
+ .to raise_error(Errno::ENOENT, %r{.*No such file or directory @ rb_sysopen - /home/fred/no-such-file.*})
52
+ end
53
+
54
+ it 'complains if a mandatory key is missing from the config file' do
55
+ `sed -i 's/path:/pxth:/' config/foreplay.yml`
56
+
57
+ expect { Foreplay::Deploy.start([:deploy, 'production', '']) }
58
+ .to raise_error(
59
+ RuntimeError,
60
+ /.*Required key path not found in instructions for production environment.*/
61
+ )
62
+ end
63
+
64
+ it 'complains if we try to deploy an environment that isn\'t defined' do
65
+ expect { Foreplay::Deploy.start([:deploy, 'unknown', '']) }
66
+ .to raise_error(
67
+ RuntimeError,
68
+ /.*No deployment configuration defined for unknown environment.*/
69
+ )
52
70
  end
53
71
 
54
72
  it 'should terminate if a remote process exits with a non-zero status' do
55
73
  process.stub(:exit_status).and_return(1)
56
- expect { Foreplay::Deploy.start([:deploy, 'production', '']) }.to raise_error(RuntimeError, /.*output message*/)
74
+ expect { Foreplay::Deploy.start([:deploy, 'production', '']) }.to raise_error(RuntimeError, /.*output message.*/)
57
75
  end
58
76
 
59
77
  it "should terminate if a connection can't be established with the remote server" do
60
78
  Net::SSH.unstub(:start)
61
79
  expect { Foreplay::Deploy.start([:deploy, 'production', '']) }
62
- .to raise_error(RuntimeError, /.*There was a problem starting an ssh session on web.example.com*/)
80
+ .to raise_error(RuntimeError, /.*There was a problem starting an ssh session on web1.example.com.*/)
63
81
  end
64
82
 
65
83
  it 'should check the config' do
@@ -68,13 +86,13 @@ describe Foreplay::Deploy do
68
86
  end
69
87
 
70
88
  it 'should deploy to the environment' do
71
- Net::SSH.should_receive(:start).with('web.example.com', 'fred', verbose: :warn, port: 22, password: 'trollope').and_yield(session)
89
+ Net::SSH.should_receive(:start).with('web1.example.com', 'fred', verbose: :warn, port: 22, password: 'trollope').and_yield(session)
72
90
 
73
91
  [
74
92
  'mkdir -p apps/foreplay && cd apps/foreplay && rm -rf 50000 && git clone git@github.com:Xenapto/foreplay.git 50000',
75
93
  'rvm rvmrc trust 50000',
76
94
  'rvm rvmrc warning ignore 50000',
77
- 'cd 50000',
95
+ 'cd 50000 && mkdir -p log',
78
96
  'if [ -f .ruby-version ] ; then rvm install `cat .ruby-version` ; else echo "No .ruby-version file found" ; fi',
79
97
  'mkdir -p config',
80
98
  'echo "RAILS_ENV=production" > .env',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreplay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xenapto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-16 00:00:00.000000000 Z
11
+ date: 2014-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport