capistrano-middleman 0.1.0 → 0.1.3
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/.rubocop.yml +1 -1
- data/Gemfile.lock +2 -2
- data/lib/capistrano/middleman/utils.rb +21 -2
- data/lib/capistrano/middleman/version.rb +1 -1
- data/lib/capistrano/middleman.rb +1 -0
- data/lib/capistrano/tasks/middleman.rake +19 -16
- data/lib/capistrano-middleman.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20ef72c54f88074387e47ea56baac694d8519269
|
4
|
+
data.tar.gz: 62761d57e50eab04f03f71d421cb83a03ef3e1fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24ab29860962edecfeadace9bc2f7e36632c568475bf010c63a8e5ce63015fd8c9a5f1ec111fb8ee3646f7e35dbc51e76b138fe5967470dc7a88854fec040a65
|
7
|
+
data.tar.gz: 9042e73bf9b3ed7cefcc0f376e5f20249aa247c6694a5bac93f735969744d15fb3e65105c9732b928ba1e79a17845e14bef6994f53d596afc3ac268b239c61f2
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -22,7 +22,7 @@ GIT
|
|
22
22
|
PATH
|
23
23
|
remote: .
|
24
24
|
specs:
|
25
|
-
capistrano-middleman (0.
|
25
|
+
capistrano-middleman (0.1.2)
|
26
26
|
capistrano (~> 3)
|
27
27
|
middleman (~> 3.3)
|
28
28
|
rubyzip (~> 1.1.7)
|
@@ -125,7 +125,7 @@ GEM
|
|
125
125
|
term-ansicolor
|
126
126
|
yard (~> 0.8.7.5)
|
127
127
|
json (1.8.2)
|
128
|
-
kramdown (1.
|
128
|
+
kramdown (1.7.0)
|
129
129
|
launchy (2.4.3)
|
130
130
|
addressable (~> 2.3)
|
131
131
|
license_finder (2.0.4)
|
@@ -1,6 +1,25 @@
|
|
1
1
|
module Capistrano
|
2
2
|
module Middleman
|
3
|
+
# Utils
|
3
4
|
module Utils
|
5
|
+
# Create zip archive from source directory
|
6
|
+
#
|
7
|
+
# @param [String] source_directory
|
8
|
+
# The directory
|
9
|
+
# @param [String] destination_file
|
10
|
+
# Name of the zip file
|
11
|
+
# @param [String] prefix
|
12
|
+
# Prefix inside zip file
|
13
|
+
# @param [String] working_directory
|
14
|
+
# The directory where rubyzip should change to
|
15
|
+
# @param [Array] exclude_patterns
|
16
|
+
# Ignore files matching patterns
|
17
|
+
# @param [TrueClass, FalseClass] keep_filesystem_permissions
|
18
|
+
# Record permissions in file system
|
19
|
+
# @param [OctalNumber] file_permissions
|
20
|
+
# Permissions for files
|
21
|
+
# @param [OctalNumber] directory_permissions
|
22
|
+
# Permissions for directories
|
4
23
|
def zip(
|
5
24
|
source_directory,
|
6
25
|
destination_file,
|
@@ -16,7 +35,7 @@ module Capistrano
|
|
16
35
|
exclude_patterns.each { |e| list.exclude e }
|
17
36
|
|
18
37
|
Zip::File.open(destination_file, Zip::File::CREATE) do |z|
|
19
|
-
list.each do |filename|
|
38
|
+
list.uniq.each do |filename|
|
20
39
|
paths = []
|
21
40
|
paths << Pathname.new(prefix) unless prefix.nil? || prefix.empty?
|
22
41
|
paths << Pathname.new(filename).relative_path_from(Pathname.new(working_directory))
|
@@ -25,7 +44,7 @@ module Capistrano
|
|
25
44
|
|
26
45
|
next if keep_filesystem_permissions
|
27
46
|
|
28
|
-
z.file.chmod(file_permissions
|
47
|
+
z.file.chmod(file_permissions, File.join(*paths)) if z.file.file? File.join(*paths)
|
29
48
|
z.file.chmod(directory_permissions, File.join(*paths)) if z.file.directory? File.join(*paths)
|
30
49
|
end
|
31
50
|
end
|
data/lib/capistrano/middleman.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
require 'securerandom'
|
1
2
|
namespace :middleman do
|
2
3
|
middleman_options = Array(fetch(:middleman_options, %w(--verbose)))
|
3
4
|
|
4
|
-
|
5
|
+
archive_prefix = fetch :archive_prefix, 'archive'
|
6
|
+
archive_name = format('%s-%s.zip', archive_prefix, SecureRandom.hex)
|
5
7
|
build_dir = fetch :build_dir, 'build'
|
6
8
|
source_dir = fetch :source_dir, 'source'
|
7
9
|
keep_filesystem_permissions = fetch :keep_filesystem_permissions, false
|
@@ -13,19 +15,19 @@ namespace :middleman do
|
|
13
15
|
tar_roles = fetch(:tar_roles, :all)
|
14
16
|
desc "Archive files to #{archive_name}"
|
15
17
|
file archive_name => source_dir do |t|
|
16
|
-
|
17
|
-
|
18
|
-
sh cmd.join(' ')
|
18
|
+
run_locally do
|
19
|
+
execute :middleman, 'build', *middleman_options
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
Capistrano::Middleman::Utils.zip(
|
22
|
+
build_dir,
|
23
|
+
t.name,
|
24
|
+
working_directory: build_dir,
|
25
|
+
exclude_patterns: exclude_patterns,
|
26
|
+
keep_filesystem_permissions: keep_filesystem_permissions,
|
27
|
+
directory_permissions: directory_permissions,
|
28
|
+
file_permissions: file_permissions
|
29
|
+
)
|
30
|
+
end
|
29
31
|
end
|
30
32
|
|
31
33
|
desc "Build #{archive_name} on localhost"
|
@@ -50,8 +52,8 @@ namespace :middleman do
|
|
50
52
|
# Upload the archive, extract it and finally remove the tmp_file
|
51
53
|
upload!(archive_file, tmp_file)
|
52
54
|
|
53
|
-
umask = capture('umask')
|
54
|
-
debug "umask on remote system #{host} is #{umask}"
|
55
|
+
# umask = capture('umask')
|
56
|
+
# debug "umask on remote system #{host} is #{umask}"
|
55
57
|
|
56
58
|
execute :unzip, tmp_file, '-d', release_path
|
57
59
|
execute :rm, '-f', tmp_file
|
@@ -61,7 +63,7 @@ namespace :middleman do
|
|
61
63
|
desc 'Cleaning up deploy'
|
62
64
|
task :clean do |_t|
|
63
65
|
FileUtils.rm_rf build_dir
|
64
|
-
FileUtils.rm_rf
|
66
|
+
FileUtils.rm_rf format('%s-%s.zip', archive_prefix, '*')
|
65
67
|
end
|
66
68
|
|
67
69
|
after 'deploy:finished', 'middleman:clean'
|
@@ -69,3 +71,4 @@ namespace :middleman do
|
|
69
71
|
task :check
|
70
72
|
task :set_current_revision
|
71
73
|
end
|
74
|
+
|
data/lib/capistrano-middleman.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-middleman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Meyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|