eventhub-command 0.0.6 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 672df67a5ce39b2ae266632a1a897b194c2ff53a
4
- data.tar.gz: 6c816a60dc682e9fe9f3b620a16c51b5258eb95a
3
+ metadata.gz: 14f3a7633c33f980da68f69dfa48f993912ea6f3
4
+ data.tar.gz: f1a290f6e67beff68ef2c1a39df41bc1e2f3605b
5
5
  SHA512:
6
- metadata.gz: c68aa4ce9cb998f195109ea953c76bdaef58d95165ba1db6b26d50d34c0f36fde25996f033538b95881f11c72206a38006ca76a53a20d5ea8f8e854a89f7b88a
7
- data.tar.gz: 35578a77eefc5437212786f1ff69f6485c3332e76eb5c7a8c3053fb4aa634a2cebf5416b7d98ddb81104fbb87c6620f6689b5735337c8ce01224edaf64c724e7
6
+ metadata.gz: 02a1c247a61767b83e9ff484e7bdffb61a80aa33af4ec2b2fbcea7d3cf56adafa1dffc8db7debe80e089f70f6ab3fe4efa92d01a39df497883bf29570885ba3a
7
+ data.tar.gz: f3d16105a493aff8f20ebc4514d6039e98580646e3738342189cd593a21608876b35fd3bb094440afe0401560108ac9615b7d3a5a946a245d5c4cab6f50bd80e
@@ -68,7 +68,7 @@ command :package do |c|
68
68
  directory_chosen_pathname = options["directories-recursively-splat"] ? directory : File.dirname(directory)
69
69
  directory_pathname = Pathname.new(directory_chosen_pathname)
70
70
  files = Dir[File.join(directory, '**', '**')]
71
- files.delete_if {|filename| filename.include?("log") || filename.include?("logs") || filename.include?("exceptions") || filename.include?("pids") || filename.include?("tmp") }
71
+ files.delete_if {|filename| ["log", "logs", "exceptions", "pids", "tmp"].include?(filename) }
72
72
  files.each do |file|
73
73
  file_pathname = Pathname.new(file)
74
74
  file_relative_pathname = file_pathname.relative_path_from(directory_pathname)
@@ -0,0 +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| filename.include?("log") || filename.include?("logs") || filename.include?("tmp/pids") }
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/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eh
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
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.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pascal Betz
@@ -106,6 +106,7 @@ files:
106
106
  - lib/eh-commands.rb
107
107
  - lib/eh.rb
108
108
  - lib/eh/commands/package.rb
109
+ - lib/eh/commands/package_rails.rb
109
110
  - lib/eh/commands/release.rb
110
111
  - lib/eh/settings.rb
111
112
  - lib/eh/version.rb