capones_recipes 1.1.1 → 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/lib/capones_recipes/tasks/airbrake.rb +1 -1
- data/lib/capones_recipes/tasks/airbrake/setup.rb +3 -2
- data/lib/capones_recipes/tasks/bookyt/setup.rb +1 -1
- data/lib/capones_recipes/tasks/database/sync.rb +14 -12
- data/lib/capones_recipes/tasks/utilities.rb +16 -19
- data/lib/capones_recipes/version.rb +1 -1
- metadata +35 -4
@@ -1 +1 @@
|
|
1
|
-
Dir.glob(File.join(File.dirname(__FILE__), '/airbrake/*.rb')).sort.each { |f|
|
1
|
+
Dir.glob(File.join(File.dirname(__FILE__), '/airbrake/*.rb')).sort.each { |f| require f }
|
@@ -6,9 +6,10 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
6
6
|
namespace :airbrake do
|
7
7
|
desc "Creates the air brake initializer with the custom API key."
|
8
8
|
task :setup do
|
9
|
-
api_key =
|
9
|
+
api_key = utilities.ask('Please insert the API key.', '')
|
10
10
|
run "mkdir -p #{shared_path}/config/initializers"
|
11
11
|
initializer_template = File.expand_path(File.dirname(__FILE__) + '/templates/airbrake.rb')
|
12
|
-
|
12
|
+
utilities.init_file(initializer_template, "<%%>", api_key, "#{shared_path}/config/initializers/airbrake.rb")
|
13
|
+
end
|
13
14
|
end
|
14
15
|
end
|
@@ -16,7 +16,7 @@ Capistrano::Configuration.instance(true).load do
|
|
16
16
|
end
|
17
17
|
modules = modules.map {|item| "'#{item}'" }.join(', ')
|
18
18
|
initializer_template = File.expand_path(File.dirname(__FILE__) + '/templates/bookyt.rb')
|
19
|
-
|
19
|
+
utilities.init_file(initializer_template, "<%%>", modules, "#{shared_path}/initializer/bookyt.rb")
|
20
20
|
end
|
21
21
|
|
22
22
|
desc "Make symlink for shared bookyt initializer"
|
@@ -64,13 +64,14 @@ Capistrano::Configuration.instance.load do
|
|
64
64
|
|
65
65
|
# Local DB import
|
66
66
|
username, password, database, host = database_config('development')
|
67
|
-
|
68
|
-
|
67
|
+
run_locally "rake db:drop && rake db:create"
|
68
|
+
run_locally "bzip2 -d -c #{filename} | mysql -u #{username} --password='#{password}' #{database}"
|
69
|
+
run_locally "rm -f #{filename}"
|
69
70
|
|
70
71
|
logger.important "sync database from the stage '#{stage}' to local finished"
|
71
72
|
|
72
73
|
# Start db:migrate
|
73
|
-
|
74
|
+
run_locally "rake db:migrate"
|
74
75
|
end
|
75
76
|
|
76
77
|
desc <<-DESC
|
@@ -91,7 +92,7 @@ Capistrano::Configuration.instance.load do
|
|
91
92
|
end
|
92
93
|
logger.info "sync #{syncdir} from #{server}:#{port} to local"
|
93
94
|
destination, base = Pathname.new(syncdir).split
|
94
|
-
|
95
|
+
run_locally "rsync --verbose --archive --compress --copy-links --delete --stats --rsh='ssh -p #{port}' #{user}@#{server}:#{current_path}/#{syncdir} #{destination.to_s}"
|
95
96
|
end
|
96
97
|
|
97
98
|
logger.important "sync filesystem from the stage '#{stage}' to local finished"
|
@@ -134,8 +135,9 @@ Capistrano::Configuration.instance.load do
|
|
134
135
|
|
135
136
|
# Local DB import
|
136
137
|
username, password, database, host = database_config('development')
|
137
|
-
|
138
|
-
|
138
|
+
run_locally "rake db:drop && rake db:create"
|
139
|
+
run_locally "bzip2 -d -c #{filename} | mysql -u #{username} --password='#{password}' #{database}"
|
140
|
+
run_locally "rm -f #{filename}"
|
139
141
|
|
140
142
|
logger.important "sync database from the stage '#{stage}' to local finished"
|
141
143
|
end
|
@@ -181,9 +183,9 @@ Capistrano::Configuration.instance.load do
|
|
181
183
|
filename = "dump.local.#{Time.now.strftime '%Y-%m-%d_%H:%M:%S'}.sql.bz2"
|
182
184
|
username, password, database, host = database_config('development')
|
183
185
|
host_option = host ? "--host='#{host}'" : ""
|
184
|
-
|
186
|
+
run_locally "mysqldump -u #{username} --password='#{password}' #{host_option} #{database} | bzip2 -9 > #{filename}"
|
185
187
|
upload filename, "#{shared_path}/sync/#{filename}"
|
186
|
-
|
188
|
+
run_locally "rm -f #{filename}"
|
187
189
|
|
188
190
|
# Remote DB import
|
189
191
|
username, password, database, host = remote_database_config(stage)
|
@@ -219,7 +221,7 @@ Capistrano::Configuration.instance.load do
|
|
219
221
|
|
220
222
|
# Sync directory up
|
221
223
|
logger.info "sync #{syncdir} to #{server}:#{port} from local"
|
222
|
-
|
224
|
+
run_locally "rsync --verbose --archive --compress --keep-dirlinks --delete --stats --rsh='ssh -p #{port}' #{syncdir} #{user}@#{server}:#{current_path}/#{destination.to_s}"
|
223
225
|
end
|
224
226
|
logger.important "sync filesystem from local to the stage '#{stage}' finished"
|
225
227
|
end
|
@@ -248,7 +250,7 @@ Capistrano::Configuration.instance.load do
|
|
248
250
|
|
249
251
|
on_rollback do
|
250
252
|
delete "#{shared_path}/sync/#{filename}"
|
251
|
-
|
253
|
+
run_locally "rm -f #{filename}"
|
252
254
|
end
|
253
255
|
|
254
256
|
# Make a backup before importing
|
@@ -262,9 +264,9 @@ Capistrano::Configuration.instance.load do
|
|
262
264
|
filename = "dump.local.#{Time.now.strftime '%Y-%m-%d_%H:%M:%S'}.sql.bz2"
|
263
265
|
username, password, database, host = database_config('development')
|
264
266
|
host_option = host ? "--host='#{host}'" : ""
|
265
|
-
|
267
|
+
run_locally "mysqldump -u #{username} --password='#{password}' #{host_option} #{database} | bzip2 -9 > #{filename}"
|
266
268
|
upload filename, "#{shared_path}/sync/#{filename}"
|
267
|
-
|
269
|
+
run_locally "rm -f #{filename}"
|
268
270
|
|
269
271
|
# Remote DB import
|
270
272
|
username, password, database, host = remote_database_config(stage)
|
@@ -1,26 +1,23 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
3
|
module Utilities
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
4
|
+
# utilities.ask('What is your name?', 'John')
|
5
|
+
def ask(question, default='')
|
6
|
+
question = "\n" + question.join("\n") if question.respond_to?(:uniq)
|
7
|
+
answer = Capistrano::CLI.ui.ask(space(question)).strip
|
8
|
+
answer.empty? ? default : answer
|
9
|
+
end
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
# utilities.yes?('Proceed with install?')
|
12
|
+
def yes?(question)
|
13
|
+
question = "\n" + question.join("\n") if question.respond_to?(:uniq)
|
14
|
+
question += ' (y/n)'
|
15
|
+
ask(question).downcase.include? 'y'
|
16
|
+
end
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
content
|
24
|
-
end
|
18
|
+
def init_file(file, find, replace, target)
|
19
|
+
content = File.open(file).read
|
20
|
+
content.gsub!(find,replace)
|
21
|
+
put content, target
|
25
22
|
end
|
26
23
|
end
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capones_recipes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
hash: 31
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 1.2.0
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Roman Simecek (CyT)
|
@@ -11,7 +16,8 @@ autorequire:
|
|
11
16
|
bindir: bin
|
12
17
|
cert_chain: []
|
13
18
|
|
14
|
-
date: 2011-10-
|
19
|
+
date: 2011-10-24 00:00:00 +02:00
|
20
|
+
default_executable:
|
15
21
|
dependencies:
|
16
22
|
- !ruby/object:Gem::Dependency
|
17
23
|
name: capistrano
|
@@ -21,6 +27,9 @@ dependencies:
|
|
21
27
|
requirements:
|
22
28
|
- - ">="
|
23
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
24
33
|
version: "0"
|
25
34
|
type: :runtime
|
26
35
|
version_requirements: *id001
|
@@ -32,6 +41,9 @@ dependencies:
|
|
32
41
|
requirements:
|
33
42
|
- - ">="
|
34
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
35
47
|
version: "0"
|
36
48
|
type: :runtime
|
37
49
|
version_requirements: *id002
|
@@ -43,6 +55,9 @@ dependencies:
|
|
43
55
|
requirements:
|
44
56
|
- - ">="
|
45
57
|
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
46
61
|
version: "0"
|
47
62
|
type: :runtime
|
48
63
|
version_requirements: *id003
|
@@ -54,6 +69,9 @@ dependencies:
|
|
54
69
|
requirements:
|
55
70
|
- - ">="
|
56
71
|
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
57
75
|
version: "0"
|
58
76
|
type: :runtime
|
59
77
|
version_requirements: *id004
|
@@ -65,6 +83,9 @@ dependencies:
|
|
65
83
|
requirements:
|
66
84
|
- - ">="
|
67
85
|
- !ruby/object:Gem::Version
|
86
|
+
hash: 3
|
87
|
+
segments:
|
88
|
+
- 0
|
68
89
|
version: "0"
|
69
90
|
type: :development
|
70
91
|
version_requirements: *id005
|
@@ -76,6 +97,9 @@ dependencies:
|
|
76
97
|
requirements:
|
77
98
|
- - ">="
|
78
99
|
- !ruby/object:Gem::Version
|
100
|
+
hash: 3
|
101
|
+
segments:
|
102
|
+
- 0
|
79
103
|
version: "0"
|
80
104
|
type: :development
|
81
105
|
version_requirements: *id006
|
@@ -139,6 +163,7 @@ files:
|
|
139
163
|
- lib/capones_recipes/tasks/thinking_sphinx/thinking_sphinx.rb
|
140
164
|
- lib/capones_recipes/tasks/utilities.rb
|
141
165
|
- lib/capones_recipes/version.rb
|
166
|
+
has_rdoc: true
|
142
167
|
homepage: http://github.com/raskhadafi/capones-recipes
|
143
168
|
licenses:
|
144
169
|
- MIT
|
@@ -152,17 +177,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
177
|
requirements:
|
153
178
|
- - ">="
|
154
179
|
- !ruby/object:Gem::Version
|
180
|
+
hash: 3
|
181
|
+
segments:
|
182
|
+
- 0
|
155
183
|
version: "0"
|
156
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
185
|
none: false
|
158
186
|
requirements:
|
159
187
|
- - ">="
|
160
188
|
- !ruby/object:Gem::Version
|
189
|
+
hash: 3
|
190
|
+
segments:
|
191
|
+
- 0
|
161
192
|
version: "0"
|
162
193
|
requirements: []
|
163
194
|
|
164
195
|
rubyforge_project:
|
165
|
-
rubygems_version: 1.
|
196
|
+
rubygems_version: 1.3.7
|
166
197
|
signing_key:
|
167
198
|
specification_version: 3
|
168
199
|
summary: Some capistrano recipes for use.
|