forj 0.0.43 → 0.0.44
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/bin/forj +49 -120
- data/lib/appinit.rb +50 -0
- data/lib/boot.rb +30 -43
- data/lib/connection.rb +28 -5
- data/lib/defaults.yaml +115 -61
- data/lib/forj-account.rb +168 -50
- data/lib/forj-config.rb +204 -148
- data/lib/forj-settings.rb +209 -0
- data/lib/helpers.rb +1 -5
- data/lib/log.rb +1 -25
- data/lib/repositories.rb +5 -4
- data/spec/connection_spec.rb +9 -10
- data/spec/forj-config_spec.rb +21 -20
- metadata +4 -2
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
|
-
|
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
|
-
|
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,
|
data/spec/connection_spec.rb
CHANGED
@@ -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 <<
|
26
|
+
$LOAD_PATH << $LIB_PATH
|
28
27
|
|
29
|
-
require '
|
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
|
-
|
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
|
data/spec/forj-config_spec.rb
CHANGED
@@ -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,
|
158
|
-
expect(@config.get(:test1, 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
|
-
|
182
|
-
|
183
|
-
@config.
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
expect(@config.get(:maestro_url, @
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
expect(@config.exist?(:maestro_url, @
|
196
|
-
expect(@config.
|
197
|
-
expect(@config.get(:maestro_url, @
|
198
|
-
|
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.
|
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-
|
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
|