eventhub-command 0.3.13 → 0.3.14
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 +4 -4
- data/.gitignore +17 -17
- data/Gemfile +2 -2
- data/Rakefile +44 -44
- data/eh.gemspec +2 -0
- data/eh.rdoc +4 -4
- data/lib/deployer/base_deployer.rb +149 -149
- data/lib/deployer/executor.rb +19 -3
- data/lib/deployer/mule_deployer.rb +85 -85
- data/lib/deployer/net_ssh_extension.rb +45 -45
- data/lib/deployer/stage.rb +36 -36
- data/lib/eh-commands.rb +2 -0
- data/lib/eh.rb +11 -11
- data/lib/eh/commands/deploy_mule.rb +23 -23
- data/lib/eh/commands/deploy_ruby.rb +25 -25
- data/lib/eh/commands/generate_processor.rb +90 -90
- data/lib/eh/commands/package_ruby.rb +113 -113
- data/lib/eh/commands/proxy.rb +50 -0
- data/lib/eh/commands/repository.rb +81 -81
- data/lib/eh/proxy/proxy.rb +98 -0
- data/lib/eh/proxy/settings/git.rb +37 -0
- data/lib/eh/proxy/settings/shell.rb +46 -0
- data/lib/eh/proxy/settings/svn.rb +61 -0
- data/lib/eh/settings.rb +28 -0
- data/lib/eh/version.rb +1 -1
- data/test/default_test.rb +14 -14
- data/test/test_helper.rb +9 -9
- data/todo.txt +8 -8
- metadata +37 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32761ef79619cd8e2bde1d39ef5c7933d2f51875
|
4
|
+
data.tar.gz: a8b2d169888960fa9fd37290f22cd2641f5a2a37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac8221ef5e6a9ee218c3af306a3a2ccb60c76c4aa4e2d7b599e2975b0f1436bcd0248f2d354e3aec07cc06560c284ec5b2f6bf298333d18b8fc7ac00853004c3
|
7
|
+
data.tar.gz: 5a4eb8f139b83b7d1e1d61e9110337cf9b62d0f57dcce898c75ee4bb50b92a8bf67213e5bbf99749e90d003864d50a4230d43927ec912f1d79ee3ced2f7e0a22
|
data/.gitignore
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
18
|
.DS_Store
|
data/Gemfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
gemspec
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
gemspec
|
data/Rakefile
CHANGED
@@ -1,44 +1,44 @@
|
|
1
|
-
require 'rake/clean'
|
2
|
-
require 'rubygems'
|
3
|
-
require 'rubygems/package_task'
|
4
|
-
require 'rdoc/task'
|
5
|
-
require 'cucumber'
|
6
|
-
require 'cucumber/rake/task'
|
7
|
-
Rake::RDocTask.new do |rd|
|
8
|
-
rd.main = "README.rdoc"
|
9
|
-
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
10
|
-
rd.title = 'Your application title'
|
11
|
-
end
|
12
|
-
|
13
|
-
spec = eval(File.read('eh.gemspec'))
|
14
|
-
|
15
|
-
Gem::PackageTask.new(spec) do |pkg|
|
16
|
-
end
|
17
|
-
CUKE_RESULTS = 'results.html'
|
18
|
-
CLEAN << CUKE_RESULTS
|
19
|
-
desc 'Run features'
|
20
|
-
Cucumber::Rake::Task.new(:features) do |t|
|
21
|
-
opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
|
22
|
-
opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
|
23
|
-
t.cucumber_opts = opts
|
24
|
-
t.fork = false
|
25
|
-
end
|
26
|
-
|
27
|
-
desc 'Run features tagged as work-in-progress (@wip)'
|
28
|
-
Cucumber::Rake::Task.new('features:wip') do |t|
|
29
|
-
tag_opts = ' --tags ~@pending'
|
30
|
-
tag_opts = ' --tags @wip'
|
31
|
-
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
|
32
|
-
t.fork = false
|
33
|
-
end
|
34
|
-
|
35
|
-
task :cucumber => :features
|
36
|
-
task 'cucumber:wip' => 'features:wip'
|
37
|
-
task :wip => 'features:wip'
|
38
|
-
require 'rake/testtask'
|
39
|
-
Rake::TestTask.new do |t|
|
40
|
-
t.libs << "test"
|
41
|
-
t.test_files = FileList['test/*_test.rb']
|
42
|
-
end
|
43
|
-
|
44
|
-
task :default => [:test,:features]
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubygems/package_task'
|
4
|
+
require 'rdoc/task'
|
5
|
+
require 'cucumber'
|
6
|
+
require 'cucumber/rake/task'
|
7
|
+
Rake::RDocTask.new do |rd|
|
8
|
+
rd.main = "README.rdoc"
|
9
|
+
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
10
|
+
rd.title = 'Your application title'
|
11
|
+
end
|
12
|
+
|
13
|
+
spec = eval(File.read('eh.gemspec'))
|
14
|
+
|
15
|
+
Gem::PackageTask.new(spec) do |pkg|
|
16
|
+
end
|
17
|
+
CUKE_RESULTS = 'results.html'
|
18
|
+
CLEAN << CUKE_RESULTS
|
19
|
+
desc 'Run features'
|
20
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
21
|
+
opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
|
22
|
+
opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
|
23
|
+
t.cucumber_opts = opts
|
24
|
+
t.fork = false
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Run features tagged as work-in-progress (@wip)'
|
28
|
+
Cucumber::Rake::Task.new('features:wip') do |t|
|
29
|
+
tag_opts = ' --tags ~@pending'
|
30
|
+
tag_opts = ' --tags @wip'
|
31
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
|
32
|
+
t.fork = false
|
33
|
+
end
|
34
|
+
|
35
|
+
task :cucumber => :features
|
36
|
+
task 'cucumber:wip' => 'features:wip'
|
37
|
+
task :wip => 'features:wip'
|
38
|
+
require 'rake/testtask'
|
39
|
+
Rake::TestTask.new do |t|
|
40
|
+
t.libs << "test"
|
41
|
+
t.test_files = FileList['test/*_test.rb']
|
42
|
+
end
|
43
|
+
|
44
|
+
task :default => [:test,:features]
|
data/eh.gemspec
CHANGED
@@ -26,4 +26,6 @@ spec = Gem::Specification.new do |s|
|
|
26
26
|
s.add_runtime_dependency('activesupport', '~> 4.1')
|
27
27
|
s.add_runtime_dependency('net-ssh', '~> 2.9')
|
28
28
|
s.add_runtime_dependency('colorize', '~> 0.7')
|
29
|
+
s.add_runtime_dependency('highline')
|
30
|
+
s.add_runtime_dependency('parseconfig')
|
29
31
|
end
|
data/eh.rdoc
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
= eh
|
2
|
-
|
3
|
-
Generate this with
|
4
|
-
eh rdoc
|
1
|
+
= eh
|
2
|
+
|
3
|
+
Generate this with
|
4
|
+
eh rdoc
|
5
5
|
After you have described your command line interface
|
@@ -1,149 +1,149 @@
|
|
1
|
-
class Deployer::BaseDeployer
|
2
|
-
attr_reader :options, :stage_path, :stage
|
3
|
-
|
4
|
-
def initialize(options)
|
5
|
-
@options = options
|
6
|
-
|
7
|
-
@stage_path = File.join(Eh::Settings.current.stages_dir, "#{options[:stage]}.yml")
|
8
|
-
@stage = Deployer::Stage.load(options[:stage], stage_path)
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def config_source_dir(*extra_paths)
|
14
|
-
File.join(base_dir, 'config', *extra_paths)
|
15
|
-
end
|
16
|
-
|
17
|
-
def log_deployment(executor, message)
|
18
|
-
executor.execute("echo $(date): #{message} - #{ENV['USER']} >> #{deploy_log_file}")
|
19
|
-
end
|
20
|
-
|
21
|
-
def base_dir
|
22
|
-
"~/apps/event_hub"
|
23
|
-
end
|
24
|
-
|
25
|
-
def deploy_log_file
|
26
|
-
File.join(shared_dir, 'logs', 'deploy.log')
|
27
|
-
end
|
28
|
-
|
29
|
-
def deploy_via
|
30
|
-
options[:deploy_via]
|
31
|
-
end
|
32
|
-
|
33
|
-
def verbose?
|
34
|
-
options[:verbose]
|
35
|
-
end
|
36
|
-
|
37
|
-
def via_scp?
|
38
|
-
deploy_via == 'scp'
|
39
|
-
end
|
40
|
-
|
41
|
-
def shared_dir
|
42
|
-
File.join(base_dir, 'shared')
|
43
|
-
end
|
44
|
-
|
45
|
-
def cached_copy_scp_dir
|
46
|
-
File.join(shared_dir, 'cached_copy_scp')
|
47
|
-
end
|
48
|
-
|
49
|
-
def cached_copy_svn_dir
|
50
|
-
File.join(shared_dir, 'cached_copy_svn')
|
51
|
-
end
|
52
|
-
|
53
|
-
def cached_copy_dir(*extra_paths)
|
54
|
-
dir = if via_scp?
|
55
|
-
cached_copy_scp_dir
|
56
|
-
else
|
57
|
-
if options[:tag]
|
58
|
-
File.join(cached_copy_svn_dir, 'tags', options[:tag], 'releases')
|
59
|
-
elsif options[:branch]
|
60
|
-
File.join(cached_copy_svn_dir, 'branches', options[:branch], 'releases')
|
61
|
-
else
|
62
|
-
File.join(cached_copy_svn_dir, 'branches', 'master', 'releases')
|
63
|
-
end
|
64
|
-
end
|
65
|
-
File.join(dir, *extra_paths)
|
66
|
-
end
|
67
|
-
|
68
|
-
def scm_username
|
69
|
-
Eh::Settings.current.repository.deploy_username
|
70
|
-
end
|
71
|
-
|
72
|
-
def scm_password
|
73
|
-
Eh::Settings.current.repository.deploy_password
|
74
|
-
end
|
75
|
-
|
76
|
-
def scm_base_url
|
77
|
-
Eh::Settings.current.repository.url
|
78
|
-
end
|
79
|
-
|
80
|
-
def repository
|
81
|
-
"#{scm_base_url}/branches/master/releases"
|
82
|
-
end
|
83
|
-
|
84
|
-
|
85
|
-
def create_base_dirs(executor)
|
86
|
-
dirs = [
|
87
|
-
File.join(base_dir, 'config'),
|
88
|
-
File.join(base_dir, 'ruby'),
|
89
|
-
File.join(base_dir, 'mule'),
|
90
|
-
File.join(base_dir, 'rails'),
|
91
|
-
shared_dir,
|
92
|
-
File.join(shared_dir, 'pids'),
|
93
|
-
File.join(shared_dir, 'logs'),
|
94
|
-
cached_copy_scp_dir
|
95
|
-
]
|
96
|
-
cmds = dirs.map do |dir|
|
97
|
-
"mkdir -p #{dir}"
|
98
|
-
end
|
99
|
-
executor.execute(cmds.join(" && "))
|
100
|
-
end
|
101
|
-
|
102
|
-
def update_scm(executor)
|
103
|
-
dir = cached_copy_svn_dir
|
104
|
-
cmd = <<-EOS
|
105
|
-
if [[ -d #{dir} ]]
|
106
|
-
then
|
107
|
-
cd #{dir}
|
108
|
-
svn up --trust-server-cert --non-interactive --username #{scm_username} --password #{scm_password}
|
109
|
-
else
|
110
|
-
svn co --trust-server-cert --non-interactive --username #{scm_username} --password #{scm_password} #{scm_base_url} #{dir}
|
111
|
-
fi
|
112
|
-
EOS
|
113
|
-
executor.execute(cmd)
|
114
|
-
end
|
115
|
-
|
116
|
-
private
|
117
|
-
|
118
|
-
|
119
|
-
# Executes an ls on all hosts and returns the combined
|
120
|
-
# list of files or dirs.
|
121
|
-
def remote_ls(executor, options, pattern)
|
122
|
-
results = executor.execute("ls #{pattern}", options)
|
123
|
-
results.map do |result|
|
124
|
-
if result[:stdout]
|
125
|
-
result[:stdout].split("\n")
|
126
|
-
end
|
127
|
-
end.flatten.compact.uniq
|
128
|
-
end
|
129
|
-
|
130
|
-
def verify_deployment_list!(requested, available)
|
131
|
-
# remove requested that are not available
|
132
|
-
puts 'Deployment List'.light_blue.on_blue
|
133
|
-
abort = false
|
134
|
-
requested.each do |name|
|
135
|
-
if available.include?(name)
|
136
|
-
puts "#{name}: AVAILABLE".green
|
137
|
-
else
|
138
|
-
abort = true
|
139
|
-
puts "#{name}: UNAVAILABLE".red
|
140
|
-
end
|
141
|
-
end
|
142
|
-
if abort
|
143
|
-
puts "Not all requested components are available in #{cached_copy_dir}. Will abort.".red
|
144
|
-
raise
|
145
|
-
end
|
146
|
-
|
147
|
-
end
|
148
|
-
|
149
|
-
end
|
1
|
+
class Deployer::BaseDeployer
|
2
|
+
attr_reader :options, :stage_path, :stage
|
3
|
+
|
4
|
+
def initialize(options)
|
5
|
+
@options = options
|
6
|
+
|
7
|
+
@stage_path = File.join(Eh::Settings.current.stages_dir, "#{options[:stage]}.yml")
|
8
|
+
@stage = Deployer::Stage.load(options[:stage], stage_path)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def config_source_dir(*extra_paths)
|
14
|
+
File.join(base_dir, 'config', *extra_paths)
|
15
|
+
end
|
16
|
+
|
17
|
+
def log_deployment(executor, message)
|
18
|
+
executor.execute("echo $(date): #{message} - #{ENV['USER']} >> #{deploy_log_file}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def base_dir
|
22
|
+
"~/apps/event_hub"
|
23
|
+
end
|
24
|
+
|
25
|
+
def deploy_log_file
|
26
|
+
File.join(shared_dir, 'logs', 'deploy.log')
|
27
|
+
end
|
28
|
+
|
29
|
+
def deploy_via
|
30
|
+
options[:deploy_via]
|
31
|
+
end
|
32
|
+
|
33
|
+
def verbose?
|
34
|
+
options[:verbose]
|
35
|
+
end
|
36
|
+
|
37
|
+
def via_scp?
|
38
|
+
deploy_via == 'scp'
|
39
|
+
end
|
40
|
+
|
41
|
+
def shared_dir
|
42
|
+
File.join(base_dir, 'shared')
|
43
|
+
end
|
44
|
+
|
45
|
+
def cached_copy_scp_dir
|
46
|
+
File.join(shared_dir, 'cached_copy_scp')
|
47
|
+
end
|
48
|
+
|
49
|
+
def cached_copy_svn_dir
|
50
|
+
File.join(shared_dir, 'cached_copy_svn')
|
51
|
+
end
|
52
|
+
|
53
|
+
def cached_copy_dir(*extra_paths)
|
54
|
+
dir = if via_scp?
|
55
|
+
cached_copy_scp_dir
|
56
|
+
else
|
57
|
+
if options[:tag]
|
58
|
+
File.join(cached_copy_svn_dir, 'tags', options[:tag], 'releases')
|
59
|
+
elsif options[:branch]
|
60
|
+
File.join(cached_copy_svn_dir, 'branches', options[:branch], 'releases')
|
61
|
+
else
|
62
|
+
File.join(cached_copy_svn_dir, 'branches', 'master', 'releases')
|
63
|
+
end
|
64
|
+
end
|
65
|
+
File.join(dir, *extra_paths)
|
66
|
+
end
|
67
|
+
|
68
|
+
def scm_username
|
69
|
+
Eh::Settings.current.repository.deploy_username
|
70
|
+
end
|
71
|
+
|
72
|
+
def scm_password
|
73
|
+
Eh::Settings.current.repository.deploy_password
|
74
|
+
end
|
75
|
+
|
76
|
+
def scm_base_url
|
77
|
+
Eh::Settings.current.repository.url
|
78
|
+
end
|
79
|
+
|
80
|
+
def repository
|
81
|
+
"#{scm_base_url}/branches/master/releases"
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
def create_base_dirs(executor)
|
86
|
+
dirs = [
|
87
|
+
File.join(base_dir, 'config'),
|
88
|
+
File.join(base_dir, 'ruby'),
|
89
|
+
File.join(base_dir, 'mule'),
|
90
|
+
File.join(base_dir, 'rails'),
|
91
|
+
shared_dir,
|
92
|
+
File.join(shared_dir, 'pids'),
|
93
|
+
File.join(shared_dir, 'logs'),
|
94
|
+
cached_copy_scp_dir
|
95
|
+
]
|
96
|
+
cmds = dirs.map do |dir|
|
97
|
+
"mkdir -p #{dir}"
|
98
|
+
end
|
99
|
+
executor.execute(cmds.join(" && "))
|
100
|
+
end
|
101
|
+
|
102
|
+
def update_scm(executor)
|
103
|
+
dir = cached_copy_svn_dir
|
104
|
+
cmd = <<-EOS
|
105
|
+
if [[ -d #{dir} ]]
|
106
|
+
then
|
107
|
+
cd #{dir}
|
108
|
+
svn up --trust-server-cert --non-interactive --username #{scm_username} --password #{scm_password}
|
109
|
+
else
|
110
|
+
svn co --trust-server-cert --non-interactive --username #{scm_username} --password #{scm_password} #{scm_base_url} #{dir}
|
111
|
+
fi
|
112
|
+
EOS
|
113
|
+
executor.execute(cmd)
|
114
|
+
end
|
115
|
+
|
116
|
+
private
|
117
|
+
|
118
|
+
|
119
|
+
# Executes an ls on all hosts and returns the combined
|
120
|
+
# list of files or dirs.
|
121
|
+
def remote_ls(executor, options, pattern)
|
122
|
+
results = executor.execute("ls #{pattern}", options)
|
123
|
+
results.map do |result|
|
124
|
+
if result[:stdout]
|
125
|
+
result[:stdout].split("\n")
|
126
|
+
end
|
127
|
+
end.flatten.compact.uniq
|
128
|
+
end
|
129
|
+
|
130
|
+
def verify_deployment_list!(requested, available)
|
131
|
+
# remove requested that are not available
|
132
|
+
puts 'Deployment List'.light_blue.on_blue
|
133
|
+
abort = false
|
134
|
+
requested.each do |name|
|
135
|
+
if available.include?(name)
|
136
|
+
puts "#{name}: AVAILABLE".green
|
137
|
+
else
|
138
|
+
abort = true
|
139
|
+
puts "#{name}: UNAVAILABLE".red
|
140
|
+
end
|
141
|
+
end
|
142
|
+
if abort
|
143
|
+
puts "Not all requested components are available in #{cached_copy_dir}. Will abort.".red
|
144
|
+
raise
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|