prun-ops 0.3.8 → 0.4.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +11 -0
  4. data/.rubocop_todo.yml +59 -0
  5. data/.ruby-version +1 -1
  6. data/CHANGELOG.md +76 -0
  7. data/CODE_OF_CONDUCT.md +132 -0
  8. data/LICENSE.txt +17 -18
  9. data/README.md +4 -77
  10. data/Rakefile +10 -0
  11. data/lib/capistrano/all.rake +13 -13
  12. data/lib/capistrano/backup.rake +17 -15
  13. data/lib/capistrano/config/app.rake +11 -11
  14. data/lib/capistrano/config/config.rake +12 -10
  15. data/lib/capistrano/config/monitis.rake +3 -1
  16. data/lib/capistrano/config/mysql.rake +9 -11
  17. data/lib/capistrano/config/nginx.rake +8 -6
  18. data/lib/capistrano/config/nodejs.rake +12 -6
  19. data/lib/capistrano/config/postgres.rake +37 -22
  20. data/lib/capistrano/config/rails.rake +3 -2
  21. data/lib/capistrano/config/redis.rake +2 -0
  22. data/lib/capistrano/config/ruby.rake +7 -5
  23. data/lib/capistrano/config/ubuntu.rake +5 -3
  24. data/lib/capistrano/config/yarn.rake +3 -1
  25. data/lib/capistrano/diagnosis.rake +29 -27
  26. data/lib/capistrano/git.rake +14 -11
  27. data/lib/capistrano/{prun-ops.rb → prun_ops.rb} +8 -6
  28. data/lib/{cred.rb → prun/cred.rb} +5 -2
  29. data/lib/{prun-ops → prun/ops}/railitie.rb +5 -3
  30. data/lib/prun/ops/version.rb +7 -0
  31. data/lib/prun/ops.rb +14 -0
  32. data/lib/tasks/backup.rake +18 -13
  33. data/lib/tasks/db.rake +29 -17
  34. data/lib/tasks/git.rake +3 -3
  35. data/lib/tasks/http.rake +4 -2
  36. data/lib/tasks/version.rake +6 -5
  37. data/sig/prun/ops.rbs +6 -0
  38. metadata +27 -51
  39. data/.gitignore +0 -16
  40. data/Gemfile +0 -4
  41. data/Gemfile.lock +0 -60
  42. data/lib/prun-ops/version.rb +0 -3
  43. data/lib/prun-ops.rb +0 -10
  44. data/prun-ops.gemspec +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 116b59e13e79f95494482a9ec283a0dc3fc61937c57e4d39bbb4ab3fc5663f4c
4
- data.tar.gz: 4b6fc7fcb75fa5955c49607bac33244a3a9a5a79882c521e62438776108f9d71
3
+ metadata.gz: ab8a519c3d3c607ef319f544086d6f085e1d691ccd12df93fc5dda7c126db41a
4
+ data.tar.gz: 951a9db04bebc5dd627281212d5da02fc7f4e5b922026413b581bc4478a09d0f
5
5
  SHA512:
