eventhub-command 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb81e0aa12621af44cf97ff6c41273583fb6058e
4
- data.tar.gz: b6f6204803e195ab6b62378b488b0e9829d169ab
3
+ metadata.gz: f7769b08c03ee849b3de62533861b3ffb1a18181
4
+ data.tar.gz: b22385d58cb84daff12fb9f9419bf885c458763a
5
5
  SHA512:
6
- metadata.gz: 40453a5bb9835dbdbf38eea34a1f462ffeaeffe82162e6d9e7decd0d0852a3c36817adc58c00e1ff16697461d31af7fdfc679655f374a52e173b3bfdc7642a05
7
- data.tar.gz: e92b423b2b83e38db6bf3cfb32f579bcf6797fd3487a9291f57edafaef8047403d24f543930522e0bc5301eaf223748719296baaa8fcd90fe3af2f4a84337176
6
+ metadata.gz: b7026d968e9d50f61b1fe0cdb14a6829ad4d6c494565ffd8c30ed5164d84ca52baf256e1eb2504455ef22bb4086e2d616c79c7c8a2584159a107f832628bd213
7
+ data.tar.gz: 4f8b613ec706f709b2bda96a2785e83b598e24bf6c8096f32af383f5723e1f9b31ea6ef0b092e19f1a2107e30466c344ce891996a80d8707ad8f575169f8c2da
@@ -1,6 +1,5 @@
1
1
  desc 'Generates a template for a processor'
2
- arg_name 'module_name'
3
- arg_name 'processor_name'
2
+ arg_name 'module_name processor_name'
4
3
 
5
4
  command :generate_processor do |c|
6
5
  c.action do |global_options, options, args|
@@ -21,13 +20,17 @@ command :generate_processor do |c|
21
20
  destination_dir = Eh::Settings.current.processes_src_dir
22
21
  destination_dir = File.join(destination_dir, "#{underscored_processor_module_name}.#{underscored_processor_class_name}")
23
22
 
24
- template_temporary_dir = "/tmp/eventhub-processor-template/"
25
- checkout_git_repo(template_temporary_dir)
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)
26
30
 
27
- FileUtils.cp_r template_temporary_dir, destination_dir
31
+ FileUtils.cp_r template_tmp_dir, destination_dir
28
32
  FileUtils.rm_rf File.join(destination_dir, ".git")
29
33
  FileUtils.rm File.join(destination_dir, 'README.md')
30
- FileUtils.mv File.join(destination_dir, 'README.template'), File.join(destination_dir, 'README.md')
31
34
 
32
35
  puts "Generating processor #{processor_module_name}::#{processor_class_name} in #{destination_dir}"
33
36
  Dir.glob(destination_dir + "/**/*.erb") do |file|
@@ -40,16 +43,16 @@ command :generate_processor do |c|
40
43
  FileUtils.mv file, File.join(File.dirname(file), File.basename(file, ".erb"))
41
44
  end
42
45
 
43
- replacements = {
44
- "underscored_processor_module_name" => underscored_processor_module_name,
45
- "underscored_processor_class_name" => underscored_processor_class_name,
46
- "processor_module_name" => processor_module_name,
47
- "processor_class_name" => processor_class_name
48
- }
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
+ ]
49
52
 
50
53
  rename_files_with_replacements(destination_dir, replacements)
51
54
 
52
- FileUtils.rm_rf template_temporary_dir
55
+ FileUtils.rm_rf template_tmp_dir
53
56
 
54
57
  puts "Done."
55
58
  end
data/lib/eh/settings.rb CHANGED
@@ -59,4 +59,8 @@ class Eh::Settings
59
59
  './tmp'
60
60
  end
61
61
 
62
+ def template_tmp_dir
63
+ "/tmp/eventhub-processor-template/"
64
+ end
65
+
62
66
  end
data/lib/eh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eh
2
- VERSION = '0.0.14'
2
+ VERSION = '0.0.15'
3
3
  end
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.14
4
+ version: 0.0.15
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-09-25 00:00:00.000000000 Z
12
+ date: 2014-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake