eventhub-command 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eh/commands/generate_processor.rb +14 -6
- data/lib/eh/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d27dd1024bb8346baf6d042be00cd1cf56cadf2
|
4
|
+
data.tar.gz: cdbf81424e09178b2b8c26bb3d2a056a0a61cc72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74a0157d27669b3033b58fddff96121a165e9d7674db544e4b646209ca0d7f3cb36c9daa896d36c66fd3b952349024a16364c6d5b2cf693dd5f052bc732ff2ba
|
7
|
+
data.tar.gz: 925ce0cd900517a1fa210585e5f7956ef97c3428e93bacd93118b0bfc39e34c6662ed4ce8fd5a67d75727fa6362ae2ad4efece79149579f42fcfb00bd800423a
|
@@ -1,16 +1,20 @@
|
|
1
1
|
desc 'Generates a template for a processor'
|
2
|
+
arg_name 'module_name'
|
3
|
+
arg_name 'processor_name'
|
4
|
+
|
2
5
|
command :generate_processor do |c|
|
3
6
|
c.action do |global_options, options, args|
|
4
7
|
require 'active_support/core_ext/string/inflections'
|
5
8
|
require 'fileutils'
|
6
9
|
require 'erb'
|
7
10
|
|
8
|
-
|
9
|
-
|
11
|
+
if args.size != 2
|
12
|
+
puts "Needs exactly 2 arguments: eh generate_processor ModuleName ProcessorName"
|
13
|
+
exit -1
|
10
14
|
end
|
11
15
|
|
12
|
-
processor_module_name =
|
13
|
-
processor_class_name =
|
16
|
+
processor_module_name = args[0].camelcase
|
17
|
+
processor_class_name = args[1].camelcase
|
14
18
|
underscored_processor_module_name = processor_module_name.underscore
|
15
19
|
underscored_processor_class_name = processor_class_name.underscore
|
16
20
|
|
@@ -22,8 +26,10 @@ command :generate_processor do |c|
|
|
22
26
|
|
23
27
|
FileUtils.cp_r template_temporary_dir, destination_dir
|
24
28
|
FileUtils.rm_rf File.join(destination_dir, ".git")
|
29
|
+
FileUtils.rm File.join(destination_dir, 'README.md')
|
30
|
+
FileUtils.mv File.join(destination_dir, 'README.template'), File.join(destination_dir, 'README.md')
|
25
31
|
|
26
|
-
puts "Generating processor #{processor_module_name}
|
32
|
+
puts "Generating processor #{processor_module_name}::#{processor_class_name} in #{destination_dir}"
|
27
33
|
Dir.glob(destination_dir + "/**/*.erb") do |file|
|
28
34
|
template = ERB.new(File.read(file))
|
29
35
|
|
@@ -35,8 +41,10 @@ command :generate_processor do |c|
|
|
35
41
|
end
|
36
42
|
|
37
43
|
replacements = {
|
44
|
+
"underscored_processor_module_name" => underscored_processor_module_name,
|
38
45
|
"underscored_processor_class_name" => underscored_processor_class_name,
|
39
|
-
"
|
46
|
+
"processor_module_name" => processor_module_name,
|
47
|
+
"processor_class_name" => processor_class_name
|
40
48
|
}
|
41
49
|
|
42
50
|
rename_files_with_replacements(destination_dir, replacements)
|
data/lib/eh/version.rb
CHANGED