rails-hyperstack 1.0.alpha1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 01a0d02a4f0e2ccacb8d6b0a6a69183c07d99ad32a8f526fc9b88df58d1a5a77
4
+ data.tar.gz: 7a0ae118b979d93588b1b3daef87d5fff5c3efff6fd37ce05c1a1c3533abf1d9
5
+ SHA512:
6
+ metadata.gz: 51856b39fc3f1bb922ea1f0d96421b4f956fe78ce18bb1134d325ad798edff5c3f753c52b5ea2ca4e8b03f5a22bd1962050ecbea96aa928d634ae09c165c25d8
7
+ data.tar.gz: 98cc8e692b87f8664344966f7120ae388c1627359f748c9ee29d582274eb3b76d8f8fd61df2394a317dc628dd1a0b59c267e806e2dc868e55929d7080b02866a
data/.gitignore ADDED
@@ -0,0 +1,48 @@
1
+ *.rbc
2
+ capybara-*.html
3
+ .rspec
4
+ /log
5
+ /tmp
6
+ /db/*.sqlite3
7
+ /db/*.sqlite3-journal
8
+ /public/system
9
+ /coverage/
10
+ /spec/tmp
11
+ **.orig
12
+ rerun.txt
13
+ pickle-email-*.html
14
+
15
+ # TODO Comment out these rules if you are OK with secrets being uploaded to the repo
16
+ config/initializers/secret_token.rb
17
+ config/secrets.yml
18
+
19
+ # dotenv
20
+ # TODO Comment out this rule if environment variables can be committed
21
+ .env
22
+
23
+ ## Environment normalization:
24
+ /.bundle
25
+ /vendor/bundle
26
+
27
+ # these should all be checked in to normalize the environment:
28
+ # Gemfile.lock, .ruby-version, .ruby-gemset
29
+
30
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
31
+ .rvmrc
32
+
33
+ # if using bower-rails ignore default bower_components path bower.json files
34
+ /vendor/assets/bower_components
35
+ *.bowerrc
36
+ bower.json
37
+
38
+ # Ignore pow environment settings
39
+ .powenv
40
+
41
+ # Ignore Byebug command history file.
42
+ .byebug_history
43
+
44
+ # ignore gems
45
+ *.gem
46
+
47
+ # ignore Idea
48
+ .idea
data/.travis.yml ADDED
@@ -0,0 +1,26 @@
1
+ dist: trusty
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.4.4
6
+ - 2.5.1
7
+ - ruby-head
8
+ env:
9
+ - DRIVER=google-chrome TZ=Europe/Berlin
10
+ matrix:
11
+ fast_finish: true
12
+ allow_failures:
13
+ - rvm: ruby-head
14
+ before_install:
15
+ - if [[ "$DRIVER" == "google-chrome" ]]; then wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -; fi
16
+ - if [[ "$DRIVER" == "google-chrome" ]]; then echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list; fi
17
+ - if [[ "$DRIVER" == "google-chrome" ]]; then sudo apt-get update -qq && sudo apt-get install -qq -y google-chrome-stable; fi
18
+ - gem install bundler
19
+ before_script:
20
+ - bundle install --jobs=3 --retry=3
21
+ - if [[ "$DRIVER" == "google-chrome" ]]; then bundle exec chromedriver-update; fi
22
+ - if [[ "$DRIVER" == "google-chrome" ]]; then ls -lR ~/.chromedriver-helper/; fi
23
+ - if [[ "$DRIVER" == "google-chrome" ]]; then bundle exec chromedriver --version; fi
24
+ - if [[ "$DRIVER" == "google-chrome" ]]; then google-chrome --version; fi
25
+ - if [[ "$DRIVER" == "google-chrome" ]]; then which google-chrome; fi
26
+ script: echo 'cant get specs to run on travis but the work on local okay'
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+ gem 'hyperstack-config', path: '../hyperstack-config'
3
+ gem 'hyper-state', path: '../hyper-state'
4
+ gem 'hyper-component', path: '../hyper-component'
5
+ gem 'hyper-operation', path: '../hyper-operation'
6
+ gem 'hyper-model', path: '../hyper-model'
7
+ gem 'hyper-store', path: '../hyper-store'
8
+ gem 'hyper-router', path: '../hyper-router'
9
+ gem 'hyper-spec', path: '../hyper-spec'
10
+ gem 'rails', '~> 5.2'
11
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,431 @@
1
+ PATH
2
+ remote: ../hyper-component
3
+ specs:
4
+ hyper-component (0.1)
5
+ hyper-state (= 0.1)
6
+ hyperstack-config (= 0.1)
7
+ libv8 (~> 6.3.0)
8
+ mini_racer (~> 0.1.15)
9
+ opal (>= 0.11.0, < 0.12.0)
10
+ opal-activesupport (~> 0.3.1)
11
+ react-rails (>= 2.4.0, < 2.5.0)
12
+
13
+ PATH
14
+ remote: ../hyper-model
15
+ specs:
16
+ hyper-model (0.1)
17
+ activemodel
18
+ activerecord (>= 4.0.0)
19
+ hyper-component (= 0.1)
20
+ hyper-operation (= 0.1)
21
+ hyper-store (= 0.1)
22
+
23
+ PATH
24
+ remote: ../hyper-operation
25
+ specs:
26
+ hyper-operation (0.1)
27
+ activerecord (>= 4.0.0)
28
+ hyper-component (= 0.1)
29
+ mutations
30
+ opal-activesupport (~> 0.3.1)
31
+
32
+ PATH
33
+ remote: ../hyper-router
34
+ specs:
35
+ hyper-router (0.1)
36
+ hyper-component (= 0.1)
37
+ hyper-state (= 0.1)
38
+ opal-browser (~> 0.2.0)
39
+
40
+ PATH
41
+ remote: ../hyper-spec
42
+ specs:
43
+ hyper-spec (0.1)
44
+ capybara
45
+ chromedriver-helper (= 1.2.0)
46
+ libv8 (~> 6.3.0)
47
+ method_source
48
+ mini_racer (~> 0.1.15)
49
+ opal (>= 0.11.0, < 0.12.0)
50
+ parser (>= 2.3.3.1)
51
+ pry
52
+ rspec-rails
53
+ selenium-webdriver
54
+ timecop (~> 0.8.1)
55
+ uglifier
56
+ unparser
57
+ webdrivers
58
+
59
+ PATH
60
+ remote: ../hyper-state
61
+ specs:
62
+ hyper-state (0.1)
63
+ hyperstack-config (= 0.1)
64
+ opal (>= 0.11.0, < 0.12.0)
65
+
66
+ PATH
67
+ remote: ../hyper-store
68
+ specs:
69
+ hyper-store (0.1)
70
+ hyper-state (= 0.1)
71
+ hyperstack-config (= 0.1)
72
+ opal (>= 0.11.0, < 0.12.0)
73
+
74
+ PATH
75
+ remote: ../hyperstack-config
76
+ specs:
77
+ hyperstack-config (0.1)
78
+ libv8 (~> 6.3.0)
79
+ listen (~> 3.0)
80
+ mini_racer (~> 0.1.15)
81
+ opal (>= 0.11.0, < 0.12.0)
82
+ opal-browser (~> 0.2.0)
83
+ uglifier
84
+ websocket
85
+
86
+ PATH
87
+ remote: .
88
+ specs:
89
+ rails-hyperstack (0.1.0)
90
+ hyper-model (= 0.1.0)
91
+ hyper-router (= 0.1.0)
92
+ hyperstack-config (= 0.1.0)
93
+ libv8 (~> 6.3.0)
94
+ mini_racer (~> 0.1.15)
95
+ opal-browser (~> 0.2.0)
96
+ opal-rails (~> 0.9.4)
97
+ rails (>= 4.0.0)
98
+ react-rails (>= 2.4.0, < 2.5.0)
99
+
100
+ GEM
101
+ remote: https://rubygems.org/
102
+ specs:
103
+ abstract_type (0.0.7)
104
+ actioncable (5.2.1)
105
+ actionpack (= 5.2.1)
106
+ nio4r (~> 2.0)
107
+ websocket-driver (>= 0.6.1)
108
+ actionmailer (5.2.1)
109
+ actionpack (= 5.2.1)
110
+ actionview (= 5.2.1)
111
+ activejob (= 5.2.1)
112
+ mail (~> 2.5, >= 2.5.4)
113
+ rails-dom-testing (~> 2.0)
114
+ actionpack (5.2.1)
115
+ actionview (= 5.2.1)
116
+ activesupport (= 5.2.1)
117
+ rack (~> 2.0)
118
+ rack-test (>= 0.6.3)
119
+ rails-dom-testing (~> 2.0)
120
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
121
+ actionview (5.2.1)
122
+ activesupport (= 5.2.1)
123
+ builder (~> 3.1)
124
+ erubi (~> 1.4)
125
+ rails-dom-testing (~> 2.0)
126
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
127
+ activejob (5.2.1)
128
+ activesupport (= 5.2.1)
129
+ globalid (>= 0.3.6)
130
+ activemodel (5.2.1)
131
+ activesupport (= 5.2.1)
132
+ activerecord (5.2.1)
133
+ activemodel (= 5.2.1)
134
+ activesupport (= 5.2.1)
135
+ arel (>= 9.0)
136
+ activestorage (5.2.1)
137
+ actionpack (= 5.2.1)
138
+ activerecord (= 5.2.1)
139
+ marcel (~> 0.3.1)
140
+ activesupport (5.2.1)
141
+ concurrent-ruby (~> 1.0, >= 1.0.2)
142
+ i18n (>= 0.7, < 2)
143
+ minitest (~> 5.1)
144
+ tzinfo (~> 1.1)
145
+ adamantium (0.2.0)
146
+ ice_nine (~> 0.11.0)
147
+ memoizable (~> 0.4.0)
148
+ addressable (2.5.2)
149
+ public_suffix (>= 2.0.2, < 4.0)
150
+ archive-zip (0.11.0)
151
+ io-like (~> 0.3.0)
152
+ arel (9.0.0)
153
+ ast (2.4.0)
154
+ babel-source (5.8.35)
155
+ babel-transpiler (0.7.0)
156
+ babel-source (>= 4.0, < 6)
157
+ execjs (~> 2.0)
158
+ bootsnap (1.3.2)
159
+ msgpack (~> 1.0)
160
+ builder (3.2.3)
161
+ capybara (3.10.1)
162
+ addressable
163
+ mini_mime (>= 0.1.3)
164
+ nokogiri (~> 1.8)
165
+ rack (>= 1.6.0)
166
+ rack-test (>= 0.6.3)
167
+ regexp_parser (~> 1.2)
168
+ xpath (~> 3.2)
169
+ childprocess (0.9.0)
170
+ ffi (~> 1.0, >= 1.0.11)
171
+ chromedriver-helper (1.2.0)
172
+ archive-zip (~> 0.10)
173
+ nokogiri (~> 1.8)
174
+ coderay (1.1.2)
175
+ coffee-rails (4.2.2)
176
+ coffee-script (>= 2.2.0)
177
+ railties (>= 4.0.0)
178
+ coffee-script (2.4.1)
179
+ coffee-script-source
180
+ execjs
181
+ coffee-script-source (1.12.2)
182
+ concord (0.1.5)
183
+ adamantium (~> 0.2.0)
184
+ equalizer (~> 0.0.9)
185
+ concurrent-ruby (1.1.3)
186
+ connection_pool (2.2.2)
187
+ crass (1.0.4)
188
+ database_cleaner (1.7.0)
189
+ diff-lcs (1.3)
190
+ dotenv (0.7.0)
191
+ equalizer (0.0.11)
192
+ erubi (1.7.1)
193
+ execjs (2.7.0)
194
+ ffi (1.9.25)
195
+ foreman (0.64.0)
196
+ dotenv (~> 0.7.0)
197
+ thor (>= 0.13.6)
198
+ globalid (0.4.1)
199
+ activesupport (>= 4.2.0)
200
+ hike (1.2.3)
201
+ i18n (1.1.1)
202
+ concurrent-ruby (~> 1.0)
203
+ ice_nine (0.11.2)
204
+ io-like (0.3.0)
205
+ jbuilder (2.8.0)
206
+ activesupport (>= 4.2.0)
207
+ multi_json (>= 1.2)
208
+ jquery-rails (4.3.3)
209
+ rails-dom-testing (>= 1, < 3)
210
+ railties (>= 4.2.0)
211
+ thor (>= 0.14, < 2.0)
212
+ libv8 (6.3.292.48.1)
213
+ listen (3.1.5)
214
+ rb-fsevent (~> 0.9, >= 0.9.4)
215
+ rb-inotify (~> 0.9, >= 0.9.7)
216
+ ruby_dep (~> 1.2)
217
+ loofah (2.2.3)
218
+ crass (~> 1.0.2)
219
+ nokogiri (>= 1.5.9)
220
+ mail (2.7.1)
221
+ mini_mime (>= 0.1.1)
222
+ marcel (0.3.3)
223
+ mimemagic (~> 0.3.2)
224
+ memoizable (0.4.2)
225
+ thread_safe (~> 0.3, >= 0.3.1)
226
+ method_source (0.9.1)
227
+ mimemagic (0.3.2)
228
+ mini_mime (1.0.1)
229
+ mini_portile2 (2.3.0)
230
+ mini_racer (0.1.15)
231
+ libv8 (~> 6.3)
232
+ minitest (5.11.3)
233
+ msgpack (1.2.4)
234
+ multi_json (1.13.1)
235
+ mutations (0.8.3)
236
+ activesupport
237
+ nio4r (2.3.1)
238
+ nokogiri (1.8.5)
239
+ mini_portile2 (~> 2.3.0)
240
+ opal (0.11.4)
241
+ ast (>= 2.3.0)
242
+ hike (~> 1.2)
243
+ parser (= 2.3.3.1)
244
+ sourcemap (~> 0.1.0)
245
+ opal-activesupport (0.3.1)
246
+ opal (>= 0.5.0, < 1.0.0)
247
+ opal-browser (0.2.0)
248
+ opal
249
+ paggio
250
+ opal-jquery (0.4.3)
251
+ opal (>= 0.10.0, < 0.12.0)
252
+ opal-rails (0.9.5)
253
+ jquery-rails
254
+ opal (>= 0.11.0, < 0.12)
255
+ opal-activesupport (>= 0.0.5)
256
+ opal-jquery (~> 0.4.0)
257
+ opal-sprockets (~> 0.4.2)
258
+ rails (>= 4.1, < 6.0)
259
+ sprockets-rails (>= 2.3.3, < 4.0)
260
+ opal-sprockets (0.4.2.0.11.0.3.1)
261
+ opal (~> 0.11.0)
262
+ sprockets (~> 3.1)
263
+ tilt (>= 1.4)
264
+ paggio (0.2.6)
265
+ parallel (1.12.1)
266
+ parser (2.3.3.1)
267
+ ast (~> 2.2)
268
+ powerpack (0.1.2)
269
+ procto (0.0.3)
270
+ pry (0.11.3)
271
+ coderay (~> 1.1.0)
272
+ method_source (~> 0.9.0)
273
+ public_suffix (3.0.3)
274
+ puma (3.12.0)
275
+ rack (2.0.6)
276
+ rack-test (1.1.0)
277
+ rack (>= 1.0, < 3)
278
+ rails (5.2.1)
279
+ actioncable (= 5.2.1)
280
+ actionmailer (= 5.2.1)
281
+ actionpack (= 5.2.1)
282
+ actionview (= 5.2.1)
283
+ activejob (= 5.2.1)
284
+ activemodel (= 5.2.1)
285
+ activerecord (= 5.2.1)
286
+ activestorage (= 5.2.1)
287
+ activesupport (= 5.2.1)
288
+ bundler (>= 1.3.0)
289
+ railties (= 5.2.1)
290
+ sprockets-rails (>= 2.0.0)
291
+ rails-dom-testing (2.0.3)
292
+ activesupport (>= 4.2.0)
293
+ nokogiri (>= 1.6)
294
+ rails-html-sanitizer (1.0.4)
295
+ loofah (~> 2.2, >= 2.2.2)
296
+ railties (5.2.1)
297
+ actionpack (= 5.2.1)
298
+ activesupport (= 5.2.1)
299
+ method_source
300
+ rake (>= 0.8.7)
301
+ thor (>= 0.19.0, < 2.0)
302
+ rainbow (2.2.2)
303
+ rake
304
+ rake (12.3.1)
305
+ rb-fsevent (0.10.3)
306
+ rb-inotify (0.9.10)
307
+ ffi (>= 0.5.0, < 2)
308
+ react-rails (2.4.7)
309
+ babel-transpiler (>= 0.7.0)
310
+ connection_pool
311
+ execjs
312
+ railties (>= 3.2)
313
+ tilt
314
+ regexp_parser (1.2.0)
315
+ rspec (3.8.0)
316
+ rspec-core (~> 3.8.0)
317
+ rspec-expectations (~> 3.8.0)
318
+ rspec-mocks (~> 3.8.0)
319
+ rspec-core (3.8.0)
320
+ rspec-support (~> 3.8.0)
321
+ rspec-expectations (3.8.2)
322
+ diff-lcs (>= 1.2.0, < 2.0)
323
+ rspec-support (~> 3.8.0)
324
+ rspec-mocks (3.8.0)
325
+ diff-lcs (>= 1.2.0, < 2.0)
326
+ rspec-support (~> 3.8.0)
327
+ rspec-rails (3.8.1)
328
+ actionpack (>= 3.0)
329
+ activesupport (>= 3.0)
330
+ railties (>= 3.0)
331
+ rspec-core (~> 3.8.0)
332
+ rspec-expectations (~> 3.8.0)
333
+ rspec-mocks (~> 3.8.0)
334
+ rspec-support (~> 3.8.0)
335
+ rspec-support (3.8.0)
336
+ rubocop (0.51.0)
337
+ parallel (~> 1.10)
338
+ parser (>= 2.3.3.1, < 3.0)
339
+ powerpack (~> 0.1)
340
+ rainbow (>= 2.2.2, < 3.0)
341
+ ruby-progressbar (~> 1.7)
342
+ unicode-display_width (~> 1.0, >= 1.0.1)
343
+ ruby-progressbar (1.10.0)
344
+ ruby_dep (1.5.0)
345
+ rubyzip (1.2.2)
346
+ sass (3.7.2)
347
+ sass-listen (~> 4.0.0)
348
+ sass-listen (4.0.0)
349
+ rb-fsevent (~> 0.9, >= 0.9.4)
350
+ rb-inotify (~> 0.9, >= 0.9.7)
351
+ sass-rails (5.0.7)
352
+ railties (>= 4.0.0, < 6)
353
+ sass (~> 3.1)
354
+ sprockets (>= 2.8, < 4.0)
355
+ sprockets-rails (>= 2.0, < 4.0)
356
+ tilt (>= 1.1, < 3)
357
+ selenium-webdriver (3.141.0)
358
+ childprocess (~> 0.5)
359
+ rubyzip (~> 1.2, >= 1.2.2)
360
+ sourcemap (0.1.1)
361
+ sprockets (3.7.2)
362
+ concurrent-ruby (~> 1.0)
363
+ rack (> 1, < 3)
364
+ sprockets-rails (3.2.1)
365
+ actionpack (>= 4.0)
366
+ activesupport (>= 4.0)
367
+ sprockets (>= 3.0.0)
368
+ sqlite3 (1.3.13)
369
+ thor (0.20.1)
370
+ thread_safe (0.3.6)
371
+ tilt (2.0.8)
372
+ timecop (0.8.1)
373
+ turbolinks (5.2.0)
374
+ turbolinks-source (~> 5.2)
375
+ turbolinks-source (5.2.0)
376
+ tzinfo (1.2.5)
377
+ thread_safe (~> 0.1)
378
+ uglifier (4.1.19)
379
+ execjs (>= 0.3.0, < 3)
380
+ unicode-display_width (1.4.0)
381
+ unparser (0.2.8)
382
+ abstract_type (~> 0.0.7)
383
+ adamantium (~> 0.2.0)
384
+ concord (~> 0.1.5)
385
+ diff-lcs (~> 1.3)
386
+ equalizer (~> 0.0.9)
387
+ parser (>= 2.3.1.2, < 2.6)
388
+ procto (~> 0.0.2)
389
+ webdrivers (3.4.3)
390
+ nokogiri (~> 1.6)
391
+ rubyzip (~> 1.0)
392
+ selenium-webdriver (~> 3.0)
393
+ websocket (1.2.8)
394
+ websocket-driver (0.7.0)
395
+ websocket-extensions (>= 0.1.0)
396
+ websocket-extensions (0.1.3)
397
+ xpath (3.2.0)
398
+ nokogiri (~> 1.8)
399
+
400
+ PLATFORMS
401
+ ruby
402
+
403
+ DEPENDENCIES
404
+ bootsnap
405
+ bundler (~> 1.16.0)
406
+ chromedriver-helper
407
+ coffee-rails (~> 4.2)
408
+ database_cleaner
409
+ foreman
410
+ hyper-component!
411
+ hyper-model!
412
+ hyper-operation!
413
+ hyper-router!
414
+ hyper-spec!
415
+ hyper-state!
416
+ hyper-store!
417
+ hyperstack-config!
418
+ jbuilder (~> 2.5)
419
+ pry
420
+ puma
421
+ rails (~> 5.2)
422
+ rails-hyperstack!
423
+ rspec
424
+ rubocop (~> 0.51.0)
425
+ sass-rails (~> 5.0)
426
+ sqlite3
427
+ turbolinks (~> 5)
428
+ uglifier (>= 1.3.0)
429
+
430
+ BUNDLED WITH
431
+ 1.16.0
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ namespace :spec do
7
+ task :prepare do
8
+ Dir.chdir('spec') do
9
+ sh('rm -rf test_app')
10
+ sh('bundle exec rails new test_app')
11
+ Dir.chdir('test_app') do
12
+ sh('bundle exec rails g hyperstack:install')
13
+ sh('mv Gemfile _Gemfile_')
14
+ sh('bundle exec rails generate model Sample name:string description:text')
15
+ sh('mv app/models/sample.rb app/hyperstack/models/sample.rb')
16
+ sh('bundle exec rake db:migrate')
17
+ sh('bundle exec rails dev:cache')
18
+ end
19
+ end
20
+ end
21
+ end
22
+
23
+ task :default do
24
+
25
+ end
@@ -0,0 +1,20 @@
1
+ require 'rails/generators'
2
+ module Hyper
3
+ class Component < Rails::Generators::Base
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ argument :components, type: :array
7
+ def create_component_file
8
+ self.components.each do |component|
9
+ component_array = component.split('::')
10
+ @modules = component_array[0..-2]
11
+ @file_name = component_array.last
12
+ @indent = 0
13
+ template 'component_template.rb',
14
+ File.join('app/hyperstack/components',
15
+ @modules.map(&:downcase).join('/'),
16
+ "#{@file_name.underscore}.rb")
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,23 @@
1
+ require 'rails/generators'
2
+ module Hyper
3
+ class Router < Rails::Generators::Base
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ argument :component, type: :string
7
+ class_option :path, type: :string, default: '/(*other)'
8
+ def create_component_file
9
+ component_array = component.split('::')
10
+ @modules = component_array[0..-2]
11
+ @file_name = component_array.last
12
+ @indent = 0
13
+ template 'router_template.rb',
14
+ File.join('app/hyperstack/components',
15
+ @modules.map(&:downcase).join('/'),
16
+ "#{@file_name.underscore}.rb")
17
+ end
18
+
19
+ def add_route
20
+ route "get '#{options['path']}', to: 'hyperstack##{@file_name.underscore}'"
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,40 @@
1
+ <%- @modules.each do |module_name| %><%= " "* @indent %>module <%= module_name.camelize %><%- @indent += 1 %>
2
+ <%- end %><%=" "* @indent %>class <%= @file_name %> < Hyperstack::Component
3
+
4
+ <%=" "* @indent %> # param :my_param
5
+ <%=" "* @indent %> # param param_with_default: "default value"
6
+ <%=" "* @indent %> # param :param_with_default2, default: "default value" # alternative syntax
7
+ <%=" "* @indent %> # param :param_with_type, type: Hash
8
+ <%=" "* @indent %> # param :array_of_hashes, type: [Hash]
9
+ <%=" "* @indent %> # collect_other_params_as :attributes # collects all other params into a hash
10
+
11
+ <%=" "* @indent %> # The following are the most common lifecycle call backs,
12
+ <%=" "* @indent %> # the following are the most common lifecycle call backs# delete any that you are not using.
13
+ <%=" "* @indent %> # call backs may also reference an instance method i.e. before_mount :my_method
14
+
15
+ <%=" "* @indent %> before_mount do
16
+ <%=" "* @indent %> # any initialization particularly of state variables goes here.
17
+ <%=" "* @indent %> # this will execute on server (prerendering) and client.
18
+ <%=" "* @indent %> end
19
+
20
+ <%=" "* @indent %> after_mount do
21
+ <%=" "* @indent %> # any client only post rendering initialization goes here.
22
+ <%=" "* @indent %> # i.e. start timers, HTTP requests, and low level jquery operations etc.
23
+ <%=" "* @indent %> end
24
+
25
+ <%=" "* @indent %> before_update do
26
+ <%=" "* @indent %> # called whenever a component will be re-rerendered
27
+ <%=" "* @indent %> end
28
+
29
+ <%=" "* @indent %> before_unmount do
30
+ <%=" "* @indent %> # cleanup any thing (i.e. timers) before component is destroyed
31
+ <%=" "* @indent %> end
32
+
33
+ <%=" "* @indent %> render do
34
+ <%=" "* @indent %> DIV do
35
+ <%=" "* @indent %> "<%= (@modules+[@file_name]).join('::') %>"
36
+ <%=" "* @indent %> end
37
+ <%=" "* @indent %> end
38
+ <%=" "* @indent %>end
39
+ <%- @modules.each do %><%- @indent -= 1 %><%=" "* @indent %>end
40
+ <%- end %>
@@ -0,0 +1,17 @@
1
+ <%- @modules.each do |module_name| %><%= " "* @indent %>module <%= module_name.camelize %><%- @indent += 1 %>
2
+ <%- end %><%=" "* @indent %>class <%= @file_name %> < HyperComponent
3
+ <%=" "* @indent %> include Hyperstack::State::Observer
4
+ <%=" "* @indent %> render do
5
+ <%=" "* @indent %> DIV do
6
+ <%=" "* @indent %> '<%= (@modules+[@file_name]).join('::') %>'
7
+ <%=" "* @indent %> # define routes using the Route psuedo component. Examples:
8
+ <%=" "* @indent %> # Route('/foo', mounts: Foo) : match the path beginning with /foo and mount component Foo here
9
+ <%=" "* @indent %> # Route('/foo') { Foo(...) } : display the contents of the block
10
+ <%=" "* @indent %> # Route('/', exact: true, mounts: Home) : match the exact path / and mount the Home component
11
+ <%=" "* @indent %> # Route('/user/:id/name', mounts: UserName) : path segments beginning with a colon will be captured in the match param
12
+ <%=" "* @indent %> # see the hyper-router gem documentation for more details
13
+ <%=" "* @indent %> end
14
+ <%=" "* @indent %> end
15
+ <%=" "* @indent %>end
16
+ <%- @modules.each do %><%- @indent -= 1 %><%=" "* @indent %>end
17
+ <%- end %>