capistrano-shortcuts 0.5.1 → 0.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f41962fc29157f3ef75a8f8f7c43a18d90ac805
4
- data.tar.gz: a1f1241f74444d541b8a0741a34c83d0e19d6dba
3
+ metadata.gz: 2bfef9df77ac8d4fd5751d55a9c341f2e0cd2ec8
4
+ data.tar.gz: 4f87c0123b6a2982dfa748aa902e4a9fedea82df
5
5
  SHA512:
6
- metadata.gz: e8de1e72b675aee925a0868d0c47be9e60f193a4ff8f04c5ea5b49229d91f0012a10909fc223fd9ceb9468cbb3f6fff1365e08cd52ff7d3547e49a86ef8d205d
7
- data.tar.gz: 7e2a4ca373244f6a05d4a3e6d8468860ffa1540616fcdec8cd4ebdefccf4d38bcb63c59a5a270fe298df767c90336de18527f8b7de3d357ffda9765500ccb24b
6
+ metadata.gz: f22077f51a320def3ff627ee7a7aabbcbc2b235f16989dc5967cc6741c123aef96084f01370f7692707cbf487ea9f42b2177f003b1a941762d50be426017eba8
7
+ data.tar.gz: 5a56b127f3ba623666caa4ff4b2f40d86314f3cd63ade79713471f481004acc5d44454e1a2fff1552d517c618c18ad228bb46fbd944ea16d26ed2dbea39caf33
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-shortcuts (0.5.1)
4
+ capistrano-shortcuts (0.6.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -8,7 +8,7 @@ This gem simply encapsulate the common custom server tasks I use to manage Rails
8
8
  Add this line to your application's Gemfile:
9
9
 
10
10
  ```ruby
11
- gem 'capistrano-shortcuts'
11
+ gem 'capistrano-shortcuts', require: false
12
12
  ```
13
13
 
14
14
 
@@ -1,11 +1,10 @@
1
- production_protected = true
2
-
3
1
  namespace :db do
4
2
 
5
3
  db_config = YAML::load_file('config/database.yml')
6
4
  local_rails_env = 'development'
7
5
  dump_file = "capistrano-dump.sql"
8
6
 
7
+
9
8
  task pull: [:dump_remote_db, :pull_db, :load_local_db]
10
9
  task push: [:dump_local_db, :push_db, :load_remote_db]
11
10
 
@@ -46,8 +45,10 @@ namespace :db do
46
45
  end
47
46
 
48
47
  task :push_db do
49
- if production_protected and fetch(:rails_env) == 'production'
50
- raise "Sorry, I refuse to push the local database to production."
48
+
49
+ if freeze_production and fetch(:rails_env) == 'production'
50
+ raise "By default, I won't push the local database to production. To override this protection add this to deploy.rb:\nset :production_protected, false'
51
+ "
51
52
  end
52
53
  run_locally do
53
54
  if db_config[fetch(:rails_env)]['host'].nil?
@@ -65,8 +66,9 @@ namespace :db do
65
66
  end
66
67
 
67
68
  task :load_remote_db do
68
- if production_protected and fetch(:rails_env) == 'production'
69
- raise "Sorry, I won't load the remote database on production."
69
+ if freeze_production and fetch(:rails_env) == 'production'
70
+ raise "Sorry, I won't load the remote database to production. To override this protection:\n set :production_protected, false'
71
+ "
70
72
  end
71
73
  on roles(:db) do
72
74
  load_db(db_config[fetch(:rails_env)], "~/#{dump_file}")
@@ -91,6 +93,12 @@ namespace :db do
91
93
  "< #{input_file}")
92
94
  end
93
95
 
96
+
97
+ def freeze_production
98
+ return true if fetch(:production_protected).nil?
99
+
100
+ fetch(:production_protected)
101
+ end
94
102
  # task :backup do
95
103
  # on roles(:db) do
96
104
  # dump_file = "cap-backup-#{Time.now.to_i}.sql"
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Shortcuts
3
- VERSION = "0.5.1"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-shortcuts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Gehman