capistrano-strategy-copy-with-bundle-package 0.0.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.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-strategy-copy-with-bundle-package.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'capistrano-strategy-copy-with-bundle-package/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'capistrano-strategy-copy-with-bundle-package'
7
+ s.version = CapistranoStrategyCopyWithBundlePackage::VERSION
8
+ s.authors = ['Rainux Luo']
9
+ s.email = ['rainux@gmail.com']
10
+ s.homepage = 'https://github.com/rainux/capistrano-strategy-copy-with-bundle-package'
11
+ s.summary = %q{Deploy your Ruby application to a server which can't access rubygems.org over Internet.}
12
+ s.description = <<-DESC
13
+ CopyWithBundlePackage is a capistrano strategy similar to copy strategy,
14
+ but with gems packaged by bundler.
15
+
16
+ It will package all gems in the copy directory and then upload to servers,
17
+ so the server no longer required to access rubygems.org.
18
+ DESC
19
+
20
+ s.rubyforge_project = 'capistrano-strategy-copy-with-bundle-package'
21
+
22
+ s.files = `git ls-files`.split("\n")
23
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
24
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
25
+ s.require_paths = ['lib']
26
+
27
+ s.add_runtime_dependency 'capistrano', '~> 2'
28
+ end
@@ -0,0 +1 @@
1
+ require 'capistrano-strategy-copy-with-bundle-package/version'
@@ -0,0 +1,3 @@
1
+ module CapistranoStrategyCopyWithBundlePackage
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,41 @@
1
+ require 'capistrano/recipes/deploy/strategy/copy'
2
+ require 'fileutils'
3
+
4
+ module Capistrano
5
+ module Deploy
6
+ module Strategy
7
+ class CopyWithBundlePackage < Copy
8
+
9
+ def build(directory)
10
+ cmd = "#{fetch(:bundle_cmd, 'bundle')} package"
11
+
12
+ Dir.chdir(directory) do
13
+ FileUtils.rm_rf 'vendor/cache'
14
+ defined?(Bundler) ? with_original_env { system(cmd) } : system(cmd)
15
+
16
+ # Check the return code of bundle package command and rollback if not 0
17
+ unless $? == 0
18
+ raise Capistrano::Error, 'bundle package failed'
19
+ end
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def with_original_env
26
+ original_env = ENV.to_hash
27
+
28
+ begin
29
+ # Clean the ENV from Bundler settings
30
+ ENV.delete('RUBYOPT')
31
+ ENV.keys.each { |k| ENV.delete(k) if k =~ /^bundle_/i }
32
+
33
+ yield
34
+ ensure
35
+ ENV.replace(original_env)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-strategy-copy-with-bundle-package
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Rainux Luo
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-10-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: capistrano
16
+ requirement: &8939500 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '2'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *8939500
25
+ description: ! " CopyWithBundlePackage is a capistrano strategy similar to copy
26
+ strategy,\n but with gems packaged by bundler.\n\n It will package all gems
27
+ in the copy directory and then upload to servers,\n so the server no longer required
28
+ to access rubygems.org.\n"
29
+ email:
30
+ - rainux@gmail.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - .gitignore
36
+ - Gemfile
37
+ - Rakefile
38
+ - capistrano-strategy-copy-with-bundle-package.gemspec
39
+ - lib/capistrano-strategy-copy-with-bundle-package.rb
40
+ - lib/capistrano-strategy-copy-with-bundle-package/version.rb
41
+ - lib/capistrano/recipes/deploy/strategy/copy_with_bundle_package.rb
42
+ homepage: https://github.com/rainux/capistrano-strategy-copy-with-bundle-package
43
+ licenses: []
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project: capistrano-strategy-copy-with-bundle-package
62
+ rubygems_version: 1.8.10
63
+ signing_key:
64
+ specification_version: 3
65
+ summary: Deploy your Ruby application to a server which can't access rubygems.org
66
+ over Internet.
67
+ test_files: []