eventhub-command 0.0.20 → 0.0.21
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/README.md +29 -29
- data/Rakefile +44 -44
- data/bin/eh +39 -39
- data/eh.gemspec +28 -28
- 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/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 +104 -97
- data/lib/eh/commands/package_rails.rb +67 -65
- data/lib/eh/settings.rb +69 -66
- data/lib/eh/version.rb +3 -3
- data/lib/eh-commands.rb +6 -6
- data/lib/eh.rb +6 -6
- data/test/default_test.rb +14 -14
- data/test/test_helper.rb +9 -9
- data/todo.txt +8 -8
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 681abd1d2c35ff3cabddcfafb4519089043a17f7
|
4
|
+
data.tar.gz: ce41988303287b6d70cd3c5ed28fa68a63863c4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71547bb39ba3f36558adb6364476f82282b2f99d3f90bd9e3d4cfc76cf2b06a8f9c16ef248fe2a27f0b8b2258354a818d81cdbeaa1850de41beefc352c201177
|
7
|
+
data.tar.gz: cb167da2538a332242d2abbe9248789e7342f236d35866579b5e93e63af720af022a9e01619b0d633af4590d54c45f872893f620522f35fc664ef6af981750d9
|
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,28 +1,28 @@
|
|
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
|
-
|
28
|
-
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
|
+
|
28
|
+
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
|
@@ -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
|
data/lib/eh/commands/deploy.rb
CHANGED
@@ -1,38 +1,38 @@
|
|
1
|
-
desc 'Deploys the app'
|
2
|
-
arg_name 'stage', optional: true
|
3
|
-
command :deploy do |c|
|
4
|
-
|
5
|
-
c.flag([:deploy_via], :desc => "One of 'copy' or 'scm'", :default_value => 'scm')
|
6
|
-
c.flag([:copy_from_dir], :desc => "Source directory for copy operation", :default_value => Eh::Settings.current.releases_dir)
|
7
|
-
c.flag([:tag], :desc => "The tag to deploy")
|
8
|
-
c.flag([:branch], :desc => "The branch to deploy", :default_value => "master")
|
9
|
-
|
10
|
-
c.action do |global_options, options, args|
|
11
|
-
stage = args[0] || "development"
|
12
|
-
|
13
|
-
deployment_dir = Eh::Settings.current.deployment_dir
|
14
|
-
|
15
|
-
env_variables = []
|
16
|
-
env_variables << "DEPLOY_VIA=#{options[:deploy_via]}"
|
17
|
-
|
18
|
-
if options[:tag]
|
19
|
-
env_variables << "TAG=#{options[:tag]}"
|
20
|
-
else
|
21
|
-
env_variables << "BRANCH=#{options[:branch]}"
|
22
|
-
end
|
23
|
-
|
24
|
-
if options[:deploy_via] == "copy"
|
25
|
-
env_variables << "COPY_FROM_DIR=#{options[:copy_from_dir]}"
|
26
|
-
end
|
27
|
-
|
28
|
-
cmd = "cd #{deployment_dir} && #{env_variables.join(' ')} bundle exec cap #{stage} event_hub"
|
29
|
-
|
30
|
-
puts "Command: #{cmd}" if global_options['v']
|
31
|
-
|
32
|
-
Bundler.with_clean_env do
|
33
|
-
system cmd
|
34
|
-
end
|
35
|
-
|
36
|
-
puts "Done."
|
37
|
-
end
|
38
|
-
end
|
1
|
+
desc 'Deploys the app'
|
2
|
+
arg_name 'stage', optional: true
|
3
|
+
command :deploy do |c|
|
4
|
+
|
5
|
+
c.flag([:deploy_via], :desc => "One of 'copy' or 'scm'", :default_value => 'scm')
|
6
|
+
c.flag([:copy_from_dir], :desc => "Source directory for copy operation", :default_value => Eh::Settings.current.releases_dir)
|
7
|
+
c.flag([:tag], :desc => "The tag to deploy")
|
8
|
+
c.flag([:branch], :desc => "The branch to deploy", :default_value => "master")
|
9
|
+
|
10
|
+
c.action do |global_options, options, args|
|
11
|
+
stage = args[0] || "development"
|
12
|
+
|
13
|
+
deployment_dir = Eh::Settings.current.deployment_dir
|
14
|
+
|
15
|
+
env_variables = []
|
16
|
+
env_variables << "DEPLOY_VIA=#{options[:deploy_via]}"
|
17
|
+
|
18
|
+
if options[:tag]
|
19
|
+
env_variables << "TAG=#{options[:tag]}"
|
20
|
+
else
|
21
|
+
env_variables << "BRANCH=#{options[:branch]}"
|
22
|
+
end
|
23
|
+
|
24
|
+
if options[:deploy_via] == "copy"
|
25
|
+
env_variables << "COPY_FROM_DIR=#{options[:copy_from_dir]}"
|
26
|
+
end
|
27
|
+
|
28
|
+
cmd = "cd #{deployment_dir} && #{env_variables.join(' ')} bundle exec cap #{stage} event_hub"
|
29
|
+
|
30
|
+
puts "Command: #{cmd}" if global_options['v']
|
31
|
+
|
32
|
+
Bundler.with_clean_env do
|
33
|
+
system cmd
|
34
|
+
end
|
35
|
+
|
36
|
+
puts "Done."
|
37
|
+
end
|
38
|
+
end
|