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
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+ # libraries neither in the API layer nor in the database layer
3
+
4
+ # load and setup ruby gems system
5
+ require 'rubygems'
6
+ require 'bundler/setup'
7
+ require 'active_support/inflector/inflections' # :underscore
8
+
9
+ # load environment specific variables
10
+ # require ENV['APP_ROOT'] + '/config/env_' + ENV['RACK_ENV']
11
+
12
+ # extend load path
13
+ %w[app/lib lib].map { |d| $LOAD_PATH.unshift ENV['APP_ROOT'] + '/' + d }
14
+ # Dir[ENV['APP_ROOT'] + '/lib/**/*.rb'].each { |f| require f }
15
+ # Dir[ENV['APP_ROOT'] + '/app/lib/**/*.rb'].each { |f| require f }
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+
3
+ require 'mongoid'
4
+
5
+ # load configuration
6
+ Mongoid.load!(ENV['APP_ROOT'] + '/config/mongoid.yml', ENV['RACK_ENV'])
7
+
8
+ # load mixin function and custom modules into Mongoid
9
+ Dir[ENV['APP_ROOT'] + '/lib/mongoid/*.rb'].each { |f| require f }
10
+
11
+ # load all application models
12
+ Dir[ENV['APP_ROOT'] + '/app/models/**/*.rb'].each { |f| require f }
@@ -0,0 +1,22 @@
1
+ # Tell Mongoid which environment this configuration is for.
2
+ development:
3
+ sessions:
4
+ default:
5
+ hosts:
6
+ - localhost:27017
7
+ database: la_mongoid_dev
8
+ production:
9
+ sessions:
10
+ default:
11
+ hosts:
12
+ - localhost:27017
13
+ database: la_mongoid
14
+ test:
15
+ sessions:
16
+ default:
17
+ hosts:
18
+ - localhost:27017
19
+ database: la_mongoid_test
20
+ options:
21
+ allow_dynamic_fields: false
22
+ safe: true
@@ -0,0 +1,22 @@
1
+ # Tell Mongoid which environment this configuration is for.
2
+ development:
3
+ sessions:
4
+ default:
5
+ hosts:
6
+ - <%= mongodb_host %>
7
+ database: <%= application_code %>_dev
8
+ production:
9
+ sessions:
10
+ default:
11
+ hosts:
12
+ - <%= mongodb_host %>
13
+ database: <%= application_code %>
14
+ test:
15
+ sessions:
16
+ default:
17
+ hosts:
18
+ - <%= mongodb_host %>
19
+ database: <%= application_code %>_test
20
+ options:
21
+ allow_dynamic_fields: false
22
+ safe: true
@@ -0,0 +1,11 @@
1
+ source 'http://ruby.taobao.org/'
2
+
3
+ <% gems['default'].each do |g, v| %>
4
+ gem '<%= g %>'<% if v.size > 0 %>, '<%= v %>'<% end %>
5
+ <% end %>
6
+
7
+ group :development do
8
+ <% gems['development'].each do |g, v| %>
9
+ gem '<%= g %>'<% if v.size > 0 %>, '<%= v %>'<% end %>
10
+ <% end %>
11
+ end
@@ -0,0 +1,16 @@
1
+ export:
2
+ - lib/la_assets.rb
3
+ - app/lib/helpers/assets_helper.rb
4
+ - lib/tasks/assets.rake
5
+ - example:
6
+ - public/assets/definition.yml
7
+ - tests: []
8
+ - settings: []
9
+ attrs:
10
+ gems:
11
+ default:
12
+ sass: ''
13
+ closure-compiler: ''
14
+ term-ansicolor: ''
15
+ development: {}
16
+ services: {}
@@ -0,0 +1,4 @@
1
+ # encoding: utf-8
2
+
3
+ # not stacked ruby class
4
+ class NotStacked; end
@@ -0,0 +1,82 @@
1
+ import:
2
+ - la-mongoid
3
+ - la-sinatra:
4
+ - tests
5
+ sync:
6
+ - la-mongoid
7
+ - la-assets-helper:
8
+ - default
9
+ - Rakefile: Rakefile
10
+ - la-sinatra:
11
+ - settings
12
+ - tests
13
+ render:
14
+ - la-sinatra: { Gemfile.erb: Gemfile, Procfile.erb: Procfile }
15
+ - la-mongoid: { config/mongoid.yml.erb: '' }
16
+ render_local: { Trivia.erb: Trivia }
17
+ export:
18
+ - app/lib/bases/web_application.rb
19
+ - lib/la_assets.rb
20
+ - lib/tasks/assets.rake
21
+ - app/lib/helpers/assets_helper.rb
22
+ - app/lib/helpers/slim_helper.rb
23
+ - app/lib/helpers/flash_i18n_errors_helper.rb
24
+ - app/lib/helpers/form_helper.rb
25
+ - features/support/*
26
+ - features/step_definitions/web_steps.rb
27
+ - lib/tasks/cucumber.rake
28
+ - lib/tasks/generator.rake
29
+ - public/assets/definition.yml
30
+ - gemfile:
31
+ - Gemfile
32
+ - rakefile:
33
+ - Rakefile
34
+ - foreman:
35
+ - Procfile
36
+ - cucumber:
37
+ - features/support/*
38
+ - features/step_definitions/web_steps.rb
39
+ - lib/task/cucumber.rake
40
+ - setup:
41
+ - .gitignore
42
+ - config.ru
43
+ - config/boot.rb
44
+ - config/exceptions.rb
45
+ - config/environment.rb
46
+ - config/application.rb
47
+ - config/route.rb
48
+ - app/lib/sinatra/mount.rb
49
+ - auth:
50
+ - app/lib/helpers/auth_helper.rb
51
+ attrs:
52
+ application_code: la_sinatra
53
+ application_name: Sinatra API/Web Frameword
54
+ gems:
55
+ default:
56
+ activesupport: ''
57
+ rack-session-mongo: ''
58
+ sinatra: ''
59
+ sinatra-contrib: ''
60
+ sinatra-r18n: ''
61
+ sinatra-flash: ''
62
+ slim: ''
63
+ puma: ''
64
+ gibberish: ''
65
+ bcrypt-ruby: ''
66
+ will_paginate_mongoid: ''
67
+ development:
68
+ rspec: ''
69
+ cucumber: ''
70
+ capybara: ''
71
+ poltergeist: ''
72
+ html2slim: ''
73
+ foreman: ''
74
+ simplecov: ''
75
+ rake: ''
76
+ rubocop: ''
77
+ sass: ''
78
+ closure-compiler: ''
79
+ term-ansicolor: ''
80
+ rspec_api_documentation: ''
81
+ services:
82
+ puma: 'bundle exec puma -p 8080 --pidfile /tmp/puma.pid'
@@ -0,0 +1,4 @@
1
+ ---
2
+ export:
3
+ - file1
4
+ - thy_group: file2
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe AppStack::App do
6
+ describe '#load_stack!' do
7
+ subject { AppStack::App.new(examples('sample_config/app_stack.yml')) }
8
+ it 'load stacked applications' do
9
+ subject.load_stack!
10
+ subject.app_stacks.size.should eq(3)
11
+ end
12
+ end
13
+ end
data/spec/spec_helper.rb CHANGED
@@ -9,6 +9,11 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
9
9
 
10
10
  require 'app_stack'
11
11
 
12
+ def examples(path)
13
+ File.join('spec/examples', path)
14
+ end
15
+
12
16
  # reset files tructure of the my_app folder
13
- FileUtils.rm_rf 'spec/fixtures/sample_files/my_app'
14
- FileUtils.cp_r 'spec/fixtures/sample_files/my_app_back', 'spec/fixtures/sample_files/my_app'
17
+ # FileUtils.rm_rf 'spec/fixtures/sample_files/my_app'
18
+ # FileUtils.cp_r 'spec/fixtures/sample_files/my_app_back',
19
+ # 'spec/fixtures/sample_files/my_app'