app_stack 1.1.4 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. data/Gemfile.lock +43 -0
  2. data/README.md +49 -38
  3. data/doc/coverage/.last_run.json +1 -0
  4. data/doc/coverage/.resultset.json +1 -0
  5. data/doc/coverage/assets/0.7.1/application.css +1110 -0
  6. data/doc/coverage/assets/0.7.1/application.js +626 -0
  7. data/doc/coverage/assets/0.7.1/fancybox/blank.gif +0 -0
  8. data/doc/coverage/assets/0.7.1/fancybox/fancy_close.png +0 -0
  9. data/doc/coverage/assets/0.7.1/fancybox/fancy_loading.png +0 -0
  10. data/doc/coverage/assets/0.7.1/fancybox/fancy_nav_left.png +0 -0
  11. data/doc/coverage/assets/0.7.1/fancybox/fancy_nav_right.png +0 -0
  12. data/doc/coverage/assets/0.7.1/fancybox/fancy_shadow_e.png +0 -0
  13. data/doc/coverage/assets/0.7.1/fancybox/fancy_shadow_n.png +0 -0
  14. data/doc/coverage/assets/0.7.1/fancybox/fancy_shadow_ne.png +0 -0
  15. data/doc/coverage/assets/0.7.1/fancybox/fancy_shadow_nw.png +0 -0
  16. data/doc/coverage/assets/0.7.1/fancybox/fancy_shadow_s.png +0 -0
  17. data/doc/coverage/assets/0.7.1/fancybox/fancy_shadow_se.png +0 -0
  18. data/doc/coverage/assets/0.7.1/fancybox/fancy_shadow_sw.png +0 -0
  19. data/doc/coverage/assets/0.7.1/fancybox/fancy_shadow_w.png +0 -0
  20. data/doc/coverage/assets/0.7.1/fancybox/fancy_title_left.png +0 -0
  21. data/doc/coverage/assets/0.7.1/fancybox/fancy_title_main.png +0 -0
  22. data/doc/coverage/assets/0.7.1/fancybox/fancy_title_over.png +0 -0
  23. data/doc/coverage/assets/0.7.1/fancybox/fancy_title_right.png +0 -0
  24. data/doc/coverage/assets/0.7.1/fancybox/fancybox-x.png +0 -0
  25. data/doc/coverage/assets/0.7.1/fancybox/fancybox-y.png +0 -0
  26. data/doc/coverage/assets/0.7.1/fancybox/fancybox.png +0 -0
  27. data/doc/coverage/assets/0.7.1/favicon_green.png +0 -0
  28. data/doc/coverage/assets/0.7.1/favicon_red.png +0 -0
  29. data/doc/coverage/assets/0.7.1/favicon_yellow.png +0 -0
  30. data/doc/coverage/assets/0.7.1/loading.gif +0 -0
  31. data/doc/coverage/assets/0.7.1/magnify.png +0 -0
  32. data/doc/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  33. data/doc/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  34. data/doc/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  35. data/doc/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  36. data/doc/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  37. data/doc/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  38. data/doc/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  39. data/doc/coverage/assets/0.7.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  40. data/doc/coverage/assets/0.7.1/smoothness/images/ui-icons_222222_256x240.png +0 -0
  41. data/doc/coverage/assets/0.7.1/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  42. data/doc/coverage/assets/0.7.1/smoothness/images/ui-icons_454545_256x240.png +0 -0
  43. data/doc/coverage/assets/0.7.1/smoothness/images/ui-icons_888888_256x240.png +0 -0
  44. data/doc/coverage/assets/0.7.1/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  45. data/doc/coverage/index.html +2420 -0
  46. data/lib/app_stack/config.rb +132 -0
  47. data/lib/app_stack/merger.rb +127 -0
  48. data/lib/app_stack/version.rb +1 -1
  49. data/lib/app_stack.rb +15 -246
  50. data/spec/config_spec.rb +82 -0
  51. data/spec/fixtures/config_sample/sample.yml +19 -0
  52. data/spec/fixtures/config_sample/wrong_key.yml +2 -0
  53. data/spec/fixtures/config_sample/wrong_type.yml +1 -0
  54. data/spec/fixtures/sample_files/module_1/Gemfile.erb +1 -0
  55. data/spec/fixtures/sample_files/module_1/app_stack.yml +10 -0
  56. data/spec/fixtures/sample_files/module_1/doc/excluding.txt +1 -0
  57. data/spec/fixtures/sample_files/module_1/lib/mixins/b_lib.rb +0 -0
  58. data/spec/fixtures/sample_files/module_1/lib/mixins/s_lib.rb +0 -0
  59. data/spec/fixtures/sample_files/module_1/lib/samples/a_lib.rb +0 -0
  60. data/spec/fixtures/sample_files/module_1/spec/config_spec.rb +0 -0
  61. data/spec/fixtures/sample_files/module_2/Gemfile +0 -0
  62. data/spec/fixtures/sample_files/module_2/Gemfile.liquid +1 -0
  63. data/spec/fixtures/sample_files/module_2/app/lib/sequence.rb +0 -0
  64. data/spec/fixtures/sample_files/module_2/app_stack.yml +3 -0
  65. data/spec/fixtures/sample_files/module_3/app_stack.yml +3 -0
  66. data/spec/fixtures/sample_files/module_3/bin/del +0 -0
  67. data/spec/fixtures/sample_files/module_3/bin/rm +0 -0
  68. data/spec/fixtures/sample_files/module_3/config/application.yml +0 -0
  69. data/spec/fixtures/sample_files/module_3/config/database_development.yml +0 -0
  70. data/spec/fixtures/sample_files/module_3/config/database_production.yml +0 -0
  71. data/spec/fixtures/sample_files/module_3/lib/libfile_1.rb +0 -0
  72. data/spec/fixtures/sample_files/module_3/lib/libfile_2.rb +0 -0
  73. data/spec/fixtures/sample_files/my_app/app_stack.yml +15 -0
  74. data/spec/fixtures/sample_files/my_app/doc/excluding.txt +1 -0
  75. data/spec/fixtures/sample_files/my_app/spec/config_spec.rb +0 -0
  76. data/spec/fixtures/sample_files/my_app_back/app_stack.yml +15 -0
  77. data/spec/fixtures/sample_files/my_app_back/doc/excluding.txt +1 -0
  78. data/spec/fixtures/sample_files/my_app_back/spec/config_spec.rb +0 -0
  79. data/spec/merger_spec.rb +43 -0
  80. data/spec/spec_helper.rb +6 -8
  81. data/spec/stackup_spec.rb +11 -50
  82. metadata +94 -47
  83. data/spec/app_as_hash_spec.rb +0 -15
  84. data/spec/export_list_spec.rb +0 -66
  85. data/spec/fixtures/.app_stack.yml +0 -21
  86. data/spec/fixtures/app-sample.yml +0 -25
  87. data/spec/fixtures/incexc/.gitignore +0 -27
  88. data/spec/fixtures/incexc/incexc-config.yml +0 -24
  89. data/spec/fixtures/incexc/lib/anyway.rb +0 -1
  90. data/spec/fixtures/incexc/lib/extra/excludes.rb +0 -1
  91. data/spec/fixtures/incexc/lib/mixin/otherlib.rb +0 -1
  92. data/spec/fixtures/incexc/spec/spec_helper.rb +0 -1
  93. data/spec/fixtures/incexc/spec/support/api_test.rb +0 -1
  94. data/spec/fixtures/incexc-config.yml +0 -23
  95. data/spec/fixtures/my_app/.app_stack.yml +0 -31
  96. data/spec/fixtures/my_app/.gitignore +0 -27
  97. data/spec/fixtures/my_app/config/self_render.conf.erb +0 -1
  98. data/spec/fixtures/sample_config.yml +0 -21
  99. data/spec/fixtures/stack_apps/module-1/.app_stack.yml +0 -17
  100. data/spec/fixtures/stack_apps/module-1/Gemfile +0 -3
  101. data/spec/fixtures/stack_apps/module-1/lib/auth_util.rb +0 -5
  102. data/spec/fixtures/stack_apps/module-1/lib/libonly1.rb +0 -6
  103. data/spec/fixtures/stack_apps/module-2/.app_stack.yml +0 -22
  104. data/spec/fixtures/stack_apps/module-2/Gemfile.erb +0 -11
  105. data/spec/fixtures/stack_apps/module-2/lib/auth_util.rb +0 -6
  106. data/spec/fixtures/stack_apps/module-2/lib/libonly2.rb +0 -6
  107. data/spec/gitignore_list_spec.rb +0 -21
  108. data/spec/load_configuration_spec.rb +0 -16
  109. data/spec/register_self_spec.rb +0 -13
  110. /data/spec/fixtures/{stack_apps/module-2 → sample_files/module_1}/Gemfile +0 -0
  111. /data/spec/fixtures/{incexc → sample_files/module_1}/Rakefile +0 -0
  112. /data/spec/fixtures/{incexc/.rspec → sample_files/module_1/config/boot_sample.rb} +0 -0
  113. /data/spec/fixtures/{incexc/Rakefile.erb → sample_files/module_1/doc/including.txt} +0 -0
data/Gemfile.lock ADDED
@@ -0,0 +1,43 @@
1
+ GEM
2
+ remote: http://ruby.taobao.org/
3
+ specs:
4
+ activesupport (4.0.0)
5
+ i18n (~> 0.6, >= 0.6.4)
6
+ minitest (~> 4.2)
7
+ multi_json (~> 1.3)
8
+ thread_safe (~> 0.1)
9
+ tzinfo (~> 0.3.37)
10
+ atomic (1.1.13)
11
+ diff-lcs (1.2.4)
12
+ i18n (0.6.5)
13
+ minitest (4.7.5)
14
+ multi_json (1.8.0)
15
+ rspec (2.14.1)
16
+ rspec-core (~> 2.14.0)
17
+ rspec-expectations (~> 2.14.0)
18
+ rspec-mocks (~> 2.14.0)
19
+ rspec-core (2.14.5)
20
+ rspec-expectations (2.14.3)
21
+ diff-lcs (>= 1.1.3, < 2.0)
22
+ rspec-mocks (2.14.3)
23
+ simplecov (0.7.1)
24
+ multi_json (~> 1.0)
25
+ simplecov-html (~> 0.7.1)
26
+ simplecov-html (0.7.1)
27
+ term-ansicolor (1.2.2)
28
+ tins (~> 0.8)
29
+ thread_safe (0.1.2)
30
+ atomic
31
+ tilt (1.4.1)
32
+ tins (0.11.0)
33
+ tzinfo (0.3.37)
34
+
35
+ PLATFORMS
36
+ ruby
37
+
38
+ DEPENDENCIES
39
+ activesupport (>= 3.2.14)
40
+ rspec (>= 2.14.1)
41
+ simplecov (>= 0.7.1)
42
+ term-ansicolor (>= 1.2.2)
43
+ tilt (>= 1.4.1)
data/README.md CHANGED
@@ -1,28 +1,47 @@
1
- # Merge Source Code from Directories in Chain
1
+ # Merge Source Files from Directories in Chain
2
2
 
