eventhub-command 0.0.17 → 0.0.19
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 +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
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
desc 'Packages Rails Console to zip file'
|
|
2
|
-
command :package_rails do |c|
|
|
3
|
-
#c.flag([:x, :exclude], :desc => "Exclude processors by name.", :type => Array, :long_desc => "You can specify multiple processors by providing a comma-separated list.")
|
|
4
|
-
#c.flag([:p, :processors], :desc => "Specify what processors to package", :type => Array, :long_desc => "You can specify multiple processors by providing a comma-separated list.")
|
|
5
|
-
c.flag([:d, :destination], :desc => "Destination directory to place created zip file.", :default_value => Eh::Settings.current.rails_release_dir)
|
|
6
|
-
c.flag([:s, :source], :desc => "Source directory to read rails console from.", :default_value => Eh::Settings.current.rails_src_dir)
|
|
7
|
-
|
|
8
|
-
c.action do |global_options, options, args|
|
|
9
|
-
source_dir = options['s']
|
|
10
|
-
destination_dir = options['d']
|
|
11
|
-
|
|
12
|
-
puts "Will package rails console from #{source_dir} to #{destination_dir}"
|
|
13
|
-
|
|
14
|
-
console = Dir["#{source_dir}"]
|
|
15
|
-
|
|
16
|
-
FileUtils.mkdir_p(destination_dir)
|
|
17
|
-
|
|
18
|
-
options = {"directories-recursively"=>true}
|
|
19
|
-
|
|
20
|
-
zipfile_name = File.join(destination_dir, "console.zip")
|
|
21
|
-
directory = source_dir
|
|
22
|
-
|
|
23
|
-
# remove zip before we create a new one
|
|
24
|
-
FileUtils.rm zipfile_name, :force => true
|
|
25
|
-
|
|
26
|
-
Zip::File.open(zipfile_name,Zip::File::CREATE) do |zipfile|
|
|
27
|
-
|
|
28
|
-
#zipfile.add(processor_name, directory)
|
|
29
|
-
[directory].each{ |file_to_be_zipped|
|
|
30
|
-
if File.directory?(file_to_be_zipped)
|
|
31
|
-
# should skip directories
|
|
32
|
-
next if options["directories-skip"]
|
|
33
|
-
# should recursively add directory
|
|
34
|
-
if options["directories-recursively"]
|
|
35
|
-
directory = file_to_be_zipped
|
|
36
|
-
puts "zipper: archiving directory: #{directory}"
|
|
37
|
-
directory_chosen_pathname = options["directories-recursively-splat"] ? directory : File.dirname(directory)
|
|
38
|
-
directory_pathname = Pathname.new(directory_chosen_pathname)
|
|
39
|
-
files = Dir[File.join(directory, '**', '**')]
|
|
40
|
-
files.delete_if {|filename| ["#{source_dir}/log", "#{source_dir}/logs", "#{source_dir}/exceptions", "#{source_dir}/tmp/pids"].include?(filename) }
|
|
41
|
-
files.each do |file|
|
|
42
|
-
file_pathname = Pathname.new(file)
|
|
43
|
-
file_relative_pathname = file_pathname.relative_path_from(directory_pathname)
|
|
44
|
-
zipfile.add(file_relative_pathname,file)
|
|
45
|
-
end
|
|
46
|
-
next
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
filename = File.basename(file_to_be_zipped)
|
|
50
|
-
|
|
51
|
-
puts "zipper: archiving #{file_to_be_zipped} as #{filename} into #{zipfile}"
|
|
52
|
-
|
|
53
|
-
zipfile.add(filename,file_to_be_zipped)
|
|
54
|
-
}
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
# find all processors in the base directory
|
|
58
|
-
#console = Dir["#{source_dir}/*"].map do |dir|
|
|
59
|
-
# File.basename(dir)
|
|
60
|
-
#end
|
|
61
|
-
|
|
62
|
-
#included_processor_names = processor_names
|
|
63
|
-
|
|
64
|
-
# only include processors specified by -p option, if option is given
|
|
65
|
-
#if options['p']
|
|
66
|
-
# included_processor_names = included_processor_names.select do |processor_name|
|
|
67
|
-
# options['p'].include?(processor_name)
|
|
68
|
-
# end
|
|
69
|
-
#end
|
|
70
|
-
#
|
|
71
|
-
## exclude processors specified by -x option, if option is given
|
|
72
|
-
#if options['x']
|
|
73
|
-
# # check if any processor has been excluded from packaging
|
|
74
|
-
# included_processor_names = included_processor_names.select do |processor_name|
|
|
75
|
-
# !options['x'].include?(processor_name)
|
|
76
|
-
# end
|
|
77
|
-
#end
|
|
78
|
-
|
|
79
|
-
# make sure we have at least one processor
|
|
80
|
-
#if included_processor_names.empty?
|
|
81
|
-
# raise "There are no processor names. Either your -s directory is empty or you specified a strange combination of -x and -p"
|
|
82
|
-
#end
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
# make sure destination directory exists
|
|
86
|
-
#FileUtils.mkdir_p(destination_dir)
|
|
87
|
-
#
|
|
88
|
-
## Zip all processors
|
|
89
|
-
#included_processor_names.each do |processor_name|
|
|
90
|
-
#
|
|
91
|
-
#directory = File.join(source_dir, processor_name) # last slash could be omitted
|
|
92
|
-
#zipfile_name = File.join(destination_dir, "#{processor_name}.zip")
|
|
93
|
-
#
|
|
94
|
-
|
|
95
|
-
puts "Done packaging #{console.size} processors"
|
|
96
|
-
end
|
|
97
|
-
end
|
|
1
|
+
desc 'Packages Rails Console to zip file'
|
|
2
|
+
command :package_rails do |c|
|
|
3
|
+
#c.flag([:x, :exclude], :desc => "Exclude processors by name.", :type => Array, :long_desc => "You can specify multiple processors by providing a comma-separated list.")
|
|
4
|
+
#c.flag([:p, :processors], :desc => "Specify what processors to package", :type => Array, :long_desc => "You can specify multiple processors by providing a comma-separated list.")
|
|
5
|
+
c.flag([:d, :destination], :desc => "Destination directory to place created zip file.", :default_value => Eh::Settings.current.rails_release_dir)
|
|
6
|
+
c.flag([:s, :source], :desc => "Source directory to read rails console from.", :default_value => Eh::Settings.current.rails_src_dir)
|
|
7
|
+
|
|
8
|
+
c.action do |global_options, options, args|
|
|
9
|
+
source_dir = options['s']
|
|
10
|
+
destination_dir = options['d']
|
|
11
|
+
|
|
12
|
+
puts "Will package rails console from #{source_dir} to #{destination_dir}"
|
|
13
|
+
|
|
14
|
+
console = Dir["#{source_dir}"]
|
|
15
|
+
|
|
16
|
+
FileUtils.mkdir_p(destination_dir)
|
|
17
|
+
|
|
18
|
+
options = {"directories-recursively"=>true}
|
|
19
|
+
|
|
20
|
+
zipfile_name = File.join(destination_dir, "console.zip")
|
|
21
|
+
directory = source_dir
|
|
22
|
+
|
|
23
|
+
# remove zip before we create a new one
|
|
24
|
+
FileUtils.rm zipfile_name, :force => true
|
|
25
|
+
|
|
26
|
+
Zip::File.open(zipfile_name,Zip::File::CREATE) do |zipfile|
|
|
27
|
+
|
|
28
|
+
#zipfile.add(processor_name, directory)
|
|
29
|
+
[directory].each{ |file_to_be_zipped|
|
|
30
|
+
if File.directory?(file_to_be_zipped)
|
|
31
|
+
# should skip directories
|
|
32
|
+
next if options["directories-skip"]
|
|
33
|
+
# should recursively add directory
|
|
34
|
+
if options["directories-recursively"]
|
|
35
|
+
directory = file_to_be_zipped
|
|
36
|
+
puts "zipper: archiving directory: #{directory}"
|
|
37
|
+
directory_chosen_pathname = options["directories-recursively-splat"] ? directory : File.dirname(directory)
|
|
38
|
+
directory_pathname = Pathname.new(directory_chosen_pathname)
|
|
39
|
+
files = Dir[File.join(directory, '**', '**')]
|
|
40
|
+
files.delete_if {|filename| ["#{source_dir}/log", "#{source_dir}/logs", "#{source_dir}/exceptions", "#{source_dir}/tmp/pids"].include?(filename) }
|
|
41
|
+
files.each do |file|
|
|
42
|
+
file_pathname = Pathname.new(file)
|
|
43
|
+
file_relative_pathname = file_pathname.relative_path_from(directory_pathname)
|
|
44
|
+
zipfile.add(file_relative_pathname,file)
|
|
45
|
+
end
|
|
46
|
+
next
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
filename = File.basename(file_to_be_zipped)
|
|
50
|
+
|
|
51
|
+
puts "zipper: archiving #{file_to_be_zipped} as #{filename} into #{zipfile}"
|
|
52
|
+
|
|
53
|
+
zipfile.add(filename,file_to_be_zipped)
|
|
54
|
+
}
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# find all processors in the base directory
|
|
58
|
+
#console = Dir["#{source_dir}/*"].map do |dir|
|
|
59
|
+
# File.basename(dir)
|
|
60
|
+
#end
|
|
61
|
+
|
|
62
|
+
#included_processor_names = processor_names
|
|
63
|
+
|
|
64
|
+
# only include processors specified by -p option, if option is given
|
|
65
|
+
#if options['p']
|
|
66
|
+
# included_processor_names = included_processor_names.select do |processor_name|
|
|
67
|
+
# options['p'].include?(processor_name)
|
|
68
|
+
# end
|
|
69
|
+
#end
|
|
70
|
+
#
|
|
71
|
+
## exclude processors specified by -x option, if option is given
|
|
72
|
+
#if options['x']
|
|
73
|
+
# # check if any processor has been excluded from packaging
|
|
74
|
+
# included_processor_names = included_processor_names.select do |processor_name|
|
|
75
|
+
# !options['x'].include?(processor_name)
|
|
76
|
+
# end
|
|
77
|
+
#end
|
|
78
|
+
|
|
79
|
+
# make sure we have at least one processor
|
|
80
|
+
#if included_processor_names.empty?
|
|
81
|
+
# raise "There are no processor names. Either your -s directory is empty or you specified a strange combination of -x and -p"
|
|
82
|
+
#end
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
# make sure destination directory exists
|
|
86
|
+
#FileUtils.mkdir_p(destination_dir)
|
|
87
|
+
#
|
|
88
|
+
## Zip all processors
|
|
89
|
+
#included_processor_names.each do |processor_name|
|
|
90
|
+
#
|
|
91
|
+
#directory = File.join(source_dir, processor_name) # last slash could be omitted
|
|
92
|
+
#zipfile_name = File.join(destination_dir, "#{processor_name}.zip")
|
|
93
|
+
#
|
|
94
|
+
|
|
95
|
+
puts "Done packaging #{console.size} processors"
|
|
96
|
+
end
|
|
97
|
+
end
|
data/lib/eh/settings.rb
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
class Eh::Settings
|
|
2
|
-
attr_reader :data
|
|
3
|
-
def self.load(file)
|
|
4
|
-
data = File.read(file)
|
|
5
|
-
json = JSON.parse(data)
|
|
6
|
-
Eh::Settings.new(json)
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def self.current=(value)
|
|
10
|
-
Thread.current[:eh_settings] = value
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def self.current
|
|
14
|
-
Thread.current[:eh_settings]
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def initialize(data)
|
|
18
|
-
@data = data
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def repository_root_dir
|
|
23
|
-
File.expand_path(data['repository_root_dir'])
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def releases_dir
|
|
27
|
-
File.join(repository_root_dir, 'releases')
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def rails_release_dir
|
|
31
|
-
File.join(releases_dir, 'rails')
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def ruby_release_dir
|
|
35
|
-
File.join(releases_dir, 'ruby')
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def
|
|
39
|
-
File.join(repository_root_dir, 'src', '
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def deployment_dir
|
|
43
|
-
File.join(repository_root_dir, 'src', 'deployment')
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def rails_src_dir
|
|
47
|
-
File.join(repository_root_dir, 'src', 'rails', 'console')
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def source_config_dir
|
|
51
|
-
File.join(repository_root_dir, 'config')
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def processor_template_repository_url
|
|
55
|
-
"https://github.com/thomis/eventhub-processor-template.git"
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def package_tmp_dir
|
|
59
|
-
'./tmp'
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def template_tmp_dir
|
|
63
|
-
"/tmp/eventhub-processor-template/"
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
end
|
|
1
|
+
class Eh::Settings
|
|
2
|
+
attr_reader :data
|
|
3
|
+
def self.load(file)
|
|
4
|
+
data = File.read(file)
|
|
5
|
+
json = JSON.parse(data)
|
|
6
|
+
Eh::Settings.new(json)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def self.current=(value)
|
|
10
|
+
Thread.current[:eh_settings] = value
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.current
|
|
14
|
+
Thread.current[:eh_settings]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def initialize(data)
|
|
18
|
+
@data = data
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def repository_root_dir
|
|
23
|
+
File.expand_path(data['repository_root_dir'])
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def releases_dir
|
|
27
|
+
File.join(repository_root_dir, 'releases')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def rails_release_dir
|
|
31
|
+
File.join(releases_dir, 'rails')
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def ruby_release_dir
|
|
35
|
+
File.join(releases_dir, 'ruby')
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def processors_src_dir
|
|
39
|
+
File.join(repository_root_dir, 'src', 'ruby')
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def deployment_dir
|
|
43
|
+
File.join(repository_root_dir, 'src', 'deployment')
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def rails_src_dir
|
|
47
|
+
File.join(repository_root_dir, 'src', 'rails', 'console')
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def source_config_dir
|
|
51
|
+
File.join(repository_root_dir, 'config')
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def processor_template_repository_url
|
|
55
|
+
"https://github.com/thomis/eventhub-processor-template.git"
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def package_tmp_dir
|
|
59
|
+
'./tmp'
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def template_tmp_dir
|
|
63
|
+
"/tmp/eventhub-processor-template/"
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
end
|
data/lib/eh/version.rb
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module Eh
|
|
2
|
-
VERSION = '0.0.
|
|
3
|
-
end
|
|
1
|
+
module Eh
|
|
2
|
+
VERSION = '0.0.19'
|
|
3
|
+
end
|
data/test/default_test.rb
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
require 'test_helper'
|
|
2
|
-
|
|
3
|
-
class DefaultTest < Test::Unit::TestCase
|
|
4
|
-
|
|
5
|
-
def setup
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def teardown
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def test_the_truth
|
|
12
|
-
assert true
|
|
13
|
-
end
|
|
14
|
-
end
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class DefaultTest < Test::Unit::TestCase
|
|
4
|
+
|
|
5
|
+
def setup
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def teardown
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def test_the_truth
|
|
12
|
+
assert true
|
|
13
|
+
end
|
|
14
|
+
end
|
data/test/test_helper.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
require 'test/unit'
|
|
2
|
-
|
|
3
|
-
# Add test libraries you want to use here, e.g. mocha
|
|
4
|
-
|
|
5
|
-
class Test::Unit::TestCase
|
|
6
|
-
|
|
7
|
-
# Add global extensions to the test case class here
|
|
8
|
-
|
|
9
|
-
end
|
|
1
|
+
require 'test/unit'
|
|
2
|
+
|
|
3
|
+
# Add test libraries you want to use here, e.g. mocha
|
|
4
|
+
|
|
5
|
+
class Test::Unit::TestCase
|
|
6
|
+
|
|
7
|
+
# Add global extensions to the test case class here
|
|
8
|
+
|
|
9
|
+
end
|
data/todo.txt
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
-- -------------------------------------
|
|
2
|
-
-- to do
|
|
3
|
-
-- -------------------------------------
|
|
4
|
-
|
|
5
|
-
- eh relase -r or --repository plate_store or http path -u user -p password
|
|
6
|
-
- folder filter, default and customize
|
|
7
|
-
- extension filter, default and custmize
|
|
8
|
-
- it could take config settings from a local .ehconfig file
|
|
1
|
+
-- -------------------------------------
|
|
2
|
+
-- to do
|
|
3
|
+
-- -------------------------------------
|
|
4
|
+
|
|
5
|
+
- eh relase -r or --repository plate_store or http path -u user -p password
|
|
6
|
+
- folder filter, default and customize
|
|
7
|
+
- extension filter, default and custmize
|
|
8
|
+
- it could take config settings from a local .ehconfig file
|
|
9
9
|
- would be nice to have a release all feature
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: eventhub-command
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.19
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pascal Betz
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2014-10-
|
|
12
|
+
date: 2014-10-30 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rake
|
|
@@ -160,3 +160,4 @@ signing_key:
|
|
|
160
160
|
specification_version: 4
|
|
161
161
|
summary: Event Hub Command Line Tool
|
|
162
162
|
test_files: []
|
|
163
|
+
has_rdoc: true
|