capistrano-git-methods 0.0.3 → 0.0.4
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 +1 -0
- data/CHANGELOG.md +6 -0
- data/README.md +11 -2
- data/lib/capistrano-git-methods.rb +34 -22
- data/lib/capistrano-git-methods/version.rb +1 -1
- metadata +12 -12
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## v 0.0.4: Capistrano config extention
|
2
|
+
|
3
|
+
Upadted the way that we extend capistrano configuration. You should now include the gem and then use `::CapistranoGitMethods.load` to actually load the methods into capistrano.
|
4
|
+
|
5
|
+
This is done to ensure that bundler doesn't extend the rake tasks with the ones defined in the gem.
|
6
|
+
|
1
7
|
## v 0.0.3: Lazy loading
|
2
8
|
|
3
9
|
Added lazyloading of the settings to avoid conflicts when using multistage.
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
# Capistrano git
|
1
|
+
# Capistrano Git Methods [](http://travis-ci.org/ekampp/capistrano-git-methods)
|
2
2
|
|
3
3
|
This is a namespace containing methods for maintaining a remote server through git instead of the standard capistrano way.
|
4
4
|
|
5
5
|
## Usage
|
6
6
|
|
7
|
-
Including this gem with `require
|
7
|
+
Including this gem with `require capistrano-git-methods` in your recipe gives access to the `git.<method>` methods.
|
8
8
|
|
9
9
|
## Methods
|
10
10
|
|
@@ -14,3 +14,12 @@ There is the following methods available:
|
|
14
14
|
* `update_code` updates the remote code to match the latest head in the given `branch`.
|
15
15
|
* `repo` sets the branch to the current head of the remote version of the code.
|
16
16
|
* `cleanup` cleans up after the git processes.
|
17
|
+
|
18
|
+
## Configuration
|
19
|
+
|
20
|
+
You can configure the library from your deploy recipe, as it lazy-loads all the settings variables, so you don't need to worry about where you require this library.
|
21
|
+
|
22
|
+
The following sonfiguration options are available:
|
23
|
+
|
24
|
+
* `repository` defines the specific repository that you want to clone.
|
25
|
+
* `brach` sets the branch within the repository to check out.
|
@@ -9,33 +9,45 @@ require "capistrano-git-methods/version"
|
|
9
9
|
# This requires the <tt>current_path</tt> variable to be present. This should
|
10
10
|
# already be available in the standard capistrano deploy scheme.
|
11
11
|
#
|
12
|
-
|
12
|
+
module CapistranoGitMethods
|
13
|
+
def self.load
|
14
|
+
Capistrano::Configuration.instance(true).load do
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
+
namespace :git do
|
17
|
+
set(:branch) { "master" }
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
19
|
+
desc "Setup your git-based deployment app"
|
20
|
+
task :setup, :except => { :no_release => true } do
|
21
|
+
dirs = [deploy_to, shared_path]
|
22
|
+
dirs += shared_children.map { |d| File.join(shared_path, d) }
|
23
|
+
run "mkdir -p #{dirs.join(' ')} && chmod g+w #{dirs.join(' ')}"
|
24
|
+
run "git clone #{repository} #{latest_release}"
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
desc "Update the deployed code."
|
28
|
+
task :update_code, :except => { :no_release => true } do
|
29
|
+
run "cd #{latest_release}; git fetch origin; git reset --hard #{branch}" do |c, s, d|
|
30
|
+
case s.to_s
|
31
|
+
when "err"
|
32
|
+
if d.to_s.include?("From ") or d.to_s.include?("->") # Assumes non-errors
|
33
|
+
logger.important "[#{c[:host]}] #{d}"
|
34
|
+
end
|
35
|
+
when "out"
|
36
|
+
logger.important "[#{c[:host]}] #{d}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
30
40
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
41
|
+
desc "Moves the repo back to the previous version of HEAD"
|
42
|
+
task :repo, :except => { :no_release => true } do
|
43
|
+
set :branch, "HEAD@{1}"
|
44
|
+
end
|
35
45
|
|
36
|
-
|
37
|
-
|
38
|
-
|
46
|
+
desc "Rewrite reflog so HEAD@{1} will continue to point to at the next previous release."
|
47
|
+
task :cleanup, :except => { :no_release => true } do
|
48
|
+
run "cd #{latest_release}; git reflog delete --rewrite HEAD@{1}; git reflog delete --rewrite HEAD@{1}"
|
49
|
+
end
|
50
|
+
end
|
39
51
|
end
|
40
52
|
end
|
41
53
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-git-methods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70306010155840 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70306010155840
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: git
|
27
|
-
requirement: &
|
27
|
+
requirement: &70306010154940 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70306010154940
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70306010153860 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70306010153860
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: yard
|
49
|
-
requirement: &
|
49
|
+
requirement: &70306010152840 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70306010152840
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: git
|
60
|
-
requirement: &
|
60
|
+
requirement: &70306010151860 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70306010151860
|
69
69
|
description: Contains a git namespace with methods for deploying to a single folder
|
70
70
|
using git as the versioning tool instead of the buildin capistrano versioning
|
71
71
|
email:
|