app_stack 0.0.9 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDUwNTI1MmNlNmI0OGFiNjBkZjU1ZDI3YjgyOTE0YTExNmVlMTBiNw==
4
+ MmFmMzhjYjBiYmRmNjZkZjFjNGIxZWU5OThjZjJhOTRhNGJlZWUwNg==
5
5
  data.tar.gz: !binary |-
6
- ZGMxZTc2MjFhYjNmYjlkZTQwZTg3Yjc0YjZkMTVlNGUwYjQyYTE2MA==
6
+ MGRmMTNmYWY5NWI1ODY0ZWVmNDdmZDcxYmFmNTQyNzhkMzBlN2YwMw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YmUyN2VlNWM2MTU2M2RmNDE5YjY4YWVkY2UxZmUyODE3MWRjN2FmYjdiNTBj
10
- NmI5MTgwODM4YTUwYTU3ZjIzNmViMzIzYTQ1NWY0Y2IyNzE4ODgxN2UzMDk0
11
- MGUwMzNlMjBkNjc5Nzk2N2ZjMWMyYThkYzRjZTEyYzRmZGNhMTc=
9
+ YmRjYmU4N2MwZDIxYmUyMDRjM2FlMDRjNGIwN2RmZTA0YjhjZDU5MDgzYmFh
10
+ OTI3Yjk3NTFiM2FjNzRmMDI1YjM4YWU4ZWQ3OWM0NGZmNTMyMTg1OTMzYjk3
11
+ NWM4YTUwZGVhZDcyOTRlMTZmYWI3MTNjOGE5Mzk2MzEyYjQxN2Y=
12
12
  data.tar.gz: !binary |-
13
- YWI1YzEzZGFkMDcxOTk2OTc4NWFhNjBlNDI5ODFiZTFmYzkxMjNlNmMwZGJm
14
- NTIyY2NiM2JkZTc1NmU4M2NhZjE0MWMzODBkODFjMzA4YWFjMjQ5MmZkOGE0
15
- MjdkZDVlZTk0Mzg1NTI5ZTY1ZjY4MmE2YzJlZDIzZGZjNDdlZWU=
13
+ ZjFkODQzOTVjZTA1ZDNjZWFjYjRjZWNjMjNkNTRmYmE0ZTVjNTQyZWQ5MDNi
14
+ YmQwODA1MTQwZGZkZGUxMGVmNWIzY2UyZDMyNWEwM2Y3YWNhZDE5ZDJjOTUy
15
+ NTY3ZTlhZDEyYzU4MDliN2U3NmUxYzNlZGRhYmFjMTM4YzVjMjU=
@@ -2,5 +2,5 @@
2
2
 
3
3
  # AppStack module
4
4
  module AppStack
5
- VERSION = '0.0.9'
5
+ VERSION = '1.0.0'
6
6
  end
data/lib/app_stack.rb CHANGED
@@ -95,7 +95,6 @@ module AppStack
95
95
  raise "no directory found for #{app}" unless File.directory?(app_dir)
96
96
  raise "no configuration found for #{app}" unless
97
97
  File.exists?(app_dir + '/' + File.basename(@conf_file))
98
- carp "Merge #{app.bold.blue}"
99
98
 
100
99
  # loop over remote files
101
100
  elist = export_list(app_dir)
@@ -107,23 +106,28 @@ module AppStack
107
106
  src_f = File.expand_path(app_dir + '/' + file)
108
107
  tgt_f = File.expand_path(@app_root + '/' + file)
109
108
 
110
- if @files[file].nil? || @files[file] == app # yes, copy it
111
- @files[file] = app unless @files[file]
112
-
113
- carp "From #{app.blue.bold} copy #{file.bold}",
114
- copy_file!(src_f, tgt_f),
115
- 1 unless File.exists?(src_f + @config['tpl_ext'])
109
+ if @files[file] == '__self' # don't handle it
110
+ carp "From #{app.blue.bold} #{file.bold}",
111
+ 'skip, use '.white + @files[file], 2
112
+ else # not registered as self, copy over
113
+ unless @files[file] == app
114
+ carp "By #{app.bold.blue}, overwrite #{@files[file].bold} #{file}",
115
+ 'ok'.green, 1 if @files[file]
116
+ @files[file] = app
117
+ end
118
+
119
+ if File.exists?(src_f + @config['tpl_ext'])
120
+ carp "From #{app.blue.bold} render #{file.bold}",
121
+ render_file!(src_f + @config['tpl_ext'], tgt_f), 1
122
+
123
+ else
124
+ carp "From #{app.blue.bold} copy #{file.bold}",
125
+ copy_file!(src_f, tgt_f), 1
126
+ end
116
127
 
