ms_deploy 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -15,4 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
- idea/
18
+ .idea/
@@ -1,12 +1,18 @@
1
1
  Capistrano::Configuration.instance.load do
2
2
 
3
3
  namespace :deploy do
4
- desc "Compile assets"
5
- task :assets do
6
- run "cd #{release_path}; RAILS_ENV=#{rails_env} #{rake} assets:precompile"
7
- end
8
- end
4
+ namespace :assets, :roles => :web do
5
+ desc "Compile assets"
6
+ task :compile do
7
+ run "cd #{release_path}; RAILS_ENV=#{rails_env} #{rake} assets:precompile"
8
+ end
9
+
10
+ task :symlink, :roles => :web, :except => {:no_release => true} do
11
+ # fixme do nothing, rails 3.1
12
+ end
9
13
 
10
- after 'deploy:symlink_dependencies', 'deploy:assets'
14
+ after 'deploy:symlink_dependencies', 'deploy:assets:compile'
11
15
 
16
+ end
17
+ end
12
18
  end
@@ -1,23 +1,15 @@
1
1
  Capistrano::Configuration.instance.load do
2
2
 
3
- rails_root = File.expand_path('../../../', __FILE__)
4
-
5
3
  namespace :deploy do
6
4
  namespace :prepare do
7
5
  task :create_config do
8
- config_file = "#{rails_root}/#{fetch(:configuration_file_prefix, 'config')}.#{fetch(:stage, 'production')}.yml"
9
- raise "No '#{rails_root}/#{fetch(:configuration_file_prefix, 'config')}.#{fetch(:stage, 'production')}.yml' config file for '#{fetch(:stage, 'production')}'" unless File.exists? config_file
10
-
11
6
  run "mkdir -p #{shared_path}/config/"
12
- put(File.read(config_file), "#{shared_path}/config/#{fetch(:configuration_file_prefix, 'config')}.production.yml", :via => :scp)
7
+ put(File.read(database_config_file), "#{shared_path}/config/#{fetch(:configuration_file_prefix, 'config')}.production.yml", :via => :scp)
13
8
  end
14
9
 
15
10
  task :create_database_config do
16
- config_file = "#{rails_root}/database.#{fetch(:stage, 'production')}.yml"
17
- raise "No '#{rails_root}/database.#{fetch(:configuration_file_prefix, 'config')}.#{fetch(:stage, 'production')}.yml' config file for '#{fetch(:stage, 'production')}'" unless File.exists? config_file
18
-
19
11
  run "mkdir -p #{shared_path}/config/"
20
- put(File.read(config_file), "#{shared_path}/config/database.yml", :via => :scp)
12
+ put(File.read(database_config_file), "#{shared_path}/config/database.yml", :via => :scp)
21
13
  end
22
14
 
23
15
  desc "Set up shared directory structure"
@@ -27,7 +19,7 @@ Capistrano::Configuration.instance.load do
27
19
 
28
20
  #desc "Rebuilds css and js asset packages"
29
21
  #task :rebuild_asset_cache, :roles => :app do
30
- # run "cd #{current_path} && #{rake_path} RAILS_ENV=#{fetch(:rails_env, "production")} asset:packager:build_all" # If you’d like to prevent Capistrano from applying your Moonshine manifests for any reason:
22
+ # run "cd #{current_path} && #{rake_path} RAILS_ENV=#{fetch(:rails_env, "production")} asset:packager:build_all"
31
23
  #end
32
24
  end
33
25
  end
@@ -37,3 +29,9 @@ Capistrano::Configuration.instance.load do
37
29
  before :"deploy:setup", :"deploy:prepare:create_shared_folders";
38
30
 
39
31
  end
32
+
33
+ def database_config_file
34
+ config_file = "#{rails_root}/config/#{fetch(:configuration_file_prefix, 'config')}.#{fetch(:stage, 'production')}.yml"
35
+ raise "No config file '#{config_file}' for '#{fetch(:stage, 'production')}'" unless File.exists? config_file
36
+ config_file
37
+ end
@@ -4,7 +4,7 @@ Capistrano::Configuration.instance.load do
4
4
  desc <<-DESC
