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 +4 -4
- data/lib/eh/commands/package.rb +1 -1
- data/lib/eh/commands/package_rails.rb +97 -0
- data/lib/eh/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14f3a7633c33f980da68f69dfa48f993912ea6f3
|
4
|
+
data.tar.gz: f1a290f6e67beff68ef2c1a39df41bc1e2f3605b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02a1c247a61767b83e9ff484e7bdffb61a80aa33af4ec2b2fbcea7d3cf56adafa1dffc8db7debe80e089f70f6ab3fe4efa92d01a39df497883bf29570885ba3a
|
7
|
+
data.tar.gz: f3d16105a493aff8f20ebc4514d6039e98580646e3738342189cd593a21608876b35fd3bb094440afe0401560108ac9615b7d3a5a946a245d5c4cab6f50bd80e
|
data/lib/eh/commands/package.rb
CHANGED
@@ -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|
|
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
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.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
|