deployments 0.0.5 → 0.0.6
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.
- data/Gemfile +0 -1
- data/README.md +10 -5
- data/config/deployments.yml +1 -0
- data/lib/deployments/build.rb +17 -6
- data/lib/deployments/version.rb +1 -1
- data/spec/build_spec.rb +12 -6
- data/spec/deployments_spec.rb +4 -0
- metadata +2 -2
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -32,8 +32,10 @@ receiver server url and domains of different envs of your application:
|
|
32
32
|
server: "your deployments server that will save build version"
|
33
33
|
development:
|
34
34
|
domain: "development.example.com"
|
35
|
+
api_key: "development api key"
|
35
36
|
staging:
|
36
37
|
domain: "staging.example.com"
|
38
|
+
api_key: "staging api key"
|
37
39
|
```
|
38
40
|
|
39
41
|
Add to your capistrano recipes the next following line, changing your_app_env
|
@@ -52,11 +54,14 @@ to the deployment environment like 'staging' or 'development':
|
|
52
54
|
Request params:
|
53
55
|
```ruby
|
54
56
|
{
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
{
|
58
|
+
:author => "author",
|
59
|
+
:commits => ["commits", "between", "tags"],
|
60
|
+
:env => "staging",
|
61
|
+
:version => "1.0.1",
|
62
|
+
:domain => "staging.example.com"
|
63
|
+
},
|
64
|
+
:api_key => "account api key"
|
60
65
|
}
|
61
66
|
```
|
62
67
|
|
data/config/deployments.yml
CHANGED
data/lib/deployments/build.rb
CHANGED
@@ -11,11 +11,14 @@ module Deployments
|
|
11
11
|
|
12
12
|
def to_params
|
13
13
|
{
|
14
|
-
:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
:deployment => {
|
15
|
+
:author => username,
|
16
|
+
:env => env,
|
17
|
+
:version => tag,
|
18
|
+
:commits => commits,
|
19
|
+
:domain => domain
|
20
|
+
},
|
21
|
+
:api_key => api_key
|
19
22
|
}
|
20
23
|
end
|
21
24
|
|
@@ -34,7 +37,15 @@ module Deployments
|
|
34
37
|
end
|
35
38
|
|
36
39
|
def domain
|
37
|
-
|
40
|
+
settings.domain
|
41
|
+
end
|
42
|
+
|
43
|
+
def api_key
|
44
|
+
settings.api_key
|
45
|
+
end
|
46
|
+
|
47
|
+
def settings
|
48
|
+
Deployments.send(env.to_sym)
|
38
49
|
end
|
39
50
|
end
|
40
51
|
end
|
data/lib/deployments/version.rb
CHANGED
data/spec/build_spec.rb
CHANGED
@@ -6,19 +6,25 @@ describe Build do
|
|
6
6
|
let(:build) { Build.new("staging") }
|
7
7
|
|
8
8
|
describe "interface for getting build information as json params" do
|
9
|
+
let(:params) { build.to_params[:deployment] }
|
10
|
+
|
9
11
|
it "should return deployer name information" do
|
10
12
|
Etc.should_receive(:getlogin).and_return("john.smith")
|
11
|
-
|
13
|
+
params[:author].should == "john.smith"
|
12
14
|
end
|
13
15
|
|
14
16
|
it "should return env" do
|
15
|
-
build.should_receive(:env).
|
16
|
-
|
17
|
+
build.should_receive(:env).exactly(3).and_return("staging")
|
18
|
+
params[:env].should == "staging"
|
17
19
|
end
|
18
20
|
|
19
21
|
it "should return domain by env" do
|
20
22
|
build.should_receive(:domain).and_return("staging.example.com")
|
21
|
-
|
23
|
+
params[:domain].should == "staging.example.com"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should return api key dedicated to the env" do
|
27
|
+
build.to_params[:api_key].should == 'api key'
|
22
28
|
end
|
23
29
|
|
24
30
|
context "in the current git project" do
|
@@ -33,11 +39,11 @@ describe Build do
|
|
33
39
|
end
|
34
40
|
|
35
41
|
it "should return current tag of the git project" do
|
36
|
-
|
42
|
+
params[:version].should == "0.0.1"
|
37
43
|
end
|
38
44
|
|
39
45
|
it "should return commits of the git project between the latests tags" do
|
40
|
-
|
46
|
+
params[:commits].should == [
|
41
47
|
"Added deployments section to the README file",
|
42
48
|
"Added README file"
|
43
49
|
]
|
data/spec/deployments_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deployments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: curb
|