production_chain 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7d25b0b389d996fd8a2eb5a4420ae6ca99da53bd
4
+ data.tar.gz: 38907458fc71a7f76903a0160269979625571688
5
+ SHA512:
6
+ metadata.gz: 9a35dfab65d00d52b86a25a987250fc73e1803095f8ed499d186978c784466b152e7a26b2442f3739995731659e10e0b5113fcc00d0427ecc3430bc3ff87524b
7
+ data.tar.gz: 7f1897a53d65ded576bbbf4d8a45a1d08d7fc7241c0e505579de87769fbb50a74b3d7334745dae71d57fdc6e41bcc48e1fb0dd3c0b9bb25daaa4519eea4d9ce3
data/README.md CHANGED
@@ -1,27 +1,19 @@
1
1
  # Production Chain
2
2
 
3
- A rails gem that incorporate various libs, recipes and tasks
4
-
5
- ## Rake
3
+ A rails gem that incorporate common rake tasks
6
4
 
7
5
  ### Rails 3
8
6
  Rake tasks are automatically loaded in a rails environment.
9
7
 
10
8
  ### Rails 2
11
- Rake tasks are not automatically loaded in your Rails 2 application. To get them, add this line to your project `Rakefile`:
9
+ Rake tasks are not automatically loaded in your Rails 2 application.
10
+ To get them, add this line to your project `Rakefile`:
11
+
12
12
  ```ruby
13
13
  require 'production_chain/tasks'
14
14
  ```
15
15
 
16
16
  ## Capistrano
17
17
 