117
128
  # register the copied file to app-root file list
118
129
  @self_files << file unless @self_files.include?(file)
119
- else # don't handle it
120
- carp "From #{app.blue.bold} #{file.bold}",
121
- 'skip, use '.white + @files[file], 2
122
130
  end
123
-
124
- carp "From #{app.blue.bold} render #{file.bold}",
125
- render_file!(src_f + @config['tpl_ext'], tgt_f),
126
- 1 if File.exists?(src_f + @config['tpl_ext'])
127
131
  end
128
132
  end
129
133
  end
@@ -214,7 +218,7 @@ module AppStack
214
218
 
215
219
  # render from erb if newer
216
220
  def render_file!(f, target)
217
- done = 'keep'.white
221
+ # done = 'keep'.white
218
222
  # if newer?(f, target)
219
223
  tilt = Tilt::ERBTemplate.new(f)
220
224
  oh = File.open(target, 'wb')
@@ -23,12 +23,12 @@ attrs:
23
23
  files:
24
24
  .app_stack.yml: __self
25
25
  .gitignore: __self
26
- Gemfile: __self
27
26
  config: __self
28
27
  config/self_render.conf: __self
29
28
  config/self_render.conf.erb: __self
30
29
  lib: __self
31
- lib/auth_util.rb: __self
30
+ lib/auth_util.rb: module-2
32
31
  lib/libonly1.rb: module-1
33
32
  lib/libonly2.rb: module-2
33
+ Gemfile: module-2
34
34
  tpl_ext: .erb
@@ -3,7 +3,6 @@ export:
3
3
  - lib/**/*.rb
4
4
  - config/**/*
5
5
  - app/**/*.rb
6
- - Gemfile
7
6
  attrs:
8
7
  application_name: App Name for Module 1
9
8
  application_code: module_1_code
data/spec/stackup_spec.rb CHANGED
@@ -5,13 +5,14 @@ describe AppStack do
5
5
  before(:all) do
6
6
  FileUtils.cp 'spec/fixtures/.app_stack.yml', 'spec/fixtures/my_app'
7
7
 
8
- %w[config/self_render.conf Gemfile].each do |f|
8
+ %w[config/self_render.conf].each do |f|
9
9
  FileUtils.touch('spec/fixtures/my_app/' + f)
10
10
  end
11
11
 
12
- sleep 1
12
+ # sleep 1
13
13
 
14
14
  FileUtils.touch('spec/fixtures/my_app/config/self_render.conf.erb')
15
+ FileUtils.touch('spec/fixtures/stack_apps/module-1/Gemfile')
15
16
  FileUtils.touch('spec/fixtures/stack_apps/module-2/Gemfile.erb')
16
17
 
17
18
  # run the stackup script
@@ -45,7 +46,7 @@ describe AppStack do
45
46
  end
46
47
 
47
48
  after(:all) do
48
- %w[config/self_render.conf Gemfile
49
+ %w[config/self_render.conf Gemfile lib/auth_util.rb
49
50
  lib/libonly1.rb lib/libonly2.rb].each do |f|
50
51
  file = 'spec/fixtures/my_app/' + f
51
52
  FileUtils.rm(file) if File.exists?(file)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Huang Wei
@@ -107,7 +107,6 @@ files:
107
107
  - spec/fixtures/my_app/.app_stack.yml
108
108
  - spec/fixtures/my_app/.gitignore
109
109
  - spec/fixtures/my_app/config/self_render.conf.erb
110
- - spec/fixtures/my_app/lib/auth_util.rb
111
110
  - spec/fixtures/sample_config.yml
112
111
  - spec/fixtures/stack_apps/module-1/.app_stack.yml
113
112
  - spec/fixtures/stack_apps/module-1/Gemfile
@@ -155,7 +154,6 @@ test_files:
155
154
  - spec/fixtures/incexc/lib/mixin/otherlib.rb
156
155
  - spec/fixtures/incexc/spec/spec_helper.rb
157
156
  - spec/fixtures/incexc/spec/support/api_test.rb
158
- - spec/fixtures/my_app/lib/auth_util.rb
159
157
  - spec/fixtures/stack_apps/module-1/lib/auth_util.rb
160
158
  - spec/fixtures/stack_apps/module-1/lib/libonly1.rb
161
159
  - spec/fixtures/stack_apps/module-2/lib/auth_util.rb
@@ -1,5 +0,0 @@
1
- # encoding: utf-8
2
-
3
- def auth_util
4
- 'auth_util from module 1'
5
- end