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
@@ -1,90 +1,90 @@
|
|
1
|
-
desc 'Generates a template for a processor'
|
2
|
-
arg_name 'module_name processor_name'
|
3
|
-
|
4
|
-
command :generate_processor do |c|
|
5
|
-
c.action do |global_options, options, args|
|
6
|
-
require 'active_support/core_ext/string/inflections'
|
7
|
-
require 'fileutils'
|
8
|
-
require 'erb'
|
9
|
-
|
10
|
-
if args.size != 2
|
11
|
-
puts "Needs exactly 2 arguments: eh generate_processor ModuleName ProcessorName"
|
12
|
-
exit -1
|
13
|
-
end
|
14
|
-
|
15
|
-
processor_module_name = args[0].camelcase
|
16
|
-
processor_class_name = args[1].camelcase
|
17
|
-
underscored_processor_module_name = processor_module_name.underscore
|
18
|
-
underscored_processor_class_name = processor_class_name.underscore
|
19
|
-
|
20
|
-
destination_dir = Eh::Settings.current.processors_src_dir
|
21
|
-
destination_dir = File.join(destination_dir, "#{underscored_processor_module_name}.#{underscored_processor_class_name}")
|
22
|
-
|
23
|
-
if Dir.exists? destination_dir
|
24
|
-
puts "#{destination_dir} already exists!"
|
25
|
-
exit -1
|
26
|
-
end
|
27
|
-
|
28
|
-
template_tmp_dir = Eh::Settings.current.template_tmp_dir
|
29
|
-
checkout_git_repo(template_tmp_dir)
|
30
|
-
|
31
|
-
FileUtils.cp_r template_tmp_dir, destination_dir
|
32
|
-
FileUtils.rm_rf File.join(destination_dir, ".git")
|
33
|
-
FileUtils.rm File.join(destination_dir, 'README.md')
|
34
|
-
|
35
|
-
puts "Generating processor #{processor_module_name}::#{processor_class_name} in #{destination_dir}"
|
36
|
-
Dir.glob(destination_dir + "/**/*.erb") do |file|
|
37
|
-
template = ERB.new(File.read(file))
|
38
|
-
|
39
|
-
File.open(file, "w") do |writeable_file|
|
40
|
-
writeable_file.puts template.result(binding)
|
41
|
-
end
|
42
|
-
|
43
|
-
FileUtils.mv file, File.join(File.dirname(file), File.basename(file, ".erb"))
|
44
|
-
end
|
45
|
-
|
46
|
-
replacements = [
|
47
|
-
["underscored_processor_module_name", underscored_processor_module_name],
|
48
|
-
["underscored_processor_class_name", underscored_processor_class_name],
|
49
|
-
["processor_module_name", processor_module_name],
|
50
|
-
["processor_class_name", processor_class_name]
|
51
|
-
]
|
52
|
-
|
53
|
-
rename_files_with_replacements(destination_dir, replacements)
|
54
|
-
|
55
|
-
FileUtils.rm_rf template_tmp_dir
|
56
|
-
|
57
|
-
puts "Done."
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def shallow_clone_git_repository(source_url, destination_dir)
|
62
|
-
system("git clone --depth 1 #{source_url} #{destination_dir}")
|
63
|
-
end
|
64
|
-
|
65
|
-
def rename_files_with_replacements(destination_dir, replacements)
|
66
|
-
Dir.glob(destination_dir + "/**/*") do |src_file_path|
|
67
|
-
if File.file? src_file_path
|
68
|
-
dir = File.dirname src_file_path
|
69
|
-
file_with_replacements = File.basename src_file_path
|
70
|
-
|
71
|
-
replacements.each do |find_string, replace_string|
|
72
|
-
file_with_replacements.sub!(find_string, replace_string)
|
73
|
-
end
|
74
|
-
|
75
|
-
dest_file_path = File.join(dir, file_with_replacements)
|
76
|
-
|
77
|
-
if src_file_path != dest_file_path
|
78
|
-
FileUtils.mv src_file_path, dest_file_path
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def checkout_git_repo(destination_dir)
|
85
|
-
template_repository_url = Eh::Settings.current.processor_template_repository_url
|
86
|
-
puts "Checking out latest template from #{template_repository_url}"
|
87
|
-
FileUtils.rm_rf(destination_dir)
|
88
|
-
FileUtils.mkdir(destination_dir)
|
89
|
-
shallow_clone_git_repository(template_repository_url, destination_dir)
|
90
|
-
end
|
1
|
+
desc 'Generates a template for a processor'
|
2
|
+
arg_name 'module_name processor_name'
|
3
|
+
|
4
|
+
command :generate_processor do |c|
|
5
|
+
c.action do |global_options, options, args|
|
6
|
+
require 'active_support/core_ext/string/inflections'
|
7
|
+
require 'fileutils'
|
8
|
+
require 'erb'
|
9
|
+
|
10
|
+
if args.size != 2
|
11
|
+
puts "Needs exactly 2 arguments: eh generate_processor ModuleName ProcessorName"
|
12
|
+
exit -1
|
13
|
+
end
|
14
|
+
|
15
|
+
processor_module_name = args[0].camelcase
|
16
|
+
processor_class_name = args[1].camelcase
|
17
|
+
underscored_processor_module_name = processor_module_name.underscore
|
18
|
+
underscored_processor_class_name = processor_class_name.underscore
|
19
|
+
|
20
|
+
destination_dir = Eh::Settings.current.processors_src_dir
|
21
|
+
destination_dir = File.join(destination_dir, "#{underscored_processor_module_name}.#{underscored_processor_class_name}")
|
22
|
+
|
23
|
+
if Dir.exists? destination_dir
|
24
|
+
puts "#{destination_dir} already exists!"
|
25
|
+
exit -1
|
26
|
+
end
|
27
|
+
|
28
|
+
template_tmp_dir = Eh::Settings.current.template_tmp_dir
|
29
|
+
checkout_git_repo(template_tmp_dir)
|
30
|
+
|
31
|
+
FileUtils.cp_r template_tmp_dir, destination_dir
|
32
|
+
FileUtils.rm_rf File.join(destination_dir, ".git")
|
33
|
+
FileUtils.rm File.join(destination_dir, 'README.md')
|
34
|
+
|
35
|
+
puts "Generating processor #{processor_module_name}::#{processor_class_name} in #{destination_dir}"
|
36
|
+
Dir.glob(destination_dir + "/**/*.erb") do |file|
|
37
|
+
template = ERB.new(File.read(file))
|
38
|
+
|
39
|
+
File.open(file, "w") do |writeable_file|
|
40
|
+
writeable_file.puts template.result(binding)
|
41
|
+
end
|
42
|
+
|
43
|
+
FileUtils.mv file, File.join(File.dirname(file), File.basename(file, ".erb"))
|
44
|
+
end
|
45
|
+
|
46
|
+
replacements = [
|
47
|
+
["underscored_processor_module_name", underscored_processor_module_name],
|
48
|
+
["underscored_processor_class_name", underscored_processor_class_name],
|
49
|
+
["processor_module_name", processor_module_name],
|
50
|
+
["processor_class_name", processor_class_name]
|
51
|
+
]
|
52
|
+
|
53
|
+
rename_files_with_replacements(destination_dir, replacements)
|
54
|
+
|
55
|
+
FileUtils.rm_rf template_tmp_dir
|
56
|
+
|
57
|
+
puts "Done."
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def shallow_clone_git_repository(source_url, destination_dir)
|
62
|
+
system("git clone --depth 1 #{source_url} #{destination_dir}")
|
63
|
+
end
|
64
|
+
|
65
|
+
def rename_files_with_replacements(destination_dir, replacements)
|
66
|
+
Dir.glob(destination_dir + "/**/*") do |src_file_path|
|
67
|
+
if File.file? src_file_path
|
68
|
+
dir = File.dirname src_file_path
|
69
|
+
file_with_replacements = File.basename src_file_path
|
70
|
+
|
71
|
+
replacements.each do |find_string, replace_string|
|
72
|
+
file_with_replacements.sub!(find_string, replace_string)
|
73
|
+
end
|
74
|
+
|
75
|
+
dest_file_path = File.join(dir, file_with_replacements)
|
76
|
+
|
77
|
+
if src_file_path != dest_file_path
|
78
|
+
FileUtils.mv src_file_path, dest_file_path
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def checkout_git_repo(destination_dir)
|
85
|
+
template_repository_url = Eh::Settings.current.processor_template_repository_url
|
86
|
+
puts "Checking out latest template from #{template_repository_url}"
|
87
|
+
FileUtils.rm_rf(destination_dir)
|
88
|
+
FileUtils.mkdir(destination_dir)
|
89
|
+
shallow_clone_git_repository(template_repository_url, destination_dir)
|
90
|
+
end
|
data/lib/eh/commands/package.rb
CHANGED
@@ -1,97 +1,104 @@
|
|
1
|
-
desc 'Packages processors to zip files'
|
2
|
-
command :package 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 files.", :default_value => Eh::Settings.current.ruby_release_dir)
|
6
|
-
c.flag([:s, :source], :desc => "Source directory to read processors from.", :default_value => Eh::Settings.current.processors_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 processors from #{source_dir} to #{destination_dir}"
|
13
|
-
# find all processors in the base directory
|
14
|
-
processor_names = Dir["#{source_dir}/*"].map do |dir|
|
15
|
-
File.basename(dir)
|
16
|
-
end
|
17
|
-
|
18
|
-
# Drop files, only use directories
|
19
|
-
processor_names.delete_if do |item|
|
20
|
-
!File.directory?("#{source_dir}/#{item}")
|
21
|
-
end
|
22
|
-
|
23
|
-
included_processor_names = processor_names
|
24
|
-
|
25
|
-
# only include processors specified by -p option, if option is given
|
26
|
-
if options['p']
|
27
|
-
included_processor_names = included_processor_names.select do |processor_name|
|
28
|
-
options['p'].include?(processor_name)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# exclude processors specified by -x option, if option is given
|
33
|
-
if options['x']
|
34
|
-
# check if any processor has been excluded from packaging
|
35
|
-
included_processor_names = included_processor_names.select do |processor_name|
|
36
|
-
!options['x'].include?(processor_name)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# make sure we have at least one processor
|
41
|
-
if included_processor_names.empty?
|
42
|
-
raise "There are no processor names. Either your -s directory is empty or you specified a strange combination of -x and -p"
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
# make sure destination directory exists
|
47
|
-
FileUtils.mkdir_p(destination_dir)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
# should
|
70
|
-
if options["directories-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
1
|
+
desc 'Packages processors to zip files'
|
2
|
+
command :package 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 files.", :default_value => Eh::Settings.current.ruby_release_dir)
|
6
|
+
c.flag([:s, :source], :desc => "Source directory to read processors from.", :default_value => Eh::Settings.current.processors_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 processors from #{source_dir} to #{destination_dir}"
|
13
|
+
# find all processors in the base directory
|
14
|
+
processor_names = Dir["#{source_dir}/*"].map do |dir|
|
15
|
+
File.basename(dir)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Drop files, only use directories
|
19
|
+
processor_names.delete_if do |item|
|
20
|
+
!File.directory?("#{source_dir}/#{item}")
|
21
|
+
end
|
22
|
+
|
23
|
+
included_processor_names = processor_names
|
24
|
+
|
25
|
+
# only include processors specified by -p option, if option is given
|
26
|
+
if options['p']
|
27
|
+
included_processor_names = included_processor_names.select do |processor_name|
|
28
|
+
options['p'].include?(processor_name)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# exclude processors specified by -x option, if option is given
|
33
|
+
if options['x']
|
34
|
+
# check if any processor has been excluded from packaging
|
35
|
+
included_processor_names = included_processor_names.select do |processor_name|
|
36
|
+
!options['x'].include?(processor_name)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# make sure we have at least one processor
|
41
|
+
if included_processor_names.empty?
|
42
|
+
raise "There are no processor names. Either your -s directory is empty or you specified a strange combination of -x and -p"
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
# make sure destination directory exists
|
47
|
+
FileUtils.mkdir_p(destination_dir)
|
48
|
+
|
49
|
+
Eh::Settings.current.deployment_management_files.each do |file|
|
50
|
+
FileUtils.cp(file, destination_dir)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Zip all processors
|
54
|
+
included_processor_names.each do |processor_name|
|
55
|
+
|
56
|
+
directory = File.join(source_dir, processor_name) # last slash could be omitted
|
57
|
+
zipfile_name = File.join(destination_dir, "#{processor_name}.zip")
|
58
|
+
|
59
|
+
# remove zip before we create a new one
|
60
|
+
FileUtils.rm zipfile_name, :force => true
|
61
|
+
|
62
|
+
options = {"directories-recursively" => true}
|
63
|
+
|
64
|
+
Zip::File.open(zipfile_name,Zip::File::CREATE) do |zipfile|
|
65
|
+
|
66
|
+
[directory].each{ |file_to_be_zipped|
|
67
|
+
|
68
|
+
if File.directory?(file_to_be_zipped)
|
69
|
+
# should skip directories
|
70
|
+
next if options["directories-skip"]
|
71
|
+
|
72
|
+
# should recursively add directory
|
73
|
+
if options["directories-recursively"]
|
74
|
+
directory = file_to_be_zipped
|
75
|
+
puts "zipper: archiving directory: #{directory}"
|
76
|
+
directory_chosen_pathname = options["directories-recursively-splat"] ? directory : File.dirname(directory)
|
77
|
+
directory_pathname = Pathname.new(directory_chosen_pathname)
|
78
|
+
files = Dir[File.join(directory, '**', '**')]
|
79
|
+
|
80
|
+
# pattern to exclude unwanted folders
|
81
|
+
re = Regexp.new("^#{directory}/(log|logs|exceptions|pids|tmp)")
|
82
|
+
files.delete_if {|filename| re.match(filename)}
|
83
|
+
|
84
|
+
files.each do |file|
|
85
|
+
file_pathname = Pathname.new(file)
|
86
|
+
file_relative_pathname = file_pathname.relative_path_from(directory_pathname)
|
87
|
+
zipfile.add(file_relative_pathname,file)
|
88
|
+
end
|
89
|
+
next
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
filename = File.basename(file_to_be_zipped)
|
94
|
+
|
95
|
+
puts "zipper: archiving #{file_to_be_zipped} as #{filename} into #{zipfile}"
|
96
|
+
|
97
|
+
zipfile.add(filename,file_to_be_zipped)
|
98
|
+
}
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
puts "Done packaging #{included_processor_names.size} processors"
|
103
|
+
end
|
104
|
+
end
|
@@ -1,65 +1,67 @@
|
|
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
|
-
|
13
|
-
|
14
|
-
console
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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 do |file_to_be_zipped|
|
30
|
-
if File.directory?(file_to_be_zipped)
|
31
|
-
# should skip directories
|
32
|
-
next if options["directories-skip"]
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
zipfile
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
+
skip_files = ["#{source_dir}/config/database.yml"]
|
13
|
+
|
14
|
+
puts "Will package rails console from #{source_dir} to #{destination_dir}"
|
15
|
+
|
16
|
+
console = Dir["#{source_dir}"]
|
17
|
+
|
18
|
+
FileUtils.mkdir_p(destination_dir)
|
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 do |file_to_be_zipped|
|
30
|
+
if File.directory?(file_to_be_zipped)
|
31
|
+
# should skip directories
|
32
|
+
next if options["directories-skip"]
|
33
|
+
|
34
|
+
directory = file_to_be_zipped
|
35
|
+
puts "zipper: archiving directory: #{directory}"
|
36
|
+
directory_chosen_pathname = options["directories-recursively-splat"] ? directory : File.dirname(directory)
|
37
|
+
directory_pathname = Pathname.new(directory_chosen_pathname)
|
38
|
+
files = Dir[File.join(directory, '**', '**')]
|
39
|
+
|
40
|
+
files.delete_if do |filename|
|
41
|
+
["#{source_dir}/log", "#{source_dir}/logs", "#{source_dir}/exceptions", "#{source_dir}/tmp"].any? do |prefix|
|
42
|
+
filename.start_with?(prefix)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
files.each do |file|
|
47
|
+
next if skip_files.include? file
|
48
|
+
|
49
|
+
file_pathname = Pathname.new(file)
|
50
|
+
file_relative_pathname = file_pathname.relative_path_from(directory_pathname)
|
51
|
+
zipfile.add(file_relative_pathname,file)
|
52
|
+
end
|
53
|
+
|
54
|
+
next
|
55
|
+
end
|
56
|
+
|
57
|
+
filename = File.basename(file_to_be_zipped)
|
58
|
+
|
59
|
+
puts "zipper: archiving #{file_to_be_zipped} as #{filename} into #{zipfile}"
|
60
|
+
|
61
|
+
zipfile.add(filename,file_to_be_zipped)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
puts "Done packaging rails"
|
66
|
+
end
|
67
|
+
end
|
data/lib/eh/settings.rb
CHANGED
@@ -1,66 +1,69 @@
|
|
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
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
def package_tmp_dir
|
59
|
-
'./tmp'
|
60
|
-
end
|
61
|
-
|
62
|
-
def template_tmp_dir
|
63
|
-
|
64
|
-
end
|
65
|
-
|
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 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
|
+
def deployment_management_files
|
67
|
+
[ File.join(deployment_dir, 'management', 'launcher.rb') ]
|
68
|
+
end
|
69
|
+
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.21'
|
3
|
+
end
|