eventhub-command 0.2.2 → 0.2.3

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.
data/lib/eh/settings.rb CHANGED
@@ -1,113 +1,114 @@
1
- class Eh::Settings
2
-
3
- attr_reader :data, :file
4
-
5
- class Repository
6
- def initialize(json)
7
- @json = json
8
- end
9
-
10
- def url
11
- @json['url']
12
- end
13
-
14
- def deploy_username
15
- @json['deploy_username']
16
- end
17
-
18
- def deploy_password
19
- @json['deploy_password']
20
- end
21
-
22
- def dir
23
- @json['dir']
24
- end
25
-
26
- def current?
27
- @json['current']
28
- end
29
- end
30
-
31
- def initialize(file)
32
- @file = file
33
- @data = JSON.parse(File.read(file))
34
- end
35
-
36
- def self.load(file)
37
- Eh::Settings.new(file)
38
- end
39
-
40
- def write
41
- File.open(file,"w") do |f|
42
- f.write(data.to_json)
43
- end
44
- end
45
-
46
- def self.current=(value)
47
- Thread.current[:eh_settings] = value
48
- end
49
-
50
- def self.current
51
- Thread.current[:eh_settings]
52
- end
53
-
54
- def repository
55
- repositories.find do |repository|
56
- repository.current?
57
- end if repositories
58
- end
59
-
60
- def repositories
61
- data["repositories"].map do |json|
62
- Eh::Settings::Repository.new(json)
63
- end if data["repositories"]
64
- end
65
-
66
- def releases_dir(*extra_paths)
67
- File.join(repository.dir, 'releases', *extra_paths)
68
- end
69
-
70
- def rails_release_dir
71
- releases_dir('rails')
72
- end
73
-
74
- def ruby_release_dir
75
- releases_dir('ruby')
76
- end
77
-
78
- def processors_src_dir
79
- File.join(repository.dir, 'src', 'ruby')
80
- end
81
-
82
- def deployment_dir
83
- File.join(repository.dir, 'src', 'deployment')
84
- end
85
-
86
- def rails_src_dir
87
- File.join(repository.dir, 'src', 'rails', 'console')
88
- end
89
-
90
- def source_config_dir
91
- File.join(repository.dir, 'config')
92
- end
93
-
94
- def processor_template_repository_url
95
- 'https://github.com/thomis/eventhub-processor-template.git'
96
- end
97
-
98
- def package_tmp_dir
99
- './tmp'
100
- end
101
-
102
- def template_tmp_dir
103
- '/tmp/eventhub-processor-template/'
104
- end
105
-
106
- def deployment_management_files
107
- [ File.join(deployment_dir, 'management', 'launcher.rb') ]
108
- end
109
-
110
- def stages_dir
111
- File.join(repository.dir, 'config', 'stages')
112
- end
113
- end
1
+ class Eh::Settings
2
+
3
+ attr_reader :data, :file
4
+
5
+ class Repository
6
+ def initialize(json)
7
+ @json = json
8
+ end
9
+
10
+ def url
11
+ @json['url']
12
+ end
13
+
14
+ def deploy_username
15
+ @json['deploy_username']
16
+ end
17
+
18
+ def deploy_password
19
+ @json['deploy_password']
20
+ end
21
+
22
+ def dir
23
+ @json['dir']
24
+ end
25
+
26
+ def current?
27
+ @json['current']
28
+ end
29
+ end
30
+
31
+ def initialize(file)
32
+ @file = file
33
+ @data = JSON.parse(File.read(file))
34
+ end
35
+
36
+ def self.load(file)
37
+ Eh::Settings.new(file)
38
+ end
39
+
40
+ def write
41
+ File.open(file,"w") do |f|
42
+ f.write(data.to_json)
43
+ end
44
+ end
45
+
46
+ def self.current=(value)
47
+ Thread.current[:eh_settings] = value
48
+ end
49
+
50
+ def self.current
51
+ Thread.current[:eh_settings]
52
+ end
53
+
54
+ def repository
55
+ repositories.find do |repository|
56
+ repository.current?
57
+ end if repositories
58
+ end
59
+
60
+ def repositories
61
+ repos = data["repositories"].map do |json|
62
+ Eh::Settings::Repository.new(json)
63
+ end if data["repositories"]
64
+ repos || []
65
+ end
66
+
67
+ def releases_dir(*extra_paths)
68
+ File.join(repository.dir, 'releases', *extra_paths)
69
+ end
70
+
71
+ def rails_release_dir
72
+ releases_dir('rails')
73
+ end
74
+
75
+ def ruby_release_dir
76
+ releases_dir('ruby')
77
+ end
78
+
79
+ def processors_src_dir
80
+ File.join(repository.dir, 'src', 'ruby')
81
+ end
82
+
83
+ def deployment_dir
84
+ File.join(repository.dir, 'src', 'deployment')
85
+ end
86
+
87
+ def rails_src_dir
88
+ File.join(repository.dir, 'src', 'rails', 'console')
89
+ end
90
+
91
+ def source_config_dir
92
+ File.join(repository.dir, 'config')
93
+ end
94
+
95
+ def processor_template_repository_url
96
+ 'https://github.com/thomis/eventhub-processor-template.git'
97
+ end
98
+
99
+ def package_tmp_dir
100
+ './tmp'
101
+ end
102
+
103
+ def template_tmp_dir
104
+ '/tmp/eventhub-processor-template/'
105
+ end
106
+
107
+ def deployment_management_files
108
+ [ File.join(deployment_dir, 'management', 'launcher.rb') ]
109
+ end
110
+
111
+ def stages_dir
112
+ File.join(repository.dir, 'config', 'stages')
113
+ end
114
+ end
data/lib/eh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
- module Eh
2
- VERSION = '0.2.2'
3
- end
1
+ module Eh
2
+ VERSION = '0.2.3'
3
+ end
data/lib/eh-commands.rb CHANGED
@@ -1,17 +1,16 @@
1
- # All commands are required here
2
- if Eh::Settings.current.repository
3
- require 'eh/commands/deploy'
4
- require 'eh/commands/generate_processor'
5
- require 'eh/commands/package_ruby'
6
- require 'eh/commands/list_stages'
7
- require 'eh/commands/deploy_config'
8
- require 'eh/commands/deploy_ruby'
9
- require 'eh/commands/deploy_mule'
10
- else
11
- # remove unused settings for this version
12
- Eh::Settings.current.data.delete('repository_root_dir')
13
- Eh::Settings.current.write
14
- puts "No current repository defined. Please run 'eh repository add' and/or 'eh repository select'"
15
- end
16
-
17
- require 'eh/commands/repository'
1
+ # All commands are required here
2
+ if Eh::Settings.current.repository
3
+ require 'eh/commands/generate_processor'
4
+ require 'eh/commands/package_ruby'
5
+ require 'eh/commands/list_stages'
6
+ require 'eh/commands/deploy_config'
7
+ require 'eh/commands/deploy_ruby'
8
+ require 'eh/commands/deploy_mule'
9
+ else
10
+ # remove unused settings for this version
11
+ Eh::Settings.current.data.delete('repository_root_dir')
12
+ Eh::Settings.current.write
13
+ puts "No current repository defined. Please run 'eh repository add' and/or 'eh repository select'"
14
+ end
15
+
16
+ require 'eh/commands/repository'
data/lib/eh.rb CHANGED
@@ -1,11 +1,11 @@
1
- module Eh
2
- end
3
-
4
- require 'zip'
5
- require 'pathname'
6
-
7
- require 'eh/version'
8
- require 'eh/settings'
9
- require 'yaml'
10
-
11
- require_relative 'deployer'
1
+ module Eh
2
+ end
3
+
4
+ require 'zip'
5
+ require 'pathname'
6
+
7
+ require 'eh/version'
8
+ require 'eh/settings'
9
+ require 'yaml'
10
+
11
+ require_relative 'deployer'
data/test/default_test.rb CHANGED
@@ -1,14 +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
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
data/test/test_helper.rb CHANGED
@@ -1,9 +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
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 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.2.2
4
+ version: 0.2.3
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: 2015-02-24 00:00:00.000000000 Z
12
+ date: 2015-02-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -153,7 +153,6 @@ files:
153
153
  - lib/eh-commands.rb
154
154
  - lib/eh.rb
155
155
  - lib/eh/commands/copy_config.rb
156
- - lib/eh/commands/deploy.rb
157
156
  - lib/eh/commands/deploy_config.rb
158
157
  - lib/eh/commands/deploy_mule.rb
159
158
  - lib/eh/commands/deploy_ruby.rb
@@ -192,9 +191,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
191
  version: '0'
193
192
  requirements: []
194
193
  rubyforge_project:
195
- rubygems_version: 2.2.2
194
+ rubygems_version: 2.4.3
196
195
  signing_key:
197
196
  specification_version: 4
198
197
  summary: Event Hub Command Line Tool
199
198
  test_files: []
200
- has_rdoc: true
@@ -1,38 +0,0 @@
1
- desc 'Deploys the app'
2
- arg_name 'stage', optional: true
3
-
4
- command :deploy do |c|
5
- c.flag([:deploy_via], :desc => "One of 'copy' or 'scm'", :default_value => 'scm')
6
- c.flag([:copy_from_dir], :desc => "Source directory for copy operation", :default_value => Eh::Settings.current.releases_dir)
7
- c.flag([:tag], :desc => "The tag to deploy")
8
- c.flag([:branch], :desc => "The branch to deploy", :default_value => "master")
9
-
10
- c.action do |global_options, options, args|
11
- stage = args[0] || "development"
12
-
13
- deployment_dir = Eh::Settings.current.deployment_dir
14
-
15
- env_variables = []
16
- env_variables << "DEPLOY_VIA=#{options[:deploy_via]}"
17
-
18
- if options[:tag]
19
- env_variables << "TAG=#{options[:tag]}"
20
- else
21
- env_variables << "BRANCH=#{options[:branch]}"
22
- end
23
-
24
- if options[:deploy_via] == "copy"
25
- env_variables << "COPY_FROM_DIR=#{options[:copy_from_dir]}"
26
- end
27
-
28
- cmd = "cd #{deployment_dir} && #{env_variables.join(' ')} bundle exec cap #{stage} event_hub"
29
-
30
- puts "Command: #{cmd}" if global_options['v']
31
-
32
- Bundler.with_clean_env do
33
- system cmd
34
- end
35
-
36
- puts "Done."
37
- end
38
- end