capones_recipes 1.2.0 → 1.2.2

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,14 +64,13 @@ Capistrano::Configuration.instance.load do
64
64
 
65
65
  # Local DB import
66
66
  username, password, database, host = database_config('development')
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}"
67
+ run "bzip2 -d -c #{filename} | mysql -u #{username} --password='#{password}' #{database}"
68
+ run "rm -f #{filename}"
70
69
 
71
70
  logger.important "sync database from the stage '#{stage}' to local finished"
72
71
 
73
72
  # Start db:migrate
74
- run_locally "rake db:migrate"
73
+ run "rake db:migrate"
75
74
  end
76
75
 
77
76
  desc <<-DESC
@@ -92,7 +91,7 @@ Capistrano::Configuration.instance.load do
92
91
  end
93
92
  logger.info "sync #{syncdir} from #{server}:#{port} to local"
94
93
  destination, base = Pathname.new(syncdir).split
95
- run_locally "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}"
96
95
  end
97
96
 
98
97
  logger.important "sync filesystem from the stage '#{stage}' to local finished"
@@ -135,9 +134,8 @@ Capistrano::Configuration.instance.load do
135
134
 
136
135
  # Local DB import
137
136
  username, password, database, host = database_config('development')
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}"
137
+ run "bzip2 -d -c #{filename} | mysql -u #{username} --password='#{password}' #{database}"
138
+ run "rm -f #{filename}"
141
139
 
142
140
  logger.important "sync database from the stage '#{stage}' to local finished"
143
141
  end
@@ -183,9 +181,9 @@ Capistrano::Configuration.instance.load do
183
181
  filename = "dump.local.#{Time.now.strftime '%Y-%m-%d_%H:%M:%S'}.sql.bz2"
184
182
  username, password, database, host = database_config('development')
185
183
  host_option = host ? "--host='#{host}'" : ""
186
- run_locally "mysqldump -u #{username} --password='#{password}' #{host_option} #{database} | bzip2 -9 > #{filename}"
184
+ run "mysqldump -u #{username} --password='#{password}' #{host_option} #{database} | bzip2 -9 > #{filename}"
187
185
  upload filename, "#{shared_path}/sync/#{filename}"
188
- run_locally "rm -f #{filename}"
186
+ system "rm -f #{filename}"
189
187
 
190
188
  # Remote DB import
191
189
  username, password, database, host = remote_database_config(stage)
@@ -221,7 +219,7 @@ Capistrano::Configuration.instance.load do
221
219
 
222
220
  # Sync directory up
223
221
  logger.info "sync #{syncdir} to #{server}:#{port} from local"
224
- run_locally "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}"
225
223
  end
226
224
  logger.important "sync filesystem from local to the stage '#{stage}' finished"
227
225
  end
@@ -250,7 +248,7 @@ Capistrano::Configuration.instance.load do
250
248
 
251
249
  on_rollback do
252
250
  delete "#{shared_path}/sync/#{filename}"
253
- run_locally "rm -f #{filename}"
251
+ system "rm -f #{filename}"
254
252
  end
255
253
 
256
254
  # Make a backup before importing
@@ -264,9 +262,9 @@ Capistrano::Configuration.instance.load do
264
262
  filename = "dump.local.#{Time.now.strftime '%Y-%m-%d_%H:%M:%S'}.sql.bz2"
265
263
  username, password, database, host = database_config('development')
266
264
  host_option = host ? "--host='#{host}'" : ""
267
- run_locally "mysqldump -u #{username} --password='#{password}' #{host_option} #{database} | bzip2 -9 > #{filename}"
265
+ run "mysqldump -u #{username} --password='#{password}' #{host_option} #{database} | bzip2 -9 > #{filename}"
268
266
  upload filename, "#{shared_path}/sync/#{filename}"
269
- run_locally "rm -f #{filename}"
267
+ system "rm -f #{filename}"
270
268
 
271
269
  # Remote DB import
272
270
  username, password, database, host = remote_database_config(stage)
@@ -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.2.0"
2
+ VERSION = "1.2.2"
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: 31
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 2
9
- - 0
10
- version: 1.2.0
4
+ prerelease:
5
+ version: 1.2.2
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-24 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.3.7
165
+ rubygems_version: 1.8.10
197
166
  signing_key:
198
167
  specification_version: 3
199
168
  summary: Some capistrano recipes for use.