cap_blue_green_deploy 1.0.0.pre.rc1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7dcbb168a64b8345a4ac64f2a9ab71025591e73c
4
- data.tar.gz: bf45a7dc14a62306a00ff4c245d304015940d20d
3
+ metadata.gz: 85697c72f54a66d12e2e722d7570d762e00bcc3c
4
+ data.tar.gz: d267f962d678ee6d0812f5f8f673c3a0f04c0362
5
5
  SHA512:
6
- metadata.gz: f7b058689c0b1260f7c5ec84dab7d55d958368892faa19513246e33c9cba5c9ffc34d84166a6b2c149eb887fe65c5f8622fd76072fc9d1f57c03a044eb3b2453
7
- data.tar.gz: e7b88001ff0b003bc20e9d04d08df8ebb394fac4d4a542cca1a96744eda100010fe07187d6960c077ff1fdbd51bc860cceb62f282f1321c8bc48c09912ea5262
6
+ metadata.gz: c36a439c165fff7888bc36a030103016862696a7ad9aa138909cadf4ac6dceef228470f2c8a8f19e6d63ae10bd8ef9c878b146b71bed45a37ff17eef2b782a82
7
+ data.tar.gz: 1274c75964d809b8c7a462ac084ee1cceba25bcce6a331dd36aa32624389b3ef795c792030dd87ef56360c71b1f36fa0de5aabdf421510723f6699917205320f
data/.gitignore CHANGED
@@ -14,3 +14,4 @@ spec/reports
14
14
  test/tmp
15
15
  test/version_tmp
16
16
  tmp
17
+ .coveralls.yml
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.0
4
+
5
+ - Removing cleanup callback after live deploy. Need to put manually in Capfile.
6
+ - Releasing 1.0.0 version :)
7
+
3
8
  ## 1.0.0.pre.rc1
4
9
 
5
10
  - Adding fully functional ```cap deploy:blue_green:live``` command
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cap_blue_green_deploy (1.0.0.pre.rc1)
4
+ cap_blue_green_deploy (1.0.0)
5
5
  capistrano (>= 2.0.0, < 3.0.0)
6
6
 
7
7
  GEM
@@ -18,9 +18,18 @@ GEM
18
18
  net-ssh (>= 2.0.14)
19
19
  net-ssh-gateway (>= 1.1.0)
20
20
  columnize (0.8.9)
21
+ coveralls (0.7.1)
22
+ multi_json (~> 1.3)
23
+ rest-client
24
+ simplecov (>= 0.7)
25
+ term-ansicolor
26
+ thor
21
27
  debugger-linecache (1.2.0)
22
28
  diff-lcs (1.2.5)
29
+ docile (1.1.5)
23
30
  highline (1.6.21)
31
+ mime-types (2.3)
32
+ multi_json (1.10.1)
24
33
  net-scp (1.2.1)
25
34
  net-ssh (>= 2.6.5)
26
35
  net-sftp (2.1.2)
@@ -28,7 +37,11 @@ GEM
28
37
  net-ssh (2.9.1)
29
38
  net-ssh-gateway (1.2.0)
30
39
  net-ssh (>= 2.6.5)
40
+ netrc (0.7.7)
31
41
  rake (10.3.2)
42
+ rest-client (1.7.2)
43
+ mime-types (>= 1.16, < 3.0)
44
+ netrc (~> 0.7)
32
45
  rspec (3.0.0)
33
46
  rspec-core (~> 3.0.0)
34
47
  rspec-expectations (~> 3.0.0)
@@ -41,7 +54,16 @@ GEM
41
54
  rspec-mocks (3.0.4)
42
55
  rspec-support (~> 3.0.0)
43
56
  rspec-support (3.0.4)
57
+ simplecov (0.9.0)
58
+ docile (~> 1.1.0)
59
+ multi_json
60
+ simplecov-html (~> 0.8.0)
61
+ simplecov-html (0.8.0)
44
62
  slop (3.6.0)
63
+ term-ansicolor (1.3.0)
64
+ tins (~> 1.0)
65
+ thor (0.19.1)
66
+ tins (1.3.2)
45
67
 
46
68
  PLATFORMS
47
69
  ruby
@@ -50,5 +72,6 @@ DEPENDENCIES
50
72
  bundler (~> 1.3)
51
73
  byebug
52
74
  cap_blue_green_deploy!
75
+ coveralls
53
76
  rake
