eventhub-command 0.0.3 → 0.0.5

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: ef927eff84f8a2b236e22649ceb729ec8229fde9
4
- data.tar.gz: d07f7fcbf3e6beb87e26dc67646aa0ec1ebf8f5f
3
+ metadata.gz: 700bf4f0837badb97682f7a76766c5eaa0e51134
4
+ data.tar.gz: 6728b968cfd4a461d3faf39db9638b29578b6d8b
5
5
  SHA512:
6
- metadata.gz: a9ed66dffea09e2caef2563ae4383b93ed6a6f37e915f1eab363ed37e83bc76502d497235b9460fca1c6f7322273495437c9b98c7e104cbdb3d5eebc0628f949
7
- data.tar.gz: a4c97edbe4f73c7c88169c688c5a62f4f4d001202429d0743309d893c7708f422d9b40dea4fdf371bbfb6f2044a82552bd99a6e9b491cac4f0e3a53b00bdb4e3
6
+ metadata.gz: 6dcef89c16193a2fc59d20addf3ec5ecf6bae84ce214aa2eb09fa8c913cd1df43508da244a2be82793c86ad3931a448ee9ade5821ed224d7be43c1c90573f613
7
+ data.tar.gz: 02acf6633498e72e6368d4cc55d28c899d64800fb94671b6d55092d12d48e34a66630e74f29a6583c86bd22d69d9733f1e31180693f6eedddb6e1549e46bdac9
data/.gitignore CHANGED
@@ -1,18 +1,18 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
18
  .DS_Store