3
3
  ## Concept
4
4
 
5
- Build your application by copy source files from
6
- a stack of modules.
5
+ Import source files from a chain of application modules.
7
6
 
8
7
  ## Synposis
9
8
 
10
9
  Put a configuration file `.app_stack.yml` in your application
11
10
  directory, in format like:
12
11
 
13
- stack:
12
+ stack_dir: '../'
13
+
14
+ The directory contains other modules to import.
15
+
16
+ stack:
14
17
  - module-1
15
18
  - module-2: [defaults, tests]
16
- stack_dir: '../stack-apps'
17
- tpl_ext: '.erb'
18
- verbose: 1
19
+ - module-3:
20
+ - defaults
21
+ - file_a.html: file_a.htm
22
+ - file_b.txt: ''
23
+
24
+ Define three modules to import (in directory `../module-1`, ...). Accord to the
25
+ above setting, stack_app will copy `default` set of files exported by `module-1`,
26
+ the `default` and `tests` set of files from `module-2` (file sets defined as string
27
+ in array), and `defaults` set of files from `module-3`, plus `file_a.html` copied
28
+ as `file_a.htm` and `file_b.txt` copied as it is (single files defined as a hash).
29
+
30
+ exclude:
31
+ - config/*
32
+ - filename_2
33
+
34
+ Do not copy `config/*` and single file `filename_2` from the stack.
35
+
19
36
  export:
20
37
  - lib/**/*.rb
21
38
  - app/**/*.rb
22
39
  - tests:
23
40
  - spec/**/*.rb
