geordi 1.2.3 → 1.3.0

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.
@@ -1,118 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
- require 'capistrano'
4
- require 'singleton'
5
- require 'highline/import'
6
-
7
- module Geordi
8
- module Capistrano
9
-
10
- class Config
11
-
12
- attr_accessor :stage, :root
13
-
14
- def initialize(stage)
15
- @stage = stage
16
- @root = find_project_root!
17
- load_capistrano_config
18
- end
19
-
20
- def user
21
- @capistrano_config.fetch(:user)
22
- end
23
-
24
- def servers
25
- @capistrano_config.find_servers(:roles => [:app])
26
- end
27
-
28
- def primary_server
29
- @capistrano_config.find_servers(:roles => [:app], :only => { :primary => true }).first
30
- end
31
-
32
- def path
33
- @capistrano_config.fetch(:deploy_to) + '/current'
34
- end
35
-
36
- def env
37
- @capistrano_config.fetch(:rails_env, 'production')
38
- end
39
-
40
- def shell
41
- @capistrano_config.fetch(:default_shell, 'bash --login')
42
- end
43
-
44
-
45
- private
46
-
47
- def load_capistrano_config
48
- config = ::Capistrano::Configuration.new
49
- config.load('deploy')
50
- config.load('config/deploy')
51
- if @stage and @stage != ''
52
- puts ::Capistrano::Version.to_s
53
- config.stage = @stage
54
-
55
- config.find_and_execute_task(stage)
56
- end
57
-
58
- @capistrano_config = config
59
- end
60
-
61
- def find_project_root!
62
- current = Dir.pwd
63
- until (File.exists? 'Capfile')
64
- Dir.chdir '..'
65
- raise 'Call me from inside a Rails project!' if current == Dir.pwd
66
- current = Dir.pwd
67
- end
68
- current
69
- end
70
- end
71
-
72
-
73
- attr_accessor :stage
74
-
75
- def config
76
- @config ||= {}
77
- @config[stage] ||= Config.new(stage)
78
- end
79
-
80
- def catching_errors(&block)
81
- begin
82
- yield
83
- rescue Exception => e
84
- $stderr.puts e.message
85
- exit 1
86
- end
87
- end
88
-
89
- def select_server
90
- choose do |menu|
91
- config.servers.each do |server|
92
- menu.choice(server) { server }
93
- end
94
-
95
- # Default to the first listed server (by convention, the first server
96
- # in the deploy files is the primary one).
97
- menu.default = '1'
98
- menu.prompt = 'Connect to [1]: '
99
- end
100
- end
101
-
102
- def shell_for(command, options = {})
103
- server = options[:select_server] ? select_server : config.primary_server
104
-
105
- remote_commands = [ 'cd', config.path ]
106
- remote_commands << '&&' << config.shell
107
- remote_commands << "-c '#{command}'" if command
108
-
109
- args = [ 'ssh', %(#{config.user}@#{server}), '-t', remote_commands.join(' ') ]
110
- if options.fetch(:exec, true)
111
- exec(*args)
112
- else
113
- system(*args)
114
- end
115
- end
116
-
117
- end
118
- end
@@ -1,17 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'cuc')
2
-
3
- module Geordi
4
- class RunTests
5
-
6
- def run
7
- 4.times { puts }
8
- puts "Running tests..."
9
- puts "========================="
10
-
11
- Cucumber.new.setup_vnc
12
- FirefoxForSelenium.setup_firefox
13
- exec *ARGV
14
- end
15
-
16
- end
17
- end