fdlcap 0.3.28 → 0.3.29

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.28
1
+ 0.3.29
data/fdlcap.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fdlcap}
8
- s.version = "0.3.28"
8
+ s.version = "0.3.29"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Factory Design Labs"]
12
- s.date = %q{2009-10-08}
12
+ s.date = %q{2009-10-09}
13
13
  s.default_executable = %q{fdlcap}
14
14
  s.email = %q{interactive@factorylabs.com}
15
15
  s.executables = ["fdlcap"]
@@ -15,7 +15,7 @@ class Capistrano::Configuration
15
15
 
16
16
  def render_erb_template(filename)
17
17
  template = File.read(filename)
18
- result = ERB.new(template).result(binding)
18
+ result = ERB.new(template).result(binding)
19
19
  end
20
20
 
21
21
  ##
@@ -31,4 +31,26 @@ class Capistrano::Configuration
31
31
  return output.to_s
32
32
  end
33
33
 
34
+ def try(command, options)
35
+ success = true
36
+ invoke_command(command, options) do |ch, stream, out|
37
+ warn "#{ch[:server]}: #{out}" if stream == :err
38
+ yield ch, stream, out if block_given?
39
+ end
40
+ rescue Capistrano::CommandError => e
41
+ success = false
42
+ end
43
+
44
+ def check(cmd, options)
45
+ puts cmd
46
+ puts options
47
+ success = false
48
+ invoke_command("if [#{cmd}]; then echo exists; else echo not_found; fi", options) do |ch, stream, out|
49
+ warn "#{ch[:server]}: #{out}" if stream == :err
50
+ success = out.strip == 'exists' ? true : false
51
+ break if stream == :err
52
+ end
53
+ success
54
+ end
55
+
34
56
  end
@@ -1,5 +1,8 @@
1
1
  Capistrano::Configuration.instance(:must_exist).load do
2
- define_recipe :geminstaller do
2
+ define_recipe :geminstaller do |*sources|
3
+ gem_sources = sources || ['http://gems.github.com', 'http://gemcutter.org']
4
+ set :gem_sources, gem_sources.flatten unless exists?(:gem_sources) && !gem_sources.empty?
5
+
3
6
  #
4
7
  # Tasks
5
8
  #
@@ -11,8 +14,6 @@ Capistrano::Configuration.instance(:must_exist).load do
11
14
  as = fetch(:runner, "app")
12
15
  via = fetch(:run_method, :sudo)
13
16
  invoke_command "gem install geminstaller", :via => via, :as => as
14
- invoke_command "gem source -a http://gems.github.com", :via => via, :as => as
15
- invoke_command "gem source -a http://gemcutter.org", :via => via, :as => as
16
17
  end
17
18
 
18
19
  desc <<-DESC
@@ -22,8 +23,6 @@ Capistrano::Configuration.instance(:must_exist).load do
22
23
  as = fetch(:runner, "app")
23
24
  via = fetch(:run_method, :sudo)
24
25
  use_geminstaller_sudo = fetch(:geminstaller_sudo, false)
25
- invoke_command "if ! gem source | grep -q 'http://gemcutter.org' ; then gem source -a 'http://gemcutter.org'; fi", :via => via, :as => as
26
- invoke_command "if ! gem source | grep -q 'http://gems.github.com' ; then gem source -a 'http://gems.github.com'; fi", :via => via, :as => as
27
26
  invoke_command "/usr/bin/geminstaller #{use_geminstaller_sudo ? '-s' : ''} -c #{current_path}/config/geminstaller.yml --geminstaller-output=all --rubygems-output=all", :via => via, :as => as
28
27
  end
29
28
 
@@ -39,15 +38,32 @@ Capistrano::Configuration.instance(:must_exist).load do
39
38
  end
40
39
  end
41
40
  end
41
+
42
+ desc <<-DESC
43
+ add gem sources to server
44
+ DESC
45
+ task :source_gem_servers, :only => { :geminstaller => true } do
46
+ as = fetch(:runner, "app")
47
+ via = fetch(:run_method, :sudo)
48
+ gem_sources.each do |source|
49
+ puts source
50
+ unless check("gem source | grep '#{source}' = '#{source}'", :via => via, :as => as)
51
+ invoke_command "gem source -a #{source}", :via => via, :as => as
52
+ end
53
+ end
54
+ end
55
+
56
+ #
57
+ # Callbacks
58
+ #
59
+ before "deploy:check", "geminstaller:add_remote_gem_dependencies"
60
+ after "deploy:setup", "geminstaller:install"
61
+ after "geminstaller:install", "geminstaller:run"
62
+ after "deploy:update", "geminstaller:run"
63
+
64
+ before "geminstaller:install", "geminstaller:source_gem_servers"
65
+ before "geminstaller:run", "geminstaller:source_gem_servers"
42
66
  end
43
67
 
44
- #
45
- # Callbacks
46
- #
47
- before "deploy:check", "geminstaller:add_remote_gem_dependencies"
48
- after "deploy:setup", "geminstaller:install"
49
- after "geminstaller:install", "geminstaller:run"
50
- after "deploy:update", "geminstaller:run"
51
68
  end
52
-
53
69
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fdlcap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.28
4
+ version: 0.3.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Factory Design Labs
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-08 00:00:00 -06:00
12
+ date: 2009-10-09 00:00:00 -06:00
13
13
  default_executable: fdlcap
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency