production_chain 0.0.5 → 0.0.6
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.md +8 -1
- data/lib/{core_ext → production_chain/core_ext}/numeric.rb +0 -0
- data/lib/production_chain/core_ext/string.rb +13 -0
- data/lib/production_chain/recipes/dump_and_restore.rb +1 -1
- data/lib/{tasks → production_chain/tasks}/backup.rake +0 -0
- data/lib/{tasks → production_chain/tasks}/db.rake +29 -2
- data/lib/{tasks → production_chain/tasks}/diagrams.rake +0 -0
- data/lib/{tasks → production_chain/tasks}/env.rake +0 -0
- data/lib/{tasks → production_chain/tasks}/mongo.rake +0 -0
- data/lib/{tasks → production_chain/tasks}/revision.rake +0 -0
- data/lib/production_chain/tasks.rb +12 -0
- data/lib/production_chain/version.rb +1 -1
- data/lib/production_chain.rb +2 -2
- data/rails/init.rb +1 -2
- metadata +19 -15
- data/lib/tasks.rb +0 -9
data/README.md
CHANGED
@@ -4,7 +4,14 @@ A rails gem that incorporate various libs, recipes and tasks
|
|
4
4
|
|
5
5
|
## Rake
|
6
6
|
|
7
|
-
|
7
|
+
### Rails 3
|
8
|
+
Rake tasks are automatically loaded in a rails environment.
|
9
|
+
|
10
|
+
### Rails 2
|
11
|
+
Rake tasks are not automatically loaded in your Rails 2 application. To get them, add this line to your project `Rakefile`:
|
12
|
+
```ruby
|
13
|
+
require 'production_chain/tasks'
|
14
|
+
```
|
8
15
|
|
9
16
|
## Capistrano
|
10
17
|
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'unicode' unless defined?(Rails) && Rails.version >= "2.2.2"
|
2
|
+
|
3
|
+
class String
|
4
|
+
def to_slug
|
5
|
+
return parameterize if defined?(Rails) && Rails.version >= "2.2.2"
|
6
|
+
str = Unicode.normalize_KD(self).gsub(/[^\x00-\x7F]/n,'')
|
7
|
+
str = str.gsub(/\W+/, '-').gsub(/^-+/,'').gsub(/-+$/,'').downcase
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_simple_format
|
11
|
+
self.gsub("</p>", "\n\n").gsub("<br />", "\n")
|
12
|
+
end
|
13
|
+
end
|
File without changes
|
@@ -87,15 +87,42 @@ private
|
|
87
87
|
|
88
88
|
def backup_mongodb_database database, user, password, host
|
89
89
|
cmd = "rm -rf dump/ 2>/dev/null && /usr/bin/env mongodump -h #{host} -d #{database}"
|
90
|
-
|
90
|
+
if user.blank?
|
91
|
+
output = cmd
|
92
|
+
else
|
93
|
+
cmd << " -u #{user}"
|
94
|
+
if password.blank?
|
95
|
+
output = cmd
|
96
|
+
else
|
97
|
+
cmd << " --password"
|
98
|
+
output = "#{cmd} ... [password filtered]"
|
99
|
+
cmd << " #{password}"
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
[cmd, output].each do |command|
|
104
|
+
command << " && tar czfh #{archive_name} dump/"
|
105
|
+
end
|
91
106
|
|
107
|
+
puts output
|
92
108
|
system(cmd)
|
93
109
|
end
|
94
110
|
|
95
111
|
def restore_mongodb_database database, user, password, host
|
96
112
|
cmd = "rm -rf dump/ 2>/dev/null && tar xvzf #{archive_name}"
|
97
113
|
cmd += " && /usr/bin/env mongorestore --drop -h #{host} -d #{database} --dir dump/*_*"
|
98
|
-
|
114
|
+
if user.blank?
|
115
|
+
puts cmd
|
116
|
+
else
|
117
|
+
cmd << " -u #{user}"
|
118
|
+
if password.blank?
|
119
|
+
puts cmd
|
120
|
+
else
|
121
|
+
cmd << " --password"
|
122
|
+
puts "#{cmd} ... [password filtered]"
|
123
|
+
cmd << " #{password}"
|
124
|
+
end
|
125
|
+
end
|
99
126
|
|
100
127
|
system(cmd)
|
101
128
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
if Rails.version >= '3'
|
2
|
+
module ProductionChain
|
3
|
+
class Railtie < Rails::Railtie
|
4
|
+
rake_tasks do
|
5
|
+
Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each { |file| load file }
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
else
|
10
|
+
require 'rake'
|
11
|
+
Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each { |file| load file }
|
12
|
+
end
|
data/lib/production_chain.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
if defined?(Rails)
|
2
2
|
# Core Ext
|
3
|
-
require
|
3
|
+
Dir[File.join(File.dirname(__FILE__), 'production_chain/core_ext/**/*.rb')].each { |file| require file }
|
4
4
|
|
5
5
|
# Rails
|
6
6
|
require "rails/action_controller/abstract_request"
|
7
7
|
require "rails/action_view/text_helper"
|
8
8
|
|
9
9
|
# Rake Tasks
|
10
|
-
require "tasks"
|
10
|
+
require "production_chain/tasks"
|
11
11
|
end
|
data/rails/init.rb
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
require "core_ext/numeric"
|
1
|
+
require File.join(File.dirname(__FILE__), '../lib/production_chain.rb')
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: production_chain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 19
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Novelys
|
@@ -14,8 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2012-
|
18
|
-
default_executable:
|
18
|
+
date: 2012-08-22 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: A rails plugin that incorporate various libs, recipes and tasks
|
@@ -30,24 +30,24 @@ extra_rdoc_files: []
|
|
30
30
|
files:
|
31
31
|
- .gitignore
|
32
32
|
- README.md
|
33
|
-
- lib/core_ext/numeric.rb
|
34
33
|
- lib/production_chain.rb
|
35
34
|
- lib/production_chain/capistrano.rb
|
35
|
+
- lib/production_chain/core_ext/numeric.rb
|
36
|
+
- lib/production_chain/core_ext/string.rb
|
36
37
|
- lib/production_chain/recipes/dump_and_restore.rb
|
37
38
|
- lib/production_chain/recipes/sphinx.rb
|
39
|
+
- lib/production_chain/tasks.rb
|
40
|
+
- lib/production_chain/tasks/backup.rake
|
41
|
+
- lib/production_chain/tasks/db.rake
|
42
|
+
- lib/production_chain/tasks/diagrams.rake
|
43
|
+
- lib/production_chain/tasks/env.rake
|
44
|
+
- lib/production_chain/tasks/mongo.rake
|
45
|
+
- lib/production_chain/tasks/revision.rake
|
38
46
|
- lib/production_chain/version.rb
|
39
47
|
- lib/rails/action_controller/abstract_request.rb
|
40
48
|
- lib/rails/action_view/text_helper.rb
|
41
|
-
- lib/tasks.rb
|
42
|
-
- lib/tasks/backup.rake
|
43
|
-
- lib/tasks/db.rake
|
44
|
-
- lib/tasks/diagrams.rake
|
45
|
-
- lib/tasks/env.rake
|
46
|
-
- lib/tasks/mongo.rake
|
47
|
-
- lib/tasks/revision.rake
|
48
49
|
- production_chain.gemspec
|
49
50
|
- rails/init.rb
|
50
|
-
has_rdoc: true
|
51
51
|
homepage: http://github.com/novelys/production_chain
|
52
52
|
licenses: []
|
53
53
|
|
@@ -57,16 +57,20 @@ rdoc_options: []
|
|
57
57
|
require_paths:
|
58
58
|
- lib
|
59
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
60
61
|
requirements:
|
61
62
|
- - ">="
|
62
63
|
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
63
65
|
segments:
|
64
66
|
- 0
|
65
67
|
version: "0"
|
66
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
67
70
|
requirements:
|
68
71
|
- - ">="
|
69
72
|
- !ruby/object:Gem::Version
|
73
|
+
hash: 23
|
70
74
|
segments:
|
71
75
|
- 1
|
72
76
|
- 3
|
@@ -75,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
79
|
requirements: []
|
76
80
|
|
77
81
|
rubyforge_project: production_chain
|
78
|
-
rubygems_version: 1.
|
82
|
+
rubygems_version: 1.8.19
|
79
83
|
signing_key:
|
80
84
|
specification_version: 3
|
81
85
|
summary: Production Chain
|