ninja-deploy 1.1.0 → 1.2.0

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/.rvmrc CHANGED
@@ -1,2 +1,2 @@
1
1
  rvm use ruby-1.8.7-p302@gemdev
2
- rvm info ruby
2
+ rvm info
data/README.rdoc CHANGED
@@ -237,6 +237,24 @@ Dependencies:
237
237
  * application variable
238
238
 
239
239
 
240
+ == RVM Recipes
241
+
242
+ Require the RVM recipes in your deploy.rb file:
243
+
244
+ require 'ninja_deploy/recipes/rvm'
245
+
246
+ === trust_rvmrc
247
+
248
+ As Callback:
249
+
250
+ after "deploy:update_code", "rvm:trust_rvmrc"
251
+
252
+ From Command-Line:
253
+
254
+ cap production rvm:trust_rvmrc
255
+
256
+
257
+
240
258
  == Note on Patches/Pull Requests
241
259
 
242
260
  * Fork the project.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.2.0
@@ -21,10 +21,21 @@ Capistrano::Configuration.instance( :must_exist ).load do
21
21
  puts "*** You can find the dump file at: #{local_file_full_path}"
22
22
  end
23
23
 
24
- # desc "Dump a remote database, fetch the dump file to the staging server and then load it to the staging database"
25
- # task :to_staging, :roles => :db, :only => { :primary => true } do
26
- #
27
- # end
24
+ desc "Dump a remote database, fetch the dump file to the staging server and then load it to the staging database"
25
+ task :to_staging_db, :roles => :db, :only => { :primary => true } do
26
+ staging_file_full_path = dump_database_to_staging
27
+
28
+ puts "*** Reading staging database config..."
29
+ username, password, database, host = host_database_config( staging_host, 'deployer', 'staging' )
30
+
31
+ Net::SSH.start( staging_host, 'deployer' ) do |ssh|
32
+ puts "*** Loading data to staging #{database} database"
33
+ ssh.exec! "bzip2 -d -c #{staging_file_full_path} | mysql -h #{host} -u #{username} --password='#{password}' #{database}"
34
+
35
+ puts "*** Removing staging dump file..."
36
+ ssh.exec! "rm #{staging_file_full_path}"
37
+ end
38
+ end
28
39
  end
29
40
 
30
41
  def dump_database_to_local
@@ -43,6 +54,30 @@ Capistrano::Configuration.instance( :must_exist ).load do
43
54
 
44
55
  local_file_full_path
45
56
  end
57
+
58
+ def dump_database_to_staging
59
+ prepare_for_database_dump
60
+
61
+ puts "*** Reading database credentials... "
62
+ user, password, database, host = remote_database_config( rails_env )
63
+
64
+ dump_database( password )
65
+
66
+ staging_file_full_path = "/tmp/#{File.basename dump_file_bz2_full_path}"
67
+
68
+ puts "*** Fetching the dump file from '#{environment_host}:#{dump_file_bz2_full_path}' and putting it at '#{staging_host}:#{staging_file_full_path}'..."
69
+
70
+ scp_cmd = "scp #{environment_host}:#{dump_file_bz2_full_path} #{staging_file_full_path}"
71
+ puts "*** Executing: #{scp_cmd}"
72
+
73
+ Net::SSH.start( staging_host, 'deployer' ) do |ssh|
74
+ ssh.exec! scp_cmd
75
+ end
76
+
77
+ remove_dump_file
78
+
79
+ staging_file_full_path
80
+ end
46
81
 
47
82
  def prepare_for_database_dump
48
83
  now = Time.now
@@ -82,5 +117,17 @@ Capistrano::Configuration.instance( :must_exist ).load do
82
117
  database = YAML::load( remote_config )
83
118
  return database["#{db}"]['username'], database["#{db}"]['password'], database["#{db}"]['database'], database["#{db}"]['host']
84
119
  end
120
+
121
+ def host_database_config( host, user, db )
122
+ remote_config = nil
123
+
124
+ Net::SSH.start( host, user ) do |ssh|
125
+ remote_config = ssh.exec!( "cat #{shared_path}/config/database.yml" )
126
+ end
127
+
128
+ database = YAML::load( remote_config )
129
+
130
+ return database["#{db}"]['username'], database["#{db}"]['password'], database["#{db}"]['database'], database["#{db}"]['host']
131
+ end
85
132
  end
86
133
  end
@@ -0,0 +1,8 @@
1
+ Capistrano::Configuration.instance( :must_exist ).load do
2
+ namespace :rvm do
3
+ desc 'Trust rvmrc file.'
4
+ task :trust_rvmrc do
5
+ run "rvm rvmrc trust #{current_release}"
6
+ end
7
+ end
8
+ end
data/ninja-deploy.gemspec CHANGED
@@ -1,55 +1,53 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ninja-deploy}
8
- s.version = "1.1.0"
8
+ s.version = "1.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ninja Loss"]
12
- s.date = %q{2010-11-10}
12
+ s.date = %q{2011-04-07}
13
13
  s.description = %q{Common shared deployment recipes for your pleasure.}