18
- Capistrano tasks are *not* automatically loaded. You have to add to your `config/deploy.rb` file:
19
-
20
- ```ruby
21
- require 'bundler/setup'
22
- require 'production_chain/capistrano'
23
- ```
24
-
25
- ### Known issues
26
-
27
- This gem assumes you have the `s3` gem installed, while not explicitly requiring either in the gemspec or in the Gemfile.
18
+ Capistrano tasks were extracted into their own gem,
19
+ [capistranovelys](https://github.com/novelys/capistranovelys).
@@ -1,3 +1,3 @@
1
1
  module ProductionChain
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: production_chain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
5
- prerelease:
4
+ version: 0.0.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Novelys
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-25 00:00:00.000000000 Z
11
+ date: 2014-03-03 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: A rails plugin that incorporate various libs, recipes and tasks
15
14
  email:
@@ -18,16 +17,12 @@ executables: []
18
17
  extensions: []
19
18
  extra_rdoc_files: []
20
19
  files:
21
- - .gitignore
20
+ - ".gitignore"
22
21
  - README.md
23
22
  - lib/production_chain.rb
24
- - lib/production_chain/capistrano.rb
25
23
  - lib/production_chain/core_ext/numeric.rb
26
24
  - lib/production_chain/core_ext/string.rb
27
- - lib/production_chain/recipes/dump_and_restore.rb
28
- - lib/production_chain/recipes/sphinx.rb
29
25
  - lib/production_chain/tasks.rb
30
- - lib/production_chain/tasks/backup.rake
31
26
  - lib/production_chain/tasks/db.rake
32
27
  - lib/production_chain/tasks/diagrams.rake
33
28
  - lib/production_chain/tasks/env.rake
@@ -40,26 +35,25 @@ files:
40
35
  - rails/init.rb
41
36
  homepage: http://github.com/novelys/production_chain
42
37
  licenses: []
38
+ metadata: {}
43
39
  post_install_message:
44
40
  rdoc_options: []
45
41
  require_paths:
46
42
  - lib
47
43
  required_ruby_version: !ruby/object:Gem::Requirement
48
- none: false
49
44
  requirements:
50
- - - ! '>='
45
+ - - ">="
51
46
  - !ruby/object:Gem::Version
52
47
  version: '0'
53
48
  required_rubygems_version: !ruby/object:Gem::Requirement
54
- none: false
55
49
  requirements:
56
- - - ! '>='
50
+ - - ">="
57
51
  - !ruby/object:Gem::Version
58
52
  version: 1.3.6
59
53
  requirements: []
60
54
  rubyforge_project: production_chain
61
- rubygems_version: 1.8.23
55
+ rubygems_version: 2.2.0
62
56
  signing_key:
63
- specification_version: 3
57
+ specification_version: 4
64
58
  summary: Production Chain
65
59
  test_files: []
@@ -1,7 +0,0 @@
1
- require "capistrano"
2
-
3
- if Capistrano::Configuration.instance
4
- Capistrano::Configuration.instance.load_paths << File.dirname(__FILE__)
5
- Capistrano::Configuration.instance.load "recipes/dump_and_restore"
6
- Capistrano::Configuration.instance.load "recipes/sphinx"
7
- end
@@ -1,28 +0,0 @@
1
- Capistrano::Configuration.instance.load do
2
- namespace :db do
3
- # this recipe needs the "mysql tasks" plugin
4
- desc "Make a dump on the remote production box and restore on the local dev box"
5
- task :dump_and_restore, :roles => :db, :only => {:primary => true} do
6
- rake = fetch(:rake, "rake")
7
- rails_env = fetch(:rails_env, "production")
8
- file_env = ENV['FILE'] || "database"
9
- run "cd #{current_release} && RAILS_ENV=#{rails_env} FILE=#{file_env} #{rake} db:backup"
10
- get "#{current_release}/db/dump.tar.gz", "db/dump.tar.gz"
11
- cmd = "RAILS_ENV=#{ ENV['RAILS_ENV'] || "development" } FILE=#{file_env} #{rake} db:restore"
12
- puts cmd
13
- system(cmd) && puts('finished')
14
- end
15
- end
16
-
17
- namespace :assets do
18
- desc "Make a dump on the remote production box and restore on the local dev box"
19
- task :dump_and_restore, :roles => :db, :only => {:primary => true} do
20
- assets_backup_path = "#{current_path}/system.tar.gz"
21
- run "cd #{current_path}/ && tar czfh #{assets_backup_path} public/system/"
22
- get "#{assets_backup_path}", "system.tar.gz"
23
- run "cd #{current_path}/ && rm #{assets_backup_path}"
24
- `rm -rf public/system/*`
25
- `tar xvzf system.tar.gz`
26
- end
27
- end
28
- end
@@ -1,51 +0,0 @@
1
- Capistrano::Configuration.instance.load do
2
- namespace :thinking_sphinx do
3
- desc "Generate the Sphinx configuration file"
4
- task :configure do
5
- rake "thinking_sphinx:configure"
6
- end
7
-
8
- desc "Index data"
9
- task :index do
10
- rake "thinking_sphinx:index"
11
- end
12
-
13
- desc "Start the Sphinx daemon"
14
- task :start do
15
- configure
16
- rake "thinking_sphinx:start"
17
- end
18
-
19
- desc "Stop the Sphinx daemon"
20
- task :stop do
21
- configure
22
- rake "thinking_sphinx:stop"
23
- end
24
-
25
- desc "Stop and then start the Sphinx daemon"
26
- task :restart do
27
- stop
28
- start
29
- end
30
-
31
- desc "Stop, re-index and then start the Sphinx daemon"
32
- task :rebuild do
33
- stop
34
- index
35
- start
36
- end
37
-
38
- desc "Add the shared folder for sphinx files for the production environment"
39
- task :shared_sphinx_folder, :roles => :web do
40
- run "mkdir -p #{shared_path}/db/sphinx/production"
41
- end
42
-
43
- def rake(*tasks)
44
- rails_env = fetch(:rails_env, "production")
45
- rake = fetch(:rake, "rake")
46
- tasks.each do |t|
47
- run "if [ -d #{release_path} ]; then cd #{release_path}; else cd #{current_path}; fi; #{rake} RAILS_ENV=#{rails_env} #{t}"
48
- end
49
- end
50
- end
51
- end
@@ -1,56 +0,0 @@
1
- require 's3'
2
-
3
- namespace :s3 do
4
-
5
- desc "Backup code, database, and scm to S3"
6
- task :backup => ["s3:backup:db", "s3:backup:shared"]
7
-
8
- namespace :backup do
9
- desc "Backup the database to S3"
10
- task :db do
11
- db_tmp_path = "#{Rails.root}/db/dump.tar.gz"
12
- Rake::Task['db:backup'].invoke
13
- send_to_s3(db_tmp_path)
14
- end
15
-
16
- desc "Backup the shared folder to S3"
17
- task :shared do
18
- cmd = " cd .. && tar czfh /tmp/shared.tar.gz shared/ --exclude=shared/log/* --exclude=shared/sphinx/*"
19
- system(cmd)
20
- shared_tmp_path = "/tmp/shared.tar.gz"
21
- send_to_s3(shared_tmp_path)
22
- end
23
- end
24
- end
25
-
26
- private
27
-
28
- def conn
29
- @s3_config ||= YAML.load_file("#{Rails.root}/config/backup_s3.yml")[Rails.env]
30
- @conn ||= S3::Service.new(:access_key_id => @s3_config['access_key_id'],
31
- :secret_access_key => @s3_config['secret_access_key'],
32
- :use_ssl => true)
33
- end
34
-
35
- def bucket_name
36
- @s3_config['bucket_name']
37
- end
38
-
39
- def backup_bucket
40
- begin
41
- bucket ||= conn.buckets.find(bucket_name)
42
- rescue S3::Error::ResponseError
43
- bucket = conn.buckets.build(bucket_name)
44
- bucket.save
45
- end
46
- bucket
47
- end
48
-
49
- def send_to_s3 local_file_path
50
- bucket = backup_bucket
51
- s3_file_path = Time.now.strftime("%Y%m%d") + '/' + local_file_path.split('/').last
52
-
53
- upload = bucket.objects.build(s3_file_path)
54
- upload.content = File.open(local_file_path)
55
- upload.save
56
- end