6
- metadata.gz: 2fd4c23a4035f580db03178b3df74423a9516d26849a081e849325d592b7adf4654b7457a0caca5fe9683916097017a4232d49e5ecaa0dd9b7919428e6c577bd
7
- data.tar.gz: da3d2673c8ea4efb0dfa56aa6a471327cb329e12c170b5516d0185b11f90f24586cd78a6db7f71900009f1f6f71bc83e043622088392229310c830e374351508
6
+ metadata.gz: f86e9847dbf61129fc413822a2d0a943c61a7cfc48116b08cd670cedd232eceb51de7edfeddf382b0aa86fe62ecc14c14018bf1d4cc1ffdabac35e4f8d39ec85
7
+ data.tar.gz: 4d1a57864a962827a2fb2868e188b082781e25303a353b2dc7586e29b77a106282fb51e0020eb073391d8e3427fdadeb13590b6f59782c9bbefc98194f10a35a
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,11 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 3.1
5
+ NewCops: enable
6
+
7
+ Style/StringLiterals:
8
+ EnforcedStyle: double_quotes
9
+
10
+ Style/StringLiteralsInInterpolation:
11
+ EnforcedStyle: double_quotes
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,59 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2025-05-08 20:49:43 UTC using RuboCop version 1.75.5.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 3
10
+ # Configuration parameters: AllowComments, AllowEmptyLambdas.
11
+ Lint/EmptyBlock:
12
+ Exclude:
13
+ - 'lib/capistrano/config/app.rake'
14
+ - 'lib/tasks/backup.rake'
15
+ - 'lib/tasks/db.rake'
16
+
17
+ # Offense count: 1
18
+ Lint/RescueException:
19
+ Exclude:
20
+ - 'lib/capistrano/config/mysql.rake'
21
+
22
+ # Offense count: 1
23
+ # Configuration parameters: AllowComments, AllowNil.
24
+ Lint/SuppressedException:
25
+ Exclude:
26
+ - 'lib/capistrano/backup.rake'
27
+
28
+ # Offense count: 9
29
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
30
+ # AllowedMethods: refine
31
+ Metrics/BlockLength:
32
+ Max: 59
33
+
34
+ # Offense count: 1
35
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
36
+ Metrics/MethodLength:
37
+ Max: 11
38
+
39
+ # Offense count: 1
40
+ Naming/AccessorMethodName:
41
+ Exclude:
42
+ - 'lib/tasks/version.rake'
43
+
44
+ # Offense count: 3
45
+ # Configuration parameters: AllowedConstants.
46
+ Style/Documentation:
47
+ Exclude:
48
+ - 'spec/**/*'
49
+ - 'test/**/*'
50
+ - 'lib/prun/cred.rb'
51
+ - 'lib/prun/ops.rb'
52
+ - 'lib/prun/ops/railitie.rb'
53
+
54
+ # Offense count: 6
55
+ # This cop supports safe autocorrection (--autocorrect).
56
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
57
+ # URISchemes: http, https
58
+ Layout/LineLength:
59
+ Max: 141
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.1.2
1
+ ruby-3.4.3
data/CHANGELOG.md ADDED
@@ -0,0 +1,76 @@
1
+ ## [Unreleased]
2
+
3
+ ## v0.0.2
4
+
5
+ - First publication
6
+
7
+ ## v0.0.4
8
+
9
+ - Changing homepage and License
10
+ - start|stop|restart thin server per application as Capistrano task
11
+
12
+ ## v0.0.5
13
+
14
+ - Removing Application server version (thin 1.6.2) dependency
15
+
16
+ ## v0.0.6
17
+
18
+ - Fixing DigitalOcean images error when slug is nil for client images
19
+ - Adding git:ff rake task
20
+
21
+ ## v0.0.8
22
+
23
+ - Adding backup[tag] capistrano task for production
24
+
25
+ ## v0.0.9
26
+
27
+ - Fixing Capistrano pulling tasks "pull:data"
28
+
29
+ ## v0.0.10
30
+
31
+ - Removing bin/ops command in order to create open-dock gem
32
+ - Remove prun-ops dependency from 'config/deployment.rb' file and ad it to 'Capfile' as `require 'capistrano/prun-ops'`
33
+
34
+ ## v0.0.21
35
+
36
+ - Remove from your 'config/deploy.rb':
37
+
38
+ ```ruby
39
+ # Backup directories
40
+ require_relative "./application.rb"
41
+ set :backup_dirs, Taskboard::Application.config.backup_dirs
42
+ ```
43
+
44
+ Also add in your Capfile:
45
+
46
+ ```ruby
47
+ ................
48
+ require 'capistrano/rails/migrations'
49
+ require "#{File.dirname(__FILE__)}/config/application"
50
+ require 'capistrano/prun-ops'
51
+ ................
52
+ ```
53
+
54
+ ## v0.1.2
55
+
56
+ - Add `cap stage dbconsole` to open a database console.
57
+
58
+ ## v0.1.6
59
+
60
+ - Add `cap stage rake[db:create]` to execute a rake task in remote server.
61
+
62
+ ## v0.2.0
63
+
64
+ - Configuration tasks: Add `cap stage config` and other tasks.
65
+
66
+ ## v0.2.8
67
+
68
+ - Bastion command
69
+
70
+ ## v0.3.3
71
+
72
+ - Including Cred to easy manage encrypted credentials
73
+
74
+ ## [0.4.0] - 2025-05-08
75
+
76
+ - Upgrade to Ruby 3.4.3
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt CHANGED
@@ -1,22 +1,21 @@
1
- Copyright (c) 2014 Juan Lebrijo
1
+ The MIT License (MIT)
2
2
 
