capones_recipes 1.14.1 → 1.15.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.
@@ -0,0 +1,47 @@
1
+ # Code snippet from: https://raw.github.com/codesnik/rails-recipes/master/lib/rails-recipes/console.rb
2
+
3
+ Capistrano::Configuration.instance.load do
4
+ desc "script/console on a remote server"
5
+ task :console do
6
+ rails_env = fetch(:rails_env, "production")
7
+ server = find_servers(:roles => [:app]).first
8
+ run_with_tty server, %W( script/console #{rails_env} )
9
+ end
10
+
11
+ desc "script/dbconsole on a remote server"
12
+ task :dbconsole do
13
+ rails_env = fetch(:rails_env, "production")
14
+ server = find_servers(:roles => [:app]).first
15
+ run_with_tty server, %W( script/dbconsole #{rails_env} )
16
+ end
17
+
18
+ set :rake_cmd do
19
+ rails_env = fetch(:rails_env, "production")
20
+ "cd #{current_path} && rake RAILS_ENV=#{rails_env}"
21
+ end
22
+
23
+ # FIXME run on only one server?
24
+ desc "task=command runs rake 'command' on application servers"
25
+ task :rake, :roles => [:app] do
26
+ if ENV['task']
27
+ run "#{rake_cmd} #{ENV['task']}"
28
+ else
29
+ # FIXME use logger instead of warn?
30
+ warn "USAGE: cap rails:rake task=..."
31
+ end
32
+ end
33
+
34
+ def run_with_tty server, cmd
35
+ # looks like total pizdets
36
+ command = []
37
+ command += %W( ssh -t #{gateway} -l #{self[:gateway_user] || self[:user]} ) if self[:gateway]
38
+ command += %W( ssh -t )
39
+ command += %W( -p #{server.port}) if server.port
40
+ command += %W( -l #{user} #{server.host} )
41
+ command += %W( cd #{current_path} )
42
+ # have to escape this once if running via double ssh
43
+ command += [self[:gateway] ? '\&\&' : '&&']
44
+ command += Array(cmd)
45
+ system *command
46
+ end
47
+ end
@@ -60,12 +60,22 @@ Capistrano::Configuration.instance.load do
60
60
  run("cd #{latest_release} && /usr/bin/env bundle exec rake #{rake_task} RAILS_ENV=#{rails_env}")
61
61
  end
62
62
 
63
- desc "Setup database"
64
- task :setup, :roles => :db do
63
+ desc "Load DB schema"
64
+ task :load_schema, :roles => :db do
65
65
  set :rake_task, 'db:schema:load'
66
66
  rake
67
+ end
68
+
69
+ desc "Load DB seeds"
70
+ task :load_seed, :roles => :db do
67
71
  set :rake_task, 'db:seed'
68
72
  rake
69
73
  end
74
+
75
+ desc "Setup database"
76
+ task :setup, :roles => :db do
77
+ load_schema
78
+ load_seed
79
+ end
70
80
  end
71
81
  end
@@ -1,3 +1,3 @@
1
1
  module CaponesRecipes
2
- VERSION = "1.14.1"
2
+ VERSION = "1.15.0"
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: 45
4
+ hash: 43
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 14
9
- - 1
10
- version: 1.14.1
8
+ - 15
9
+ - 0
10
+ version: 1.15.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roman Simecek (CyT)
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-12-28 00:00:00 Z
19
+ date: 2012-02-10 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: capistrano
@@ -148,6 +148,7 @@ files:
148
148
  - lib/capones_recipes/tasks/kuhsaft/sync.rb
149
149
  - lib/capones_recipes/tasks/new_relic.rb
150
150
  - lib/capones_recipes/tasks/rails.rb
151
+ - lib/capones_recipes/tasks/rails/console.rb
151
152
  - lib/capones_recipes/tasks/rails/database.rb
152
153
  - lib/capones_recipes/tasks/rails/logs.rb
153
154
  - lib/capones_recipes/tasks/restful_authentication.rb
@@ -188,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
189
  requirements: []
189
190
 
190
191
  rubyforge_project:
191
- rubygems_version: 1.8.10
192
+ rubygems_version: 1.8.12
192
193
  signing_key:
193
194
  specification_version: 3
194
195
  summary: Some capistrano recipes for use.