capistrano-craft 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '09f776fa507f01ebc0ba95804640d29136b275a1'
4
- data.tar.gz: 5117c84753e343bbf86dacaf7730d61fe2daf2e4
3
+ metadata.gz: ccc517736e79408a6302f9d48c3d9fdf9add3283
4
+ data.tar.gz: ceeb2af2e5057d14dcfb24e781bd12d122c939e9
5
5
  SHA512:
6
- metadata.gz: 0255aadbcfd907b73a5bed129038f64315dbab38b44f721002c9807f854960ac1a106b0553eebf3b7bbd612716a85c8c49b6aabc8214728c8bedf19c865e2277
7
- data.tar.gz: feecf14faf1ca427911734b386f42c67ffbcc0158b1da3a1cad3b013e4ba41827af72d3dc0b0ced8cf7490958a344e1c8a6279b53297dbabacdc8620704c7190
6
+ metadata.gz: 1d441c129fe7c1dee24322f82bf01bc84ebd9b6b4ba481afd065d0041b941a0969de5452c17523bdff0fc7347b8c013a838e6edd2cdb5c8db3738ae9f7c06bd0
7
+ data.tar.gz: ef9a333c743f98f358f317a7f2eff081bceb246407d378b841f5cef2a6568bc359eb5752e21b36881ecd25be67adab5c56644225b00bb29b7a1ac475c9e2f6fd
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-craft (0.1.0)
4
+ capistrano-craft (0.1.1)
5
5
  capistrano (~> 3.1)
6
6
  capistrano-composer (~> 0.0.6)
7
7
 
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Capistrano::Craft
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/capistrano/craft`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ As of October 2019 this is very still very much under development. Please make sure you have appropriate backups to avoid any potential data loss.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ This gem automates the deployment of Craft CMS apps with Capistrano. It will automatically detect local and remote environment settings to make synchronizing of database and assets straightforward.
6
6
 
7
7
  ## Installation
8
8
 
@@ -12,32 +12,49 @@ Add this line to your application's Gemfile:
12
12
  gem 'capistrano-craft'
13
13
  ```
14
14
 
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
15
+ Or install system wide:
20
16
 
21
17
  $ gem install capistrano-craft
22
18
 
23
19
  ## Usage
24
20
 
25
- TODO: Write usage instructions here
21
+ $ staging deploy
22
+ $ production deploy
23
+
24
+ ### Compiling Assets
26
25
 
27
- ## Development
26
+ Change `:craft_compile_assets` to be your production asset compilation command. By default, it is assumed your project has a `package.json` file and `npm install` will be run first. The default asset compilcation command is `npm run production --production --silent`
28
27
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
28
+ ### Synchronize Database
30
29
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
30
 
33
- ## Contributing
34
31
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/capistrano-craft. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
32
+ ### Settings
36
33
 
37
- ## License
38
34
 
39
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
35
 
41
- ## Code of Conduct
42
36
 
43
- Everyone interacting in the Capistrano::Craft project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/capistrano-craft/blob/master/CODE_OF_CONDUCT.md).
37
+ Full list of available settings:
38
+
39
+ ```
40
+ set :config_path, "config"
41
+ set :php, "php"
42
+
43
+ set :craft_local_env, -> { "#{Dir.pwd}/.env" }
44
+ set :craft_remote_env, -> { "#{fetch(:deploy_to)}/shared/.env" }
45
+
46
+ set :craft_local_db_dump, "db.sql"
47
+ set :craft_local_backups, "backups"
48
+ set :craft_remote_backups, "shared/backups"
49
+
50
+ # assets
51
+ set :craft_compile_assets, "npm run production --production --silent"
52
+
53
+ # console
54
+ set :craft_console_path, -> { "craft" }
55
+ set :craft_console_flags, ""
56
+
57
+ # Role filtering
58
+ set :craft_roles, :all
59
+ set :craft_deploy_roles, :all
60
+ ```
@@ -2,9 +2,13 @@
2
2
  # Craft CMS defaults
