appril-cli 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6688ffe7a76f2dcee1e23d9425a33e6e4d53ec4a
4
- data.tar.gz: 820e1300cebf1e9fe46ba1d5bbca2b8dcb9e0449
3
+ metadata.gz: c6fce6c027dc0c76302855dffb23a042f0bd5763
4
+ data.tar.gz: 4c8fbd6935a8d4255138b19f02ea85a10254d5d2
5
5
  SHA512:
6
- metadata.gz: 9a75c1bc52aabaa0dac78e8f07b09114048ccbcf9144b45e91bb3b703eaa0e9f73f0376c1ceff3c15ef553912f602dfb0d825963cb2213015fbf4dd86b5edd39
7
- data.tar.gz: 6d1f0c33713a66d513cf7af96773713e4f6422be9cdf740a11060bb08769017aee1fff1220aadf75fe5f2633f64a4e5f9715af782232fb53bafac3eb75b6f7e0
6
+ metadata.gz: 3046ef4df845c82e265b35fdf0d6e83b2fed4860074848c7d2f9b4fbf9d237d176f59a6059cdb408bc218ad2486178ef581affd6523fe5a44b4ad50f2af90714
7
+ data.tar.gz: de4057dc75eee1af3c25c7415d3399068cb76824fb7ec8f82ee4620f00564d5a451ef833b2a76fa00275a3b43620f5620464420eebadde720cae620e1702efd0
@@ -12,12 +12,14 @@ import {vue_plugin, vuex_plugins} from 'appril/plugins'
12
12
  import components from 'appril/components'
13
13
  import async_components_loader from 'appril/components/async_loader'
14
14
  import ApiBuilder from 'appril/api'
15
+ import Layout from 'templates/layouts/app.html'
15
16
 
16
17
  /** delete or comment this line if your components piped through Crudle
17
18
  import {state as crudle_state, mutations as crudle_mutations} from 'crudle/store'
18
19
  merge(state, crudle_state)
19
20
  merge(mutations, crudle_mutations) /* */
20
21
 
22
+ const FRESH_STATE_FOR_EVERY_COMPONENT = false
21
23
  const DEVELOPMENT = APP_ENV === 'development'
22
24
 
23
25
  Vue.use(Vuex)
@@ -26,11 +28,22 @@ if (DEVELOPMENT) {
26
28
  vuex_plugins.push(VuexLogger())
27
29
  }
28
30
 
29
- const api = ApiBuilder(default_api)
31
+ const store = new Vuex.Store({
32
+ state: cloneDeep(state),
33
+ mutations,
34
+ strict: DEVELOPMENT,
35
+ plugins: vuex_plugins
36
+ })
37
+
38
+ const api = ApiBuilder(default_api, store)
30
39
 
