crushserver 0.1.6 → 0.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/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ *.gem
2
+ pkg
data/Rakefile CHANGED
@@ -1,31 +1,13 @@
1
- require 'rubygems'
2
-
3
- # From will_paginate gem: http://wiki.github.com/mislav/will_paginate
4
- desc %{Update ".manifest" with the latest list of project filenames. Respect\
5
- .gitignore by excluding everything that git ignores. Update `files` and\
6
- `test_files` arrays in "*.gemspec" file if it's present.}
7
- task :manifest do
8
- list = Dir['**/*'].sort
9
- spec_file = Dir['*.gemspec'].first
10
- list -= [spec_file] if spec_file
11
-
12
- File.read('.gitignore').each_line do |glob|
13
- glob = glob.chomp.sub(/^\//, '')
14
- list -= Dir[glob]
15
- list -= Dir["#{glob}/**/*"] if File.directory?(glob) and !File.symlink?(glob)
16
- puts "excluding #{glob}"
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gemspec|
4
+ gemspec.name = 'crushserver'
5
+ gemspec.summary = "A collection of capistrano tasks frequently used at Crush + Lovely."
6
+ gemspec.description = gemspec.summary
7
+ gemspec.authors = ['PJ Kelly', 'Mason Browne']
8
+ gemspec.email = 'pj@crushlovely.com'
9
+ gemspec.homepage = 'http://github.com/crushlovely/crushserver'
17
10
  end
18
-
19
- if spec_file
20
- spec = File.read spec_file
21
- spec.gsub! /^(\s* s.(test_)?files \s* = \s* )( \[ [^\]]* \] | %w\( [^)]* \) )/mx do
22
- assignment = $1
23
- bunch = $2 ? list.grep(/^test\//) : list
24
- '%s%%w(%s)' % [assignment, bunch.join(' ')]
25
- end
26
-
27
- File.open(spec_file, 'w') {|f| f << spec }
28
- end
29
- File.open('.manifest', 'w') {|f| f << list.join("\n") }
11
+ rescue LoadError
12
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
30
13
  end
31
-
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.0
@@ -0,0 +1,43 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{crushserver}
8
+ s.version = "0.2.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["PJ Kelly", "Mason Browne"]
12
+ s.date = %q{2009-10-22}
13
+ s.description = %q{A collection of capistrano tasks frequently used at Crush + Lovely.}
14
+ s.email = %q{pj@crushlovely.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README"
18
+ ]
19
+ s.files = [
20
+ ".gitignore",
21
+ "LICENSE",
22
+ "README",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "crushserver.gemspec",
26
+ "lib/crushserver/recipes.rb"
27
+ ]
28
+ s.homepage = %q{http://github.com/crushlovely/crushserver}
29
+ s.rdoc_options = ["--charset=UTF-8"]
30
+ s.require_paths = ["lib"]
31
+ s.rubygems_version = %q{1.3.5}
32
+ s.summary = %q{A collection of capistrano tasks frequently used at Crush + Lovely.}
33
+
34
+ if s.respond_to? :specification_version then
35
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
36
+ s.specification_version = 3
37
+
38
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
39
+ else
40
+ end
41
+ else
42
+ end
43
+ end
@@ -65,29 +65,6 @@ Capistrano::Configuration.instance(:must_exist).load do
65
65
  end
66
66
  end
67
67
  end
68
-
69
-
70
- desc "create database.yml"
71
- task :create_database_yml do
72
- # Gather some info
73
- set :db_pass, Capistrano::CLI.password_prompt("Database Password: ")
74
-
75
- # Set defaults
76
- set :db_user, "deploy"
77
- set :db_host, "localhost"
78
- set :db_adapter, "mysql"
79
- database_configuration =<<-EOF
80
- #{rails_env}:
81
- adapter: #{db_adapter}
82
- host: #{db_host}
83
- username: #{db_user}
84
- password: #{db_pass}
85
- database: #{application}_#{rails_env}
86
- EOF
87
-
88
- run "mkdir -p #{shared_path}/config"
89
- put database_configuration, "#{shared_path}/config/database.yml"
90
- end
91
68
 
92
69
  desc "Clean database sessions older than 12 hours"
93
70
  task :clean_sessions do
@@ -98,158 +75,5 @@ EOF
98
75
  task :copy_apache_conf_file do
99
76
  sudo "cp #{current_path}/config/apache/#{stage}.conf /etc/httpd/conf/apps/#{application}.conf"
100
77
  end
101
-
102
- desc "Stream log from rails"
103
- task :log, :roles => :app do
104
- stream "tail -f #{current_path}/log/#{rails_env}.log"
105
- end
106
-
107
- desc "Stream access log"
108
- task :access_log, :roles => :app do
109
- sudo_stream "tail -f /etc/httpd/logs/#{domain}-access_log"
110
- end
111
-
112
- desc "Stream error log"
113
- task :error_log, :roles => :app do
114
- sudo_stream "tail -f /etc/httpd/logs/#{domain}-error_log"
115
- end
116
-
117
- desc "Stream rewrite log"
118
- task :rewrite_log, :roles => :app do
119
- sudo_stream "tail -f /etc/httpd/logs/#{domain}-rewrite_log"
120
- end
121
-
122
- desc "Show output of top"
123
- task :server_top do
124
- sudo_stream "top -b -n1"
125
- #sudo "top -b -n1"
126
- end
127
-
128
- desc "Remove log, tmp, and database.yml files from repository."
129
- task :prep_svn do
130
- remove_log_from_svn
131
- remove_tmp_from_svn
132
- remove_database_yml_from_svn
133
- end
134
-
135
- desc "Remove log from svn."
136
- task :remove_log_from_svn do
137
- puts "removing log directory contents from svn"
138
- system "svn remove log/*"
139
- puts "ignoring log directory"
140
- system "svn propset svn:ignore '*.log' log/"
141
- system "svn update log/"
142
- puts "committing changes"
143
- system "svn commit -m 'Removed and ignored log files'"
144
- end
145
-
146
- desc "Remove tmp from svn."
147
- task :remove_tmp_from_svn do
148
- puts "removing tmp directory from svn"
149
- system "svn remove tmp/*"
150
- puts "ignoring tmp directory"
151
- system "svn propset svn:ignore '*' tmp/"
152
- system "svn update tmp/"
153
- puts "committing changes"
154
- system "svn commit -m 'Removed contents of and ignored tmp'"
155
- end
156
-
157
- desc "Remove database.yml from svn."
158
- task :remove_database_yml_from_svn do
159
- puts "removing database.yml from svn"
160
- system "svn remove config/database.yml"
161
- puts "ignoring database.yml"
162
- system "svn propset svn:ignore 'database.yml' config/"
163
- system "svn update config/"
164
- puts "committing changes"
165
- system "svn commit -m 'Removed and ignored database.yml'"
166
- end
167
-
168
- desc "Create a local database.yml file (for use after it's been ignored by svn)"
169
- task :create_local_database_yml do
170
- database_yml_path = 'config/database.yml'
171
- question = "This task will over-write #{database_yml_path} if it exists. Are you sure you wish to continue? (y/n) "
172
- if Capistrano::CLI.ui.ask(question) == 'y'
173
- puts
174
- puts "First we need some configuration info..."
175
- puts
176
- set :db_user, Capistrano::CLI.ui.ask("Database User: ")
177
- set :db_password, Capistrano::CLI.password_prompt("Database Password: ")
178
- set :db_host, "localhost"
179
- set :db_adapter, "mysql"
180
- database_configuration =<<-EOF
181
- local: &local
182
- adapter: mysql
183
- host: localhost
184
- username: #{db_user}
185
- password: #{db_password}
186
-
187
- development:
188
- database: #{application}_development
189
- <<: *local
190
-
191
- test:
192
- database: #{application}_test
193
- <<: *local
194
- EOF
195
- system "touch #{database_yml_path} && > #{database_yml_path}"
196
- system "echo \"#{database_configuration}\" >> #{database_yml_path}"
197
- puts
198
- puts "Success! #{database_yml_path} has been created!"
199
- else
200
- puts "Goodbye."
201
- end
202
- end
203
- end
204
- end
205
-
206
- # So we're... 99% sure that these no longer apply.
207
- class Capistrano::Configuration
208
-
209
- ##
210
- # Run a command as root and stream it back
211
-
212
- def sudo_stream(command)
213
- sudo(command) do |channel, stream, out|
214
- puts out if stream == :out
215
- if stream == :err
216
- puts "[err : #{channel[:host]}] #{out}"
217
- break
218
- end
219
- end
220
- end
221
-
222
- # Run a task and ask for input when input_query is seen.
223
- # Sends the response back to the server.
224
- #
225
- # +input_query+ is a regular expression.
226
- #
227
- # Can be used where +run+ would otherwise be used.
228
- #
229
- # run_with_input 'ssh-keygen ...'
230
- def run_with_input(shell_command, input_query=/^Password/)
231
- handle_command_with_input(:run, shell_command, input_query)
232
78
  end
233
-
234
- # Run a task as root and ask for input when a regular expression is seen.
235
- # Sends the response back to the server.
236
- #
237
- # +input_query+ is a regular expression
238
- def sudo_with_input(shell_command, input_query=/^Password/)
239
- handle_command_with_input(:sudo, shell_command, input_query)
240
- end
241
-
242
- private
243
-
244
- # Do the actual capturing of the input and streaming of the output.
245
- def handle_command_with_input(local_run_method, shell_command, input_query)
246
- send(local_run_method, shell_command) do |channel, stream, data|
247
- logger.info data, channel[:host]
248
- if data =~ input_query
249
- pass = Capistrano::CLI.password_prompt "#{data}:"
250
- channel.send_data "#{pass}\n"
251
- end
252
- end
253
- end
254
-
255
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crushserver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - PJ Kelly
@@ -14,26 +14,30 @@ date: 2009-10-22 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies: []
16
16
 
17
- description: A collection of capistrano tasks we use frequently.
18
- email: admin@crushlovely.com
17
+ description: A collection of capistrano tasks frequently used at Crush + Lovely.
18
+ email: pj@crushlovely.com
19
19
  executables: []
20
20
 
21
21
  extensions: []
22
22
 
23
- extra_rdoc_files: []
24
-
23
+ extra_rdoc_files:
24
+ - LICENSE
25
+ - README
25
26
  files:
27
+ - .gitignore
26
28
  - LICENSE
27
29
  - README
28
30
  - Rakefile
31
+ - VERSION
32
+ - crushserver.gemspec
29
33
  - lib/crushserver/recipes.rb
30
34
  has_rdoc: true
31
- homepage: http://github.com/crushlovely/crushserver/tree/master
35
+ homepage: http://github.com/crushlovely/crushserver
32
36
  licenses: []
33
37
 
34
38
  post_install_message:
35
- rdoc_options: []
36
-
39
+ rdoc_options:
40
+ - --charset=UTF-8
37
41
  require_paths:
38
42
  - lib
39
43
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -54,6 +58,6 @@ rubyforge_project:
54
58
  rubygems_version: 1.3.5
55
59
  signing_key:
56
60
  specification_version: 3
57
- summary: A collection of capistrano tasks we use frequently.
61
+ summary: A collection of capistrano tasks frequently used at Crush + Lovely.
58
62
  test_files: []
59
63