3
- MIT License
3
+ Copyright (c) 2014 jlebrijo
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
12
11
 
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
15
14
 
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -44,7 +44,7 @@ require "capistrano/puma"
44
44
  install_plugin Capistrano::Puma # Default puma tasks
45
45
  install_plugin Capistrano::Puma::Systemd
46
46
  require "#{File.dirname(__FILE__)}/config/application"
47
- require 'capistrano/prun-ops'
47
+ require 'capistrano/prun_ops'
48
48
  Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
49
49
  Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
50
50
  ```
@@ -52,7 +52,7 @@ Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
52
52
  In order to configure RVM and PUMA you have here the params:
53
53
 
54
54
  ```ruby
55
- set :rvm_ruby_version, "ruby-3.2.2"
55
+ set :rvm_ruby_version, File.read(".ruby-version").strip
56
56
  set :rvm_custom_path, "/usr/share/rvm"
57
57
 
58
58
 
@@ -71,7 +71,7 @@ set :puma_bind, "tcp://0.0.0.0:3000"
71
71
  # set :puma_preload_app, true
72
72
  ```
73
73
 
74
- Notice that you are adding all prun-ops tasks with the line `require 'capistrano/prun-ops'`
74
+ Notice that you are adding all prun-ops tasks with the line `require 'capistrano/prun_ops'`
75
75
 
76
76
  Your config/deploy/production.rb:
77
77
 
@@ -97,7 +97,7 @@ Secondary tasks:
97
97
  - `cap [stg] ruby:brightbox`(DEPRECATED) install ruby on .ruby-version version from brightbox
98
98
  - `cap [stg] ruby:rvm` install ruby version manager
99
99
  - `cap [stg] ruby:install_rvm_project_version` installs ruby version in .ruby-version file of the project
100
- - `cap [stg] rails:prepare` install rails dependencies
100
+ - `cap [stg] rails:prepare`(DEPRECATED) install rails dependencies
101
101
  - `cap [stg] postgres:install` install and configure postgres
102
102
  - `cap [stg] postgres:[start|stop|restart]` start/stop postgres
103
103
  - `cap [stg] nginx:install` install and configure nginx
@@ -218,76 +218,3 @@ At this moment we are implementing [NewRelic](http://newrelic.com/) monitoring,
218
218
  ## License
219
219
 
220
220
  [MIT License](http://opensource.org/licenses/MIT). Made by [Lebrijo.com](http://lebrijo.com)
221
-
222
- ## Release notes
223
-
224
- ### v0.0.2
225
-
226
- - First publication
227
-
228
- ### v0.0.4
229
-
230
- - Changing homepage and License
231
- - start|stop|restart thin server per application as Capistrano task
232
-
233
- ### v0.0.5
234
-
235
- - Removing Application server version (thin 1.6.2) dependency
236
-
237
- ### v0.0.6
238
-
239
- - Fixing DigitalOcean images error when slug is nil for client images
240
- - Adding git:ff rake task
241
-
242
- ### v0.0.8
243
-
244
- - Adding backup[tag] capistrano task for production
245
-
246
- ### v0.0.9
247
-
248
- - Fixing Capistrano pulling tasks "pull:data"
249
-
250
- ### v0.0.10
251
-
252
- - Removing bin/ops command in order to create open-dock gem
253
- - Remove prun-ops dependency from 'config/deployment.rb' file and ad it to 'Capfile' as `require 'capistrano/prun-ops'`
254
-
255
- ### v0.0.21
256
-
257
- - Remove from your 'config/deploy.rb':
258
-
259
- ```ruby
260
- # Backup directories
261
- require_relative "./application.rb"
262
- set :backup_dirs, Taskboard::Application.config.backup_dirs
263
- ```
264
-
265
- Also add in your Capfile:
266
-
267
- ```ruby
268
- ................
269
- require 'capistrano/rails/migrations'
270
- require "#{File.dirname(__FILE__)}/config/application"
271
- require 'capistrano/prun-ops'
272
- ................
273
- ```
274
-
275
- ### v0.1.2
276
-
277
- - Add `cap stage dbconsole` to open a database console.
278
-
279
- ### v0.1.6
280
-
281
- - Add `cap stage rake[db:create]` to execute a rake task in remote server.
282
-
283
- ### v0.2.0
284
-
285
- - Configuration tasks: Add `cap stage config` and other tasks.
286
-
287
- ### v0.2.8
288
-
289
- - Bastion command
290
-
291
- ### v0.3.3
292
-
293
- - Including Cred to easy manage encrypted credentials
data/Rakefile CHANGED
@@ -1,2 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
2
11
 
12
+ task default: %i[spec rubocop]
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  if defined?(Rails) && Rails.application.config.respond_to?(:backup_dirs)
3
4
  set :backup_dirs, Rails.application.config.backup_dirs
@@ -6,8 +7,7 @@ else
6
7
  end
7
8
 
8
9
  namespace :deploy do
9
-
10
- %w(start stop restart).each do |action|
10
+ %w[start stop restart].each do |action|
11
11
  desc "#{action.capitalize} application"
12
12
  task :"#{action}" do
13
13
  on roles(:app) do
@@ -19,53 +19,53 @@ namespace :deploy do
19
19
  task :upload_linked_files do
20
20
  on roles :app do
21
21
  shared = "/var/www/#{fetch :application}/shared"
22
- fetch(:linked_files).each do |f|
22
+ fetch(:linked_files)&.each do |f|
23
23
  execute "mkdir -p #{shared}/#{File.dirname f}"
24
24
  upload! f, "#{shared}/#{f}"
25
- end if fetch(:linked_files)
25
+ end
26
26
  end
27
27
  end
28
28
 
29
29
  after :publishing, :upload_linked_files
30
30
  # after :publishing, :restart
31
31
 
32
- desc 'Create database'
32
+ desc "Create database"
33
33
  task :db_create do
34
34
  on roles(:db) do
35
35
  within release_path do
36
36
  with rails_env: fetch(:stage) do
37
- execute :rails, 'db:create'
37
+ execute :rails, "db:create"
38
38
  end
39
39
  end
40
40
  end
41
41
  end
42
- desc 'Create drop'
42
+ desc "Create drop"
43
43
  task :db_drop do
44
44
  on roles(:db) do
45
45
  within release_path do
46
46
  with rails_env: fetch(:stage) do
47
- execute :rails, 'db:drop'
47
+ execute :rails, "db:drop"
48
48
  end
49
49
  end
50
50
  end
51
51
  end
52
- desc 'Setup database'
52
+ desc "Setup database"
53
53
  task :db_reset do
54
54
  on roles(:db) do
55
55
  within release_path do
56
56
  with rails_env: fetch(:stage) do
57
- execute :rails, 'db:schema:load'
58
- execute :rails, 'db:seed'
57
+ execute :rails, "db:schema:load"
58
+ execute :rails, "db:seed"
59
59
  end
60
60
  end
61
61
  end
62
62
  end
63
- desc 'Seed database'
63
+ desc "Seed database"
64
64
  task :db_seed do
65
65
  on roles(:db) do
66
66
  within release_path do
67
67
  with rails_env: fetch(:stage) do
68
- execute :rails, 'db:seed'
68
+ execute :rails, "db:seed"
69
69
  end
70
70
  end
71
71
  end
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  namespace :backup do
2
- desc 'Restore data from git repo, last backup by default'
3
- task :restore, :tag do |task, args|
4
+ desc "Restore data from git repo, last backup by default"
5
+ task :restore, :tag do |_task, args|
4
6
  on roles(:app) do
5
7
  within release_path do
6
8
  with rails_env: fetch(:stage) do
@@ -11,8 +13,8 @@ namespace :backup do
11
13
  end
12
14
  end
13
15
 
14
- desc 'Backup data to a git repo, tagging it into the git repo'
15
- task :backup, :tag do |task, args|
16
+ desc "Backup data to a git repo, tagging it into the git repo"
17
+ task :backup, :tag do |_task, args|
16
18
  on roles(:app) do
17
19
  within release_path do
18
20
  with rails_env: "production" do
@@ -23,32 +25,33 @@ task :backup, :tag do |task, args|
23
25
  end
24
26
 
25
27
  namespace :pull do
26
- desc 'Pull data (db/files) from remote (i.e: production) application.'
28
+ desc "Pull data (db/files) from remote (i.e: production) application."
27
29
  task :data do
28
30
  invoke "pull:files"
29
31
  invoke "pull:db"
30
32
  end
31
33
 
32
- desc 'Pull db: Hot backup, download and restore of the stage database'
34
+ desc "Pull db: Hot backup, download and restore of the stage database"
33
35
  task :db do
34
36
  on roles(:app) do
35
37
  within release_path do
36
38
  with rails_env: fetch(:stage) do
37
- execute :rake, 'db:backup'
39
+ execute :rake, "db:backup"
38
40
  execute "mv #{release_path}/tmp/db.sql /tmp/db.sql"
39
- download! '/tmp/db.sql', 'tmp/db.sql'
41
+ download! "/tmp/db.sql", "tmp/db.sql"
40
42
  end
41
43
  run_locally do
42
- begin # Don't raise error if rails version < 5
43
- execute 'rails db:environment:set RAILS_ENV=development'
44
- rescue;end
45
- rake 'db:restore'
44
+ # Don't raise error if rails version < 5
45
+ begin
46
+ execute "rails db:environment:set RAILS_ENV=development"
47
+ rescue StandardError; end
48
+ rake "db:restore"
46
49
  end
47
50
  end
48
51
  end
49
52
  end
50
53
 
51
- desc 'Pull files uploaded'
54
+ desc "Pull files uploaded"
52
55
  task :files do
53
56
  on roles(:app) do |host|
54
57
  run_locally do
@@ -61,8 +64,7 @@ namespace :pull do
61
64
  else
62
65
  error ": Set key :backup_dirs to know which ones to pull"
63
66
  end
64
-
65
67
  end
66
68
  end
67
69
  end
68
- end
70
+ end
@@ -1,22 +1,22 @@
1
- namespace :app do
1
+ # frozen_string_literal: true
2
2
 
3
+ namespace :app do
3
4
  task :db_prepare do
4
5
  on roles(:app) do
5
- invoke 'deploy:starting'
6
- invoke 'deploy:started'
7
- invoke 'deploy:updating'
8
- invoke 'bundler:install'
6
+ invoke "deploy:starting"
7
+ invoke "deploy:started"
8
+ invoke "deploy:updating"
9
+ invoke "bundler:install"
9
10
  if Rails.application.config.respond_to? :backup_repo
10
- invoke 'backup:restore'
11
+ invoke "backup:restore"
11
12
  else
12
- invoke 'deploy:db_create'
13
- invoke 'deploy:migrate'
14
- invoke 'deploy:db_seed'
13
+ invoke "deploy:db_create"
14
+ invoke "deploy:migrate"
15
+ invoke "deploy:db_seed"
15
16
  end
16
17
  end
17
18
  end
18
19
 
19
20
  task :test do
20
21
  end
21
-
22
- end
22
+ end