capones_recipes 1.1.0 → 1.1.1

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