eventhub-command 0.0.17 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +17 -17
- data/Gemfile +2 -2
- data/README.md +29 -29
- data/Rakefile +44 -44
- data/bin/eh +39 -39
- data/eh.gemspec +27 -27
- data/eh.rdoc +4 -4
- data/features/eh.feature +8 -8
- data/features/step_definitions/eh_steps.rb +6 -6
- data/features/support/env.rb +15 -15
- data/lib/eh-commands.rb +7 -7
- data/lib/eh.rb +6 -6
- data/lib/eh/commands/copy_config.rb +51 -51
- data/lib/eh/commands/deploy.rb +38 -38
- data/lib/eh/commands/generate_processor.rb +90 -90
- data/lib/eh/commands/package.rb +97 -100
- data/lib/eh/commands/package_rails.rb +97 -97
- data/lib/eh/settings.rb +66 -66
- data/lib/eh/version.rb +3 -3
- data/test/default_test.rb +14 -14
- data/test/test_helper.rb +9 -9
- data/todo.txt +8 -8
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06385893c9ba6a5fcae55712fb643fc13ddbed02
|
4
|
+
data.tar.gz: c060785f7a420d703cb7dbdc99ec6c0f6024b5cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65b34eb3b78cffa22884ec506f68c87a5232e60e763c3bf80dcb67b5b6d4aad59e379221b6e84ab1139dbc2e5a42f6cf8e596627fbb672112a14a008db2a0458
|
7
|
+
data.tar.gz: 4354ecadc71e542b5aedd14422a88d6c205e289c549f3ffeb8916931bb43d94f0c3df55d4dcd1a5d78e1dc758119f9d8ac8bc6243597d6a959fd5b1ab0144d44
|
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/README.md
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
eventhub-command
|
2
|
-
================
|
3
|
-
|
4
|
-
Event Hub Command Line Tool includes the following features
|
5
|
-
|
6
|
-
* Packaging Event Hub Processor's
|
7
|
-
* Pushing Channel Adapter and Processor configuration files to servers
|
8
|
-
* Scaffold your Event Hub Processor
|
9
|
-
|
10
|
-
## Installation
|
11
|
-
|
12
|
-
Install gem and make command provided by this gem available
|
13
|
-
|
14
|
-
~~~ sh
|
15
|
-
$ gem i eventhub-command
|
16
|
-
$ rbenv rehash
|
17
|
-
~~~
|
18
|
-
|
19
|
-
First time running the command
|
20
|
-
~~~ sh
|
21
|
-
$ eh
|
22
|
-
Config file missing: ~/.eh, will create it now...
|
23
|
-
Please specify the Eventhub SVN root directory (i.e. the directory which contains the 'src', 'release', ... directories
|
24
|
-
/Users/username/dev/event_hub
|
25
|
-
Config file written to /Users/username/.eh. Please try again.
|
26
|
-
$
|
27
|
-
~~~
|
28
|
-
|
29
|
-
## Usage
|
1
|
+
eventhub-command
|
2
|
+
================
|
3
|
+
|
4
|
+
Event Hub Command Line Tool includes the following features
|
5
|
+
|
6
|
+
* Packaging Event Hub Processor's
|
7
|
+
* Pushing Channel Adapter and Processor configuration files to servers
|
8
|
+
* Scaffold your Event Hub Processor
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Install gem and make command provided by this gem available
|
13
|
+
|
14
|
+
~~~ sh
|
15
|
+
$ gem i eventhub-command
|
16
|
+
$ rbenv rehash
|
17
|
+
~~~
|
18
|
+
|
19
|
+
First time running the command
|
20
|
+
~~~ sh
|
21
|
+
$ eh
|
22
|
+
Config file missing: ~/.eh, will create it now...
|
23
|
+
Please specify the Eventhub SVN root directory (i.e. the directory which contains the 'src', 'release', ... directories
|
24
|
+
/Users/username/dev/event_hub
|
25
|
+
Config file written to /Users/username/.eh. Please try again.
|
26
|
+
$
|
27
|
+
~~~
|
28
|
+
|
29
|
+
## Usage
|
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/bin/eh
CHANGED
@@ -1,39 +1,39 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'gli'
|
3
|
-
require 'fileutils'
|
4
|
-
require 'json'
|
5
|
-
require 'eh' # eh needs to be required in advance so we can access Eh::Settings
|
6
|
-
require 'bundler'
|
7
|
-
include GLI::App
|
8
|
-
|
9
|
-
program_desc 'Command line tools for EventHub'
|
10
|
-
|
11
|
-
version Eh::VERSION
|
12
|
-
config_file = File.expand_path(File.join('~', '.eh'))
|
13
|
-
if File.readable?(config_file)
|
14
|
-
settings = Eh::Settings.load(config_file)
|
15
|
-
Eh::Settings.current = settings
|
16
|
-
else
|
17
|
-
puts "Config file missing: ~/.eh, will create it now..."
|
18
|
-
puts "Please specify the Eventhub SVN root directory (i.e. the directory which contains the 'src', 'release', ... directories"
|
19
|
-
input = STDIN.gets.chomp
|
20
|
-
data = {'repository_root_dir' => input}
|
21
|
-
File.open(config_file, 'w') do |file|
|
22
|
-
file.write(JSON.dump(data))
|
23
|
-
end
|
24
|
-
puts "Config file written to #{config_file}. Please try again."
|
25
|
-
exit
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
require 'eh-commands'
|
30
|
-
|
31
|
-
# Use argument validation
|
32
|
-
arguments :strict
|
33
|
-
|
34
|
-
accept Array do |value|
|
35
|
-
value.split(/,/).map(&:strip)
|
36
|
-
end
|
37
|
-
|
38
|
-
switch([:v, :verbose], :desc => "Show additional output.")
|
39
|
-
exit run(ARGV)
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'gli'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'json'
|
5
|
+
require 'eh' # eh needs to be required in advance so we can access Eh::Settings
|
6
|
+
require 'bundler'
|
7
|
+
include GLI::App
|
8
|
+
|
9
|
+
program_desc 'Command line tools for EventHub'
|
10
|
+
|
11
|
+
version Eh::VERSION
|
12
|
+
config_file = File.expand_path(File.join('~', '.eh'))
|
13
|
+
if File.readable?(config_file)
|
14
|
+
settings = Eh::Settings.load(config_file)
|
15
|
+
Eh::Settings.current = settings
|
16
|
+
else
|
17
|
+
puts "Config file missing: ~/.eh, will create it now..."
|
18
|
+
puts "Please specify the Eventhub SVN root directory (i.e. the directory which contains the 'src', 'release', ... directories"
|
19
|
+
input = STDIN.gets.chomp
|
20
|
+
data = {'repository_root_dir' => input}
|
21
|
+
File.open(config_file, 'w') do |file|
|
22
|
+
file.write(JSON.dump(data))
|
23
|
+
end
|
24
|
+
puts "Config file written to #{config_file}. Please try again."
|
25
|
+
exit
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
require 'eh-commands'
|
30
|
+
|
31
|
+
# Use argument validation
|
32
|
+
arguments :strict
|
33
|
+
|
34
|
+
accept Array do |value|
|
35
|
+
value.split(/,/).map(&:strip)
|
36
|
+
end
|
37
|
+
|
38
|
+
switch([:v, :verbose], :desc => "Show additional output.")
|
39
|
+
exit run(ARGV)
|
data/eh.gemspec
CHANGED
@@ -1,27 +1,27 @@
|
|
1
|
-
# Ensure we require the local version and not one we might have installed already
|
2
|
-
require File.join([File.dirname(__FILE__),'lib','eh','version.rb'])
|
3
|
-
spec = Gem::Specification.new do |s|
|
4
|
-
s.name = 'eventhub-command'
|
5
|
-
s.version = Eh::VERSION
|
6
|
-
s.author = ['Pascal Betz','Thomas Steiner']
|
7
|
-
s.email = ['pascal.betz@simplificator.com','thomas.steiner@ikey.ch']
|
8
|
-
s.homepage = 'http://github.com/thomis/eventhub-command'
|
9
|
-
s.platform = Gem::Platform::RUBY
|
10
|
-
s.description = 'Event Hub Command Line Tool which supports you with various Event Hub related administrative development features.'
|
11
|
-
s.summary = 'Event Hub Command Line Tool'
|
12
|
-
s.license = "MIT"
|
13
|
-
s.files = `git ls-files`.split("
|
14
|
-
")
|
15
|
-
s.require_paths << 'lib'
|
16
|
-
s.has_rdoc = true
|
17
|
-
s.extra_rdoc_files = ['README.md','eh.rdoc']
|
18
|
-
s.rdoc_options << '--title' << 'eh' << '--main' << 'README.rdoc' << '-ri'
|
19
|
-
s.bindir = 'bin'
|
20
|
-
s.executables << 'eh'
|
21
|
-
s.add_development_dependency('rake', '~> 10.1')
|
22
|
-
s.add_development_dependency('rdoc', '~> 4.1')
|
23
|
-
s.add_development_dependency('aruba', '~> 0.5')
|
24
|
-
s.add_runtime_dependency('gli','2.12.0')
|
25
|
-
s.add_runtime_dependency('rubyzip', '~> 1.0')
|
26
|
-
s.add_runtime_dependency('activesupport', '~> 4.1')
|
27
|
-
end
|
1
|
+
# Ensure we require the local version and not one we might have installed already
|
2
|
+
require File.join([File.dirname(__FILE__),'lib','eh','version.rb'])
|
3
|
+
spec = Gem::Specification.new do |s|
|
4
|
+
s.name = 'eventhub-command'
|
5
|
+
s.version = Eh::VERSION
|
6
|
+
s.author = ['Pascal Betz','Thomas Steiner']
|
7
|
+
s.email = ['pascal.betz@simplificator.com','thomas.steiner@ikey.ch']
|
8
|
+
s.homepage = 'http://github.com/thomis/eventhub-command'
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.description = 'Event Hub Command Line Tool which supports you with various Event Hub related administrative development features.'
|
11
|
+
s.summary = 'Event Hub Command Line Tool'
|
12
|
+
s.license = "MIT"
|
13
|
+
s.files = `git ls-files`.split("
|
14
|
+
")
|
15
|
+
s.require_paths << 'lib'
|
16
|
+
s.has_rdoc = true
|
17
|
+
s.extra_rdoc_files = ['README.md','eh.rdoc']
|
18
|
+
s.rdoc_options << '--title' << 'eh' << '--main' << 'README.rdoc' << '-ri'
|
19
|
+
s.bindir = 'bin'
|
20
|
+
s.executables << 'eh'
|
21
|
+
s.add_development_dependency('rake', '~> 10.1')
|
22
|
+
s.add_development_dependency('rdoc', '~> 4.1')
|
23
|
+
s.add_development_dependency('aruba', '~> 0.5')
|
24
|
+
s.add_runtime_dependency('gli','2.12.0')
|
25
|
+
s.add_runtime_dependency('rubyzip', '~> 1.0')
|
26
|
+
s.add_runtime_dependency('activesupport', '~> 4.1')
|
27
|
+
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
|
data/features/eh.feature
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
Feature: My bootstrapped app kinda works
|
2
|
-
In order to get going on coding my awesome app
|
3
|
-
I want to have aruba and cucumber setup
|
4
|
-
So I don't have to do it myself
|
5
|
-
|
6
|
-
Scenario: App just runs
|
7
|
-
When I get help for "eh"
|
8
|
-
Then the exit status should be 0
|
1
|
+
Feature: My bootstrapped app kinda works
|
2
|
+
In order to get going on coding my awesome app
|
3
|
+
I want to have aruba and cucumber setup
|
4
|
+
So I don't have to do it myself
|
5
|
+
|
6
|
+
Scenario: App just runs
|
7
|
+
When I get help for "eh"
|
8
|
+
Then the exit status should be 0
|
@@ -1,6 +1,6 @@
|
|
1
|
-
When /^I get help for "([^"]*)"$/ do |app_name|
|
2
|
-
@app_name = app_name
|
3
|
-
step %(I run `#{app_name} help`)
|
4
|
-
end
|
5
|
-
|
6
|
-
# Add more step definitions here
|
1
|
+
When /^I get help for "([^"]*)"$/ do |app_name|
|
2
|
+
@app_name = app_name
|
3
|
+
step %(I run `#{app_name} help`)
|
4
|
+
end
|
5
|
+
|
6
|
+
# Add more step definitions here
|
data/features/support/env.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
require 'aruba/cucumber'
|
2
|
-
|
3
|
-
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
4
|
-
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
|
5
|
-
|
6
|
-
Before do
|
7
|
-
# Using "announce" causes massive warnings on 1.9.2
|
8
|
-
@puts = true
|
9
|
-
@original_rubylib = ENV['RUBYLIB']
|
10
|
-
ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
|
11
|
-
end
|
12
|
-
|
13
|
-
After do
|
14
|
-
ENV['RUBYLIB'] = @original_rubylib
|
15
|
-
end
|
1
|
+
require 'aruba/cucumber'
|
2
|
+
|
3
|
+
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
4
|
+
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
|
5
|
+
|
6
|
+
Before do
|
7
|
+
# Using "announce" causes massive warnings on 1.9.2
|
8
|
+
@puts = true
|
9
|
+
@original_rubylib = ENV['RUBYLIB']
|
10
|
+
ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
|
11
|
+
end
|
12
|
+
|
13
|
+
After do
|
14
|
+
ENV['RUBYLIB'] = @original_rubylib
|
15
|
+
end
|
data/lib/eh-commands.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
|
2
|
-
# All commands are required here
|
3
|
-
require 'eh/commands/deploy'
|
4
|
-
require 'eh/commands/copy_config'
|
5
|
-
require 'eh/commands/generate_processor'
|
6
|
-
require 'eh/commands/package_rails'
|
7
|
-
require 'eh/commands/package'
|
1
|
+
|
2
|
+
# All commands are required here
|
3
|
+
require 'eh/commands/deploy'
|
4
|
+
require 'eh/commands/copy_config'
|
5
|
+
require 'eh/commands/generate_processor'
|
6
|
+
require 'eh/commands/package_rails'
|
7
|
+
require 'eh/commands/package'
|
data/lib/eh.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
module Eh
|
2
|
-
end
|
3
|
-
require 'zip'
|
4
|
-
require 'pathname'
|
5
|
-
|
6
|
-
require 'eh/version'
|
1
|
+
module Eh
|
2
|
+
end
|
3
|
+
require 'zip'
|
4
|
+
require 'pathname'
|
5
|
+
|
6
|
+
require 'eh/version'
|
7
7
|
require 'eh/settings'
|
@@ -1,51 +1,51 @@
|
|
1
|
-
desc 'Copies the config directory of a given processor to remote'
|
2
|
-
command :copy_config do |c|
|
3
|
-
c.flag([:s, :source], :desc => "Source config directory", :default_value => Eh::Settings.current.source_config_dir, :long_desc => "A local directory containing subfolders for each of the processors")
|
4
|
-
c.flag([:p, :processors], :desc => "Specify what processors' configs to copy", :type => Array, :long_desc => "You can specify multiple processors by providing a comma-separated list.")
|
5
|
-
|
6
|
-
c.action do |global_options, options, args|
|
7
|
-
source_config_dir = options['s']
|
8
|
-
repository_deployment_dir = File.join(Eh::Settings.current.repository_root_dir, "branches", "master", "src", "deployment")
|
9
|
-
|
10
|
-
processor_names = Dir["#{source_config_dir}/*"].map do |dir|
|
11
|
-
File.basename(dir)
|
12
|
-
end
|
13
|
-
|
14
|
-
included_processor_names = processor_names
|
15
|
-
|
16
|
-
# only include processors specified by -p option, if option is given
|
17
|
-
if options['p']
|
18
|
-
included_processor_names = included_processor_names.select do |processor_name|
|
19
|
-
options['p'].include?(processor_name)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
# make sure we have at least one processor
|
24
|
-
if included_processor_names.empty?
|
25
|
-
raise "There are no processor configs to copy. Either there is nothing in #{source_config_dir} or the processor(s) specified with -p don't exist."
|
26
|
-
end
|
27
|
-
|
28
|
-
included_processor_names.each do |processor_name|
|
29
|
-
processor_config_source_dir = File.join(source_config_dir, processor_name)
|
30
|
-
|
31
|
-
cmd = "cd #{repository_deployment_dir} && COPY_FROM_DIR=#{processor_config_source_dir} bundle exec cap event_hub:scp_copy_config"
|
32
|
-
|
33
|
-
puts "Will copy config files from #{processor_config_source_dir} to remote."
|
34
|
-
puts "WARNING: This will overwrite any existing files with the same name!"
|
35
|
-
puts "Do you really want to do this?"
|
36
|
-
input = STDIN.gets.chomp
|
37
|
-
|
38
|
-
unless ['y', 'Y'].include?(input)
|
39
|
-
raise "Not confirmed. Stop."
|
40
|
-
end
|
41
|
-
|
42
|
-
puts "Command: #{cmd}" if global_options['v']
|
43
|
-
|
44
|
-
Bundler.with_clean_env do
|
45
|
-
system cmd
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
puts "Done."
|
50
|
-
end
|
51
|
-
end
|
1
|
+
desc 'Copies the config directory of a given processor to remote'
|
2
|
+
command :copy_config do |c|
|
3
|
+
c.flag([:s, :source], :desc => "Source config directory", :default_value => Eh::Settings.current.source_config_dir, :long_desc => "A local directory containing subfolders for each of the processors")
|
4
|
+
c.flag([:p, :processors], :desc => "Specify what processors' configs to copy", :type => Array, :long_desc => "You can specify multiple processors by providing a comma-separated list.")
|
5
|
+
|
6
|
+
c.action do |global_options, options, args|
|
7
|
+
source_config_dir = options['s']
|
8
|
+
repository_deployment_dir = File.join(Eh::Settings.current.repository_root_dir, "branches", "master", "src", "deployment")
|
9
|
+
|
10
|
+
processor_names = Dir["#{source_config_dir}/*"].map do |dir|
|
11
|
+
File.basename(dir)
|
12
|
+
end
|
13
|
+
|
14
|
+
included_processor_names = processor_names
|
15
|
+
|
16
|
+
# only include processors specified by -p option, if option is given
|
17
|
+
if options['p']
|
18
|
+
included_processor_names = included_processor_names.select do |processor_name|
|
19
|
+
options['p'].include?(processor_name)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# make sure we have at least one processor
|
24
|
+
if included_processor_names.empty?
|
25
|
+
raise "There are no processor configs to copy. Either there is nothing in #{source_config_dir} or the processor(s) specified with -p don't exist."
|
26
|
+
end
|
27
|
+
|
28
|
+
included_processor_names.each do |processor_name|
|
29
|
+
processor_config_source_dir = File.join(source_config_dir, processor_name)
|
30
|
+
|
31
|
+
cmd = "cd #{repository_deployment_dir} && COPY_FROM_DIR=#{processor_config_source_dir} bundle exec cap event_hub:scp_copy_config"
|
32
|
+
|
33
|
+
puts "Will copy config files from #{processor_config_source_dir} to remote."
|
34
|
+
puts "WARNING: This will overwrite any existing files with the same name!"
|
35
|
+
puts "Do you really want to do this?"
|
36
|
+
input = STDIN.gets.chomp
|
37
|
+
|
38
|
+
unless ['y', 'Y'].include?(input)
|
39
|
+
raise "Not confirmed. Stop."
|
40
|
+
end
|
41
|
+
|
42
|
+
puts "Command: #{cmd}" if global_options['v']
|
43
|
+
|
44
|
+
Bundler.with_clean_env do
|
45
|
+
system cmd
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
puts "Done."
|
50
|
+
end
|
51
|
+
end
|