eventhub-command 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 14bd6614bdbbed40ed0e6fb52e7a2b46d9c68012
4
+ data.tar.gz: a0913f61ab264055d277452efdb1cec4784daa3b
5
+ SHA512:
6
+ metadata.gz: a56aeed1b2a050e7cf7026ad407b3dccf2da68d7b674f131183b2faaaac95bd7bb524afd0f675a8fe19cac52707b1e0a6cd2c1cd9d3d9012afe0c40a1dd21c1e
7
+ data.tar.gz: c2aff2da200f025d5216cdb2484898c3be313e058b92bf39d834a9af931b987ffb6c049d150092969a2fd7dad07ef3604a3c06422c26534f164bbfd1d7d3b871
data/.gitignore ADDED
@@ -0,0 +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
18
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/README.rdoc ADDED
@@ -0,0 +1,14 @@
1
+ eventhub-command
2
+ ================
3
+
4
+ Event Hub Command Line Tool to support you with
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
data/Rakefile ADDED
@@ -0,0 +1,44 @@
1
+ require 'rake/clean'
2
+ require 'rubygems'
3
+ require 'rubygems/package_task'
4
+ require 'rdoc/task'
5
+ require 'cucumber'
6
+ require 'cucumber/rake/task'
7
+ Rake::RDocTask.new do |rd|
8
+ rd.main = "README.rdoc"
9
+ rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
10
+ rd.title = 'Your application title'
11
+ end
12
+
13
+ spec = eval(File.read('eh.gemspec'))
14
+
15
+ Gem::PackageTask.new(spec) do |pkg|
16
+ end
17
+ CUKE_RESULTS = 'results.html'
18
+ CLEAN << CUKE_RESULTS
19
+ desc 'Run features'
20
+ Cucumber::Rake::Task.new(:features) do |t|
21
+ opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
22
+ opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
23
+ t.cucumber_opts = opts
24
+ t.fork = false
25
+ end
26
+
27
+ desc 'Run features tagged as work-in-progress (@wip)'
28
+ Cucumber::Rake::Task.new('features:wip') do |t|
29
+ tag_opts = ' --tags ~@pending'
30
+ tag_opts = ' --tags @wip'
31
+ t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
32
+ t.fork = false
33
+ end
34
+
35
+ task :cucumber => :features
36
+ task 'cucumber:wip' => 'features:wip'
37
+ task :wip => 'features:wip'
38
+ require 'rake/testtask'
39
+ Rake::TestTask.new do |t|
40
+ t.libs << "test"
41
+ t.test_files = FileList['test/*_test.rb']
42
+ end
43
+
44
+ task :default => [:test,:features]
data/bin/eh ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'eh' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('eventhub-command', 'eh')
data/eh.gemspec ADDED
@@ -0,0 +1,25 @@
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 = 'EventHub Command Line Tool which supports you with various Event Hub related administrative development features.'
11
+ s.summary = 'EventHub 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.rdoc','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
data/eh.rdoc ADDED
@@ -0,0 +1,5 @@
1
+ = eh
2
+
3
+ Generate this with
4
+ eh rdoc
5
+ After you have described your command line interface
@@ -0,0 +1,8 @@
1
+ Feature: My bootstrapped app kinda works
2
+ In order to get going on coding my awesome app
3
+ I want to have aruba and cucumber setup
4
+ So I don't have to do it myself
5
+
6
+ Scenario: App just runs
7
+ When I get help for "eh"
8
+ Then the exit status should be 0
@@ -0,0 +1,6 @@
1
+ When /^I get help for "([^"]*)"$/ do |app_name|
2
+ @app_name = app_name
3
+ step %(I run `#{app_name} help`)
4
+ end
5
+
6
+ # Add more step definitions here
@@ -0,0 +1,15 @@
1
+ require 'aruba/cucumber'
2
+
3
+ ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
4
+ LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
5
+
6
+ Before do
7
+ # Using "announce" causes massive warnings on 1.9.2
8
+ @puts = true
9
+ @original_rubylib = ENV['RUBYLIB']
10
+ ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
11
+ end
12
+
13
+ After do
14
+ ENV['RUBYLIB'] = @original_rubylib
15
+ end
@@ -0,0 +1,65 @@
1
+ desc 'Packages processors to zip files'
2
+ command :package 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 files.", :default_value => Eh::Settings.current.package_tmp_dir)
6
+ c.flag([:s, :source], :desc => "Source directory to read processors from.", :default_value => Eh::Settings.current.processes_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 processors from #{source_dir} to #{destination_dir}"
13
+ # find all processors in the base directory
14
+ processor_names = Dir["#{source_dir}/*"].map do |dir|
15
+ File.basename(dir)
16
+ end
17
+
18
+ included_processor_names = processor_names
19
+
20
+ # only include processors specified by -p option, if option is given
21
+ if options['p']
22
+ included_processor_names = included_processor_names.select do |processor_name|
23
+ options['p'].include?(processor_name)
24
+ end
25
+ end
26
+
27
+ # exclude processors specified by -x option, if option is given
28
+ if options['x']
29
+ # check if any processor has been excluded from packaging
30
+ included_processor_names = included_processor_names.select do |processor_name|
31
+ !options['x'].include?(processor_name)
32
+ end
33
+ end
34
+
35
+ # make sure we have at least one processor
36
+ if included_processor_names.empty?
37
+ raise "There are no processor names. Either your -s directory is empty or you specified a strange combination of -x and -p"
38
+ end
39
+
40
+
41
+ # make sure destination directory exists
42
+ FileUtils.mkdir_p(destination_dir)
43
+
44
+ # Zip all processors
45
+ included_processor_names.each do |processor_name|
46
+
47
+ source = File.join(source_dir, processor_name)
48
+ destination = File.join(destination_dir, "#{processor_name}.zip")
49
+
50
+ puts "Packaging '#{processor_name}'"
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']
57
+
58
+ cmd = "zip -FS -r #{destination} #{source} #{arguments}"
59
+ puts "Packaging '#{processor_name}' to #{destination} with \"#{cmd}\"" if global_options['v']
60
+ system(cmd)
61
+ end
62
+
63
+ puts "Done packaging #{included_processor_names.size} processors"
64
+ end
65
+ end
@@ -0,0 +1,16 @@
1
+ desc 'Packages processors to zip files'
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
@@ -0,0 +1,39 @@
1
+ require 'json'
2
+ class Eh::Settings
3
+ attr_reader :data
4
+ def self.load(file)
5
+ data = File.read(file)
6
+ json = JSON.parse(data)
7
+ Eh::Settings.new(json)
8
+ end
9
+
10
+ def self.current=(value)
11
+ Thread.current[:eh_settings] = value
12
+ end
13
+
14
+ def self.current
15
+ Thread.current[:eh_settings]
16
+ end
17
+
18
+ def initialize(data)
19
+ @data = data
20
+ end
21
+
22
+
23
+ def repository_root_dir
24
+ File.expand_path(data['repository_root_dir'])
25
+ end
26
+
27
+ def release_dir
28
+ File.join(repository_root_dir, 'branches', 'master', 'releases', 'ruby')
29
+ end
30
+
31
+ def processes_src_dir
32
+ File.join(repository_root_dir, 'branches', 'master', 'src', 'process')
33
+ end
34
+
35
+ def package_tmp_dir
36
+ './tmp'
37
+ end
38
+
39
+ end
data/lib/eh/version.rb ADDED
@@ -0,0 +1,3 @@
1
+ module Eh
2
+ VERSION = '0.0.1'
3
+ end
data/lib/eh.rb ADDED
@@ -0,0 +1,6 @@
1
+ module Eh
2
+ end
3
+ require 'eh/version'
4
+ require 'eh/settings'
5
+ require 'eh/commands/release'
6
+ require 'eh/commands/package'
@@ -0,0 +1,14 @@
1
+ require 'test_helper'
2
+
3
+ class DefaultTest < Test::Unit::TestCase
4
+
5
+ def setup
6
+ end
7
+
8
+ def teardown
9
+ end
10
+
11
+ def test_the_truth
12
+ assert true
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ require 'test/unit'
2
+
3
+ # Add test libraries you want to use here, e.g. mocha
4
+
5
+ class Test::Unit::TestCase
6
+
7
+ # Add global extensions to the test case class here
8
+
9
+ end
data/todo.txt ADDED
@@ -0,0 +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
9
+ - would be nice to have a release all feature
metadata ADDED
@@ -0,0 +1,130 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: eventhub-command
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Pascal Betz
8
+ - Thomas Steiner
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-09-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '10.1'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '10.1'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rdoc
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '4.1'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '4.1'
42
+ - !ruby/object:Gem::Dependency
43
+ name: aruba
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '0.5'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '0.5'
56
+ - !ruby/object:Gem::Dependency
57
+ name: gli
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '='
61
+ - !ruby/object:Gem::Version
62
+ version: 2.12.0
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '='
68
+ - !ruby/object:Gem::Version
69
+ version: 2.12.0
70
+ description: EventHub Command Line Tool which supports you with various Event Hub
71
+ related administrative development features.
72
+ email:
73
+ - pascal.betz@simplificator.com
74
+ - thomas.steiner@ikey.ch
75
+ executables:
76
+ - eh
77
+ extensions: []
78
+ extra_rdoc_files:
79
+ - README.rdoc
80
+ - eh.rdoc
81
+ files:
82
+ - ".gitignore"
83
+ - Gemfile
84
+ - README.rdoc
85
+ - Rakefile
86
+ - bin/eh
87
+ - eh.gemspec
88
+ - eh.rdoc
89
+ - features/eh.feature
90
+ - features/step_definitions/eh_steps.rb
91
+ - features/support/env.rb
92
+ - lib/eh.rb
93
+ - lib/eh/commands/package.rb
94
+ - lib/eh/commands/release.rb
95
+ - lib/eh/settings.rb
96
+ - lib/eh/version.rb
97
+ - test/default_test.rb
98
+ - test/test_helper.rb
99
+ - todo.txt
100
+ homepage: http://github.com/thomis/eventhub-command
101
+ licenses:
102
+ - MIT
103
+ metadata: {}
104
+ post_install_message:
105
+ rdoc_options:
106
+ - "--title"
107
+ - eh
108
+ - "--main"
109
+ - README.rdoc
110
+ - "-ri"
111
+ require_paths:
112
+ - lib
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ requirements: []
125
+ rubyforge_project:
126
+ rubygems_version: 2.2.2
127
+ signing_key:
128
+ specification_version: 4
129
+ summary: EventHub Command Line Tool
130
+ test_files: []