minicap 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +7 -1
  2. data/lib/minicap.rb +59 -57
  3. metadata +3 -3
data/README.md CHANGED
@@ -15,7 +15,13 @@ Minicap also has two features that the stock deployment recipes lack;
15
15
 
16
16
  ## Using Minicap
17
17
 
18
- The easiest way to start using minicap is to change the first line of your project's `Capfile` to `load 'minicap'`. Copy the contents of minicap's `examples/deploy.rb` as a jumping off point for your project's `deploy.rb`.
18
+ To use minicap, your project's `Capfile` should look like
19
+
20
+ require 'rubygems'
21
+ require 'minicap'
22
+ load 'config/deploy'
23
+
24
+ Copy the contents of minicap's `examples/deploy.rb` as a jumping off point for your project's `deploy.rb`.
19
25
 
20
26
  ## Coming soon
21
27
 
@@ -1,71 +1,73 @@
1
- require 'capistrano/recipes/deploy/scm'
1
+ Capistrano::Configuration.instance(:must_exist).load do
2
+ require 'capistrano/recipes/deploy/scm'
2
3
 
3
- default_run_options[:pty] = true # Needed for debian based servers
4
- set :ssh_options, {:forward_agent => true}
4
+ default_run_options[:pty] = true # Needed for debian based servers
5
+ set :ssh_options, {:forward_agent => true}
5
6
 
6
- namespace :deploy do
7
- desc "Set up the deployment structure"
8
- task :setup, :except => { :no_release => true } do
9
- run "mkdir -p #{deploy_to}"
10
- run_gregarious "[ -d #{deploy_to}/.git ] || git clone -q #{repository} #{deploy_to}"
11
- unversioned_dirs.each { |d| run "mkdir -p #{deploy_to + '/' + d}" } if exists? :unversioned_dirs
12
- end
7
+ namespace :deploy do
8
+ desc "Set up the deployment structure"
9
+ task :setup, :except => { :no_release => true } do
10
+ run "mkdir -p #{deploy_to}"
11
+ run_gregarious "[ -d #{deploy_to}/.git ] || git clone -q #{repository} #{deploy_to}"
12
+ unversioned_dirs.each { |d| run "mkdir -p #{deploy_to + '/' + d}" } if exists? :unversioned_dirs
13
+ end
13
14
 
14
- desc "Update the deployed code"
15
- task :default, :except => { :no_release => true } do
16
- fetch
17
- deploy.check_yr_head if fetch(:pedantic_remote, false) && branch !~ /HEAD/
18
- update_code
19
- orphans if fetch(:look_for_orphans, false)
20
- end
15
+ desc "Update the deployed code"
16
+ task :default, :except => { :no_release => true } do
17
+ fetch
18
+ deploy.check_yr_head if fetch(:pedantic_remote, false) && branch !~ /HEAD/
19
+ update_code
20
+ orphans if fetch(:look_for_orphans, false)
21
+ end
21
22
 
22
- desc "Fetches the latest from the repo"
23
- task :fetch do
24
- run_gregarious "cd #{deploy_to} ; git fetch -q origin"
25
- end
23
+ desc "Fetches the latest from the repo"
24
+ task :fetch do
25
+ run_gregarious "cd #{deploy_to} ; git fetch -q origin"
26
+ end
26
27
 
27
- desc "Aborts if remote's HEAD is different than ours"
28
- task :check_yr_head do
29
- remote = capture("cd #{deploy_to} ; git show-ref origin/#{branch}").split[0]
30
- local = `git show-ref #{branch}`.split[0]
31
- abort "It looks like you haven't pushed your changes yet. Aborting
32
- Your HEAD is #{local[0,7]}
33
- Their HEAD is #{remote[0,7]}" if local != remote
34
- end
28
+ desc "Aborts if remote's HEAD is different than ours"
29
+ task :check_yr_head do
30
+ remote = capture("cd #{deploy_to} ; git show-ref origin/#{branch}").split[0]
31
+ local = `git show-ref #{branch}`.split[0]
32
+ abort "It looks like you haven't pushed your changes yet. Aborting
33
+ Your HEAD is #{local[0,7]}
34
+ Their HEAD is #{remote[0,7]}" if local != remote
35
+ end
35
36
 
36
- desc "Does a git reset to get the repo looking like branch"
37
- task :update_code do
38
- run "cd #{deploy_to} ; git reset --hard origin/#{branch}"
39
- end
37
+ desc "Does a git reset to get the repo looking like branch"
38
+ task :update_code do
39
+ run "cd #{deploy_to} ; git reset --hard origin/#{branch}"
40
+ end
40
41
 
41
- desc "Reports back on remote files that didn't come from git, or aren't ignored by git"
42
- task :orphans do
43
- orphans = capture "cd #{deploy_to} ; git ls-files -o"
44
- unless orphans.empty?
45
- logger.important <<-EOF
46
- The following files are present in the deployment, and are unaccounted for
47
- You may want to manually slay them, or else add them to .gitignore
42
+ desc "Reports back on remote files that didn't come from git, or aren't ignored by git"
43
+ task :orphans do
44
+ orphans = capture "cd #{deploy_to} ; git ls-files -o"
45
+ unless orphans.empty?
46
+ logger.important <<-EOF
47
+ The following files are present in the deployment, and are unaccounted for
48
+ You may want to manually slay them, or else add them to .gitignore
48
49
 
49
- #{orphans}
50
- EOF
50
+ #{orphans}
51
+ EOF
52
+ end
51
53
  end
52
- end
53
54
 
54
- desc "Rollback a single commit"
55
- task :rollback, :except => { :no_release => true } do
56
- set :branch, "HEAD^"
57
- default
55
+ desc "Rollback a single commit"
56
+ task :rollback, :except => { :no_release => true } do
57
+ set :branch, "HEAD^"
58
+ default
59
+ end
58
60
  end
59
- end
60
61
 
61
- #
62
- # Runs the given command via cap's wrapper, which handles things like ssh host
63
- # key messages, passphrase prompts, and the like
64
- #
65
- def run_gregarious(cmd)
66
- run cmd do |ch,stream,text|
67
- ch[:state] ||= { :channel => ch }
68
- output = Capistrano::Deploy::SCM.new(:git, self).handle_data(ch[:state], stream, text)
69
- ch.send_data(output) if output
62
+ #
63
+ # Runs the given command via cap's wrapper, which handles things like ssh host
64
+ # key messages, passphrase prompts, and the like
65
+ #
66
+ def run_gregarious(cmd)
67
+ run cmd do |ch,stream,text|
68
+ ch[:state] ||= { :channel => ch }
69
+ output = Capistrano::Deploy::SCM.new(:git, self).handle_data(ch[:state], stream, text)
70
+ ch.send_data(output) if output
71
+ end
70
72
  end
71
73
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minicap
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
+ - 1
7
8
  - 0
8
9
  - 0
9
- - 1
10
- version: 0.0.1
10
+ version: 1.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mat Trudel