crazycode-cap-recipes 0.3.37 → 0.3.38

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/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
- ---
1
+ ---
2
2
  :major: 0
3
3
  :minor: 3
4
- :build:
5
- :patch: 37
4
+ :build:
5
+ :patch: 38
@@ -0,0 +1,136 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{crazycode-cap-recipes}
8
+ s.version = "0.3.38"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["crazycode"]
12
+ s.date = %q{2011-04-25}
13
+ s.default_executable = %q{cap-recipes}
14
+ s.description = %q{Battle-tested capistrano recipes for debian, passenger, apache, hudson, delayed_job, juggernaut, rubygems, backgroundrb, rails and more}
15
+ s.email = %q{crazycode@gmail.com}
16
+ s.executables = ["cap-recipes"]
17
+ s.extra_rdoc_files = [
18
+ "LICENSE",
19
+ "README.textile"
20
+ ]
21
+ s.files = [
22
+ "LICENSE",
23
+ "README.textile",
24
+ "Rakefile",
25
+ "VERSION.yml",
26
+ "bin/cap-recipes",
27
+ "cap-recipes.gemspec",
28
+ "crazycode-cap-recipes.gemspec",
29
+ "examples/advanced/deploy.rb",
30
+ "examples/advanced/deploy/experimental.rb",
31
+ "examples/advanced/deploy/production.rb",
32
+ "examples/simple/deploy.rb",
33
+ "lib/cap_recipes.rb",
34
+ "lib/cap_recipes/tasks/apache.rb",
35
+ "lib/cap_recipes/tasks/apache/install.rb",
36
+ "lib/cap_recipes/tasks/apache/manage.rb",
37
+ "lib/cap_recipes/tasks/aptitude.rb",
38
+ "lib/cap_recipes/tasks/aptitude/manage.rb",
39
+ "lib/cap_recipes/tasks/backgroundrb.rb",
40
+ "lib/cap_recipes/tasks/backgroundrb/hooks.rb",
41
+ "lib/cap_recipes/tasks/backgroundrb/manage.rb",
42
+ "lib/cap_recipes/tasks/bundler.rb",
43
+ "lib/cap_recipes/tasks/bundler/manage.rb",
44
+ "lib/cap_recipes/tasks/delayed_job.rb",
45
+ "lib/cap_recipes/tasks/delayed_job/hooks.rb",
46
+ "lib/cap_recipes/tasks/delayed_job/manage.rb",
47
+ "lib/cap_recipes/tasks/ec2/install.rb",
48
+ "lib/cap_recipes/tasks/ec2/manage.rb",
49
+ "lib/cap_recipes/tasks/gitdeploy.rb",
50
+ "lib/cap_recipes/tasks/gitdeploy/setup.rb",
51
+ "lib/cap_recipes/tasks/gitosis.rb",
52
+ "lib/cap_recipes/tasks/gitosis/install.rb",
53
+ "lib/cap_recipes/tasks/gitosis/manage.rb",
54
+ "lib/cap_recipes/tasks/hudson.rb",
55
+ "lib/cap_recipes/tasks/hudson/manage.rb",
56
+ "lib/cap_recipes/tasks/jetty.rb",
57
+ "lib/cap_recipes/tasks/jetty/install.rb",
58
+ "lib/cap_recipes/tasks/jetty/manage.rb",
59
+ "lib/cap_recipes/tasks/jetty/web.rb",
60
+ "lib/cap_recipes/tasks/juggernaut.rb",
61
+ "lib/cap_recipes/tasks/juggernaut/hooks.rb",
62
+ "lib/cap_recipes/tasks/juggernaut/manage.rb",
63
+ "lib/cap_recipes/tasks/maven.rb",
64
+ "lib/cap_recipes/tasks/memcache.rb",
65
+ "lib/cap_recipes/tasks/memcache/hooks.rb",
66
+ "lib/cap_recipes/tasks/memcache/install.rb",
67
+ "lib/cap_recipes/tasks/memcache/manage.rb",
68
+ "lib/cap_recipes/tasks/mongodb.rb",
69
+ "lib/cap_recipes/tasks/mongodb/install.rb",
70
+ "lib/cap_recipes/tasks/mongodb/manage.rb",
71
+ "lib/cap_recipes/tasks/passenger.rb",
72
+ "lib/cap_recipes/tasks/passenger/install.rb",
73
+ "lib/cap_recipes/tasks/passenger/manage.rb",
74
+ "lib/cap_recipes/tasks/rails.rb",
75
+ "lib/cap_recipes/tasks/rails/hooks.rb",
76
+ "lib/cap_recipes/tasks/rails/manage.rb",
77
+ "lib/cap_recipes/tasks/ruby.rb",
78
+ "lib/cap_recipes/tasks/ruby/install.rb",
79
+ "lib/cap_recipes/tasks/rubygems.rb",
80
+ "lib/cap_recipes/tasks/rubygems/install.rb",
81
+ "lib/cap_recipes/tasks/rubygems/manage.rb",
82
+ "lib/cap_recipes/tasks/templates/hudson.erb",
83
+ "lib/cap_recipes/tasks/templates/mongod.conf.erb",
84
+ "lib/cap_recipes/tasks/templates/mongodb.init.erb",
85
+ "lib/cap_recipes/tasks/templates/mongodb.repo.erb",
86
+ "lib/cap_recipes/tasks/templates/mongos.init.erb",
87
+ "lib/cap_recipes/tasks/templates/tomcat.erb",
88
+ "lib/cap_recipes/tasks/thinking_sphinx.rb",
89
+ "lib/cap_recipes/tasks/thinking_sphinx/hooks.rb",
90
+ "lib/cap_recipes/tasks/thinking_sphinx/install.rb",
91
+ "lib/cap_recipes/tasks/thinking_sphinx/manage.rb",
92
+ "lib/cap_recipes/tasks/tomcat.rb",
93
+ "lib/cap_recipes/tasks/tomcat/install.rb",
94
+ "lib/cap_recipes/tasks/tomcat/manage.rb",
95
+ "lib/cap_recipes/tasks/tomcat/war.rb",
96
+ "lib/cap_recipes/tasks/utilities.rb",
97
+ "lib/cap_recipes/tasks/whenever.rb",
98
+ "lib/cap_recipes/tasks/whenever/hooks.rb",
99
+ "lib/cap_recipes/tasks/whenever/manage.rb",
100
+ "lib/cap_recipes/tasks/yum.rb",
101
+ "lib/cap_recipes/tasks/yum/manage.rb",
102
+ "lib/capify.rb",
103
+ "lib/templates/Capfile.tt",
104
+ "lib/templates/deploy.rb.tt",
105
+ "spec/cap/all/Capfile",
106
+ "spec/cap/helper.rb",
107
+ "spec/cap_recipes_spec.rb",
108
+ "spec/spec_helper.rb",
109
+ "specs.watchr"
110
+ ]
111
+ s.homepage = %q{http://github.com/crazycode/cap-recipes}
112
+ s.require_paths = ["lib"]
113
+ s.rubyforge_project = %q{crazycode-cap-recipes}
114
+ s.rubygems_version = %q{1.3.7}
115
+ s.summary = %q{Battle-tested capistrano recipes for passenger, delayed_job, and more}
116
+ s.test_files = [
117
+ "examples/advanced/deploy.rb",
118
+ "examples/advanced/deploy/experimental.rb",
119
+ "examples/advanced/deploy/production.rb",
120
+ "examples/simple/deploy.rb",
121
+ "spec/cap/helper.rb",
122
+ "spec/cap_recipes_spec.rb",
123
+ "spec/spec_helper.rb"
124
+ ]
125
+
126
+ if s.respond_to? :specification_version then
127
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
128
+ s.specification_version = 3
129
+
130
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
131
+ else
132
+ end
133
+ else
134
+ end
135
+ end
136
+
@@ -0,0 +1 @@
1
+ Dir[File.join(File.dirname(__FILE__), 'gitdeploy/*.rb')].sort.each { |lib| require lib }
@@ -0,0 +1,140 @@
1
+ Capistrano::Configuration.instance(true).load do |configuration|
2
+ set :use_sudo, true
3
+
4
+ _cset :deploy_to_parent, "/srv/applications"
5
+ _cset :branch, "master"
6
+
7
+ default_run_options[:pty] = true
8
+
9
+ # this is capistrano's default location.
10
+ # depending on the permissions of the server
11
+ # you may need to create it and chown it over
12
+ # to :user (e.g. chown -R robotuser:robotuser /u)
13
+ set :deploy_to do
14
+ "#{deploy_to_parent}/#{application}"
15
+ end
16
+
17
+ set :deploy_to_gitrepo do
18
+ "#{deploy_to}/gitrepo"
19
+ end
20
+
21
+
22
+ set :local_base_dir do
23
+ "#{`pwd`}".strip
24
+ end
25
+
26
+ _cset :war_config, Array.new
27
+
28
+
29
+ set :local_git_dir do
30
+ "/tmp/localgit_#{application}"
31
+ end
32
+ set :local_gitrepo do
33
+ "#{local_git_dir}/local_gitrepo"
34
+ end
35
+
36
+ namespace :gitdeploy do
37
+
38
+ desc "setup remote and locate gitdeploy dir"
39
+ task :setup do
40
+ gitdeploy.setup_remote
41
+ gitdeploy.setup_local
42
+ end
43
+
44
+ task :setup_remote do
45
+ run clone_repository_command()
46
+ end
47
+
48
+ task :setup_local do
49
+ system clone_repository_local_command()
50
+ end
51
+
52
+ task :tag do
53
+ tag_name = configuration[:tag]
54
+ if tag_name.nil?
55
+ rails "NO tag. pls use -s tag=xxx set tag_name"
56
+ end
57
+
58
+ if war_config.nil? or war_config.size == 0
59
+ raise 'NO war_config'
60
+ end
61
+
62
+ system "cd #{local_gitrepo}; git checkout #{branch}; git fetch; git merge origin/#{branch};"
63
+
64
+ war_config.each do |config|
65
+ puts "name=#{config[:name]}, war=#{config[:war]}"
66
+ puts update_repository_local_command(config[:name], config[:war])
67
+ system update_repository_local_command(config[:name], config[:war])
68
+ end
69
+
70
+ system "cd #{local_gitrepo}; git add .; git commit -m 'tag with #{tag_name}'; git tag #{tag_name};"
71
+
72
+ # push tags and latest code
73
+ system "cd #{local_gitrepo}"
74
+ system "git push origin #{branch}"
75
+ if $? != 0
76
+ raise "git push failed"
77
+ end
78
+
79
+ system "git push origin #{branch} --tags"
80
+ if $? != 0
81
+ raise "git push --tags failed"
82
+ end
83
+ end
84
+
85
+ task :deploy do
86
+ tag_name = configuration[:tag]
87
+ if tag_name.nil?
88
+ rails "NO tag. pls use -s tag=xxx set tag_name"
89
+ end
90
+
91
+ run update_repository_remote_command(tag_name)
92
+ end
93
+
94
+
95
+ def self.clone_repository_local_command
96
+ [
97
+ "if [ ! -e #{local_git_dir} ]",
98
+ "then mkdir -p #{local_git_dir}",
99
+ "cd #{local_git_dir}",
100
+ "git clone #{repository} #{local_gitrepo}",
101
+ "fi"
102
+ ].join("; ")
103
+ end
104
+
105
+
106
+ def self.update_repository_local_command(name, war)
107
+ [
108
+ "if [ -e #{local_gitrepo}/#{name} ]",
109
+ "then rm -Rf #{local_gitrepo}/#{name}",
110
+ "fi",
111
+ "mkdir -p #{local_gitrepo}/#{name}",
112
+ "cd #{local_gitrepo}/#{name}",
113
+ "jar -xf #{local_base_dir}/#{war}"
114
+ ].join("; ")
115
+ end
116
+
117
+ def self.clone_repository_command
118
+ [
119
+ "if [ ! -e #{deploy_to_gitrepo} ]",
120
+ "then sudo mkdir -p #{deploy_to}",
121
+ "sudo chown #{user} #{deploy_to}",
122
+ "cd #{deploy_to}",
123
+ "git clone #{repository} #{deploy_to_gitrepo}",
124
+ "fi"
125
+ ].join("; ")
126
+ end
127
+
128
+ def self.update_repository_remote_command(tag_name)
129
+ [
130
+ "cd #{deploy_to_gitrepo}",
131
+ "git fetch",
132
+ "git checkout #{branch}",
133
+ "git merge origin/#{branch}",
134
+ "git checkout -b tag_#{tag_name} #{tag_name}",
135
+ ].join("; ")
136
+ end
137
+
138
+ end
139
+
140
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 37
9
- version: 0.3.37
8
+ - 38
9
+ version: 0.3.38
10
10
  platform: ruby
11
11
  authors:
12
12
  - crazycode
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-04-22 00:00:00 +08:00
17
+ date: 2011-04-25 00:00:00 +08:00
18
18
  default_executable: cap-recipes
19
19
  dependencies: []
20
20
 
@@ -34,6 +34,7 @@ files:
34
34
  - VERSION.yml
35
35
  - bin/cap-recipes
36
36
  - cap-recipes.gemspec
37
+ - crazycode-cap-recipes.gemspec
37
38
  - examples/advanced/deploy.rb
38
39
  - examples/advanced/deploy/experimental.rb
39
40
  - examples/advanced/deploy/production.rb
@@ -54,6 +55,8 @@ files:
54
55
  - lib/cap_recipes/tasks/delayed_job/manage.rb
55
56
  - lib/cap_recipes/tasks/ec2/install.rb
56
57
  - lib/cap_recipes/tasks/ec2/manage.rb
58
+ - lib/cap_recipes/tasks/gitdeploy.rb
59
+ - lib/cap_recipes/tasks/gitdeploy/setup.rb
57
60
  - lib/cap_recipes/tasks/gitosis.rb
58
61
  - lib/cap_recipes/tasks/gitosis/install.rb
59
62
  - lib/cap_recipes/tasks/gitosis/manage.rb