3
3
  #
4
4
 
5
+ append :linked_dirs, "vendor", "storage"
6
+
5
7
  set :config_path, "config"
6
8
  set :php, "php"
7
9
 
10
+ set :assets_path, "web/uploads"
11
+
8
12
  set :craft_local_env, -> { "#{Dir.pwd}/.env" }
9
13
  set :craft_remote_env, -> { "#{fetch(:deploy_to)}/shared/.env" }
10
14
 
@@ -13,7 +17,7 @@ set :craft_local_backups, "backups"
13
17
  set :craft_remote_backups, "shared/backups"
14
18
 
15
19
  # assets
16
- set :craft_compile_assets, "npm run production --production --silent"
20
+ set :craft_compile_assets, "production --quiet"
17
21
 
18
22
  # console
19
23
  set :craft_console_path, -> { "craft" }
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Craft
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -3,17 +3,16 @@ namespace :craft do
3
3
  desc "Ensure folder permissions are correct"
4
4
  task :set_permissions do
5
5
  on release_roles(fetch(:craft_deploy_roles)) do
6
- within release_path do
7
- # https://docs.craftcms.com/v3/installation.html#step-2-set-the-file-permissions
6
+ # https://docs.craftcms.com/v3/installation.html#step-2-set-the-file-permissions
8
7
 
9
- execute "chmod 744 .env"
10
- execute "chmod 744 composer.json"
11
- execute "chmod 744 composer.lock"
12
- execute "chmod 744 config/license.key"
13
- execute "chmod -R 744 storage/*"
14
- execute "chmod -R 744 vendor/*"
15
- execute "chmod -R 744 web/cpresources/*"
16
- end
8
+ # Attempt to chmod but don't fail if these aren't setup
9
+ execute "chmod -f 744 #{fetch(:craft_remote_env)} || true"
10
+ execute "chmod -f 744 #{release_path}/composer.json || true"
11
+ execute "chmod -f 744 #{release_path}/composer.lock || true"
12
+ execute "chmod -f 744 #{release_path}/config/license.key || true"
13
+ execute "chmod -fR 744 #{release_path}/storage/* || true"
14
+ execute "chmod -fR 744 #{release_path}/vendor/* || true"
15
+ execute "chmod -fR 744 #{release_path}/web/cpresources/* || true"
17
16
  end
18
17
  end
19
18
 
@@ -29,10 +28,10 @@ namespace :craft do
29
28
  desc "Synchronise assets between local and remote server"
30
29
  task :sync do
31
30
  run_locally do
32
- on release_roles(fetch(:craft_deploy_roles)) do
31
+ release_roles(fetch(:craft_deploy_roles)).each do |role|
33
32
  puts "User -> " + role.user
34
- execute :rsync, "-vzO #{role.user}@#{role.hostname}:#{shared_path}/web/assets/ web/assets"
35
- execute :rsync, "-vzO web/assets/ #{role.user}@#{role.hostname}:#{shared_path}/web/assets"
33
+ execute :rsync, "-rvzO #{role.user}@#{role.hostname}:#{shared_path}/#{fetch(:assets_path)}/ #{fetch(:assets_path)}"
34
+ execute :rsync, "-rvzO #{fetch(:assets_path)}/ #{role.user}@#{role.hostname}:#{shared_path}/#{fetch(:assets_path)}"
36
35
  end
37
36
  end
38
37
  end
@@ -7,8 +7,8 @@ namespace :deploy do
7
7
  task :compile_assets do
8
8
  on release_roles(fetch(:craft_deploy_roles)) do
9
9
  within release_path do
10
- execute :npm, "install", "--production", "--silent"
11
- execute fetch(:craft_compile_assets)
10
+ execute :npm, "install", "--silent"
11
+ execute :npm, "run", fetch(:craft_compile_assets)
12
12
  end
13
13
  end
14
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-craft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Dyer