capistrano-git-push 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2b7dccd01a1562684d925396608dc0bd0e2e62ea
4
+ data.tar.gz: b61aedef730413d0f3418bb6655ea70b2a465e00
5
+ SHA512:
6
+ metadata.gz: 17a5cfa14722fd7b6a584427158baa0a3d968829af1ca77b780d774a9736007e2d8426cd77f7b52f2e8b35b42566463311d8c4f82a2dd77aee76cfa53c366bbd
7
+ data.tar.gz: 28e9ecbe4d7637e149386b23ffc800e942b89381e329ae04262f69f884039166c5bdf0ec693bff89a479a46e6cecbf888092fc7bb88c01a93056f014aba31ce0
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - 1.9.2
7
+ - rbx
8
+ matrix:
9
+ allow_failures:
10
+ - rvm: rbx
11
+ script: bundle exec rake spec
12
+ cache: bundler
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-git-push.gemspec
4
+ gemspec
5
+
6
+ # sanity dependencies
7
+ gem 'coveralls', group: :test, require: false
8
+ gem 'simplecov', '~> 0.7.1'
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Yann Lugrin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Capistrano::Git::Push
2
+
3
+ A capistrano git strategy to deploy local repository by git push.
4
+
5
+ ## Usage
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'capistrano-git-push'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install capistrano-git-push
18
+
19
+ and then add to `Capfile`:
20
+
21
+ require 'capistrano/git/push_strategy'
22
+
23
+ and then add to `deploy.rb`:
24
+
25
+ set :scm, :git
26
+ set :git_strategy, Capistrano::Git::PushStrategy
27
+
28
+ Attention `repo_url` as no effect, but `branch` can be used to set local
29
+ branch to push on server.
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require 'bundler/gem_tasks'
2
+ require "rspec/core/rake_task"
3
+
4
+ task :default => :spec
5
+ RSpec::Core::RakeTask.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'capistrano-git-push'
7
+ spec.version = `cat VERSION`
8
+ spec.authors = ['Yann Lugrin']
9
+ spec.email = ['yann.lugrin@liquid-concept.ch']
10
+ spec.description = %q{A capistrano git strategy to deploy local repository by git push}
11
+ spec.summary = %q{Capistrano git push strategy}
12
+ spec.homepage = 'https://github.com/yannlugrin/capistrano-git-push'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_development_dependency 'bundler', '~> 1.3'
21
+ spec.add_development_dependency 'rake'
22
+ spec.add_development_dependency 'rspec'
23
+ spec.add_development_dependency 'mocha'
24
+
25
+ spec.add_dependency 'capistrano', '~> 3.1'
26
+ end
@@ -0,0 +1,41 @@
1
+ # Original code from capistrano git default strategy under MIT licence
2
+ # (Copyright (c) 2012-2013 Tom Clements, Lee Hambley)
3
+ #
4
+ # New code also under MIT licence
5
+ # (Copyright (c) 2014 Yann Lugrin
6
+
7
+ require 'capistrano/git'
8
+
9
+ class Capistrano::Git < Capistrano::SCM
10
+ module PushStrategy
11
+ def test
12
+ test! " [ -f #{repo_path}/HEAD ] "
13
+ end
14
+
15
+ def check
16
+ run_locally do
17
+ test 'git show-ref'
18
+ end
19
+ end
20
+
21
+ def clone
22
+ git :init, '--bare', repo_path
23
+ end
24
+
25
+ def update
26
+ host = context.host
27
+
28
+ run_locally do
29
+ execute :git, :push, '--force', "#{host.user}@#{host.hostname}:#{repo_path} #{fetch(:branch)}:master"
30
+ end
31
+ end
32
+
33
+ def release
34
+ git :archive, 'master', '| tar -x -f - -C', release_path
35
+ end
36
+
37
+ def fetch_revision
38
+ context.capture(:git, 'rev-parse --short master')
39
+ end
40
+ end
41
+ end
File without changes
@@ -0,0 +1,70 @@
1
+ require 'spec_helper'
2
+
3
+ require 'capistrano/git/push_strategy'
4
+
5
+ module Capistrano
6
+ describe Git::PushStrategy do
7
+ let(:context) { Class.new.new }
8
+ let(:run_locally) { SSHKit::Backend::Local.any_instance }
9
+ let(:host) { mock(user: :user, hostname: :hostname)}
10
+ subject { Capistrano::Git.new(context, Capistrano::Git::PushStrategy) }
11
+
12
+ describe '#test' do
13
+ it 'should call test for repo HEAD' do
14
+ context.expects(:repo_path).returns('/path/to/repo')
15
+ context.expects(:test).with ' [ -f /path/to/repo/HEAD ] '
16
+
17
+ subject.test
18
+ end
19
+ end
20
+
21
+ describe '#check' do
22
+ it 'should test the repo url' do
23
+ run_locally.expects(:test).with('git show-ref')
24
+
25
+ subject.check
26
+ end
27
+ end
28
+
29
+ describe '#clone' do
30
+ it 'should run git clone' do
31
+ context.expects(:repo_path).returns('/path/to/repo')
32
+
33
+ context.expects(:execute).with(:git, :init, '--bare', '/path/to/repo')
34
+
35
+ subject.clone
36
+ end
37
+ end
38
+
39
+ describe '#update' do
40
+ it 'should run git update' do
41
+ context.expects(:host).returns(host)
42
+
43
+ run_locally.expects(:repo_path).returns('/path/to/repo')
44
+ run_locally.expects(:fetch).returns(:branch)
45
+
46
+ run_locally.expects(:execute).with(:git, :push, '--force', 'user@hostname:/path/to/repo branch:master')
47
+
48
+ subject.update
49
+ end
50
+ end
51
+
52
+ describe '#release' do
53
+ it 'should run git archive' do
54
+ context.expects(:release_path).returns(:path)
55
+
56
+ context.expects(:execute).with(:git, :archive, 'master', '| tar -x -f - -C', :path)
57
+
58
+ subject.release
59
+ end
60
+ end
61
+
62
+ describe '#fetch_revision' do
63
+ it 'should run git rev-parse' do
64
+ context.expects(:capture).with(:git, 'rev-parse --short master')
65
+
66
+ subject.fetch_revision
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,23 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+
4
+ if ENV['CI']
5
+ require 'coveralls'
6
+ Coveralls.wear! do
7
+ add_filter 'spec'
8
+ end
9
+ end
10
+
11
+ require 'capistrano/all'
12
+ require 'rspec'
13
+ require 'mocha/api'
14
+
15
+ # Requires supporting files with custom matchers and macros, etc,
16
+ # in ./support/ and its subdirectories.
17
+ Dir['#{File.dirname(__FILE__)}/support/**/*.rb'].each {|f| require f}
18
+
19
+ RSpec.configure do |config|
20
+ config.treat_symbols_as_metadata_keys_with_true_values = true
21
+ config.mock_framework = :mocha
22
+ config.order = 'random'
23
+ end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-git-push
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Yann Lugrin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: mocha
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: capistrano
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '3.1'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '3.1'
83
+ description: A capistrano git strategy to deploy local repository by git push
84
+ email:
85
+ - yann.lugrin@liquid-concept.ch
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - .gitignore
91
+ - .travis.yml
92
+ - Gemfile
93
+ - LICENSE
94
+ - README.md
95
+ - Rakefile
96
+ - VERSION
97
+ - capistrano-git-push.gemspec
98
+ - lib/capistrano-git-push.rb
99
+ - lib/capistrano/git/push_strategy.rb
100
+ - spec/lib/capistrano/git/push_strategy_spec.rb
101
+ - spec/spec_helper.rb
102
+ homepage: https://github.com/yannlugrin/capistrano-git-push
103
+ licenses:
104
+ - MIT
105
+ metadata: {}
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubyforge_project:
122
+ rubygems_version: 2.1.4
123
+ signing_key:
124
+ specification_version: 4
125
+ summary: Capistrano git push strategy
126
+ test_files:
127
+ - spec/lib/capistrano/git/push_strategy_spec.rb
128
+ - spec/spec_helper.rb