capistrano-novafabrica 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.DS_Store ADDED
Binary file
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda", ">= 0"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.6.4"
12
+ gem "rcov", ">= 0"
13
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,20 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.6.4)
6
+ bundler (~> 1.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rake (0.9.2)
10
+ rcov (0.9.10)
11
+ shoulda (2.11.3)
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ bundler (~> 1.0.0)
18
+ jeweler (~> 1.6.4)
19
+ rcov
20
+ shoulda
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Matthew Bergman
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = capistrano-novafabrica
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to capistrano-novafabrica
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2011 Matthew Bergman. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "capistrano-novafabrica"
18
+ gem.homepage = "http://github.com/FotoVerite/capistrano-novafabrica"
19
+ gem.license = "MIT"
20
+ gem.summary = "Nova Fabrica Capistrano recipies"
21
+ gem.description = "Nova Fabrica Capistrano recipies"
22
+ gem.email = "matt@novafabric.com"
23
+ gem.authors = ["Matthew Bergman", "Kevin Skoglund"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ require 'rcov/rcovtask'
36
+ Rcov::RcovTask.new do |test|
37
+ test.libs << 'test'
38
+ test.pattern = 'test/**/test_*.rb'
39
+ test.verbose = true
40
+ test.rcov_opts << '--exclude "gems/*"'
41
+ end
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "capistrano-novafabrica #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.3
@@ -0,0 +1,66 @@
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 = "capistrano-novafabrica"
8
+ s.version = "1.0.3"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Matthew Bergman", "Kevin Skoglund"]
12
+ s.date = "2012-08-12"
13
+ s.description = "Nova Fabrica Capistrano recipies"
14
+ s.email = "matt@novafabric.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".DS_Store",
21
+ ".document",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "capistrano-novafabrica.gemspec",
29
+ "lib/.DS_Store",
30
+ "lib/capistrano/.DS_Store",
31
+ "lib/capistrano/novafabrica/base.rb",
32
+ "lib/capistrano/novafabrica/database.rb",
33
+ "lib/capistrano/novafabrica/dj.rb",
34
+ "lib/capistrano/novafabrica/helper.rb",
35
+ "lib/capistrano/novafabrica/solr.rb",
36
+ "lib/capistrano/novafabrica/tomcat.rb",
37
+ "lib/capistrano/novafabrica/unicorn.rb"
38
+ ]
39
+ s.homepage = "http://github.com/FotoVerite/capistrano-novafabrica"
40
+ s.licenses = ["MIT"]
41
+ s.require_paths = ["lib"]
42
+ s.rubygems_version = "1.8.21"
43
+ s.summary = "Nova Fabrica Capistrano recipies"
44
+
45
+ if s.respond_to? :specification_version then
46
+ s.specification_version = 3
47
+
48
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
50
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
51
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
52
+ s.add_development_dependency(%q<rcov>, [">= 0"])
53
+ else
54
+ s.add_dependency(%q<shoulda>, [">= 0"])
55
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
56
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
57
+ s.add_dependency(%q<rcov>, [">= 0"])
58
+ end
59
+ else
60
+ s.add_dependency(%q<shoulda>, [">= 0"])
61
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
62
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
63
+ s.add_dependency(%q<rcov>, [">= 0"])
64
+ end
65
+ end
66
+
data/lib/.DS_Store ADDED
Binary file
Binary file
@@ -0,0 +1,64 @@
1
+ require 'capistrano/novafabrica/helper'
2
+ require 'capistrano/novafabrica/database'
3
+
4
+ configuration = Capistrano::Configuration.respond_to?(:instance) ?
5
+ Capistrano::Configuration.instance(:must_exist) :
6
+ Capistrano.configuration(:must_exist)
7
+
8
+ configuration.load do
9
+
10
+ after "deploy:update_code", "deploy:create_symlinks"
11
+ after "deploy:update_code", "deploy:cleanup"
12
+
13
+ # Configuration
14
+ #
15
+
16
+ # Multistage
17
+ require 'capistrano/ext/multistage'
18
+ _cset(:default_stage) { 'staging' }
19
+
20
+ # User details
21
+ _cset :user, 'deploy'
22
+ # Application details
23
+ _cset(:runner) { user }
24
+ _cset :use_sudo, false
25
+
26
+ # SCM settings
27
+ _cset :scm, 'git'
28
+ set(:repository) { "git@github.com:novafabrica/#{app_name}.git" }
29
+ _cset :branch, 'master'
30
+ _cset :deploy_via, 'remote_cache'
31
+ _cset(:symlinks) { Hash.new }
32
+
33
+ # Git settings for Capistrano
34
+ default_run_options[:pty] = true # needed for git password prompts
35
+ ssh_options[:forward_agent] = true # use the keys for the person running the cap command to check out the app
36
+
37
+ # Deploy tasks for Passenger
38
+ namespace :deploy do
39
+
40
+ desc "Restarting mod_rails with restart.txt"
41
+ task :restart, :roles => :app, :except => { :no_release => true } do
42
+ run "touch #{current_path}/tmp/restart.txt"
43
+ end
44
+
45
+
46
+ desc "Create symlinks from the latest release to the shared directory"
47
+ task :create_symlinks do
48
+
49
+ run "ln -nfs #{shared_path}/config/database.yml #{latest_release}/config/database.yml"
50
+
51
+ symlinks.each do |type, value|
52
+ directories = value.is_a?(Array) ? value : [value]
53
+ directories.each do |dir|
54
+ run "mkdir -p #{shared_path}/public/#{type}/#{dir}"
55
+ run "rm -rf #{latest_release}/public/#{type}/#{dir}"
56
+ run "ln -nfs #{shared_path}/public/#{type}/#{dir} #{latest_release}/public/#{type}/#{dir}"
57
+ end
58
+ end
59
+
60
+ end
61
+
62
+ end
63
+
64
+ end
@@ -0,0 +1,39 @@
1
+ require 'capistrano/novafabrica/helper'
2
+
3
+ configuration = Capistrano::Configuration.respond_to?(:instance) ?
4
+ Capistrano::Configuration.instance(:must_exist) :
5
+ Capistrano.configuration(:must_exist)
6
+
7
+ configuration.load do
8
+
9
+ _cset(:rails_root) { abort 'Please specify rails root with "#{File.dirname(__FILE__)}/.."'}
10
+
11
+ before "deploy:cold", "db:create_database_file"
12
+ #after "deploy:cold", "db:create_database"
13
+
14
+ namespace :db do
15
+ desc "create mysql db"
16
+ task :create_database do
17
+ run "cd #{current_release}; bundle exec rake RAILS_ENV=#{rails_env} db:create"
18
+ end
19
+
20
+ desc "After updating code we need to populate a new database.yml"
21
+ task :create_database_file, :roles => :app do
22
+ require "yaml"
23
+ run "mkdir -p #{shared_path}/config/"
24
+ buffer = YAML::load_file(rails_root + 'config/database.yml')
25
+ # get ride of uneeded configurations
26
+ buffer.delete('test')
27
+ buffer.delete('development')
28
+ buffer.delete('cucumber')
29
+
30
+ # Populate production element
31
+ buffer["#{rails_env}"]['username'] = "deploy"
32
+ buffer["#{rails_env}"]['password'] = Capistrano::CLI.ui.ask("Enter MySQL database password: ")
33
+
34
+ put YAML::dump(buffer), "#{shared_path}/config/database.yml", :mode => 0664
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,31 @@
1
+ require 'capistrano/novafabrica/helper'
2
+
3
+ configuration = Capistrano::Configuration.respond_to?(:instance) ?
4
+ Capistrano::Configuration.instance(:must_exist) :
5
+ Capistrano.configuration(:must_exist)
6
+
7
+ configuration.load do
8
+
9
+ after "deploy:start", "delayed_job:start"
10
+ after "deploy:stop", "delayed_job:stop"
11
+ after "deploy:restart", "delayed_job:restart"
12
+
13
+ namespace :delayed_job do
14
+ desc "Start delayed_job process"
15
+ task :start, :roles => :app do
16
+ run "cd #{current_path}; RAILS_ENV=#{rails_env} bundle exec script/delayed_job start"
17
+ end
18
+
19
+ desc "Stop delayed_job process"
20
+ task :stop, :roles => :app do
21
+ run "cd #{current_path}; RAILS_ENV=#{rails_env} bundle exec script/delayed_job stop"
22
+ end
23
+
24
+ desc "Restart delayed_job process"
25
+ task :restart, :roles => :app do
26
+ run "cd #{current_path}; RAILS_ENV=#{rails_env} bundle exec script/delayed_job stop"
27
+ run "cd #{current_path}; RAILS_ENV=#{rails_env} bundle exec script/delayed_job start"
28
+ end
29
+ end
30
+
31
+ end
@@ -0,0 +1,5 @@
1
+ def _cset(name, *args, &block)
2
+ unless exists?(name)
3
+ set(name, *args, &block)
4
+ end
5
+ end
@@ -0,0 +1,18 @@
1
+ require 'capistrano/novafabrica/helper'
2
+
3
+ configuration = Capistrano::Configuration.respond_to?(:instance) ?
4
+ Capistrano::Configuration.instance(:must_exist) :
5
+ Capistrano.configuration(:must_exist)
6
+
7
+ configuration.load do
8
+
9
+ namespace :solr do
10
+
11
+ desc "Solr Reindex"
12
+ task :reindex, :role => :web do
13
+ run "cd #{current_path}; bundle exec rake RAILS_ENV=#{rails_env} maharam:reindex"
14
+ end
15
+
16
+ end
17
+
18
+ end
@@ -0,0 +1,39 @@
1
+ require 'capistrano/novafabrica/helper'
2
+
3
+ configuration = Capistrano::Configuration.respond_to?(:instance) ?
4
+ Capistrano::Configuration.instance(:must_exist) :
5
+ Capistrano.configuration(:must_exist)
6
+
7
+ configuration.load do
8
+
9
+ after "deploy:update_code", "tomcat:restart"
10
+
11
+ _cset :tomcat_home, "/opt/tomcat6/"
12
+ _cset :tomcat_ctrl, "/etc/init.d/tomcat6"
13
+
14
+ namespace :tomcat do
15
+
16
+ desc "start tomcat"
17
+ task :start do
18
+ "#{tomcat_ctrl} start"
19
+ end
20
+
21
+ desc "stop tomcat"
22
+ task :stop do
23
+ "#{tomcat_ctrl} stop"
24
+ end
25
+
26
+ desc "stop and start tomcat"
27
+ task :restart do
28
+ tomcat.stop
29
+ tomcat.start
30
+ end
31
+
32
+ desc "tail :tomcat_home/logs/*.log and logs/catalina.out"
33
+ task :tail do
34
+ stream "tail -f #{tomcat_home}/logs/*.log #{tomcat_home}/logs/catalina.out"
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,38 @@
1
+ require 'capistrano/novafabrica/helper'
2
+
3
+ configuration = Capistrano::Configuration.respond_to?(:instance) ?
4
+ Capistrano::Configuration.instance(:must_exist) :
5
+ Capistrano.configuration(:must_exist)
6
+
7
+ configuration.load do
8
+
9
+ after "deploy:update_code", "unicorn:restart"
10
+
11
+ _cset :unicorn_ctrl, "/etc/init.d/unicorn"
12
+
13
+ namespace :unicorn do
14
+
15
+ desc "start unicorn"
16
+ task :start do
17
+ "#{unicorn_ctrl} start"
18
+ end
19
+
20
+ desc "stop unicorn"
21
+ task :stop do
22
+ "#{unicorn_ctrl} stop"
23
+ end
24
+
25
+ desc "stop and start unicorn"
26
+ task :restart do
27
+ tomcat.stop
28
+ tomcat.start
29
+ end
30
+
31
+ desc "tail :current_path/log/unicorn.stderr.log"
32
+ task :tail do
33
+ stream "tail -f #{current_path}/log/unicorn.stderr.log"
34
+ end
35
+
36
+ end
37
+
38
+ end
metadata ADDED
@@ -0,0 +1,133 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-novafabrica
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Matthew Bergman
9
+ - Kevin Skoglund
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-08-12 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: shoulda
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ - !ruby/object:Gem::Dependency
32
+ name: bundler
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: 1.0.0
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: 1.0.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: jeweler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.6.4
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: 1.6.4
63
+ - !ruby/object:Gem::Dependency
64
+ name: rcov
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ description: Nova Fabrica Capistrano recipies
80
+ email: matt@novafabric.com
81
+ executables: []
82
+ extensions: []
83
+ extra_rdoc_files:
84
+ - LICENSE.txt
85
+ - README.rdoc
86
+ files:
87
+ - .DS_Store
88
+ - .document
89
+ - Gemfile
90
+ - Gemfile.lock
91
+ - LICENSE.txt
92
+ - README.rdoc
93
+ - Rakefile
94
+ - VERSION
95
+ - capistrano-novafabrica.gemspec
96
+ - lib/.DS_Store
97
+ - lib/capistrano/.DS_Store
98
+ - lib/capistrano/novafabrica/base.rb
99
+ - lib/capistrano/novafabrica/database.rb
100
+ - lib/capistrano/novafabrica/dj.rb
101
+ - lib/capistrano/novafabrica/helper.rb
102
+ - lib/capistrano/novafabrica/solr.rb
103
+ - lib/capistrano/novafabrica/tomcat.rb
104
+ - lib/capistrano/novafabrica/unicorn.rb
105
+ homepage: http://github.com/FotoVerite/capistrano-novafabrica
106
+ licenses:
107
+ - MIT
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ segments:
119
+ - 0
120
+ hash: 57371100441759937
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ requirements: []
128
+ rubyforge_project:
129
+ rubygems_version: 1.8.21
130
+ signing_key:
131
+ specification_version: 3
132
+ summary: Nova Fabrica Capistrano recipies
133
+ test_files: []