data/README.md CHANGED
@@ -1,14 +1,29 @@
1
- eventhub-command
2
- ================
3
-
4
- Event Hub Command Line Tool includes the following features
5
-
6
- * Packaging Event Hub Processor's
7
- * Pushing Channel Adapter and Processor configuration files to servers
8
- * Scaffold your Event Hub Processor
9
-
10
- ## Installation
11
-
12
- gem 'eventhub-command'
13
-
14
- ## Usage
1
+ eventhub-command
2
+ ================
3
+
4
+ Event Hub Command Line Tool includes the following features
5
+
6
+ * Packaging Event Hub Processor's
7
+ * Pushing Channel Adapter and Processor configuration files to servers
8
+ * Scaffold your Event Hub Processor
9
+
10
+ ## Installation
11
+
12
+ Install gem and make command provided by this gem available
13
+
14
+ ~~~ sh
15
+ $ gem i eventhub-command
16
+ $ rbenv rehash
17
+ ~~~
18
+
19
+ First time running the command
20
+ ~~~ sh
21
+ $ eh
22
+ Config file missing: ~/.eh, will create it now...
23
+ Please specify the Eventhub SVN root directory (i.e. the directory which contains the 'src', 'release', ... directories
24
+ /Users/username/dev/event_hub
25
+ Config file written to /Users/username/.eh. Please try again.
26
+ $
27
+ ~~~
28
+
29
+ ## Usage
data/eh.gemspec CHANGED
@@ -1,25 +1,26 @@
1
- # Ensure we require the local version and not one we might have installed already
2
- require File.join([File.dirname(__FILE__),'lib','eh','version.rb'])
3
- spec = Gem::Specification.new do |s|
4
- s.name = 'eventhub-command'
5
- s.version = Eh::VERSION
6
- s.author = ['Pascal Betz','Thomas Steiner']
7
- s.email = ['pascal.betz@simplificator.com','thomas.steiner@ikey.ch']
8
- s.homepage = 'http://github.com/thomis/eventhub-command'
9
- s.platform = Gem::Platform::RUBY
10
- s.description = 'Event Hub Command Line Tool which supports you with various Event Hub related administrative development features.'
11
- s.summary = 'Event Hub Command Line Tool'
12
- s.license = "MIT"
13
- s.files = `git ls-files`.split("
14
- ")
15
- s.require_paths << 'lib'
16
- s.has_rdoc = true
17
- s.extra_rdoc_files = ['README.md','eh.rdoc']
18
- s.rdoc_options << '--title' << 'eh' << '--main' << 'README.rdoc' << '-ri'
19
- s.bindir = 'bin'
20
- s.executables << 'eh'
21
- s.add_development_dependency('rake', '~> 10.1')
22
- s.add_development_dependency('rdoc', '~> 4.1')
23
- s.add_development_dependency('aruba', '~> 0.5')
24
- s.add_runtime_dependency('gli','2.12.0')
25
- end
1
+ # Ensure we require the local version and not one we might have installed already
2
+ require File.join([File.dirname(__FILE__),'lib','eh','version.rb'])
3
+ spec = Gem::Specification.new do |s|
4
+ s.name = 'eventhub-command'
5
+ s.version = Eh::VERSION
6
+ s.author = ['Pascal Betz','Thomas Steiner']
7
+ s.email = ['pascal.betz@simplificator.com','thomas.steiner@ikey.ch']
8
+ s.homepage = 'http://github.com/thomis/eventhub-command'
9
+ s.platform = Gem::Platform::RUBY
10
+ s.description = 'Event Hub Command Line Tool which supports you with various Event Hub related administrative development features.'
11
+ s.summary = 'Event Hub Command Line Tool'
12
+ s.license = "MIT"
13
+ s.files = `git ls-files`.split("
14
+ ")
15
+ s.require_paths << 'lib'
16
+ s.has_rdoc = true
17
+ s.extra_rdoc_files = ['README.md','eh.rdoc']
18
+ s.rdoc_options << '--title' << 'eh' << '--main' << 'README.rdoc' << '-ri'
19
+ s.bindir = 'bin'
20
+ s.executables << 'eh'
21
+ s.add_development_dependency('rake', '~> 10.1')
22
+ s.add_development_dependency('rdoc', '~> 4.1')
23
+ s.add_development_dependency('aruba', '~> 0.5')
24
+ s.add_runtime_dependency('gli','2.12.0')
25
+ s.add_runtime_dependency('rubyzip')
26
+ end
data/lib/eh-commands.rb CHANGED
@@ -1,2 +1,5 @@
1
1
  # All commands are required here
2
- require 'eh/commands/package'
2
+ require 'eh/commands/release'
3
+ require 'eh/commands/package'
4
+
5
+ require 'zip'
data/lib/eh.rb CHANGED
@@ -1,4 +1,7 @@
1
1
  module Eh
2
2
  end
3
+ require 'zip'
4
+ require 'pathname'
5
+
3
6
  require 'eh/version'
4
7
  require 'eh/settings'
@@ -2,7 +2,7 @@ desc 'Packages processors to zip files'
2
2
  command :package do |c|
3
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
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)
5
+ c.flag([:d, :destination], :desc => "Destination directory to place created zip files.", :default_value => Eh::Settings.current.package_tmp_dir)
6
6
  c.flag([:s, :source], :desc => "Source directory to read processors from.", :default_value => Eh::Settings.current.processes_src_dir)
7
7
 
8
8
  c.action do |global_options, options, args|
@@ -39,25 +39,64 @@ command :package do |c|
39
39
 
40
40
 
41
41
  # make sure destination directory exists
42
- FileUtils.mkdir_p(destination_dir)
42
+ FileUtils.mkdir_p(destination_dir)
43
43
 
44
44
  # Zip all processors
45
45
  included_processor_names.each do |processor_name|
46
46
 
47
- source = File.join(source_dir, processor_name)
48
- destination = File.join(destination_dir, "#{processor_name}.zip")
47
+ directory = File.join(source_dir, processor_name) # last slash could be omitted
48
+ zipfile_name = "/tmp/#{processor_name}.zip"
49
49
 
50
- puts "Packaging '#{processor_name}'"
50
+ options = {"directories-recursively"=>true}
51
51
 
52
- arguments = ['tmp', 'logs', 'exceptions'].map do |item|
53
- expanded = File.join(source, item, '*')
54
- "-x \"#{expanded}\""
55
- end.join(' ')
56
- arguments << " -q" unless arguments['v']
52
+ Zip::File.open(zipfile_name,Zip::File::CREATE) do |zipfile|
53
+
54
+ #zipfile.add(processor_name, directory)
55
+ [directory].each{ |file_to_be_zipped|
57
56
 
58
- cmd = "zip -FS -r #{destination} #{source} #{arguments}"
59
- puts "Packaging '#{processor_name}' to #{destination} with \"#{cmd}\"" if global_options['v']
60
- system(cmd)
57
+ if File.directory?(file_to_be_zipped)
58
+ # should skip directories
59
+ next if options["directories-skip"]
60
+
61
+ # should recursively add directory
62
+ if options["directories-recursively"]
63
+ directory = file_to_be_zipped
64
+ puts "zipper: archiving directory: #{directory}"
65
+ directory_chosen_pathname = options["directories-recursively-splat"] ? directory : File.dirname(directory)
66
+ directory_pathname = Pathname.new(directory_chosen_pathname)
67
+ Dir[File.join(directory, '**', '**')].each do |file|
68
+ file_pathname = Pathname.new(file)
69
+ file_relative_pathname = file_pathname.relative_path_from(directory_pathname)
70
+ zipfile.add(file_relative_pathname,file)
71
+ end
72
+ next
73
+ end
74
+ end
75
+
76
+ filename = File.basename(file_to_be_zipped)
77
+
78
+ puts "zipper: archiving #{file_to_be_zipped} as #{filename} into #{zipfile}"
79
+
80
+ zipfile.add(filename,file_to_be_zipped)
81
+ }
82
+ end
83
+
84
+
85
+
86
+ #source = File.join(source_dir, processor_name)
87
+ #destination = File.join(destination_dir, "#{processor_name}.zip")
88
+
89
+ #puts "Packaging '#{processor_name}'"
90
+
91
+ #arguments = ['tmp', 'logs', 'exceptions', 'log'].map do |item|
92
+ # expanded = File.join(source, item, '*')
93
+ # "-x \"#{expanded}\""
94
+ #end.join(' ')
95
+ #arguments << " -q" unless arguments['v']
96
+ #puts source_dir
97
+ #cmd = "cd #{source_dir} && zip -FS -r #{destination} #{processor_name} #{arguments}"
98
+ #puts "Packaging '#{processor_name}' to #{destination} with \"#{cmd}\"" if global_options['v']
99
+ #system(cmd)
61
100
  end
62
101
 
63
102
  puts "Done packaging #{included_processor_names.size} processors"
@@ -0,0 +1,16 @@
1
+ desc 'Releases processor zip files to destination'
2
+ command :release do |c|
3
+ c.flag([:d, :destination], :desc => "Destination directory to place created zip files.", :default_value => Eh::Settings.current.release_dir)
4
+ c.flag([:s, :source], :desc => "Source directory to read processors from.", :default_value => Eh::Settings.current.package_tmp_dir)
5
+
6
+ c.action do |global_options, options, args|
7
+ source_dir = options['s']
8
+ destination_dir = options['d']
9
+ pattern = "#{source_dir}/*.zip"
10
+ cmd = "cp #{pattern} #{destination_dir}"
11
+ puts "Will copy #{Dir[pattern].size} files from #{source_dir} to #{destination_dir}"
12
+ puts "Command: #{cmd}" if global_options['v']
13
+ system cmd
14
+ puts "Done."
15
+ end
16
+ end
data/lib/eh/settings.rb CHANGED
@@ -1,35 +1,38 @@
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 ruby_release_dir
27
- File.join(repository_root_dir, 'releases', 'ruby')
28
- end
29
-
30
- def processes_src_dir
31
- File.join(repository_root_dir, 'src', 'process')
32
- end
33
-
34
-
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 release_dir
27
+ File.join(repository_root_dir, 'releases', 'ruby')
28
+ end
29
+
30
+ def processes_src_dir
31
+ File.join(repository_root_dir, 'src', 'process')
32
+ end
33
+
34
+ def package_tmp_dir
35
+ './tmp'
36
+ end
37
+
35
38
  end
data/lib/eh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eh
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.5'
3
3
  end
data/todo.txt CHANGED
@@ -1,9 +1,9 @@
1
- -- -------------------------------------
2
- -- to do
3
- -- -------------------------------------
4
-
5
- - eh relase -r or --repository plate_store or http path -u user -p password
6
- - folder filter, default and customize
7
- - extension filter, default and custmize
8
- - it could take config settings from a local .ehconfig file
1
+ -- -------------------------------------
2
+ -- to do
3
+ -- -------------------------------------
4
+
5
+ - eh relase -r or --repository plate_store or http path -u user -p password
6
+ - folder filter, default and customize
7
+ - extension filter, default and custmize
8
+ - it could take config settings from a local .ehconfig file
9
9
  - would be nice to have a release all feature
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.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pascal Betz
@@ -9,48 +9,48 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-05 00:00:00.000000000 Z
12
+ date: 2014-09-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '10.1'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '10.1'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rdoc
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: '4.1'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '4.1'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: aruba
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0.5'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0.5'
56
56
  - !ruby/object:Gem::Dependency
@@ -67,6 +67,20 @@ dependencies:
67
67
  - - '='
68
68
  - !ruby/object:Gem::Version
69
69
  version: 2.12.0
70
+ - !ruby/object:Gem::Dependency
71
+ name: rubyzip
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
70
84
  description: Event Hub Command Line Tool which supports you with various Event Hub
71
85
  related administrative development features.
72
86
  email:
@@ -79,7 +93,7 @@ extra_rdoc_files:
79
93
  - README.md
80
94
  - eh.rdoc
81
95
  files:
82
- - .gitignore
96
+ - ".gitignore"
83
97
  - Gemfile
84
98
  - README.md
85
99
  - Rakefile
@@ -92,6 +106,7 @@ files:
92
106
  - lib/eh-commands.rb
93
107
  - lib/eh.rb
94
108
  - lib/eh/commands/package.rb
109
+ - lib/eh/commands/release.rb
95
110
  - lib/eh/settings.rb
96
111
  - lib/eh/version.rb
97
112
  - test/default_test.rb
@@ -103,22 +118,22 @@ licenses:
103
118
  metadata: {}
104
119
  post_install_message:
105
120
  rdoc_options:
106
- - --title
121
+ - "--title"
107
122
  - eh
108
- - --main
123
+ - "--main"
109
124
  - README.rdoc
110
- - -ri
125
+ - "-ri"
111
126
  require_paths:
112
127
  - lib
113
128
  - lib
114
129
  required_ruby_version: !ruby/object:Gem::Requirement
115
130
  requirements:
116
- - - '>='
131
+ - - ">="
117
132
  - !ruby/object:Gem::Version
118
133
  version: '0'
119
134
  required_rubygems_version: !ruby/object:Gem::Requirement
120
135
  requirements:
121
- - - '>='
136
+ - - ">="
122
137
  - !ruby/object:Gem::Version
123
138
  version: '0'
124
139
  requirements: []