capistrano-git-copy-bundle 0.1.0 → 0.2.0

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: 279dec3ad87eb26598309202ae710e8d56a48168
4
- data.tar.gz: d3264a4fa769f780137897833859e0b4b1a6142f
3
+ metadata.gz: df61315e329e8b5892b56b025b5f525e18224743
4
+ data.tar.gz: e1282409da8e80ebb2d9369db3dd555626230f03
5
5
  SHA512:
6
- metadata.gz: 2b3d8d8c19d9f0271023175873a304d110574d3afa97d7927acabd665151f9c5827bcbe4d437cd7582eac1a89913fe090d1f8ca56c9439e4a6182ce371d4edb5
7
- data.tar.gz: be90b7e6c971904055c0aeac706d9de87a16cf2434c57a0d8429ad361eea13dcc217df402d93555ee40145ed47a5f8f44cd8e99484b09a0477dfcc6f62a731d3
6
+ metadata.gz: 28d78d5ec7401ec119edcdb6aa95538afbe3ee5f6a9dad42627e71b5d4b5b242a2f2d2d1b00094dd7644f5b350b822dc79387f53670520411605cea7c5499b29
7
+ data.tar.gz: 73db3645f17321fd485959c505bb0185655b253a53fa7014770b24db417b9d1c0123ffaf34508d04c0d7c59ac3a14bb64a20117e9382d71ffdc21e79f91392a7
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.2.0 (2017-04-08)
4
+ ### Changes
5
+ - Removed dependency of _capistrano-git-copy_
6
+
3
7
  ## 0.1.0 (2015-08-26)
4
8
  ### Changes
5
9
  - Package gems
@@ -1,4 +1,3 @@
1
- require 'digest/md5'
2
1
  require 'capistrano/bundler'
3
2
  require 'capistrano/git_copy/bundle/utility'
4
3
  require 'capistrano/git_copy/bundle/task'
@@ -1 +1 @@
1
- load File.expand_path('../tasks/bundle.cap', __FILE__)
1
+ load File.expand_path('../tasks/bundle.rake', __FILE__)
@@ -1,3 +1,7 @@
1
+ def git_copy_bundle_utility
2
+ @_git_copy_bundle_utility ||= Capistrano::GitCopy::Bundle::Utility.new(self)
3
+ end
4
+
1
5
  namespace :load do
2
6
  task :defaults do
3
7
  set :bundle_flags, "#{fetch(:bundle_flags)} --local"
@@ -6,17 +10,14 @@ end
6
10
 
7
11
  namespace :git_copy do
8
12
  namespace :bundle do
9
- def git_copy_bundle_utility
10
- @git_copy_bundle_utility ||= Capistrano::GitCopy::Bundle::Utility.new(self)
11
- end
12
-
13
13
  task upload: :'git_copy:bundle:cache' do
14
14
  on release_roles :all do
15
15
  git_copy_bundle_utility.upload
16
16
  end
17
17
  end
18
18
 
19
- task cache: :'git_copy:update' do
19
+ desc 'Cache bundled gems'
20
+ task :cache do
20
21
  run_locally do
21
22
  git_copy_bundle_utility.cache
22
23
  end
@@ -1,24 +1,24 @@
1
- require 'capistrano/git_copy/utility'
1
+ require 'fileutils'
2
+ require 'digest/md5'
2
3
 
3
4
  module Capistrano
4
5
  module GitCopy
5
6
  module Bundle
6
- # Utility stuff to avoid cluttering of bundle.cap
7
- class Utility < ::Capistrano::GitCopy::Utility
7
+ # Utility stuff to avoid cluttering of bundle.rake
8
+ class Utility
9
+ def initialize(context)
10
+ @context = context
11
+ end
12
+
8
13
  # Cache used gems
9
14
  #
10
15
  # @return void
11
16
  def cache
12
- local_vendor_path = File.join(repo_path, 'vendor')
13
-
14
17
  execute(:mkdir, '-p', local_cache_path) unless test!("[ -d #{local_cache_path} ]")
