renfield 0.0.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.
- data/README.textile +52 -0
- data/lib/renfield.rb +85 -0
- data/renfield.gemspec +27 -0
- metadata +85 -0
data/README.textile
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
h1. Renfield
|
2
|
+
|
3
|
+
h2. Installation
|
4
|
+
|
5
|
+
On your @environment.rb@ :
|
6
|
+
|
7
|
+
<pre>
|
8
|
+
config.gem :renfield
|
9
|
+
</pre>
|
10
|
+
|
11
|
+
Then execute @rake gems:install@ if needed.
|
12
|
+
|
13
|
+
The Renfield requires vlad - gems:install should install that one too.
|
14
|
+
|
15
|
+
Your @lib/tasks/vlad.rake@ must also include vlad. Like so:
|
16
|
+
|
17
|
+
<pre>
|
18
|
+
begin
|
19
|
+
require 'vlad'
|
20
|
+
Vlad.load :app => :passenger
|
21
|
+
rescue LoadError
|
22
|
+
# do nothing
|
23
|
+
raise "vlad didn't load!"
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'renfield'
|
27
|
+
</pre>
|
28
|
+
|
29
|
+
|
30
|
+
h2. Additions:
|
31
|
+
|
32
|
+
Renfield includes:
|
33
|
+
|
34
|
+
h3. Methods
|
35
|
+
|
36
|
+
* color generation for console messages: @red@, @green@, @yellow@, @blue@, @magenta@, @cyan@. Example: @puts red('hello')@ will print a red "hello" message on the console.
|
37
|
+
* @info@, @warning@, @error@. They are a fancy way of printing information messages, warnings and errors. Example: @info 'dump done'@
|
38
|
+
* @remote_rake@ for executing a rake on the target server. Example: @remote_rake 'db:drop'@ will do @run "cd #{current_path}; rake RAILS_ENV='production' db:drop"@
|
39
|
+
|
40
|
+
h3. Remote tasks
|
41
|
+
|
42
|
+
* @vlad:chown@ does nothing yet.
|
43
|
+
* @vlad:restart@ does @run "cd #{current_path}; touch tmp/restart.txt"@
|
44
|
+
* @vlad:confirm@ asks for a confirmation before continuing. Otherwise the rake is aborted.
|
45
|
+
* @vlad:clean_migrate@ executes @rake db:reset db:migrate@ on the target server
|
46
|
+
* @vlad:maintenance:set@ puts a "this site is undergoing maintenance" page on the site
|
47
|
+
* @vlad:maintenance:remove@ removes the maintenance page
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
data/lib/renfield.rb
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'vlad'
|
2
|
+
|
3
|
+
namespace :vlad do
|
4
|
+
|
5
|
+
class << self
|
6
|
+
{ :red => "\e[31m",
|
7
|
+
:green => "\e[32m",
|
8
|
+
:yellow => "\e[33m",
|
9
|
+
:blue => "\e[34m",
|
10
|
+
:magenta => "\e[35m",
|
11
|
+
:cyan => "\e[36m",
|
12
|
+
:bold_red => "\e[1;31m",
|
13
|
+
:bold_green => "\e[1;32m",
|
14
|
+
:bold_yellow => "\e[1;33m",
|
15
|
+
:bold_blue => "\e[1;34m",
|
16
|
+
:bold_magenta => "\e[1;35m",
|
17
|
+
:bold_cyan => "\e[1;36m"
|
18
|
+
}.each do |color, code|
|
19
|
+
|
20
|
+
define_method(color) do |text|
|
21
|
+
"#{code}#{text}\e[0m"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def info(text)
|
27
|
+
puts bold_green(text)
|
28
|
+
end
|
29
|
+
|
30
|
+
def warning(text)
|
31
|
+
puts "#{bold_yellow('WARNING')}: #{text}"
|
32
|
+
end
|
33
|
+
|
34
|
+
def error(text)
|
35
|
+
puts "#{bold_red('ERROR')}: #{text}"
|
36
|
+
end
|
37
|
+
|
38
|
+
def remote_rake(command)
|
39
|
+
run "cd #{current_path}; rake RAILS_ENV='production' #{command}"
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "changes the owner of the complete directory to the group 'rails'"
|
43
|
+
remote_task :chown do
|
44
|
+
info "Changing owner to ???"
|
45
|
+
end
|
46
|
+
|
47
|
+
desc "Touch tmp/restart.txt"
|
48
|
+
remote_task :restart do
|
49
|
+
info "Touching tmp/restart.txt"
|
50
|
+
run "cd #{current_path}; touch tmp/restart.txt"
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "Prompt the user before updating the server"
|
54
|
+
task :confirm do
|
55
|
+
puts bold_blue("Please confirm action in #{domain} server (yes/no):")
|
56
|
+
answer = STDIN.gets.chomp
|
57
|
+
if answer != 'yes'
|
58
|
+
raise "Cancelled by user"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
desc "Re-creates the database and migrates"
|
63
|
+
remote_task :clean_migrate do
|
64
|
+
remote_rake('db:reset db:migrate')
|
65
|
+
end
|
66
|
+
|
67
|
+
namespace :maintenance do
|
68
|
+
desc 'Set maintenance mode'
|
69
|
+
remote_task :set do
|
70
|
+
info "Seting maintenance mode"
|
71
|
+
begin
|
72
|
+
run "cp #{current_path}/public/maintenance.html #{current_path}/public/system/maintenance.html"
|
73
|
+
rescue Exception => ex
|
74
|
+
warning ex.to_s
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
desc 'Remove maintenance mode'
|
79
|
+
remote_task :remove do
|
80
|
+
info "Removing maintenance mode"
|
81
|
+
run "rm -f #{current_path}/public/system/maintenance.html"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
data/renfield.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = %q{renfield}
|
3
|
+
s.version = "0.0.1"
|
4
|
+
|
5
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
|
+
s.authors = ["Enrique Garcia Cota", "Francisco de Juan"]
|
7
|
+
s.date = %q{2010-07-22}
|
8
|
+
s.description = %q{Adds several interesting methods and tasks to vlad the deployer}
|
9
|
+
s.email = %q{github@splendeo.es}
|
10
|
+
s.extra_rdoc_files = [
|
11
|
+
"README.textile"
|
12
|
+
]
|
13
|
+
s.files = [
|
14
|
+
"README.textile",
|
15
|
+
"renfield.gemspec",
|
16
|
+
"lib/renfield.rb"
|
17
|
+
]
|
18
|
+
s.homepage = %q{http://github.com/splendeo/renfield}
|
19
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
s.rubygems_version = %q{1.3.5}
|
22
|
+
s.summary = %q{Adds several methods and tasks to vlad the deployer}
|
23
|
+
|
24
|
+
s.add_dependency("vlad", ">= 2.0.0")
|
25
|
+
|
26
|
+
end
|
27
|
+
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: renfield
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Enrique Garcia Cota
|
14
|
+
- Francisco de Juan
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2010-07-22 00:00:00 +02:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: vlad
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 15
|
31
|
+
segments:
|
32
|
+
- 2
|
33
|
+
- 0
|
34
|
+
- 0
|
35
|
+
version: 2.0.0
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id001
|
38
|
+
description: Adds several interesting methods and tasks to vlad the deployer
|
39
|
+
email: github@splendeo.es
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files:
|
45
|
+
- README.textile
|
46
|
+
files:
|
47
|
+
- README.textile
|
48
|
+
- renfield.gemspec
|
49
|
+
- lib/renfield.rb
|
50
|
+
has_rdoc: true
|
51
|
+
homepage: http://github.com/splendeo/renfield
|
52
|
+
licenses: []
|
53
|
+
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options:
|
56
|
+
- --charset=UTF-8
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
77
|
+
requirements: []
|
78
|
+
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 1.3.7
|
81
|
+
signing_key:
|
82
|
+
specification_version: 3
|
83
|
+
summary: Adds several methods and tasks to vlad the deployer
|
84
|
+
test_files: []
|
85
|
+
|