capistrano-craft 0.1.0 → 0.1.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +34 -17
- data/lib/capistrano/craft/defaults.rb +5 -1
- data/lib/capistrano/craft/version.rb +1 -1
- data/lib/capistrano/tasks/craft.rake +12 -13
- data/lib/capistrano/tasks/deploy.rake +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccc517736e79408a6302f9d48c3d9fdf9add3283
|
4
|
+
data.tar.gz: ceeb2af2e5057d14dcfb24e781bd12d122c939e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d441c129fe7c1dee24322f82bf01bc84ebd9b6b4ba481afd065d0041b941a0969de5452c17523bdff0fc7347b8c013a838e6edd2cdb5c8db3738ae9f7c06bd0
|
7
|
+
data.tar.gz: ef9a333c743f98f358f317a7f2eff081bceb246407d378b841f5cef2a6568bc359eb5752e21b36881ecd25be67adab5c56644225b00bb29b7a1ac475c9e2f6fd
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Capistrano::Craft
|
2
2
|
|
3
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
21
|
+
$ staging deploy
|
22
|
+
$ production deploy
|
23
|
+
|
24
|
+
### Compiling Assets
|
26
25
|
|
27
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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, "
|
20
|
+
set :craft_compile_assets, "production --quiet"
|
17
21
|
|
18
22
|
# console
|
19
23
|
set :craft_console_path, -> { "craft" }
|
@@ -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
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
31
|
+
release_roles(fetch(:craft_deploy_roles)).each do |role|
|
33
32
|
puts "User -> " + role.user
|
34
|
-
execute :rsync, "-
|
35
|
-
execute :rsync, "-
|
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", "--
|
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
|