meltwater-capistrano-strategies 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,31 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ meltwater-capistrano-strategies (0.4.0)
5
+ capistrano (~> 2.6)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ capistrano (2.15.3)
11
+ highline
12
+ net-scp (>= 1.0.0)
13
+ net-sftp (>= 2.0.0)
14
+ net-ssh (>= 2.0.14)
15
+ net-ssh-gateway (>= 1.1.0)
16
+ highline (1.6.18)
17
+ net-scp (1.1.0)
18
+ net-ssh (>= 2.6.5)
19
+ net-sftp (2.1.1)
20
+ net-ssh (>= 2.6.5)
21
+ net-ssh (2.6.7)
22
+ net-ssh-gateway (1.2.0)
23
+ net-ssh (>= 2.6.5)
24
+ rake (0.9.2.2)
25
+
26
+ PLATFORMS
27
+ ruby
28
+
29
+ DEPENDENCIES
30
+ meltwater-capistrano-strategies!
31
+ rake
@@ -0,0 +1,57 @@
1
+ require 'capistrano/recipes/deploy/strategy/copy'
2
+ require 'fileutils'
3
+ require 'tempfile' # Dir.tmpdir
4
+
5
+ #
6
+ # Please note: this strategy ignores the :repository parameter. It will bundle up your local checkout
7
+ # _at the commit hash_ that is checked out and send it to the servers.
8
+ #
9
+
10
+ class Capistrano::Deploy::Strategy::NoScm < Capistrano::Deploy::Strategy::Copy
11
+
12
+ private
13
+
14
+ def prepare!
15
+ create_revision_file
16
+ create_helper_symlink
17
+ ensure_remote_folder
18
+ end
19
+
20
+ def cleanup!
21
+ remove_helper_symlink
22
+ remove_revision_file
23
+ end
24
+
25
+ def project_root
26
+ @project_root ||= fetch( :project_root, '' ) + "/"
27
+ end
28
+
29
+ def exclusions
30
+ exclusions = copy_exclude.map { |e| "--exclude=\"#{e}\"" }.join(' ')
31
+ end
32
+
33
+ def create_helper_symlink
34
+ system( "ln -s #{pwd}/#{project_root}. /tmp/#{File.basename(destination)} " )
35
+ end
36
+
37
+ def create_revision_file
38
+ File.open(File.join(pwd, project_root, "REVISION"), "w") { |f| f.puts(revision) }
39
+ end
40
+
41
+ def ensure_remote_folder
42
+ run "test -e #{configuration[:releases_path]}/#{File.basename(destination)} || mkdir #{configuration[:releases_path]}/#{File.basename(destination)}"
43
+ end
44
+
45
+ def remove_helper_symlink
46
+ FileUtils.rm( "/tmp/#{File.basename(destination)}" )
47
+ end
48
+
49
+ def remove_revision_file
50
+ FileUtils.rm( File.join( pwd, project_root, "REVISION" ) )
51
+ end
52
+
53
+ def pwd
54
+ @pwd ||= Dir.pwd
55
+ end
56
+
57
+ end
@@ -0,0 +1,40 @@
1
+ require 'capistrano/recipes/deploy/strategy/no_scm'
2
+ require 'fileutils'
3
+ require 'tempfile' # Dir.tmpdir
4
+
5
+ #
6
+ # Please note: this strategy ignores the :repository parameter. It will bundle up your local checkout
7
+ # _at the commit hash_ that is checked out and send it to the servers.
8
+ #
9
+
10
+ class Capistrano::Deploy::Strategy::PwdCopy < Capistrano::Deploy::Strategy::NoScm
11
+
12
+ def deploy!
13
+ prepare!
14
+ package!
15
+ distribute!
16
+ ensure
17
+ cleanup!
18
+ end
19
+
20
+ private
21
+
22
+ def package!
23
+ system( "ln -s #{pwd}/#{project_root}. /tmp/#{File.basename(destination)} " )
24
+ system( "( cd /tmp && tar #{exclusions} -czf #{pwd}/#{filename} #{File.basename(destination)}/* && cd #{pwd} )" )
25
+ end
26
+
27
+ def cleanup!
28
+ remove_tar
29
+ super
30
+ end
31
+
32
+ def remove_tar
33
+ FileUtils.rm( @filename )
34
+ end
35
+
36
+ def filename
37
+ @filename ||= "#{File.basename(destination)}.tar.gz"
38
+ end
39
+
40
+ end
@@ -0,0 +1,50 @@
1
+ require 'capistrano/recipes/deploy/strategy/no_scm'
2
+ require 'fileutils'
3
+ require 'tempfile' # Dir.tmpdir
4
+
5
+ #
6
+ # Please note: this strategy ignores the :repository parameter. It will bundle up your local checkout
7
+ # _at the commit hash_ that is checked out and send it to the servers.
8
+ #
9
+
10
+ class Capistrano::Deploy::Strategy::Rsync < Capistrano::Deploy::Strategy::NoScm
11
+
12
+ def deploy!
13
+ prepare!
14
+ distribute!
15
+ ensure
16
+ cleanup!
17
+ end
18
+
19
+ private
20
+
21
+ def distribute!
22
+ execute_on_servers do |servers|
23
+ servers.each do |server|
24
+ system( "rsync -PLaqz #{exclusions} /tmp/#{File.basename(destination)} #{ssh_options[:user]}@#{server}:#{configuration[:releases_path]}/." )
25
+ end
26
+ end
27
+ end
28
+
29
+ # def project_root
30
+ # @project_root ||= fetch( :project_root, '' ) + "/"
31
+ # end
32
+ #
33
+ # def create_revision_file
34
+ # File.open(File.join(pwd, project_root, "REVISION"), "w") { |f| f.puts(revision) }
35
+ # end
36
+ #
37
+ #
38
+ # def remove_helper_symlink
39
+ # FileUtils.rm( "/tmp/#{File.basename(destination)}" )
40
+ # end
41
+ #
42
+ # def remove_revision_file
43
+ # FileUtils.rm( File.join( pwd, project_root, "REVISION" ) )
44
+ # end
45
+ #
46
+ # def pwd
47
+ # @pwd ||= Dir.pwd
48
+ # end
49
+
50
+ end
@@ -0,0 +1,25 @@
1
+ require 'capistrano/recipes/deploy/strategy/no_scm'
2
+
3
+ class Capistrano::Deploy::Strategy::UploadWar < Capistrano::Deploy::Strategy::NoScm
4
+
5
+ def deploy!
6
+ prepare!
7
+ distribute!
8
+ end
9
+
10
+ private
11
+
12
+ def prepare!
13
+ ensure_remote_folder
14
+ system "mkdir META-INF; echo '#{revision}' > META-INF/REVISION; jar uf #{artifact_path} META-INF/REVISION; rm -fr META-INF"
15
+ end
16
+
17
+ def distribute!
18
+ upload artifact_path, "#{configuration[:releases_path]}/#{File.basename(destination)}/#{application}.war"
19
+ end
20
+
21
+ def artifact_path
22
+ @artifact_path ||= fetch( :artifact_path )
23
+ end
24
+
25
+ end
@@ -0,0 +1,2 @@
1
+ require 'capistrano'
2
+ require 'meltwater-capistrano-strategies/version'
@@ -0,0 +1,5 @@
1
+ module MeltwaterCapistranoStrategies
2
+ unless defined?(::MeltwaterCapistranoStrategies::VERSION)
3
+ VERSION = "0.5.3".freeze
4
+ end
5
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/meltwater-capistrano-strategies/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = 'meltwater-capistrano-strategies'
6
+ gem.version = MeltwaterCapistranoStrategies::VERSION.dup
7
+ gem.author = 'Sebastian Geidies'
8
+ gem.email = 'sebastian.geidies@meltwater.com'
9
+ gem.homepage = 'http://gitlab.meltwater.com/meltwater-capistrano-strategies'
10
+ gem.summary = %q{Common Capistrano tasks at Meltwater}
11
+ gem.description = %q{Capistrano plugin with additional deploy strategies.}
12
+
13
+ gem.files = `git ls-files`.split("\n")
14
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
16
+ gem.require_paths = ['lib']
17
+
18
+ #Dev dependencies
19
+ gem.add_development_dependency 'rake'
20
+
21
+ #Runtime dependencies
22
+ gem.add_dependency 'capistrano', '~>2.6'
23
+
24
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: meltwater-capistrano-strategies
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 5
8
+ - 3
9
+ version: 0.5.3
10
+ platform: ruby
11
+ authors:
12
+ - Sebastian Geidies
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2013-05-15 00:00:00 -04:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rake
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :development
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: capistrano
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 2
41
+ - 6
42
+ version: "2.6"
43
+ type: :runtime
44
+ version_requirements: *id002
45
+ description: Capistrano plugin with additional deploy strategies.
46
+ email: sebastian.geidies@meltwater.com
47
+ executables: []
48
+
49
+ extensions: []
50
+
51
+ extra_rdoc_files: []
52
+
53
+ files:
54
+ - Gemfile
55
+ - Gemfile.lock
56
+ - lib/capistrano/recipes/deploy/strategy/no_scm.rb
57
+ - lib/capistrano/recipes/deploy/strategy/pwd_copy.rb
58
+ - lib/capistrano/recipes/deploy/strategy/rsync.rb
59
+ - lib/capistrano/recipes/deploy/strategy/upload_war.rb
60
+ - lib/meltwater-capistrano-strategies.rb
61
+ - lib/meltwater-capistrano-strategies/version.rb
62
+ - meltwater-capistrano-strategies-0.4.0.gem
63
+ - meltwater-capistrano-strategies.gemspec
64
+ has_rdoc: true
65
+ homepage: http://gitlab.meltwater.com/meltwater-capistrano-strategies
66
+ licenses: []
67
+
68
+ post_install_message:
69
+ rdoc_options: []
70
+
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ segments:
85
+ - 0
86
+ version: "0"
87
+ requirements: []
88
+
89
+ rubyforge_project:
90
+ rubygems_version: 1.3.6
91
+ signing_key:
92
+ specification_version: 3
93
+ summary: Common Capistrano tasks at Meltwater
94
+ test_files: []
95
+