14
14
  s.email = %q{ninja.loss@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.rdoc"
17
+ "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
- ".gitignore",
22
- ".rvmrc",
23
- "LICENSE",
24
- "README.rdoc",
25
- "Rakefile",
26
- "VERSION",
27
- "lib/ninja_deploy.rb",
28
- "lib/ninja_deploy/recipes/database.rb",
29
- "lib/ninja_deploy/recipes/deploy.rb",
30
- "lib/ninja_deploy/recipes/log.rb",
31
- "lib/ninja_deploy/recipes/passenger.rb",
32
- "lib/ninja_deploy/recipes/sass.rb",
33
- "lib/ninja_deploy/recipes/thinking_sphinx.rb",
34
- "lib/ninja_deploy/recipes/version.rb",
35
- "lib/ninja_deploy/recipes/whenever.rb",
36
- "ninja-deploy.gemspec",
37
- "spec/ninja-deploy_spec.rb",
38
- "spec/spec.opts",
39
- "spec/spec_helper.rb"
21
+ ".rvmrc",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "lib/ninja_deploy.rb",
27
+ "lib/ninja_deploy/recipes/database.rb",
28
+ "lib/ninja_deploy/recipes/deploy.rb",
29
+ "lib/ninja_deploy/recipes/log.rb",
30
+ "lib/ninja_deploy/recipes/passenger.rb",
31
+ "lib/ninja_deploy/recipes/rvm.rb",
32
+ "lib/ninja_deploy/recipes/sass.rb",
33
+ "lib/ninja_deploy/recipes/thinking_sphinx.rb",
34
+ "lib/ninja_deploy/recipes/version.rb",
35
+ "lib/ninja_deploy/recipes/whenever.rb",
36
+ "ninja-deploy.gemspec",
37
+ "spec/ninja-deploy_spec.rb",
38
+ "spec/spec.opts",
39
+ "spec/spec_helper.rb"
40
40
  ]
41
41
  s.homepage = %q{http://github.com/ninja-loss/ninja-deploy}
42
- s.rdoc_options = ["--charset=UTF-8"]
43
42
  s.require_paths = ["lib"]
44
- s.rubygems_version = %q{1.3.7}
43
+ s.rubygems_version = %q{1.7.2}
45
44
  s.summary = %q{Common shared deployment recipes.}
46
45
  s.test_files = [
47
46
  "spec/ninja-deploy_spec.rb",
48
- "spec/spec_helper.rb"
47
+ "spec/spec_helper.rb"
49
48
  ]
50
49
 
51
50
  if s.respond_to? :specification_version then
52
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
53
51
  s.specification_version = 3
54
52
 
55
53
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ninja-deploy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease: false
4
+ hash: 31
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 1.1.0
10
+ version: 1.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ninja Loss
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-10 00:00:00 -06:00
19
- default_executable:
18
+ date: 2011-04-07 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: rspec
@@ -59,7 +58,6 @@ extra_rdoc_files:
59
58
  - README.rdoc
60
59
  files:
61
60
  - .document
62
- - .gitignore
63
61
  - .rvmrc
64
62
  - LICENSE
65
63
  - README.rdoc
@@ -70,6 +68,7 @@ files:
70
68
  - lib/ninja_deploy/recipes/deploy.rb
71
69
  - lib/ninja_deploy/recipes/log.rb
72
70
  - lib/ninja_deploy/recipes/passenger.rb
71
+ - lib/ninja_deploy/recipes/rvm.rb
73
72
  - lib/ninja_deploy/recipes/sass.rb
74
73
  - lib/ninja_deploy/recipes/thinking_sphinx.rb
75
74
  - lib/ninja_deploy/recipes/version.rb
@@ -78,13 +77,12 @@ files:
78
77
  - spec/ninja-deploy_spec.rb
79
78
  - spec/spec.opts
80
79
  - spec/spec_helper.rb
81
- has_rdoc: true
82
80
  homepage: http://github.com/ninja-loss/ninja-deploy
83
81
  licenses: []
84
82
 
85
83
  post_install_message:
86
- rdoc_options:
87
- - --charset=UTF-8
84
+ rdoc_options: []
85
+
88
86
  require_paths:
89
87
  - lib
90
88
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -108,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
106
  requirements: []
109
107
 
110
108
  rubyforge_project:
111
- rubygems_version: 1.3.7
109
+ rubygems_version: 1.7.2
112
110
  signing_key:
113
111
  specification_version: 3
114
112
  summary: Common shared deployment recipes.
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC