app_stack 1.3.4 → 1.4.0

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.
Files changed (79) hide show
  1. checksums.yaml +15 -0
  2. data/Gemfile +6 -5
  3. data/Gemfile.lock +17 -5
  4. data/README.md +13 -1
  5. data/app_stack.gemspec +6 -5
  6. data/lib/app_stack/app.rb +86 -0
  7. data/lib/app_stack/cli_options.rb +42 -36
  8. data/lib/app_stack/compare_list.rb +195 -0
  9. data/lib/app_stack/configuration.rb +119 -0
  10. data/lib/app_stack/operator.rb +60 -0
  11. data/lib/app_stack/version.rb +1 -1
  12. data/lib/app_stack.rb +34 -6
  13. data/spec/app_stack_spec.rb +17 -0
  14. data/spec/cli_options_spec.rb +20 -0
  15. data/spec/compare_list_spec.rb +18 -0
  16. data/spec/configuration_spec.rb +95 -0
  17. data/spec/examples/la-assets-helper/app_stack.yml +14 -0
  18. data/spec/examples/la-assets-helper/lib/la_assets.rb +319 -0
  19. data/spec/examples/la-import_app/Trivia.erb +2 -0
  20. data/spec/examples/la-import_app/app_stack.yml +83 -0
  21. data/spec/examples/la-mongoid/app_stack.yml +49 -0
  22. data/spec/examples/la-mongoid/config/boot.rb +15 -0
  23. data/spec/examples/la-mongoid/config/database.rb +12 -0
  24. data/spec/examples/la-mongoid/config/mongoid.yml +22 -0
  25. data/spec/examples/la-mongoid/config/mongoid.yml.erb +22 -0
  26. data/spec/examples/la-sinatra/Gemfile.erb +11 -0
  27. data/spec/examples/la-sinatra/app_stack.yml +16 -0
  28. data/spec/examples/no-stacked/some_list.rb +4 -0
  29. data/spec/examples/sample_config/app_stack.yml +82 -0
  30. data/spec/examples/sample_config/hash_export.yml +4 -0
  31. data/spec/load_stack_spec.rb +13 -0
  32. data/spec/spec_helper.rb +7 -2
  33. data/tags +87 -34
  34. metadata +66 -87
  35. data/.app_stack.yml +0 -14
  36. data/bin/config_assets +0 -3
  37. data/lib/app_stack/copy_list_builder.rb +0 -147
  38. data/lib/app_stack/local_files_parser.rb +0 -95
  39. data/lib/app_stack/stack_app.rb +0 -119
  40. data/spec/config_spec.rb +0 -82
  41. data/spec/fixtures/config_sample/sample.yml +0 -19
  42. data/spec/fixtures/sample_files/module_1/Gemfile.erb +0 -1
  43. data/spec/fixtures/sample_files/module_1/app_stack.yml +0 -10
  44. data/spec/fixtures/sample_files/module_1/config/boot_sample.rb +0 -0
  45. data/spec/fixtures/sample_files/module_1/doc/excluding.txt +0 -1
  46. data/spec/fixtures/sample_files/module_1/doc/including.txt +0 -0
  47. data/spec/fixtures/sample_files/module_1/lib/mixins/b_lib.rb +0 -0
  48. data/spec/fixtures/sample_files/module_1/lib/mixins/s_lib.rb +0 -0
  49. data/spec/fixtures/sample_files/module_1/lib/samples/a_lib.rb +0 -0
  50. data/spec/fixtures/sample_files/module_1/spec/config_spec.rb +0 -0
  51. data/spec/fixtures/sample_files/module_2/Gemfile +0 -0
  52. data/spec/fixtures/sample_files/module_2/Gemfile.liquid +0 -1
  53. data/spec/fixtures/sample_files/module_2/app/lib/sequence.rb +0 -0
  54. data/spec/fixtures/sample_files/module_2/app_stack.yml +0 -3
  55. data/spec/fixtures/sample_files/module_3/app_stack.yml +0 -3
  56. data/spec/fixtures/sample_files/module_3/bin/del +0 -0
  57. data/spec/fixtures/sample_files/module_3/bin/rm +0 -0
  58. data/spec/fixtures/sample_files/module_3/config/application.yml +0 -0
  59. data/spec/fixtures/sample_files/module_3/config/database_development.yml +0 -0
  60. data/spec/fixtures/sample_files/module_3/config/database_production.yml +0 -0
  61. data/spec/fixtures/sample_files/module_3/lib/libfile_1.rb +0 -0
  62. data/spec/fixtures/sample_files/module_3/lib/libfile_2.rb +0 -0
  63. data/spec/fixtures/sample_files/my_app/app_stack.yml +0 -15
  64. data/spec/fixtures/sample_files/my_app/doc/excluding.txt +0 -1
  65. data/spec/fixtures/sample_files/my_app/local.conf +0 -0
  66. data/spec/fixtures/sample_files/my_app/local.conf.erb +0 -1
  67. data/spec/fixtures/sample_files/my_app/spec/config_spec.rb +0 -0
  68. data/spec/fixtures/sample_files/my_app_back/app_stack.yml +0 -15
  69. data/spec/fixtures/sample_files/my_app_back/doc/excluding.txt +0 -1
  70. data/spec/fixtures/sample_files/my_app_back/local.conf +0 -0
  71. data/spec/fixtures/sample_files/my_app_back/local.conf.erb +0 -1
  72. data/spec/fixtures/sample_files/my_app_back/spec/config_spec.rb +0 -0
  73. data/spec/merger_spec.rb +0 -43
  74. data/spec/stackup_spec.rb +0 -18
  75. /data/{file.erb → spec/examples/find_conf_file/both/.app_stack.yml} +0 -0
  76. /data/spec/{fixtures/sample_files/module_1/Gemfile → examples/find_conf_file/both/app_stack.yml} +0 -0
  77. /data/spec/{fixtures/sample_files/module_1/Rakefile → examples/find_conf_file/with_dot/.app_stack.yml} +0 -0
  78. /data/spec/{fixtures/config_sample → examples/sample_config}/wrong_key.yml +0 -0
  79. /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,19 +0,0 @@
1
- stack:
2
- - mod_a
3
- - mod_b:
4
- - file_a
5
- - file_b: file_b_target
6
- export:
7
- - Rakefile
8
- - tests:
9
- - spec/**/*
10
- - others:
11
- - Gemfile
12
- - Procfile
13
- exclude:
14
- - exclude_me
15
- attrs:
16
- outer:
17
- - inter:
18
- some_key: some_value
19
-
@@ -1 +0,0 @@
1
- Mod1: <%= application_code %>
@@ -1,10 +0,0 @@
1
- export:
2
- - lib/**/*.rb
3
- - doc/**/*
4
- - Gemfile
5
- - Rakefile
6
- - tests:
7
- - spec/**/*_spec.rb
8
- - config:
9
- - config/boot_sample.rb: config/boot.rb
10
-
@@ -1 +0,0 @@
1
- from module1
File without changes
@@ -1 +0,0 @@
1
- Mod2: {{ application_code }}
@@ -1,3 +0,0 @@
1
- export:
2
- - app/**/*.rb
3
- - Gemfile
@@ -1,3 +0,0 @@
1
- export:
2
- - lib/**/*.rb
3
- - bin/**/*
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 %>
@@ -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 %>
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