5
5
  Symlink shared directories and files.
6
6
  DESC
7
- task :symlink_dependencies do
7
+ task :symlink_dependencies, :roles => :web, :except => {:no_release => true} do
8
8
  shared_directories_to_link = fetch(:shared_directories_to_link, [])
9
9
  directories_to_create = fetch(:directories_to_create, [])
10
10
  files_to_delete = fetch(:files_to_delete, [])
@@ -19,6 +19,7 @@ Capistrano::Configuration.instance.load do
19
19
  end
20
20
  end
21
21
 
22
+ before 'deploy:finalize_update', 'deploy:symlink'
22
23
  after 'deploy:symlink', 'deploy:symlink_dependencies'
23
24
 
24
25
  end
@@ -5,10 +5,11 @@ Capistrano::Configuration.instance.load do
5
5
  namespace :deploy do
6
6
  namespace :prepare do
7
7
  task :database do
8
- set_unless :db_admin_user, 'root'
9
- set_unless :db_admin_password, Capistrano::CLI.password_prompt("Type your mysql password for user #{db_admin_user}: ")
10
- set_unless :db_name, application.to_s + '_' + rails_env.to_s
11
- set_unless :db_password, database_config['password']
8
+ set :db_admin_user, 'root' unless fetch(:db_admin_user, nil)
9
+ set :db_admin_password, Capistrano::CLI.password_prompt("Type your mysql password for user '#{db_admin_user}': ") unless fetch(:db_admin_password, nil)
10
+ set :db_name, application.gsub(/\W+/, '')[0..5] + '_' + rails_env.to_s unless fetch(:db_name, nil)
11
+ set :db_user_name, 'root' unless fetch(:db_user_name, nil)
12
+ set :db_user_password, '' unless fetch(:db_user_password, nil)
12
13
 
13
14
  unless database_exits?
14
15
  create_database
@@ -38,7 +39,7 @@ Capistrano::Configuration.instance.load do
38
39
 
39
40
  def setup_database_permissions
40
41
  grant_sql = <<-SQL
41
- GRANT ALL PRIVILEGES ON #{db_name}.* TO #{application}@localhost IDENTIFIED BY '#{db_password}';
42
+ GRANT ALL PRIVILEGES ON #{db_name}.* TO #{db_user_name}@localhost IDENTIFIED BY '#{db_user_password}';
42
43
  SQL
43
44
 
44
45
  run "mysql --user=#{db_admin_user} --password=#{db_admin_password} --execute=\"#{grant_sql}\""
@@ -1,3 +1,3 @@
1
1
  module MsDeploy
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/ms_deploy.gemspec CHANGED
@@ -14,7 +14,11 @@ Gem::Specification.new do |gem|
14
14
  gem.name = "ms_deploy"
15
15
  gem.require_paths = ["lib"]
16
16
 
17
+ gem.add_dependency('capistrano')
18
+ gem.add_dependency('capistrano-ext')
17
19
  gem.add_dependency('erubis')
18
20
 
21
+ #gem 'cap-recipes', '>= 0.3.36', :require => false # http://github.com/nesquena/cap-recipes
22
+
19
23
  gem.version = MsDeploy::VERSION
20
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ms_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,33 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-01 00:00:00.000000000 Z
12
+ date: 2011-12-02 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: capistrano
16
+ requirement: &75236870 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *75236870
25
+ - !ruby/object:Gem::Dependency
26
+ name: capistrano-ext
27
+ requirement: &75236330 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *75236330
14
36
  - !ruby/object:Gem::Dependency
15
37
  name: erubis
16
- requirement: &76228310 !ruby/object:Gem::Requirement
38
+ requirement: &75333520 !ruby/object:Gem::Requirement
17
39
  none: false
18
40
  requirements:
19
41
  - - ! '>='
@@ -21,7 +43,7 @@ dependencies:
21
43
  version: '0'
22
44
  type: :runtime
23
45
  prerelease: false
24
- version_requirements: *76228310
46
+ version_requirements: *75333520
25
47
  description: capistrano deployment task for my projects
26
48
  email:
27
49
  - michael.schiller@gmx.de