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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f34876824ba2dc393f73ed7f0727847fe3695c4f
4
- data.tar.gz: b460995cb2c51d550986aca589a6734c59b17ce8
3
+ metadata.gz: 20ef72c54f88074387e47ea56baac694d8519269
4
+ data.tar.gz: 62761d57e50eab04f03f71d421cb83a03ef3e1fe
5
5
  SHA512:
6
- metadata.gz: 1140b941732728b758890d6cc9614891dc589c19219be2e42196d49e0893a193785d5c2d0181e6d7e6c1f6af16429db0c91162068c5e5981f83195dd092bda38
7
- data.tar.gz: b4ee9490f710bce07755fa7818b2288b76b0efc1634f044737585768fface396c90dbf04b52e5bf48a28c7597bca121b4db13f6c61250cf664685decfc7e77dd
6
+ metadata.gz: 24ab29860962edecfeadace9bc2f7e36632c568475bf010c63a8e5ce63015fd8c9a5f1ec111fb8ee3646f7e35dbc51e76b138fe5967470dc7a88854fec040a65
7
+ data.tar.gz: 9042e73bf9b3ed7cefcc0f376e5f20249aa247c6694a5bac93f735969744d15fb3e65105c9732b928ba1e79a17845e14bef6994f53d596afc3ac268b239c61f2
data/.rubocop.yml CHANGED
@@ -12,7 +12,7 @@ Metrics/LineLength:
12
12
 
13
13
  # Configuration parameters: CountKeywordArgs.
14
14
  Metrics/ParameterLists:
15
- Max: 6
15
+ Max: 8
16
16
 
17
17
  Style/CaseEquality:
18
18
  Enabled: false
data/Gemfile.lock CHANGED
@@ -22,7 +22,7 @@ GIT
22
22
  PATH
23
23
  remote: .
24
24
  specs:
25
- capistrano-middleman (0.0.1)
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.6.0)
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 , File.join(*paths)) if z.file.file? File.join(*paths)
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
@@ -3,6 +3,6 @@
3
3
  module Capistrano
4
4
  # Middleman
5
5
  module Middleman
6
- VERSION = '0.1.0'
6
+ VERSION = '0.1.3'
7
7
  end
8
8
  end
@@ -2,5 +2,6 @@ require 'zip'
2
2
  require 'zip/filesystem'
3
3
  require 'pathname'
4
4
  require 'capistrano/middleman/utils'
5
+ require 'tempfile'
5
6
 
6
7
  load File.expand_path('../tasks/middleman.rake', __FILE__)
@@ -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
- archive_name = fetch :archive_name, 'archive.zip'
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
- cmd = %w(middleman build)
17
- cmd.concat middleman_options
18
- sh cmd.join(' ')
18
+ run_locally do
19
+ execute :middleman, 'build', *middleman_options
19
20
 
20
- Capistrano::Middleman::Utils.zip(
21
- build_dir,
22
- t.name,
23
- working_directory: build_dir,
24
- exclude_patterns: exclude_patterns,
25
- keep_filesystem_permissions: keep_filesystem_permissions,
26
- directory_permissions: directory_permissions,
27
- file_permissions: file_permissions
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 archive_name
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
+
@@ -1 +1,3 @@
1
+ # rubocop:disable Style/FileName
1
2
  require 'capistrano/middleman/version'
3
+ # rubocop:enable Style/FileName
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.0
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-04-27 00:00:00.000000000 Z
11
+ date: 2015-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler