forj 0.0.43 → 0.0.44

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/repositories.rb CHANGED
@@ -56,7 +56,7 @@ module Repositories
56
56
 
57
57
 
58
58
 
59
- def create_infra(maestro_repo)
59
+ def create_infra(maestro_repo, branch)
60
60
  # Build our own infra from maestro infra templates.
61
61
  infra = File.join($FORJ_DATA_PATH, 'infra')
62
62
  dest_cloud_init = File.join(infra, 'cloud-init')
@@ -67,11 +67,12 @@ module Repositories
67
67
  Logging.debug("Cleaning up '%s'" % [infra])
68
68
  FileUtils.rm_r(infra)
69
69
  end
70
- Helpers.ensure_dir_exists(dest_cloud_init)
70
+ AppInit.ensure_dir_exists(dest_cloud_init)
71
71
  Logging.debug("Copying recursively '%s' to '%s'" % [cloud_init, infra])
72
72
  FileUtils.copy_entry(cloud_init, dest_cloud_init)
73
73
 
74
- build_env = File.join(template,'maestro.box.master.env')
74
+ template_file = 'maestro.box.' + branch + '.env'
75
+ build_env = File.join(template,template_file)
75
76
  Logging.debug("Copying '%s' to '%s'" % [build_env, infra])
76
77
  FileUtils.copy(build_env, infra)
77
78
 
@@ -128,7 +129,7 @@ module Repositories
128
129
  sAccountName = oConfig.get(:account_name)
129
130
 
130
131
  yDns = {}
131
- yDns = oConfig.ExtraGet(:forj_accounts, sAccountName, :dns) if oConfig.ExtraExist?(:forj_accounts, sAccountName, :dns)
132
+ yDns = oConfig.oConfig.ExtraGet(:forj_accounts, sAccountName, :dns) if oConfig.oConfig.ExtraExist?(:forj_accounts, sAccountName, :dns)
132
133
  build_env = File.join(infra_dir, 'maestro.box.master.env')
133
134
  Logging.debug("Reading data from '%s'" % build_env)
134
135
  tags = {'SET_DNS_TENANTID' => :tenant_id,
@@ -22,29 +22,28 @@ require 'fog'
22
22
 
23
23
  $APP_PATH = File.dirname(__FILE__)
24
24
  $LIB_PATH = File.expand_path(File.join(File.dirname($APP_PATH),'lib'))
25
- $FORJ_DATA_PATH= File.expand_path('~/.forj')
26
25
 
27
- $LOAD_PATH << './lib'
26
+ $LOAD_PATH << $LIB_PATH
28
27
 
29
- require 'forj-config.rb' # Load class ForjConfig
30
- require 'log.rb' # Load default loggers
31
- require 'connection.rb' # Load class ForjConnection
32
- require 'forj-account.rb'
28
+ require 'appinit.rb' # Load generic Application level function
33
29
 
34
30
  # Initialize forj paths
35
- ensure_forj_dirs_exists()
36
-
37
- include Logging
31
+ AppInit::forj_initialize()
38
32
 
33
+ # Initialize global Log object
39
34
  $FORJ_LOGGER=ForjLog.new('forj-rspec.log', Logger::FATAL)
40
35
 
36
+ require 'forj-config.rb' # Load class ForjConfig
37
+ require 'connection.rb' # Load class ForjConnection
38
+ require 'forj-account.rb'
39
+
41
40
 
42
41
  describe 'Module: forj-connection' do
43
42
 
44
43
  it 'should connect to hpcloud (smoke test)' do
45
44
 
46
45
  Fog.mock!
47
- conn = ForjConnection.new(ForjConfig.new())
46
+ conn = ForjConnection.new(ForjAccount.new(ForjConfig.new()))
48
47
  expect(conn).to be
49
48
 
50
49
  Fog::Mock.reset
@@ -154,8 +154,8 @@ describe "class: forj-config," do
154
154
 
155
155
  it 'can get defaults if no key' do
156
156
  expect(@config.set(:test1, nil)).to equal(true)
157
- expect(@config.get(:test1, nil, 'default')).to eq('default')
158
- expect(@config.get(:test1, nil, nil)).to equal(nil)
157
+ expect(@config.get(:test1, 'default')).to eq('default')
158
+ expect(@config.get(:test1, nil)).to equal(nil)
159
159
  expect(@config.set(:maestro_url,nil)).to equal(true)
160
160
  expect(@config.get(:maestro_url)).to eq(@url)
161
161
  end
@@ -178,24 +178,25 @@ describe "class: forj-config," do
178
178
  @aArray4[1] = { :hash_2 => { :maestro_url => 'url4' }}
179
179
  end
180
180
 
181
- it 'can get data from one hash' do
182
- expect(@config.get(:maestro_url, @yYAML1)).to eq('url1')
183
- @config.set(:maestro_url, 'runtime')
184
- expect(@config.get(:maestro_url, @yYAML1)).to eq('runtime')
185
- end
186
-
187
- it 'can get data from array of hash' do
188
- @config.set(:maestro_url, nil)
189
- expect(@config.get(:maestro_url, @aArray1)).to eq('url2')
190
- expect(@config.get(:maestro_url, @aArray2)).to eq('url1')
191
- end
192
- it 'can get data from array of hashes' do
193
- @config.set('maestro_url', nil)
194
- expect(@config.exist?(:maestro_url, @aArray3)).to eq('hash_1')
195
- expect(@config.exist?(:maestro_url, @aArray4)).to eq('hash_2')
196
- expect(@config.get(:maestro_url, @aArray3)).to eq('url3')
197
- expect(@config.get(:maestro_url, @aArray4)).to eq('url4')
198
- end
181
+ # Obsolete.
182
+ #~ it 'can get data from one hash' do
183
+ #~ expect(@config.get(:maestro_url, @yYAML1)).to eq('url1')
184
+ #~ @config.set(:maestro_url, 'runtime')
185
+ #~ expect(@config.get(:maestro_url, @yYAML1)).to eq('runtime')
186
+ #~ end
187
+ #~
188
+ #~ it 'can get data from array of hash' do
189
+ #~ @config.set(:maestro_url, nil)
190
+ #~ expect(@config.get(:maestro_url, @aArray1)).to eq('url2')
191
+ #~ expect(@config.get(:maestro_url, @aArray2)).to eq('url1')
192
+ #~ end
193
+ #~ it 'can get data from array of hashes' do
194
+ #~ @config.set('maestro_url', nil)
195
+ #~ expect(@config.exist?(:maestro_url, @aArray3)).to eq('hash_1')
196
+ #~ expect(@config.exist?(:maestro_url, @aArray4)).to eq('hash_2')
197
+ #~ expect(@config.get(:maestro_url, @aArray3)).to eq('url3')
198
+ #~ expect(@config.get(:maestro_url, @aArray4)).to eq('url4')
199
+ #~ end
199
200
  end
200
201
  end
201
202
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forj
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.43
4
+ version: 0.0.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - forj team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-19 00:00:00.000000000 Z
11
+ date: 2014-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -153,6 +153,8 @@ files:
153
153
  - lib/defaults.yaml
154
154
  - lib/down.rb
155
155
  - lib/boot.rb
156
+ - lib/appinit.rb
157
+ - lib/forj-settings.rb
156
158
  - lib/setup.rb
157
159
  - lib/repositories.rb
158
160
  - lib/ssh.rb