app_stack 1.3.4 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +6 -5
- data/Gemfile.lock +17 -5
- data/README.md +13 -1
- data/app_stack.gemspec +6 -5
- data/lib/app_stack/app.rb +86 -0
- data/lib/app_stack/cli_options.rb +42 -36
- data/lib/app_stack/compare_list.rb +195 -0
- data/lib/app_stack/configuration.rb +119 -0
- data/lib/app_stack/operator.rb +60 -0
- data/lib/app_stack/version.rb +1 -1
- data/lib/app_stack.rb +34 -6
- data/spec/app_stack_spec.rb +17 -0
- data/spec/cli_options_spec.rb +20 -0
- data/spec/compare_list_spec.rb +18 -0
- data/spec/configuration_spec.rb +95 -0
- data/spec/examples/la-assets-helper/app_stack.yml +14 -0
- data/spec/examples/la-assets-helper/lib/la_assets.rb +319 -0
- data/spec/examples/la-import_app/Trivia.erb +2 -0
- data/spec/examples/la-import_app/app_stack.yml +83 -0
- data/spec/examples/la-mongoid/app_stack.yml +49 -0
- data/spec/examples/la-mongoid/config/boot.rb +15 -0
- data/spec/examples/la-mongoid/config/database.rb +12 -0
- data/spec/examples/la-mongoid/config/mongoid.yml +22 -0
- data/spec/examples/la-mongoid/config/mongoid.yml.erb +22 -0
- data/spec/examples/la-sinatra/Gemfile.erb +11 -0
- data/spec/examples/la-sinatra/app_stack.yml +16 -0
- data/spec/examples/no-stacked/some_list.rb +4 -0
- data/spec/examples/sample_config/app_stack.yml +82 -0
- data/spec/examples/sample_config/hash_export.yml +4 -0
- data/spec/load_stack_spec.rb +13 -0
- data/spec/spec_helper.rb +7 -2
- data/tags +87 -34
- metadata +66 -87
- data/.app_stack.yml +0 -14
- data/bin/config_assets +0 -3
- data/lib/app_stack/copy_list_builder.rb +0 -147
- data/lib/app_stack/local_files_parser.rb +0 -95
- data/lib/app_stack/stack_app.rb +0 -119
- data/spec/config_spec.rb +0 -82
- data/spec/fixtures/config_sample/sample.yml +0 -19
- data/spec/fixtures/sample_files/module_1/Gemfile.erb +0 -1
- data/spec/fixtures/sample_files/module_1/app_stack.yml +0 -10
- data/spec/fixtures/sample_files/module_1/config/boot_sample.rb +0 -0
- data/spec/fixtures/sample_files/module_1/doc/excluding.txt +0 -1
- data/spec/fixtures/sample_files/module_1/doc/including.txt +0 -0
- data/spec/fixtures/sample_files/module_1/lib/mixins/b_lib.rb +0 -0
- data/spec/fixtures/sample_files/module_1/lib/mixins/s_lib.rb +0 -0
- data/spec/fixtures/sample_files/module_1/lib/samples/a_lib.rb +0 -0
- data/spec/fixtures/sample_files/module_1/spec/config_spec.rb +0 -0
- data/spec/fixtures/sample_files/module_2/Gemfile +0 -0
- data/spec/fixtures/sample_files/module_2/Gemfile.liquid +0 -1
- data/spec/fixtures/sample_files/module_2/app/lib/sequence.rb +0 -0
- data/spec/fixtures/sample_files/module_2/app_stack.yml +0 -3
- data/spec/fixtures/sample_files/module_3/app_stack.yml +0 -3
- data/spec/fixtures/sample_files/module_3/bin/del +0 -0
- data/spec/fixtures/sample_files/module_3/bin/rm +0 -0
- data/spec/fixtures/sample_files/module_3/config/application.yml +0 -0
- data/spec/fixtures/sample_files/module_3/config/database_development.yml +0 -0
- data/spec/fixtures/sample_files/module_3/config/database_production.yml +0 -0
- data/spec/fixtures/sample_files/module_3/lib/libfile_1.rb +0 -0
- data/spec/fixtures/sample_files/module_3/lib/libfile_2.rb +0 -0
- data/spec/fixtures/sample_files/my_app/app_stack.yml +0 -15
- data/spec/fixtures/sample_files/my_app/doc/excluding.txt +0 -1
- data/spec/fixtures/sample_files/my_app/local.conf +0 -0
- data/spec/fixtures/sample_files/my_app/local.conf.erb +0 -1
- data/spec/fixtures/sample_files/my_app/spec/config_spec.rb +0 -0
- data/spec/fixtures/sample_files/my_app_back/app_stack.yml +0 -15
- data/spec/fixtures/sample_files/my_app_back/doc/excluding.txt +0 -1
- data/spec/fixtures/sample_files/my_app_back/local.conf +0 -0
- data/spec/fixtures/sample_files/my_app_back/local.conf.erb +0 -1
- data/spec/fixtures/sample_files/my_app_back/spec/config_spec.rb +0 -0
- data/spec/merger_spec.rb +0 -43
- data/spec/stackup_spec.rb +0 -18
- /data/{file.erb → spec/examples/find_conf_file/both/.app_stack.yml} +0 -0
- /data/spec/{fixtures/sample_files/module_1/Gemfile → examples/find_conf_file/both/app_stack.yml} +0 -0
- /data/spec/{fixtures/sample_files/module_1/Rakefile → examples/find_conf_file/with_dot/.app_stack.yml} +0 -0
- /data/spec/{fixtures/config_sample → examples/sample_config}/wrong_key.yml +0 -0
- /data/spec/{fixtures/config_sample → examples/sample_config}/wrong_type.yml +0 -0
data/spec/config_spec.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe AppStack::Config do
|
5
|
-
context 'raise parse errors' do
|
6
|
-
it 'for unkown keys' do
|
7
|
-
expect do
|
8
|
-
AppStack::Config.new('spec/fixtures/config_sample/wrong_key.yml')
|
9
|
-
end.to raise_error(AppStack::ParseError)
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'for wrong data types' do
|
13
|
-
expect do
|
14
|
-
AppStack::Config.new('spec/fixtures/config_sample/wrong_type.yml')
|
15
|
-
end.to raise_error(AppStack::ParseError)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'load configuration' do
|
20
|
-
subject :config do
|
21
|
-
AppStack::Config.new('spec/fixtures/config_sample/sample.yml')
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'for default' do
|
25
|
-
config.stack_dir.should eq(File.expand_path('spec/fixtures'))
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'set new value' do
|
29
|
-
config.attrs['outer'][0]['inter']['some_key'].should eq('some_value')
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context 'read properties' do
|
34
|
-
subject :config do
|
35
|
-
AppStack::Config.new('spec/fixtures/sample_files/my_app/app_stack.yml')
|
36
|
-
end
|
37
|
-
|
38
|
-
it '#directory' do
|
39
|
-
dir = File.expand_path('./spec/fixtures/sample_files/my_app')
|
40
|
-
config.directory.should eq(dir)
|
41
|
-
end
|
42
|
-
|
43
|
-
it '#filename' do
|
44
|
-
file = File.expand_path('./spec/fixtures/sample_files/my_app/app_stack.yml')
|
45
|
-
config.filename.should eq(file)
|
46
|
-
end
|
47
|
-
|
48
|
-
it '#app_name' do
|
49
|
-
config.app_name.should eq('my_app')
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe '#export_files' do
|
54
|
-
subject(:conf) { AppStack::Config.new('spec/fixtures/sample_files/module_1/app_stack.yml') }
|
55
|
-
it 'default file list' do
|
56
|
-
%w[mixins/b_lib.rb mixins/s_lib.rb samples/a_lib.rb].each do |fb|
|
57
|
-
file = File.expand_path('./spec/fixtures/sample_files/module_1/lib/' + fb)
|
58
|
-
conf.export_files[file].should eq('/lib/' + fb)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'load group files' do
|
63
|
-
file = File.expand_path('./spec/fixtures/sample_files/module_1/spec/config_spec.rb')
|
64
|
-
conf.export_files('tests')[file].should eq('/spec/config_spec.rb')
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'file mapping hash' do
|
68
|
-
file = File.expand_path('./spec/fixtures/sample_files/module_1/config/boot_sample.rb')
|
69
|
-
conf.export_files('config')[file].should eq('/config/boot.rb')
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe 'other file lists' do
|
74
|
-
subject(:conf) { AppStack::Config.new('spec/fixtures/sample_files/my_app/app_stack.yml') }
|
75
|
-
it '#exclude_list' do
|
76
|
-
file = File.expand_path('./spec/fixtures/sample_files/my_app/doc/excluding.txt')
|
77
|
-
conf.exclude_files[file].should eq('/doc/excluding.txt')
|
78
|
-
p conf.export_files('config')
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
82
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
Mod1: <%= application_code %>
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
from module1
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
Mod2: {{ application_code }}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,15 +0,0 @@
|
|
1
|
-
stack:
|
2
|
-
- module_1:
|
3
|
-
- default
|
4
|
-
- tests
|
5
|
-
- module_2
|
6
|
-
- module_3:
|
7
|
-
- default
|
8
|
-
- config/application.yml: ''
|
9
|
-
- config/database_production.yml: config/database.yml
|
10
|
-
exclude:
|
11
|
-
- doc/excluding.txt
|
12
|
-
- Rakefile
|
13
|
-
- bin/*
|
14
|
-
attrs:
|
15
|
-
application_code: my_app
|
@@ -1 +0,0 @@
|
|
1
|
-
from my_app
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
set to <%= application_code %>
|
File without changes
|
@@ -1,15 +0,0 @@
|
|
1
|
-
stack:
|
2
|
-
- module_1:
|
3
|
-
- default
|
4
|
-
- tests
|
5
|
-
- module_2
|
6
|
-
- module_3:
|
7
|
-
- default
|
8
|
-
- config/application.yml: ''
|
9
|
-
- config/database_production.yml: config/database.yml
|
10
|
-
exclude:
|
11
|
-
- doc/excluding.txt
|
12
|
-
- Rakefile
|
13
|
-
- bin/*
|
14
|
-
attrs:
|
15
|
-
application_code: my_app
|
@@ -1 +0,0 @@
|
|
1
|
-
from my_app
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
set to <%= application_code %>
|
File without changes
|
data/spec/merger_spec.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe AppStack::Merger do
|
6
|
-
subject (:mg) { AppStack::Merger.new('spec/fixtures/sample_files/my_app/app_stack.yml') }
|
7
|
-
describe '#parse_stacks' do
|
8
|
-
it 'get a stacked app list' do
|
9
|
-
mg.stacks[0].app_name.should eq('module_1')
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'get a group of files' do
|
13
|
-
file = File.expand_path('spec/fixtures/sample_files/module_1/spec/config_spec.rb')
|
14
|
-
mg.stacks[0].copy_list[file].should eq('/spec/config_spec.rb')
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'get the default files' do
|
18
|
-
file = File.expand_path('spec/fixtures/sample_files/module_2/app/lib/sequence.rb')
|
19
|
-
mg.stacks[1].copy_list[file].should eq('/app/lib/sequence.rb')
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'get file with specified target name' do
|
23
|
-
file = File.expand_path('spec/fixtures/sample_files/module_3/config/database_production.yml')
|
24
|
-
mg.stacks[2].copy_list[file].should eq('config/database.yml')
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '#prepare' do
|
29
|
-
it 'get copy list' do
|
30
|
-
mg.prepare
|
31
|
-
file = File.expand_path('spec/fixtures/sample_files/module_3/config/database_production.yml')
|
32
|
-
target = File.expand_path('spec/fixtures/sample_files/my_app/config/database.yml')
|
33
|
-
mg.copy_list[target].should eq(file)
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'get render list' do
|
37
|
-
mg.prepare
|
38
|
-
file = File.expand_path('spec/fixtures/sample_files/module_2/Gemfile.liquid')
|
39
|
-
target = File.expand_path('spec/fixtures/sample_files/my_app/Gemfile')
|
40
|
-
mg.render_list[target].should eq(file)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
data/spec/stackup_spec.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe AppStack do
|
5
|
-
describe '.stackup!' do
|
6
|
-
it 'copy proper files' do
|
7
|
-
AppStack.stackup!('spec/fixtures/sample_files/my_app/app_stack.yml')
|
8
|
-
File.exists?('spec/fixtures/sample_files/my_app/config/boot_sample.rb').should be_false
|
9
|
-
File.exists?('spec/fixtures/sample_files/my_app/doc/including.txt').should be_true
|
10
|
-
File.exists?('spec/fixtures/sample_files/my_app/app/lib/sequence.rb').should be_true
|
11
|
-
File.read('spec/fixtures/sample_files/my_app/Gemfile').should eq("Mod2: my_app\n")
|
12
|
-
File.read('spec/fixtures/sample_files/my_app/doc/excluding.txt').should eq("from my_app\n")
|
13
|
-
File.read('spec/fixtures/sample_files/my_app/local.conf').should eq("set to my_app\n")
|
14
|
-
FileUtils.rm_rf 'spec/fixtures/sample_files/my_app'
|
15
|
-
FileUtils.cp_r 'spec/fixtures/sample_files/my_app_back', 'spec/fixtures/sample_files/my_app'
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
File without changes
|
/data/spec/{fixtures/sample_files/module_1/Gemfile → examples/find_conf_file/both/app_stack.yml}
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|