54
77
  rspec
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Cap Blue Green Deploy (Under Development) [![Code Climate](https://codeclimate.com/github/rafaelbiriba/cap_blue_green_deploy/badges/gpa.svg)](https://codeclimate.com/github/rafaelbiriba/cap_blue_green_deploy) [![Travis](https://api.travis-ci.org/rafaelbiriba/cap_blue_green_deploy.svg?branch=master)](https://travis-ci.org/rafaelbiriba/cap_blue_green_deploy)
1
+ # Cap Blue Green Deploy (Under Tests) [![Code Climate](https://codeclimate.com/github/rafaelbiriba/cap_blue_green_deploy/badges/gpa.svg)](https://codeclimate.com/github/rafaelbiriba/cap_blue_green_deploy) [![Travis](https://api.travis-ci.org/rafaelbiriba/cap_blue_green_deploy.svg?branch=master)](https://travis-ci.org/rafaelbiriba/cap_blue_green_deploy) [![Gem Version](https://badge.fury.io/rb/cap_blue_green_deploy.svg)](http://badge.fury.io/rb/cap_blue_green_deploy) [![Coverage Status](https://coveralls.io/repos/rafaelbiriba/cap_blue_green_deploy/badge.png?branch=master)](https://coveralls.io/r/rafaelbiriba/cap_blue_green_deploy?branch=master)
2
2
 
3
3
  Blue-Green deployment solution for Capistrano, using symbolic links between releases.
4
4
 
data/Rakefile CHANGED
@@ -3,5 +3,12 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new
5
5
 
6
+ namespace :spec do
7
+ desc "Run Rspec test pushing Coverage results"
8
+ task :coveralls do
9
+ system "coveralls push"
10
+ end
11
+ end
12
+
6
13
  task :default => :spec
7
14
  task :test => :spec
@@ -23,4 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "rake"
24
24
  spec.add_development_dependency "rspec"
25
25
  spec.add_development_dependency "byebug"
26
+ spec.add_development_dependency "coveralls"
26
27
  end
@@ -13,8 +13,6 @@ module CapBlueGreenDeploy::Tasks::Live
13
13
  task :live, :roles => :app, :except => { :no_release => true } { live_task_run }
14
14
  end
15
15
  end
16
-
17
- after "deploy:blue_green:live", "deploy:cleanup"
18
16
  end
19
17
  end
20
18
  end
@@ -1,3 +1,3 @@
1
1
  module CapBlueGreenDeploy
2
- VERSION = "1.0.0.pre.rc1"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -15,6 +15,121 @@ describe CapBlueGreenDeploy::Tasks::Cleanup do
15
15
  allow(@config).to receive(:load) { |&arg| arg.call }
16
16
  end
17
17
 
18
+ describe "#cleanup_task_run" do
19
+ let :local_releases do
20
+ ["1", "2", "3"]
21
+ end
22
+
23
+ let :logger do
24
+ OpenStruct.new(important: nil, info: nil)
25
+ end
26
+
27
+ before do
28
+ expect(subject).to receive(:filter_local_releases!)
29
+ allow(subject).to receive(:local_releases).and_return(local_releases)
30
+ allow(subject).to receive(:logger).and_return(logger)
31
+ end
32
+
33
+ context "with old releases" do
34
+ let :keep_releases do
35
+ 2
36
+ end
37
+
38
+ before do
39
+ allow(subject).to receive(:remove_dirs)
40
+ allow(subject).to receive(:local_releases_fullpath)
41
+ allow(logger).to receive(:info)
42
+ allow(subject).to receive(:keep_releases).and_return(keep_releases)
43
+ end
44
+
45
+ it "should log if there is old releases to clean" do
46
+ expect(logger).to receive(:info).with("keeping #{keep_releases} of #{local_releases.length} deployed releases").and_return(logger)
47
+ expect(subject).to receive(:logger).and_return(logger)
48
+ subject.cleanup_task_run
49
+ end
50
+
51
+ it "should call remove dirs if there is old releases to clean" do
52
+ expect(subject).to receive(:local_releases_fullpath).and_return("/teste")
53
+ expect(subject).to receive(:remove_dirs).with("/teste")
54
+ subject.cleanup_task_run
55
+ end
56
+ end
57
+
58
+ context "without old releases" do
59
+ it "should log if there is no old releases to clean" do
60
+ expect(subject).to receive(:keep_releases).and_return(4)
61
+ expect(logger).to receive(:important).with("no old releases to clean up").and_return(logger)
62
+ expect(subject).to receive(:logger).and_return(logger)
63
+ subject.cleanup_task_run
64
+ end
65
+ end
66
+ end
67
+
68
+ describe "#local_releases_fullpath" do
69
+ let :local_releases do
70
+ ["1", "2", "3"]
71
+ end
72
+
73
+ let :releases_path do
74
+ "teste"
75
+ end
76
+
77
+ before do
78
+ allow(subject).to receive(:local_releases).and_return(local_releases)
79
+ allow(subject).to receive(:releases_path).and_return(releases_path)
80
+ end
81
+
82
+ it "should return full path of local_releases filtering keep_releases" do
83
+ allow(subject).to receive(:keep_releases).and_return(1)
84
+ expect(subject.local_releases_fullpath).to eq("#{releases_path}/1 #{releases_path}/2")
85
+ end
86
+
87
+ it "should empty if keep_releases value is greater than local_releases" do
88
+ allow(subject).to receive(:keep_releases).and_return(4)
89
+ expect(subject.local_releases_fullpath).to eq("")
90
+ end
91
+ end
92
+
93
+ describe "#filter_local_releases!" do
94
+ let :live_path do
95
+ "live_path"
96
+ end
97
+
98
+ let :previous_path do
99
+ "previous_path"
100
+ end
101
+
102
+ before do
103
+ allow(subject).to receive(:fullpath_by_symlink).and_return("")
104
+ allow(subject).to receive(:blue_green_live_path).and_return(live_path)
105
+ allow(subject).to receive(:blue_green_previous_path).and_return(previous_path)
106
+ end
107
+
108
+ it "should remove current_live release from local releases list" do
109
+ expect(subject).to receive(:fullpath_by_symlink).with(live_path).and_return(live_path)
110
+ subject.instance_variable_set(:@local_releases, [live_path, "teste"])
111
+ expect(subject.filter_local_releases!).to eq ["teste"]
112
+ expect(subject.instance_variable_get(:@local_releases)).to eq ["teste"]
113
+ end
114
+
115
+ it "should remove previous_live release from local releases list" do
116
+ expect(subject).to receive(:fullpath_by_symlink).with(previous_path).and_return(previous_path)
117
+ subject.instance_variable_set(:@local_releases, [previous_path, "teste"])
118
+ expect(subject.filter_local_releases!).to eq ["teste"]
119
+ expect(subject.instance_variable_get(:@local_releases)).to eq ["teste"]
120
+ end
121
+ end
122
+
123
+ describe "#local_releases" do
124
+ it "should return fir list inside a path" do
125
+ path = "/path"
126
+ dirs = ["dir1", "dir2"]
127
+ allow(subject).to receive(:releases_path).and_return(path)
128
+ expect(subject).to receive(:dirs_inside).with(path).and_return(dirs)
129
+ expect(subject.local_releases).to eq dirs
130
+ end
131
+ end
132
+
18
133
  describe ".task_load" do
19
134
  let :subject do
20
135
  CapBlueGreenDeploy::Tasks::Cleanup
@@ -61,11 +61,6 @@ describe CapBlueGreenDeploy::Tasks::Live do
61
61
  allow(subject).to receive(:after)
62
62
  end
63
63
 
64
- it "should create callback to run cleanup after live action" do
65
- expect(subject).to receive(:after).with("deploy:blue_green:live", "deploy:cleanup")
66
- subject.task_load(@config)
67
- end
68
-
69
64
  context "capistrano blue green live task" do
70
65
  before do
71
66
  expect(subject).to receive(:namespace).with(:deploy) { |&arg| arg.call }
@@ -24,10 +24,6 @@ describe CapBlueGreenDeploy::Tasks::Rollback do
24
24
  "previous path"
25
25
  end
26
26
 
27
- let :current_release do
28
- "current release"
29
- end
30
-
31
27
  before do
32
28
  allow(subject).to receive(:do_symlink)
33
29
  allow(subject).to receive(:fullpath_by_symlink).and_return("")
data/spec/spec_helper.rb CHANGED
@@ -2,6 +2,8 @@ require "rake"
2
2
  require "byebug"
3
3
  require "capistrano"
4
4
  require "cap_blue_green_deploy"
5
+ require 'coveralls'
6
+ Coveralls.wear!
5
7
 
6
8
  # This file was generated by the `rspec --init` command. Conventionally, all
7
9
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cap_blue_green_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.rc1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael Biriba
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-17 00:00:00.000000000 Z
11
+ date: 2014-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -86,6 +86,20 @@ dependencies:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: coveralls
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
89
103
  description: Blue-Green deployment solution for Capistrano, using symbolic links between
90
104
  releases.
91
105
  email:
@@ -135,9 +149,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
149
  version: '0'
136
150
  required_rubygems_version: !ruby/object:Gem::Requirement
137
151
  requirements:
138
- - - ">"
152
+ - - ">="
139
153
  - !ruby/object:Gem::Version
140
- version: 1.3.1
154
+ version: '0'
141
155
  requirements: []
142
156
  rubyforge_project:
143
157
  rubygems_version: 2.1.11