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.
- checksums.yaml +8 -8
- data/.gitignore +1 -2
- data/Gemfile +7 -0
- data/Gemfile.lock +61 -0
- data/README.md +65 -25
- data/Rakefile +8 -0
- data/bin/cap-all +0 -0
- data/bin/console-for +0 -0
- data/bin/cuc +0 -0
- data/bin/cuc-show +0 -0
- data/bin/cuc-vnc-setup +1 -1
- data/bin/deploy-to-production +0 -0
- data/bin/dump-for +0 -0
- data/bin/gitpt +0 -0
- data/bin/load-dump +0 -0
- data/bin/migrate-all +0 -0
- data/bin/rs +0 -0
- data/bin/run_tests +1 -1
- data/bin/shell-for +0 -0
- data/bin/tests +0 -0
- data/features/console.feature +6 -0
- data/features/cucumber.feature +129 -0
- data/features/dump.feature +31 -0
- data/features/firefox.feature +53 -0
- data/features/shell.feature +30 -0
- data/features/support/env.rb +5 -0
- data/geordi.gemspec +1 -2
- data/lib/geordi/capistrano_config.rb +23 -26
- data/lib/geordi/commands/capistrano.rb +1 -4
- data/lib/geordi/commands/cucumber.rb +19 -6
- data/lib/geordi/commands/deploy.rb +9 -14
- data/lib/geordi/commands/firefox.rb +9 -6
- data/lib/geordi/commands/png_optimize.rb +2 -3
- data/lib/geordi/commands/shell.rb +2 -3
- data/lib/geordi/cucumber.rb +29 -28
- data/lib/geordi/firefox_for_selenium.rb +21 -60
- data/lib/geordi/interaction.rb +0 -1
- data/lib/geordi/remote.rb +9 -5
- data/lib/geordi/util.rb +6 -2
- data/lib/geordi/version.rb +1 -1
- metadata +10 -5
- data/lib/geordi/capistrano.rb +0 -118
- data/lib/geordi/run_tests.rb +0 -17
data/lib/geordi/capistrano.rb
DELETED
@@ -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
|
data/lib/geordi/run_tests.rb
DELETED
@@ -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
|