24
- exclude:
25
- - lib/extra/*.rb
41
+
42
+ When used as a stack module, export the above files where ruby files under `lib/`
43
+ and `app` are in the `defaults` set, besides with the `tests` set.
44
+
26
45
  attrs:
27
46
  application_name: App Name
28
47
  application_code: app_code
@@ -32,45 +51,37 @@ directory, in format like:
32
51
  - rspec: '~> 2.0.0'
33
52
  - ...
34
53
  development:
35
- files:
36
- README.md: __self
37
-
38
54
 
39
- `stack`
40
- : 设置导入的模块名,元素为字符串(只导入'default'组的文件)或Hash,
41
- : 为Hash时,key为模块名,值为文件组的数组('all'代表全部)。
55
+ `attrs` can be inserted into `.erb` files.
56
+
57
+ stack_dir: '../'
42
58
 
43
- `stack_dir`(默认为`../stack-apps`)
44
- : 模块程序所在位置。
59
+ Define directory where the source code of stack modules located. Default is `../`
45
60
 
46
- `export`(默认为空)
47
- : 可被拷贝至其他模块的文件pattern(为字符串时),或pattern的组
48
- : (像上述示例中的`tests`一样)。
61
+ tpl_ext: ['.erb', '.haml', '.liquid']
49
62
 
50
- `exclude`(默认为空)
51
- : 导出到其它模块时,从`export`列表中除外的文件pattern。
52
- : 注意如果模块中定义了`.gitignore`文件,则其中的内容也会被加载至
53
- : `exclude`列表。
63
+ Default as above (refer to document below).
54
64
 
55
- `attrs`
56
- : 用于assign至`.erb`文件的属性值。在上面的例子中module2会继承
57
- : module1中设置的值。
65
+ ## Copy Precedence
58
66
 
59
- `files` field is auto-generated, you should not edit it manually.
67
+ For a module chain `a, b, c, ...`, files exported by `b` will over-write
68
+ the same files exported by `a` and so on.
60
69
 
61
- `export` defines files that should be copied when other modules include
62
- the current module. Besides `export`, the acquire module can use `include`
63
- and `exclude` adjust files that imports from other modules.
70
+ If you want the files defined in `a`, manually copy it to the local directory
71
+ and set it to `exclude` list.
64
72
 
65
- Variables defined in `attrs` will be assigned into `.erb` files.
73
+ Note: `exclude` means 'use local file if exists, otherwise copy it', not
74
+ 'do not copy it'.
66
75
 
67
- `gems` need a support from `Gemfile.erb`.
76
+ ## Template
68
77
 
69
- ## Templates
78
+ If defined to export, for example `Gemfile`, and also defined a `Gemfile.erb`,
79
+ the later will be used as a template to render `Gemefile`.
70
80
 
71
- If you have both a `config.yml` and a `config.yml.erb` file, when export,
72
- the `config.yml.erb` will be used instead of `config.yml`, and `attrs` will
73
- be assigned into this file.
81
+ For a module chain `a, b, c, ...`, `attrs` defined in `c` will merged into
82
+ `attrs` defined in `b` ... and then assigned into the `erb` template.
74
83
 
75
- Variables in `attrs` will be merged in chain follows the app-stack.
84
+ App_stack use tilt to support `.erb`, `.haml` and `.liquid`, if a file have
85
+ more than one template defined, the later will silently over-write the former.
86
+ You can change the order in `tpl_ext` setting.
76
87
 
@@ -0,0 +1 @@
1
+ {"result":{"covered_percent":94.33}}
@@ -0,0 +1 @@
1
+ {"RSpec":{"coverage":{"/cygdrive/d/working/gems/app_stack-gem/lib/app_stack.rb":[null,null,1,1,1,1,1,1,1,null,1,null,2,null,1,null,1,null,null,1,1,null,null,null,1,null,1,1,null,null,1,null,null,1,null],"/cygdrive/d/working/gems/app_stack-gem/lib/app_stack/config.rb":[null,1,null,1,1,null,null,1,1,null,1,39,39,null,null,39,null,null,null,null,null,null,null,null,null,39,null,68,null,null,67,66,null,null,null,37,null,null,null,37,315,null,null,null,37,null,null,1,244,null,null,null,1,2,null,null,1,22,null,null,null,1,34,34,34,null,null,1,49,null,null,1,42,14,14,14,null,null,28,null,null,null,1,null,null,1,null,24,24,88,20,20,20,null,null,68,68,null,null,24,null,null,null,1,100,100,null,10,10,10,10,null,null,90,126,null,null,100,null,null,null,null,1,92,92,92,100,null,92,null,null,null],"/cygdrive/d/working/gems/app_stack-gem/lib/app_stack/merger.rb":[null,null,1,null,1,1,null,1,null,7,7,7,null,7,7,7,7,null,7,7,7,null,null,1,3,3,9,48,48,3,null,6,null,null,39,39,117,null,null,39,6,null,33,null,null,null,9,null,null,3,0,0,0,null,null,0,0,0,null,null,null,null,1,1,12,2,null,null,1,null,1,11,11,11,null,null,1,1,1,1,1,1,null,0,0,null,1,null,null,null,1,7,null,7,null,28,null,0,21,null,null,null,null,1,21,21,21,21,21,21,63,21,null,null,null,1,84,45,6,null,null,1,0,0,null,null,null],"/cygdrive/d/working/gems/app_stack-gem/spec/fixtures/sample_files/module_1/spec/config_spec.rb":[],"/cygdrive/d/working/gems/app_stack-gem/spec/fixtures/sample_files/my_app/spec/config_spec.rb":[],"/cygdrive/d/working/gems/app_stack-gem/spec/fixtures/sample_files/my_app_back/spec/config_spec.rb":[],"/cygdrive/d/working/gems/app_stack-gem/spec/merger_spec.rb":[null,null,1,null,1,7,1,1,1,null,null,1,1,1,null,null,1,1,1,null,null,1,1,1,null,null,null,1,1,1,1,1,1,null,null,1,1,1,1,1,null,null,null],"/cygdrive/d/working/gems/app_stack-gem/spec/stackup_spec.rb":[null,1,null,1,1,1,1,1,1,1,1,1,1,1,null,null,null]},"timestamp":1380702239}}