deployments 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -7,7 +7,6 @@ gem 'grit'
7
7
  gem 'simple-conf'
8
8
 
9
9
  group :development do
10
- gem 'debugger'
11
10
  gem 'ruby_gntp'
12
11
  gem 'guard'
13
12
  gem 'guard-rspec'
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
- :author => "author",
56
- :commits => ["commits", "between", "tags"],
57
- :env => "staging",
58
- :version => "1.0.1",
59
- :domain => "staging.example.com"
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
 
@@ -2,4 +2,5 @@ options:
2
2
  server: "example.com"
3
3
  staging:
4
4
  domain: "staging.example.com"
5
+ api_key: "api key"
5
6
 
@@ -11,11 +11,14 @@ module Deployments
11
11
 
12
12
  def to_params
13
13
  {
14
- :author => username,
15
- :env => env,
16
- :version => tag,
17
- :commits => commits,
18
- :domain => domain
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
- Deployments.send(env.to_sym).domain
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
@@ -1,3 +1,3 @@
1
1
  module Deployments
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
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
- build.to_params[:author].should == "john.smith"
13
+ params[:author].should == "john.smith"
12
14
  end
13
15
 
14
16
  it "should return env" do
15
- build.should_receive(:env).twice.and_return("staging")
16
- build.to_params[:env].should == "staging"
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
- build.to_params[:domain].should == "staging.example.com"
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
- build.to_params[:version].should == "0.0.1"
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
- build.to_params[:commits].should == [
46
+ params[:commits].should == [
41
47
  "Added deployments section to the README file",
42
48
  "Added README file"
43
49
  ]
@@ -9,6 +9,10 @@ describe Deployments do
9
9
  it "should get domain for env" do
10
10
  Deployments.staging.domain == "staging.example.com"
11
11
  end
12
+
13
+ it "should get api key of the app" do
14
+ Deployments.staging.api_key.should == "api key"
15
+ end
12
16
  end
13
17
  end
14
18
 
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.5
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-05-31 00:00:00.000000000 Z
12
+ date: 2012-06-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: curb