deployments 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -1
- data/config/deployments.yml +2 -0
- data/lib/deployments/build.rb +6 -1
- data/lib/deployments/version.rb +1 -1
- data/spec/build_spec.rb +6 -1
- data/spec/deployments_spec.rb +4 -0
- data/spec/dispatcher_spec.rb +1 -11
- metadata +1 -1
data/README.md
CHANGED
@@ -25,11 +25,15 @@ If you are using Rails 2 version you should add load method to your Rakefile:
|
|
25
25
|
```
|
26
26
|
|
27
27
|
At first you need to create in the config folder deployments.yml file with
|
28
|
-
|
28
|
+
receiver server url and domains of different envs of your application:
|
29
29
|
|
30
30
|
```yaml
|
31
31
|
options:
|
32
32
|
server: "your deployments server that will save build version"
|
33
|
+
development:
|
34
|
+
domain: "development.example.com"
|
35
|
+
staging:
|
36
|
+
domain: "staging.example.com"
|
33
37
|
```
|
34
38
|
|
35
39
|
Add to your capistrano recipes the next following line, changing your_app_env
|
data/config/deployments.yml
CHANGED
data/lib/deployments/build.rb
CHANGED
@@ -14,7 +14,8 @@ module Deployments
|
|
14
14
|
:username => username,
|
15
15
|
:env => env,
|
16
16
|
:tag => tag,
|
17
|
-
:commits => commits
|
17
|
+
:commits => commits,
|
18
|
+
:domain => domain
|
18
19
|
}
|
19
20
|
end
|
20
21
|
|
@@ -31,6 +32,10 @@ module Deployments
|
|
31
32
|
def tag
|
32
33
|
project.tag
|
33
34
|
end
|
35
|
+
|
36
|
+
def domain
|
37
|
+
Deployments.send(env.to_sym).domain
|
38
|
+
end
|
34
39
|
end
|
35
40
|
end
|
36
41
|
|
data/lib/deployments/version.rb
CHANGED
data/spec/build_spec.rb
CHANGED
@@ -12,10 +12,15 @@ describe Build do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should return env" do
|
15
|
-
build.should_receive(:env).and_return("staging")
|
15
|
+
build.should_receive(:env).twice.and_return("staging")
|
16
16
|
build.to_params[:env].should == "staging"
|
17
17
|
end
|
18
18
|
|
19
|
+
it "should return domain by env" do
|
20
|
+
build.should_receive(:domain).and_return("staging.example.com")
|
21
|
+
build.to_params[:domain].should == "staging.example.com"
|
22
|
+
end
|
23
|
+
|
19
24
|
context "in the current git project" do
|
20
25
|
let(:project_path) { './spec/fixtures/repositories/commits_tag/dot_git' }
|
21
26
|
|
data/spec/deployments_spec.rb
CHANGED
data/spec/dispatcher_spec.rb
CHANGED
@@ -36,17 +36,7 @@ describe Dispatcher do
|
|
36
36
|
|
37
37
|
context "with valid data" do
|
38
38
|
let(:response) { double('response', :response_code => 200) }
|
39
|
-
let(:fields)
|
40
|
-
{
|
41
|
-
:username => "john.smith",
|
42
|
-
:env => "staging",
|
43
|
-
:tag => "0.0.1",
|
44
|
-
:commits => [
|
45
|
-
"Added deployments section to the README file",
|
46
|
-
"Added README file"
|
47
|
-
]
|
48
|
-
}
|
49
|
-
end
|
39
|
+
let(:fields) { { } }
|
50
40
|
|
51
41
|
it "should successfully send" do
|
52
42
|
dispatcher.run.should be_true
|