lorj 1.0.12 → 1.0.13
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.
- checksums.yaml +4 -4
- data/bin/lorj_account_import.rb +128 -0
- data/build/build_with_proxy.sh +1 -1
- data/lib/core/core.rb +36 -1
- data/lib/core/core_import_export.rb +168 -0
- data/lib/core/core_setup_encrypt.rb +52 -25
- data/lib/core/lorj_basecontroller.rb +154 -0
- data/lib/core/lorj_baseprocess.rb +16 -0
- data/lib/lorj/version.rb +2 -2
- data/lib/lorj.rb +1 -0
- data/lib/lorj_account.rb +17 -1
- data/lorj-spec/cache/.key +2 -0
- data/lorj-spec/data/accounts/test.yaml +21 -0
- data/lorj-spec/data/config.yaml +15 -0
- data/lorj-spec/process/mock/data.yaml +39 -0
- data/lorj-spec/process/mock/defaults.yaml +0 -20
- data/lorj.gemspec +1 -1
- data/spec/05_lorj_keypath_spec.rb +19 -5
- data/spec/06_lorj_object_data_spec.rb +19 -5
- data/spec/09_prc_spec.rb +31 -6
- data/spec/10_lorj_log_spec.rb +21 -7
- data/spec/11_lorj_defaults_spec.rb +18 -6
- data/spec/12_lorj_config_spec.rb +18 -6
- data/spec/13_lorj_account_spec.rb +25 -6
- data/spec/20_lorj_meta_spec.rb +24 -8
- data/spec/21_lorj_processes_spec.rb +18 -6
- data/spec/22_lorj_core_spec.rb +19 -6
- data/spec/30_lorj_basedefinition_spec.rb +125 -0
- data/spec/31_lorj_importexport_spec.rb +182 -0
- data/spec/spec_helper.rb +54 -0
- metadata +43 -33
data/lib/lorj/version.rb
CHANGED
data/lib/lorj.rb
CHANGED
@@ -48,6 +48,7 @@ require 'core/core_controller' # Lorj core controller functions
|
|
48
48
|
require 'core/core_object_data' # Lorj ObjectData class
|
49
49
|
require 'core/lorj_data' # Lorj Lorj::Data object
|
50
50
|
require 'core/lorj_basedefinition' # Lorj Lorj::BaseDefinition object
|
51
|
+
require 'core/core_import_export' # Import/export functions
|
51
52
|
require 'core/lorj_baseprocess' # Lorj Lorj::BaseProcess object
|
52
53
|
require 'core/lorj_basecontroller' # Lorj Lorj::BaseController object
|
53
54
|
require 'core/lorj_keypath' # Lorj Lorj::BaseDefinition object
|
data/lib/lorj_account.rb
CHANGED
@@ -459,15 +459,31 @@ module Lorj
|
|
459
459
|
# Defines Account exclusive functions
|
460
460
|
class Account
|
461
461
|
def ac_new(sAccountName, provider_name)
|
462
|
+
return nil if sAccountName.nil?
|
463
|
+
ac_erase
|
464
|
+
ac_update(sAccountName, provider_name)
|
465
|
+
end
|
466
|
+
|
467
|
+
# update Account protected data
|
468
|
+
# account name and provider name.
|
469
|
+
#
|
470
|
+
def ac_update(sAccountName, provider_name)
|
462
471
|
return nil if sAccountName.nil?
|
463
472
|
@account_name = sAccountName
|
464
473
|
index = layer_index('account')
|
465
474
|
|
466
475
|
account = @config_layers[index][:config]
|
467
|
-
account.erase
|
468
476
|
account.ac_new sAccountName, provider_name
|
469
477
|
end
|
470
478
|
|
479
|
+
def ac_erase
|
480
|
+
index = layer_index('account')
|
481
|
+
|
482
|
+
account = @config_layers[index][:config]
|
483
|
+
account.erase
|
484
|
+
true
|
485
|
+
end
|
486
|
+
|
471
487
|
# Load Account Information
|
472
488
|
def ac_load(sAccountName = @account_name)
|
473
489
|
@account_name = sAccountName unless !sAccountName.nil? &&
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
# Account example file. The structure on this file is defined by
|
16
|
+
:account:
|
17
|
+
:name: test
|
18
|
+
:provider: :mock
|
19
|
+
:credentials:
|
20
|
+
:keypair_name: 'mykey'
|
21
|
+
:key: 'txE/s8KgWVaYZjYkGIZ3yA=='
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
---
|
15
|
+
:default:
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
# Sample of Object data model definition for :mock process
|
16
|
+
:setup:
|
17
|
+
- :desc: 'Step 1'
|
18
|
+
:explanation: |-
|
19
|
+
My complete explanation is in
|
20
|
+
multiline <%= config['text'] %>
|
21
|
+
- :desc: 'Step 2'
|
22
|
+
:add:
|
23
|
+
- :data
|
24
|
+
|
25
|
+
:sections:
|
26
|
+
:credentials:
|
27
|
+
:keypair_name:
|
28
|
+
:data:
|
29
|
+
:account_exclusive: true
|
30
|
+
:key:
|
31
|
+
:desc: 'An encrypted key data'
|
32
|
+
:encrypted: true
|
33
|
+
:maestro:
|
34
|
+
:maestro_url:
|
35
|
+
:lorj_default:
|
36
|
+
:default_case:
|
37
|
+
:default_value: 'success'
|
38
|
+
:default_case2:
|
39
|
+
:default_value: 'incorrect - meta-default value'
|
@@ -20,23 +20,3 @@
|
|
20
20
|
:default_case2: 'success'
|
21
21
|
:description:
|
22
22
|
:FORJ_HPC: Testing extra application default value.
|
23
|
-
:setup:
|
24
|
-
- :desc: 'Step 1'
|
25
|
-
:explanation: |-
|
26
|
-
My complete explanation is in
|
27
|
-
multiline <%= config['text'] %>
|
28
|
-
- :desc: 'Step 2'
|
29
|
-
:add:
|
30
|
-
- :data
|
31
|
-
:sections:
|
32
|
-
:credentials:
|
33
|
-
:keypair_name:
|
34
|
-
:data:
|
35
|
-
:account_exclusive: true
|
36
|
-
:maestro:
|
37
|
-
:maestro_url:
|
38
|
-
:lorj_default:
|
39
|
-
:default_case:
|
40
|
-
:default_value: 'success'
|
41
|
-
:default_case2:
|
42
|
-
:default_value: 'incorrect - meta-default value'
|
data/lorj.gemspec
CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
'--title Lorj - The Process Controllers framework system' << \
|
36
36
|
'--main README.md'
|
37
37
|
|
38
|
-
spec.add_runtime_dependency 'config_layers', '~>0.1.
|
38
|
+
spec.add_runtime_dependency 'config_layers', '~>0.1.5'
|
39
39
|
spec.add_runtime_dependency 'highline', '~> 1.6.21'
|
40
40
|
spec.add_runtime_dependency 'ansi', '>= 1.4.3'
|
41
41
|
spec.add_runtime_dependency 'encryptor', '1.3.0'
|
@@ -15,12 +15,26 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
# To debug spec, depending on Ruby version, you may need to install
|
19
|
+
# 1.8 => ruby-debug
|
20
|
+
# 1.9 => debugger
|
21
|
+
# 2.0+ => byebug
|
22
|
+
# The right debugger should be installed by default by bundle
|
23
|
+
# So, just call:
|
24
|
+
#
|
25
|
+
# bundle
|
26
|
+
#
|
27
|
+
# Then set RSPEC_DEBUG=true, put a 'stop' where you want in the spec code
|
28
|
+
# and start rspec or even rake spec.
|
29
|
+
#
|
30
|
+
# RSPEC_DEBUG=true rake spec_local (or spec which includes docker spec)
|
31
|
+
# OR
|
32
|
+
# RSPEC_DEBUG=true rspec -f doc --color spec/<file>_spec.rb
|
33
|
+
#
|
22
34
|
|
23
|
-
|
35
|
+
app_path = File.dirname(__FILE__)
|
36
|
+
$LOAD_PATH << app_path unless $LOAD_PATH.include?(app_path)
|
37
|
+
require 'spec_helper'
|
24
38
|
|
25
39
|
describe 'Lorj::KeyPath' do
|
26
40
|
context '.new(:test)' do
|
@@ -15,12 +15,26 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
# To debug spec, depending on Ruby version, you may need to install
|
19
|
+
# 1.8 => ruby-debug
|
20
|
+
# 1.9 => debugger
|
21
|
+
# 2.0+ => byebug
|
22
|
+
# The right debugger should be installed by default by bundle
|
23
|
+
# So, just call:
|
24
|
+
#
|
25
|
+
# bundle
|
26
|
+
#
|
27
|
+
# Then set RSPEC_DEBUG=true, put a 'stop' where you want in the spec code
|
28
|
+
# and start rspec or even rake spec.
|
29
|
+
#
|
30
|
+
# RSPEC_DEBUG=true rake spec_local (or spec which includes docker spec)
|
31
|
+
# OR
|
32
|
+
# RSPEC_DEBUG=true rspec -f doc --color spec/<file>_spec.rb
|
33
|
+
#
|
22
34
|
|
23
|
-
|
35
|
+
app_path = File.dirname(__FILE__)
|
36
|
+
$LOAD_PATH << app_path unless $LOAD_PATH.include?(app_path)
|
37
|
+
require 'spec_helper'
|
24
38
|
|
25
39
|
describe 'Lorj::ObjectData' do
|
26
40
|
context 'initialize with internal false' do
|
data/spec/09_prc_spec.rb
CHANGED
@@ -15,23 +15,47 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
-
#
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
# This spec manipulate Lorj and PrcLib module
|
19
|
+
#
|
20
|
+
# In the context on a complete rspec run (rake spec)
|
21
|
+
# modules required are loaded once only.
|
22
|
+
# So, PrcLib will need to be reloaded (load) with the spec addon.
|
23
|
+
|
24
|
+
# spec_helper added:
|
25
|
+
# PrcLib.spec_cleanup, to simply cleanup the library loaded.
|
26
|
+
# This is easier than unload module and reload them later with load from all
|
27
|
+
# Files which update PrcLib.
|
28
|
+
# To debug spec, depending on Ruby version, you may need to install
|
29
|
+
# 1.8 => ruby-debug
|
30
|
+
# 1.9 => debugger
|
31
|
+
# 2.0+ => byebug
|
32
|
+
# The right debugger should be installed by default by bundle
|
33
|
+
# So, just call:
|
34
|
+
#
|
35
|
+
# bundle
|
36
|
+
#
|
37
|
+
# Then set RSPEC_DEBUG=true, put a 'stop' where you want in the spec code
|
38
|
+
# and start rspec or even rake spec.
|
39
|
+
#
|
40
|
+
# RSPEC_DEBUG=true rake spec_local (or spec which includes docker spec)
|
41
|
+
# OR
|
42
|
+
# RSPEC_DEBUG=true rspec -f doc --color spec/<file>_spec.rb
|
43
|
+
#
|
22
44
|
|
23
45
|
app_path = File.dirname(__FILE__)
|
24
|
-
$LOAD_PATH <<
|
46
|
+
$LOAD_PATH << app_path unless $LOAD_PATH.include?(app_path)
|
47
|
+
require 'spec_helper'
|
25
48
|
|
26
49
|
describe 'Module PrcLib: ' do
|
27
50
|
after(:all) do
|
28
51
|
Object.send(:remove_const, :PrcLib)
|
29
52
|
load File.join(app_path, '..', 'lib', 'prc.rb') # Load prc
|
30
53
|
load File.join(app_path, '..', 'lib', 'logging.rb') # Load logging
|
54
|
+
load File.join(app_path, '..', 'lib', 'lorj.rb') # Load prc
|
55
|
+
load File.join(app_path, 'spec_helper.rb') # Reload spec PrcLib addon
|
31
56
|
end
|
32
57
|
|
33
58
|
it 'load Lorj and PrcLib Modules' do
|
34
|
-
require 'lorj' # Load lorj framework
|
35
59
|
expect(Lorj).to be
|
36
60
|
expect(PrcLib).to be
|
37
61
|
end
|
@@ -42,6 +66,7 @@ describe 'Module PrcLib: ' do
|
|
42
66
|
end
|
43
67
|
|
44
68
|
it 'default app is lorj and cannot be updated.' do
|
69
|
+
PrcLib.spec_cleanup
|
45
70
|
expect(PrcLib.app_name).to eq('lorj')
|
46
71
|
PrcLib.app_name = 'lorj-spec'
|
47
72
|
expect(PrcLib.app_name).to eq('lorj')
|
data/spec/10_lorj_log_spec.rb
CHANGED
@@ -15,12 +15,26 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
# To debug spec, depending on Ruby version, you may need to install
|
19
|
+
# 1.8 => ruby-debug
|
20
|
+
# 1.9 => debugger
|
21
|
+
# 2.0+ => byebug
|
22
|
+
# The right debugger should be installed by default by bundle
|
23
|
+
# So, just call:
|
24
|
+
#
|
25
|
+
# bundle
|
26
|
+
#
|
27
|
+
# Then set RSPEC_DEBUG=true, put a 'stop' where you want in the spec code
|
28
|
+
# and start rspec or even rake spec.
|
29
|
+
#
|
30
|
+
# RSPEC_DEBUG=true rake spec_local (or spec which includes docker spec)
|
31
|
+
# OR
|
32
|
+
# RSPEC_DEBUG=true rspec -f doc --color spec/<file>_spec.rb
|
33
|
+
#
|
22
34
|
|
23
|
-
|
35
|
+
app_path = File.dirname(__FILE__)
|
36
|
+
$LOAD_PATH << app_path unless $LOAD_PATH.include?(app_path)
|
37
|
+
require 'spec_helper'
|
24
38
|
|
25
39
|
# This spec HAVE to the the first one executed!
|
26
40
|
# Do never create a file or rename this file, which will
|
@@ -42,7 +56,7 @@ describe 'Module: Lorj,' do
|
|
42
56
|
end
|
43
57
|
|
44
58
|
it 'PrcLib module exist' do
|
45
|
-
require 'lorj' # Load lorj framework
|
59
|
+
# require 'lorj' # Load lorj framework
|
46
60
|
expect(PrcLib.class).to equal(Module)
|
47
61
|
|
48
62
|
expect(PrcLib.log).to be_nil
|
@@ -63,7 +77,7 @@ describe 'Module: Lorj,' do
|
|
63
77
|
it 'create PrcLib.log object at first message' do
|
64
78
|
PrcLib.level = Logger::FATAL
|
65
79
|
PrcLib.app_name = 'lorj-spec'
|
66
|
-
PrcLib.app_defaults = File.join(app_path, 'lorj-spec')
|
80
|
+
PrcLib.app_defaults = File.join(File.dirname(app_path), 'lorj-spec')
|
67
81
|
|
68
82
|
PrcLib.debug 'Rspec logging ...'
|
69
83
|
|
@@ -15,14 +15,26 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
# To debug spec, depending on Ruby version, you may need to install
|
19
|
+
# 1.8 => ruby-debug
|
20
|
+
# 1.9 => debugger
|
21
|
+
# 2.0+ => byebug
|
22
|
+
# The right debugger should be installed by default by bundle
|
23
|
+
# So, just call:
|
24
|
+
#
|
25
|
+
# bundle
|
26
|
+
#
|
27
|
+
# Then set RSPEC_DEBUG=true, put a 'stop' where you want in the spec code
|
28
|
+
# and start rspec or even rake spec.
|
29
|
+
#
|
30
|
+
# RSPEC_DEBUG=true rake spec_local (or spec which includes docker spec)
|
31
|
+
# OR
|
32
|
+
# RSPEC_DEBUG=true rspec -f doc --color spec/<file>_spec.rb
|
33
|
+
#
|
20
34
|
|
21
35
|
app_path = File.dirname(__FILE__)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
require 'lorj' # Load lorj framework
|
36
|
+
$LOAD_PATH << app_path unless $LOAD_PATH.include?(app_path)
|
37
|
+
require 'spec_helper'
|
26
38
|
|
27
39
|
describe 'class: Lorj::Default loaded lorj_spec/defaults.yaml, '\
|
28
40
|
'no controller data,' do
|
data/spec/12_lorj_config_spec.rb
CHANGED
@@ -15,14 +15,26 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
# To debug spec, depending on Ruby version, you may need to install
|
19
|
+
# 1.8 => ruby-debug
|
20
|
+
# 1.9 => debugger
|
21
|
+
# 2.0+ => byebug
|
22
|
+
# The right debugger should be installed by default by bundle
|
23
|
+
# So, just call:
|
24
|
+
#
|
25
|
+
# bundle
|
26
|
+
#
|
27
|
+
# Then set RSPEC_DEBUG=true, put a 'stop' where you want in the spec code
|
28
|
+
# and start rspec or even rake spec.
|
29
|
+
#
|
30
|
+
# RSPEC_DEBUG=true rake spec_local (or spec which includes docker spec)
|
31
|
+
# OR
|
32
|
+
# RSPEC_DEBUG=true rspec -f doc --color spec/<file>_spec.rb
|
33
|
+
#
|
20
34
|
|
21
35
|
app_path = File.dirname(__FILE__)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
require 'lorj' # Load lorj framework
|
36
|
+
$LOAD_PATH << app_path unless $LOAD_PATH.include?(app_path)
|
37
|
+
require 'spec_helper'
|
26
38
|
|
27
39
|
describe 'class: Lorj::Config,' do
|
28
40
|
context 'new instance, with no default local config files, ' do
|
@@ -15,14 +15,26 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
# To debug spec, depending on Ruby version, you may need to install
|
19
|
+
# 1.8 => ruby-debug
|
20
|
+
# 1.9 => debugger
|
21
|
+
# 2.0+ => byebug
|
22
|
+
# The right debugger should be installed by default by bundle
|
23
|
+
# So, just call:
|
24
|
+
#
|
25
|
+
# bundle
|
26
|
+
#
|
27
|
+
# Then set RSPEC_DEBUG=true, put a 'stop' where you want in the spec code
|
28
|
+
# and start rspec or even rake spec.
|
29
|
+
#
|
30
|
+
# RSPEC_DEBUG=true rake spec_local (or spec which includes docker spec)
|
31
|
+
# OR
|
32
|
+
# RSPEC_DEBUG=true rspec -f doc --color spec/<file>_spec.rb
|
33
|
+
#
|
20
34
|
|
21
35
|
app_path = File.dirname(__FILE__)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
require 'lorj' # Load lorj framework
|
36
|
+
$LOAD_PATH << app_path unless $LOAD_PATH.include?(app_path)
|
37
|
+
require 'spec_helper'
|
26
38
|
|
27
39
|
describe 'class: Lorj::Account,' do
|
28
40
|
context 'Lorj::Account.new,' do
|
@@ -217,6 +229,13 @@ describe 'class: Lorj::Account,' do
|
|
217
229
|
expect(@account.where?(:data)).to eq(%w(runtime account))
|
218
230
|
end
|
219
231
|
|
232
|
+
it 'account.ac_erase return true, and :data disappeared.' do
|
233
|
+
expect(@account.ac_erase).to equal(true)
|
234
|
+
expect(@account.where?(:data)).to eq(%w(runtime))
|
235
|
+
expect(@account.ac_load 'test1').to equal(true)
|
236
|
+
expect(@account.where?(:data)).to eq(%w(runtime account))
|
237
|
+
end
|
238
|
+
|
220
239
|
it "account.get(:keypair_name, :name => 'account') return "\
|
221
240
|
"saved 'nova_test2'" do
|
222
241
|
expect(@account.get(:keypair_name, nil,
|
data/spec/20_lorj_meta_spec.rb
CHANGED
@@ -15,14 +15,26 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
# To debug spec, depending on Ruby version, you may need to install
|
19
|
+
# 1.8 => ruby-debug
|
20
|
+
# 1.9 => debugger
|
21
|
+
# 2.0+ => byebug
|
22
|
+
# The right debugger should be installed by default by bundle
|
23
|
+
# So, just call:
|
24
|
+
#
|
25
|
+
# bundle
|
26
|
+
#
|
27
|
+
# Then set RSPEC_DEBUG=true, put a 'stop' where you want in the spec code
|
28
|
+
# and start rspec or even rake spec.
|
29
|
+
#
|
30
|
+
# RSPEC_DEBUG=true rake spec_local (or spec which includes docker spec)
|
31
|
+
# OR
|
32
|
+
# RSPEC_DEBUG=true rspec -f doc --color spec/<file>_spec.rb
|
33
|
+
#
|
20
34
|
|
21
35
|
app_path = File.dirname(__FILE__)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
require 'lorj' # Load lorj framework
|
36
|
+
$LOAD_PATH << app_path unless $LOAD_PATH.include?(app_path)
|
37
|
+
require 'spec_helper'
|
26
38
|
|
27
39
|
describe 'Lorj::MetaAppConfig,' do
|
28
40
|
context 'core with sample initialized,' do
|
@@ -57,11 +69,12 @@ YAMLDOC
|
|
57
69
|
p_get(options)
|
58
70
|
end
|
59
71
|
end
|
60
|
-
|
72
|
+
|
61
73
|
@metadata = MetaAppConfigSpec.new YAML.load(data)
|
62
74
|
end
|
63
75
|
|
64
76
|
it 'sections returns [:section1, :section2].' do
|
77
|
+
# Ruby 1.8 requires to use sort, as Hash do not have order garantee
|
65
78
|
expect(@metadata.sections.sort).to eq([:section1, :section2, :section3])
|
66
79
|
end
|
67
80
|
|
@@ -70,11 +83,13 @@ YAMLDOC
|
|
70
83
|
end
|
71
84
|
|
72
85
|
it 'sections(:data2) returns [:section1, :section2].' do
|
86
|
+
# Ruby 1.8 requires to use sort, as Hash do not have order garantee
|
73
87
|
expect(@metadata.sections(:data2).sort).to eq([:section1, :section2])
|
74
88
|
end
|
75
89
|
|
76
90
|
it 'datas returns [:data1, :data2, :data3].' do
|
77
|
-
|
91
|
+
# Ruby 1.8 requires to use sort, as Hash do not have order garantee
|
92
|
+
expect(@metadata.datas.sort).to eq([:data1, :data2, :data3].sort)
|
78
93
|
end
|
79
94
|
|
80
95
|
if /1\.8/ =~ RUBY_VERSION
|
@@ -160,6 +175,7 @@ YAMLDOC
|
|
160
175
|
expect(@metadata[:sections, :section2, :data2, :option2]).to eq('value3')
|
161
176
|
expect(@metadata.define_controller_data(:section2,
|
162
177
|
:data2, data)).to eq(data)
|
178
|
+
# Ruby 1.8 requires to use sort, as Hash do not have order garantee
|
163
179
|
expect(@metadata.sections(:data2).sort).to eq([:section1, :section2])
|
164
180
|
expect(@metadata[:sections, :section2, :data2, :option2]).to eq(:value4)
|
165
181
|
end
|
@@ -15,14 +15,26 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
# To debug spec, depending on Ruby version, you may need to install
|
19
|
+
# 1.8 => ruby-debug
|
20
|
+
# 1.9 => debugger
|
21
|
+
# 2.0+ => byebug
|
22
|
+
# The right debugger should be installed by default by bundle
|
23
|
+
# So, just call:
|
24
|
+
#
|
25
|
+
# bundle
|
26
|
+
#
|
27
|
+
# Then set RSPEC_DEBUG=true, put a 'stop' where you want in the spec code
|
28
|
+
# and start rspec or even rake spec.
|
29
|
+
#
|
30
|
+
# RSPEC_DEBUG=true rake spec_local (or spec which includes docker spec)
|
31
|
+
# OR
|
32
|
+
# RSPEC_DEBUG=true rspec -f doc --color spec/<file>_spec.rb
|
33
|
+
#
|
20
34
|
|
21
35
|
app_path = File.dirname(__FILE__)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
require 'lorj' # Load lorj framework
|
36
|
+
$LOAD_PATH << app_path unless $LOAD_PATH.include?(app_path)
|
37
|
+
require 'spec_helper'
|
26
38
|
|
27
39
|
describe 'Lorj::Process,' do
|
28
40
|
context 'Lorj::ProcessResource,' do
|
data/spec/22_lorj_core_spec.rb
CHANGED
@@ -15,14 +15,26 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
# To debug spec, depending on Ruby version, you may need to install
|
19
|
+
# 1.8 => ruby-debug
|
20
|
+
# 1.9 => debugger
|
21
|
+
# 2.0+ => byebug
|
22
|
+
# The right debugger should be installed by default by bundle
|
23
|
+
# So, just call:
|
24
|
+
#
|
25
|
+
# bundle
|
26
|
+
#
|
27
|
+
# Then set RSPEC_DEBUG=true, put a 'stop' where you want in the spec code
|
28
|
+
# and start rspec or even rake spec.
|
29
|
+
#
|
30
|
+
# RSPEC_DEBUG=true rake spec_local (or spec which includes docker spec)
|
31
|
+
# OR
|
32
|
+
# RSPEC_DEBUG=true rspec -f doc --color spec/<file>_spec.rb
|
33
|
+
#
|
20
34
|
|
21
35
|
app_path = File.dirname(__FILE__)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
require 'lorj' # Load lorj framework
|
36
|
+
$LOAD_PATH << app_path unless $LOAD_PATH.include?(app_path)
|
37
|
+
require 'spec_helper'
|
26
38
|
|
27
39
|
describe 'Lorj::Core,' do
|
28
40
|
context 'Using lorj-spec process, ' do
|
@@ -36,6 +48,7 @@ describe 'Lorj::Core,' do
|
|
36
48
|
it 'Lorj::Core.new(nil, :mock) return an error' do
|
37
49
|
expect { Lorj::Core.new(nil, :mock) }.to raise_error(Lorj::PrcError)
|
38
50
|
end
|
51
|
+
|
39
52
|
it 'Lorj::Core.new(nil, [{ :process_module => :mock}]) gets loaded.' do
|
40
53
|
expect(core = Lorj::Core.new(nil, [{ :process_module => :mock }])).to be
|
41
54
|
expect(core.config).to be
|