capones_recipes 1.11.4 → 1.11.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,71 @@
1
+ Capistrano::Configuration.instance.load do
2
+ before "deploy:setup", "db:prepare_config"
3
+ after "deploy:finalize_update", "db:symlink"
4
+
5
+ namespace :db do
6
+ desc "Create database.yaml based on example"
7
+ task :prepare_config do
8
+ run "mkdir -p #{shared_path}/db"
9
+ run "mkdir -p #{shared_path}/config"
10
+ end
11
+
12
+ # Author:: Simone Carletti <weppos@weppos.net>
13
+ # License:: MIT License
14
+ # Link:: http://www.simonecarletti.com/
15
+ # Source:: http://gist.github.com/2769
16
+ desc <<-DESC
17
+ Creates the database.yml configuration file in shared path.
18
+
19
+ By default, this task uses a template unless a template
20
+ called database.yml.erb is found either is :template_dir
21
+ or /config/deploy folders. The default template matches
22
+ the template for config/database.yml file shipped with Rails.
23
+
24
+ When this recipe is loaded, db:configure is automatically configured
25
+ to be invoked after deploy:setup. You can skip this task setting
26
+ the variable :skip_db_setup to true. This is especially useful
27
+ if you are using this recipe in combination with
28
+ capistrano-ext/multistaging to avoid multiple db:configure calls
29
+ when running deploy:configure for all stages one by one.
30
+ DESC
31
+ task :configure, :except => { :no_release => true } do
32
+
33
+ default_template = <<-EOF
34
+ base: &base
35
+ adapter: sqlite3
36
+ timeout: 5000
37
+ development:
38
+ database: #{shared_path}/db/development.sqlite3
39
+ <<: *base
40
+ test:
41
+ database: #{shared_path}/db/test.sqlite3
42
+ <<: *base
43
+ production:
44
+ database: #{shared_path}/db/production.sqlite3
45
+ <<: *base
46
+ EOF
47
+
48
+ location = fetch(:template_dir, "config/deploy") + '/database.yml.erb'
49
+ template = File.file?(location) ? File.read(location) : default_template
50
+
51
+ config = ERB.new(template)
52
+
53
+ put config.result(binding), "#{shared_path}/config/database.yml"
54
+ end
55
+
56
+ desc "Make symlink for shared database yaml"
57
+ task :symlink do
58
+ run "ln -nfs #{shared_path}/config/database.yml #{latest_release}/config/database.yml"
59
+ end
60
+
61
+ task :rake, :roles => :app do
62
+ run("cd #{deploy_to}/current && /usr/bin/env bundle exec rake #{rake_task} RAILS_ENV=#{rails_env}")
63
+ end
64
+
65
+ desc "Setup database"
66
+ task :setup, :roles => :db do
67
+ set :rake_task, 'db:setup'
68
+ rake
69
+ end
70
+ end
71
+ end
@@ -1,3 +1,3 @@
1
1
  module CaponesRecipes
2
- VERSION = "1.11.4"
2
+ VERSION = "1.11.5"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capones_recipes
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 49
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 11
9
- - 4
10
- version: 1.11.4
9
+ - 5
10
+ version: 1.11.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roman Simecek (CyT)
@@ -147,7 +147,7 @@ files:
147
147
  - lib/capones_recipes/tasks/kuhsaft/sync.rb
148
148
  - lib/capones_recipes/tasks/new_relic.rb
149
149
  - lib/capones_recipes/tasks/rails.rb
150
- - lib/capones_recipes/tasks/rails/database_yml.rb
150
+ - lib/capones_recipes/tasks/rails/database.rb
151
151
  - lib/capones_recipes/tasks/rails/logs.rb
152
152
  - lib/capones_recipes/tasks/restful_authentication.rb
153
153
  - lib/capones_recipes/tasks/settings_logic.rb
@@ -1,27 +0,0 @@
1
- Capistrano::Configuration.instance.load do
2
- before "deploy:setup", "db:prepare_config"
3
- after "deploy:finalize_update", "db:symlink"
4
-
5
- namespace :db do
6
- desc "Create database.yaml based on example"
7
- task :prepare_config do
8
- run "mkdir -p #{shared_path}/config"
9
- upload "config/database.yml.example", "#{shared_path}/config/database.yml", :via => :scp
10
- end
11
-
12
- desc "Make symlink for shared database yaml"
13
- task :symlink do
14
- run "ln -nfs #{shared_path}/config/database.yml #{latest_release}/config/database.yml"
15
- end
16
-
17
- task :rake, :roles => :app do
18
- run("cd #{deploy_to}/current && /usr/bin/env bundle exec rake #{rake_task} RAILS_ENV=#{rails_env}")
19
- end
20
-
21
- desc "Setup database"
22
- task :setup, :roles => :app do
23
- set :rake_task, 'db:setup'
24
- rake
25
- end
26
- end
27
- end