31
40
  const initialize = function(data) {
32
41
  deep_freeze(data)
33
42
 
43
+ if (data.user) {
44
+ store.commit('__USER__', data.user)
45
+ }
46
+
34
47
  // /* uncomment this line to disable RealTime Communication Protocol
35
48
  api.rtcp.connect({
36
49
  // make sure this url to match RTCPController url
@@ -47,24 +60,30 @@ const initialize = function(data) {
47
60
 
48
61
  const router = new Router(components)
49
62
 
50
- const store = new Vuex.Store({
51
- state: cloneDeep(state),
52
- mutations,
53
- strict: DEVELOPMENT,
54
- plugins: vuex_plugins
55
- })
56
-
57
63
  new Vue({
58
64
  store,
59
65
  el: '#app',
60
- template: `<component :is="$store.state.__ROOT_COMPONENT__"></component>`,
66
+ template: Layout,
61
67
  components: async_components_loader(components, client_url + APP_ENV, api[default_api])
62
68
  })
63
69
 
64
70
  router.component_matched = function(component) {
65
- if (store.state.__ROOT_COMPONENT__ === component.name)
66
- return
67
- store.replaceState(merge(cloneDeep(state), {__ROOT_COMPONENT__: component.name}))
71
+
72
+ if (store.state.__ROOT_COMPONENT__) {
73
+ if (store.state.__ROOT_COMPONENT__ !== component.name) {
74
+ // component switched
75
+ if (FRESH_STATE_FOR_EVERY_COMPONENT) {
76
+ // start with a fresh state
77
+ store.replaceState(merge(cloneDeep(state), {__ROOT_COMPONENT__: component.name}))
78
+ } else {
79
+ // just update __ROOT_COMPONENT__
80
+ store.commit('__ROOT_COMPONENT__', component.name)
81
+ }
82
+ }
83
+ } else {
84
+ store.replaceState(merge(cloneDeep(state), {__ROOT_COMPONENT__: component.name}))
85
+ }
86
+
68
87
  }
69
88
 
70
89
  router.start()
@@ -20,4 +20,11 @@ class BaseController < Appril::BaseController
20
20
  e.backtrace && e.backtrace.each {|l| puts " \e[0;36m%s\e[0m" % l}
21
21
  e.message
22
22
  end
23
+
24
+ private
25
+ # fetch user using authorization_token
26
+ def user?
27
+ # return unless authorization_token = params[:__authorization_token__] || cookies[:__authorization_token__]
28
+ # User.find_by(authorization_token: authorization_token)
29
+ end
23
30
  end
@@ -3,7 +3,10 @@ class Index < BaseController
3
3
 
4
4
  # environmental data to be sent to client at App initialization
5
5
  def _env
6
- {}
6
+ user = user? # see BaseController#user?
7
+ {
8
+ user: user
9
+ }
7
10
  end
8
11
 
9
12
  # data to be sent to client at Component initialization
@@ -4,8 +4,8 @@
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
6
6
  <script type="text/javascript">window.module = {}</script>
7
- <link rel="stylesheet" media="all" href="{{client_url}}/core.css">
8
- <script src="{{client_url}}/core.js"></script>
7
+ <link rel="stylesheet" media="all" href="{{client_url}}/app.css">
8
+ <script src="{{client_url}}/app.js"></script>
9
9
  </head>
10
10
  <body>
11
11
  <div id="app"></div>
@@ -0,0 +1,3 @@
1
+ <div>
2
+ <component :is="$store.state.__ROOT_COMPONENT__"></component>
3
+ </div>
data/app/core/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  # do NOT edit this file, edit ../Gemfile instead
2
- gem 'appril', '>= 0.2'
3
- gem 'rocketio', '>= 0.3'
2
+ gem 'appril', '>= 0.2.2'
3
+ gem 'rocketio', '>= 0.4.1'
4
+ gem 'rocketio-views', '>= 0.4'
4
5
  gem 'tubesock', '>= 0.2.7'
data/app/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "version": "0.0.0",
4
4
  "description": "...",
5
5
  "devDependencies": {
6
- "appril": ">= 0.2.8",
6
+ "appril": ">= 0.4.1",
7
7
  "appril-polyfills": ">= 0.0.2",
8
8
  "appril-url": ">= 0.0.5",
9
9
  "appril-utils": ">= 0.1.5",
@@ -22,7 +22,7 @@
22
22
  "optimize-css-assets-webpack-plugin": "1",
23
23
  "style-loader": "*",
24
24
  "url-loader": "*",
25
- "vue": "^2.0.0-beta.3",
25
+ "vue": "^2.0.0-beta.5",
26
26
  "vue-html-loader": "1",
27
27
  "vuex": "^2.0.0-rc.3",
28
28
  "webpack": "^2.1.0-beta.18"
@@ -3,7 +3,7 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin')
3
3
  const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
4
4
 
5
5
  const plugins = [
6
- new webpack.optimize.CommonsChunkPlugin({names: ['core'], minChunks: 2}),
6
+ new webpack.optimize.CommonsChunkPlugin({names: ['app'], minChunks: 2}),
7
7
 
8
8
  // new webpack.ProvidePlugin({
9
9
  // $: 'jquery',
@@ -5,7 +5,7 @@ APP_ENV = process.env.APP_ENV || 'development'
5
5
  if (APP_ENV === 'development') {
6
6
  process.stdout.write('Generating configs... ')
7
7
  try {
8
- child_process.execSync('./core/generate_configs.rb')
8
+ child_process.execSync('bundle exec ./core/generate_configs.rb')
9
9
  console.log('done')
10
10
  } catch(e) {
11
11
  console.log(e.stdout.toString() + e.stderr.toString())
@@ -1,5 +1,5 @@
1
1
  module Appril
2
2
  class CLI
3
- VERSION = '0.2.2'.freeze
3
+ VERSION = '0.2.3'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appril-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Slee Woo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-25 00:00:00.000000000 Z
11
+ date: 2016-08-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Appril CLI
14
14
  email:
@@ -24,6 +24,7 @@ files:
24
24
  - app/.pryrc
25
25
  - app/Gemfile
26
26
  - app/Rakefile
27
+ - app/base/app.js
27
28
  - app/base/assets/styles.css
28
29
  - app/base/boot.rb
29
30
  - app/base/components/base_controller.rb
@@ -32,12 +33,12 @@ files:
32
33
  - app/base/components/index/server.rb
33
34
  - app/base/components/index/template.html
34
35
  - app/base/components/rtcp_controller.rb
35
- - app/base/core.js
36
36
  - app/base/helpers/application_helpers.rb
37
37
  - app/base/helpers/index.js
38
38
  - app/base/load.rb
39
39
  - app/base/models/base_model.rb
40
40
  - app/base/templates/layout.liquid
41
+ - app/base/templates/layouts/app.html
41
42
  - app/compiled/.ignore
42
43
  - app/config.ru
43
44
  - app/config/config.rb
@@ -110,5 +111,5 @@ rubyforge_project:
110
111
  rubygems_version: 2.5.1
111
112
  signing_key:
112
113
  specification_version: 4
113
- summary: '["appril-cli-0.2.2", "Appril CLI"]'
114
+ summary: '["appril-cli-0.2.3", "Appril CLI"]'
114
115
  test_files: []