capistrano-git-archive 0.0.1 → 0.0.2

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
- data.tar.gz: cef161195a125a79131f1bedfb2bf523e6e68607
4
- metadata.gz: ec0d07470f1a365994cf3467c64805d964d2b787
3
+ data.tar.gz: 016f39d273ef509e914bd5c2787f4cf138ba9025
4
+ metadata.gz: 6227856610d7ef9ef2c121b58de7c2abcab8e66f
5
5
  SHA512:
6
- data.tar.gz: 0936d85f6c1784cfe5d52dd71497a182066544ec716f01a775059785317e2d856d2d2e4afd19f382bacf67cd199b648ecae2c791442dd6094863fe46c644b483
7
- metadata.gz: 61958c3006d32d8fa0fde1e625a835bb3f60eb88b53ff620a84c34350712305e6339d4694aa4229847292be86723513340b3434e4397eabf41a1e2e8ad9409c1
6
+ data.tar.gz: e14526e459de2b308dc5eacf7adae4e864d6459784f85555c8e8f12c6eabde40611935104cb4f3b2fc6d985c666d78fb096dbe54be85560f76471ece2550e5da
7
+ metadata.gz: ba6827f9d868063c20631df94c192bb7a92acae432b83e6a4b7be4f4046a1f909e0b8a1b7fd741d6b22928ff9acc11aaeeba68fbbb9bb10abe9a849ad065a74d
@@ -0,0 +1,2 @@
1
+
2
+ \.idea/
@@ -0,0 +1 @@
1
+ # Change Log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-rails-console.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Florian Schwab
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
File without changes
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,20 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano/git_archive/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'capistrano-git-archive'
8
+ spec.version = Capistrano::GitArchive::VERSION
9
+ spec.authors = ['Mikkel Riber']
10
+ spec.email = ['riber@kongens.net']
11
+ spec.description = 'git archive deploy strategy for Capistrano.'
12
+ spec.summary = 'git archive deploy strategy'
13
+ spec.homepage = 'https://github.com/kongens-net/capistrano-git-archive'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.require_paths = ['lib']
18
+
19
+ spec.add_dependency 'capistrano', '>= 3.7.0', '< 4.0.0'
20
+ end
@@ -0,0 +1 @@
1
+ require 'capistrano/git_archive/scm'
@@ -0,0 +1,53 @@
1
+ require 'tempfile'
2
+ require 'capistrano/scm/plugin'
3
+
4
+ module Capistrano
5
+ module GitArchive
6
+ # SCM plugin for capistrano
7
+ # uses a local clone and uploads a tar archive to the server
8
+ class SCM < ::Capistrano::SCM::Plugin
9
+ # set default values
10
+ def set_defaults
11
+ end
12
+
13
+ # define plugin tasks
14
+ def define_tasks
15
+ eval_rakefile File.expand_path('../tasks/git_archive.rake', __FILE__)
16
+ end
17
+
18
+ # register capistrano hooks
19
+ def register_hooks
20
+ after 'deploy:new_release_path', 'git_archive:create_release'
21
+ before 'deploy:set_current_revision', 'git_archive:set_current_revision'
22
+ end
23
+
24
+ def archive_repository(&block)
25
+ block.call
26
+ ensure
27
+ temp_file.close
28
+ temp_file.unlink
29
+ end
30
+
31
+ def git_archive_to_temp_file
32
+ `git archive --remote=#{fetch(:repo_url)} --output=#{temp_file.path} #{fetch(:branch, 'master')}`
33
+ end
34
+
35
+
36
+ # Upload and extract release
37
+ #
38
+ # @return void
39
+ def release
40
+ remote_archive_path = File.join(fetch(:deploy_to), File.basename(temp_file.path))
41
+
42
+ backend.execute :mkdir, '-p', release_path
43
+ backend.upload!(temp_file.path, remote_archive_path)
44
+ backend.execute(:tar, '-f', remote_archive_path, '-x', '-C', release_path)
45
+ backend.execute(:rm, '-f', remote_archive_path)
46
+ end
47
+
48
+ def temp_file
49
+ @temp_file ||= Tempfile.new([fetch(:application), '.tar.gz'])
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,18 @@
1
+ git_archive_plugin = self
2
+
3
+ namespace :git_archive do
4
+ desc 'Copy repo to releases'
5
+ task :create_release do
6
+ git_archive_plugin.archive_repository do
7
+ git_archive_plugin.git_archive_to_temp_file
8
+
9
+ on release_roles :all do
10
+ git_archive_plugin.release
11
+ end
12
+ end
13
+ end
14
+
15
+ desc 'Determine the revision that will be deployed'
16
+ task :set_current_revision do
17
+ end
18
+ end
@@ -0,0 +1,8 @@
1
+ # Capistrano
2
+ module Capistrano
3
+ # GitCopy
4
+ module GitArchive
5
+ # gem version
6
+ VERSION = '0.0.2'
7
+ end
8
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-git-archive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikkel Riber
@@ -33,8 +33,19 @@ extensions: []
33
33
 
34
34
  extra_rdoc_files: []
35
35
 
36
- files: []
37
-
36
+ files:
37
+ - .gitignore
38
+ - CHANGELOG.md
39
+ - Gemfile
40
+ - LICENSE.txt
41
+ - README.md
42
+ - Rakefile
43
+ - capistrano-git-archive-0.0.1.gem
44
+ - capistrano-git-archive.gemspec
45
+ - lib/capistrano/git_archive.rb
46
+ - lib/capistrano/git_archive/scm.rb
47
+ - lib/capistrano/git_archive/tasks/git_archive.rake
48
+ - lib/capistrano/git_archive/version.rb
38
49
  homepage: https://github.com/kongens-net/capistrano-git-archive
39
50
  licenses:
40
51
  - MIT