15
- execute(:mkdir, '-p', local_vendor_path) unless test!("[ -d #{local_vendor_path} ]")
16
-
17
- execute(:ln, '-s', local_cache_path, File.join(local_vendor_path, 'cache'))
18
18
 
19
19
  if gems_changed?
20
20
  Bundler.with_clean_env do
21
- execute("bundle package --gemfile #{File.join(repo_path, 'Gemfile')} --all --all-platforms")
21
+ execute("bundle package --gemfile #{File.join(Dir.pwd, 'Gemfile')} --all --all-platforms")
22
22
  end
23
23
 
24
24
  File.open(cached_gemfile_md5_path, 'w') { |f| f.write(gemfile_md5) } unless gemfile_md5.nil?
@@ -48,6 +48,7 @@ module Capistrano
48
48
  # @return void
49
49
  def clear_local
50
50
  execute(:rm, '-rf', File.join(local_cache_path, '*')) if test!("[ -d #{local_cache_path} ]")
51
+
51
52
  File.unlink(cached_gemfile_md5_path)
52
53
  end
53
54
 
@@ -69,14 +70,14 @@ module Capistrano
69
70
  #
70
71
  # @return [String]
71
72
  def local_cache_path
72
- File.join(tmp_path, 'bundle_cache')
73
+ File.join(Dir.pwd, 'vendor', 'cache')
73
74
  end
74
75
 
75
76
  # MD5 sum of Gemfile.lock to deploy
76
77
  #
77
78
  # @return [String]
78
79
  def gemfile_md5
79
- @_gemfile_md5 ||= Digest::MD5.file(File.join(repo_path, 'Gemfile.lock')).hexdigest rescue nil
80
+ @_gemfile_md5 ||= Digest::MD5.file(File.join(Dir.pwd, 'Gemfile.lock')).hexdigest rescue nil
80
81
  end
81
82
 
82
83
  # MD5 sum of Gemfile.lock for local gem cache
@@ -90,7 +91,7 @@ module Capistrano
90
91
  #
91
92
  # @return [String]
92
93
  def cached_gemfile_md5_path
93
- File.join(tmp_path, 'git_copy_bundle_gemfile_lock.md5')
94
+ File.join(Dir.pwd, '.capistrano-git-copy-bundle-gemfile-lock.md5')
94
95
  end
95
96
 
96
97
  # Checks if Gemfile.lock has changed since last deploy
@@ -106,6 +107,28 @@ module Capistrano
106
107
  def local_gems
107
108
  %x(ls #{local_cache_path}).split(/\s+/)
108
109
  end
110
+
111
+ private
112
+
113
+ def fetch(*args)
114
+ @context.fetch(*args)
115
+ end
116
+
117
+ def execute(*args)
118
+ @context.execute(*args)
119
+ end
120
+
121
+ def capture(*args)
122
+ @context.capture(*args)
123
+ end
124
+
125
+ def test!(*args)
126
+ @context.test(*args)
127
+ end
128
+
129
+ def upload!(*args)
130
+ @context.upload!(*args)
131
+ end
109
132
  end
110
133
  end
111
134
  end
@@ -1,7 +1,7 @@
1
1
  module Capistrano
2
2
  module GitCopy
3
3
  module Bundle
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-git-copy-bundle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Schwab
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-26 00:00:00.000000000 Z
11
+ date: 2017-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -97,7 +97,7 @@ files:
97
97
  - capistrano-git-copy-bundle.gemspec
98
98
  - lib/capistrano/git_copy/bundle.rb
99
99
  - lib/capistrano/git_copy/bundle/task.rb
100
- - lib/capistrano/git_copy/bundle/tasks/bundle.cap
100
+ - lib/capistrano/git_copy/bundle/tasks/bundle.rake
101
101
  - lib/capistrano/git_copy/bundle/utility.rb
102
102
  - lib/capistrano/git_copy/bundle/version.rb
103
103
  homepage: https://github.com/ydkn/capistrano-git-copy-bundle
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  requirements: []
121
121
  rubyforge_project:
122
- rubygems_version: 2.4.8
122
+ rubygems_version: 2.6.11
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: Packages gems locally and uploads them to the remote server instead of fetching