appril-cli 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/Gemfile +1 -1
- data/app/base/app.js +41 -62
- data/app/base/component.js +1 -3
- data/app/base/components/base_controller.rb +1 -0
- data/app/base/components/rtcp_controller.rb +3 -0
- data/app/base/helpers/user.rb +7 -0
- data/app/base/store/mutations.js +2 -5
- data/app/base/store/state.js +0 -1
- data/app/base/templates/layouts/app.html +1 -1
- data/app/package.json +1 -1
- data/app/webpack/entry.js +7 -2
- data/app/webpack/output.js +1 -1
- data/lib/appril-cli/version.rb +1 -1
- metadata +5 -4
- /data/app/base/assets/{styles.css → app.css} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aaf51693e976f3705b533a067f6c78f7fd9e6c20
|
4
|
+
data.tar.gz: 7c0f82b8545055cc268cba2ec510cac3a9611441
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ef58942e1a8397f0ffbffa97f0a32598beec89c67558ebdbc7fde090e60e794a5e371d2d4ca09665533c14161251351244f203c1c8229ded95e649bcfc3f142
|
7
|
+
data.tar.gz: d8598cb33bd2bb245e744225b1edca5e2adb46e32e03f6d14e077a9a57e7f09ccda4a08af4260b042e97b5c896612c0a5a153110474d93c2729419fb8929a923
|
data/app/Gemfile
CHANGED
data/app/base/app.js
CHANGED
@@ -1,22 +1,29 @@
|
|
1
1
|
|
2
|
-
const FRESH_STATE_FOR_EVERY_COMPONENT = true
|
3
2
|
const DEVELOPMENT = APP_ENV === 'development'
|
4
3
|
|
5
|
-
import {merge, reduce, cloneDeep} from 'lodash'
|
4
|
+
import {merge, map, reduce, filter, cloneDeep} from 'lodash'
|
6
5
|
import Vue from 'vue'
|
6
|
+
import VueRouter from 'vue-router'
|
7
7
|
import Vuex from 'vuex'
|
8
8
|
import VuexLogger from 'vuex/logger'
|
9
9
|
import Alert from 'appril-alert'
|
10
10
|
import {vue_plugin, vuex_plugins} from 'appril/plugins'
|
11
11
|
import {state, mutations} from 'appril/store'
|
12
|
-
import
|
12
|
+
import config from 'app/appril.json'
|
13
13
|
|
14
14
|
/** delete or comment this line if your components piped through Crudle
|
15
15
|
import {state as crudle_state, mutations as crudle_mutations} from 'crudle/store'
|
16
16
|
merge(state, crudle_state)
|
17
17
|
merge(mutations, crudle_mutations) /* */
|
18
18
|
|
19
|
+
Vue.use(VueRouter)
|
19
20
|
Vue.use(Vuex)
|
21
|
+
|
22
|
+
if (DEVELOPMENT) {
|
23
|
+
Vue.config.devtools = true
|
24
|
+
vuex_plugins.push(VuexLogger())
|
25
|
+
}
|
26
|
+
|
20
27
|
const store = new Vuex.Store({
|
21
28
|
state: cloneDeep(state),
|
22
29
|
mutations,
|
@@ -25,18 +32,11 @@ const store = new Vuex.Store({
|
|
25
32
|
})
|
26
33
|
|
27
34
|
const api_callbacks = {
|
28
|
-
|
29
35
|
// do whatever with params Object just before sending to server
|
30
|
-
on_request(params) {
|
31
|
-
// if (store.state.__ENV__.user && store.state.__ENV__.user.authorization_token) {
|
32
|
-
// params.__authorization_token__ = store.state.__ENV__.user.authorization_token
|
33
|
-
// }
|
34
|
-
},
|
36
|
+
on_request(params) {},
|
35
37
|
|
36
38
|
// do whatever with data received from server just before entering success callback
|
37
|
-
on_response(response) {
|
38
|
-
// it is possible only to update the response content, not the type
|
39
|
-
},
|
39
|
+
on_response(response) {},
|
40
40
|
|
41
41
|
// to be used for requests that does not define a error handler
|
42
42
|
on_error(error) {
|
@@ -50,76 +50,55 @@ const rtcp = new RTCP(api_callbacks)
|
|
50
50
|
|
51
51
|
rtcp.connect({
|
52
52
|
// make sure this URL is matching RTCPController URL
|
53
|
-
path: server_url + '__rtcp__',
|
53
|
+
path: config.server_url + '__rtcp__',
|
54
54
|
// disconnect if user is idle for N seconds (it will reconnect on user activity)
|
55
55
|
disconnect_after: 60
|
56
56
|
})
|
57
57
|
|
58
58
|
import {urlify} from 'appril-utils'
|
59
59
|
import api_builder from 'appril/api'
|
60
|
-
|
60
|
+
|
61
|
+
const components = reduce(config.components, function(map,component) {
|
61
62
|
component.url = urlify(component.url)
|
62
63
|
component.xhr = api_builder.xhr(component, api_callbacks)
|
63
64
|
component.rtcp = api_builder.rtcp(component, rtcp)
|
64
|
-
Object.defineProperty(component, 'api', {get() {return component[default_api]}})
|
65
|
+
Object.defineProperty(component, 'api', {get() {return component[config.default_api]}})
|
65
66
|
map[component.name] = component
|
66
67
|
return map
|
67
68
|
}, {})
|
68
69
|
|
69
|
-
const handle_state = function(component, env) {
|
70
|
-
|
71
|
-
if (!store.state.__ROOT_COMPONENT__)
|
72
|
-
return store.replaceState(merge(cloneDeep(state), {__ROOT_COMPONENT__: component.name, __ENV__: env}))
|
73
|
-
|
74
|
-
if (store.state.__ROOT_COMPONENT__ === component.name)
|
75
|
-
return // do nothing if component did not change
|
76
|
-
|
77
|
-
if (FRESH_STATE_FOR_EVERY_COMPONENT)
|
78
|
-
return store.replaceState(merge(cloneDeep(state), {__ROOT_COMPONENT__: component.name, __ENV__: env}))
|
79
|
-
|
80
|
-
store.commit('__ROOT_COMPONENT__', component.name)
|
81
|
-
store.commit('__ENV__', env)
|
82
|
-
}
|
83
|
-
|
84
|
-
import Router from 'appril/router'
|
85
|
-
const router = new Router(components)
|
86
|
-
|
87
|
-
router.component_matched = function(component) {
|
88
|
-
if (component.api._env) {
|
89
|
-
component.api._env().get({
|
90
|
-
success(env) { handle_state(component, env) }
|
91
|
-
})
|
92
|
-
} else {
|
93
|
-
handle_state(component)
|
94
|
-
}
|
95
|
-
}
|
96
|
-
|
97
|
-
import load_component from 'appril/load-component'
|
98
70
|
import deploy_component from './component'
|
99
|
-
const component_loaders = reduce(components, function(map, component) {
|
100
|
-
map[component.name] = function(resolve, reject) {
|
101
|
-
load_component(component, client_url + APP_ENV, function(constructor) {
|
102
|
-
resolve(deploy_component(components, component, constructor))
|
103
|
-
}, reject)
|
104
|
-
}
|
105
|
-
return map
|
106
|
-
}, {})
|
107
71
|
|
108
|
-
|
72
|
+
const router = new VueRouter({
|
73
|
+
mode: 'history',
|
74
|
+
base: __dirname,
|
75
|
+
routes: map(filter(components, 'entry_path'), function(component) {
|
76
|
+
return {
|
77
|
+
name: component.name,
|
78
|
+
path: component.url_pattern,
|
79
|
+
component: (resolve) => System.import(`components/${component.entry_path}/index.js`).then(function(constructor) {
|
80
|
+
if (component.api._env) {
|
81
|
+
component.api._env().get({
|
82
|
+
success(env) {
|
83
|
+
store.commit('__SET_ENV__', {component: component.name, env})
|
84
|
+
resolve(deploy_component(components, component, constructor.default))
|
85
|
+
}
|
86
|
+
})
|
87
|
+
} else {
|
88
|
+
resolve(deploy_component(components, component, constructor.default))
|
89
|
+
}
|
90
|
+
})
|
91
|
+
}
|
92
|
+
})
|
93
|
+
})
|
109
94
|
|
95
|
+
document.addEventListener('DOMContentLoaded', function() {
|
110
96
|
Vue.use(vue_plugin({components, rtcp}))
|
111
97
|
|
112
|
-
if (DEVELOPMENT) {
|
113
|
-
Vue.config.devtools = true
|
114
|
-
vuex_plugins.push(VuexLogger())
|
115
|
-
}
|
116
|
-
|
117
98
|
new Vue({
|
99
|
+
router,
|
118
100
|
store,
|
119
101
|
el: '#app',
|
120
|
-
template: require('templates/layouts/app.html')
|
121
|
-
components: component_loaders
|
102
|
+
template: require('templates/layouts/app.html')
|
122
103
|
})
|
123
|
-
|
124
|
-
router.start()
|
125
104
|
})
|
data/app/base/component.js
CHANGED
data/app/base/store/mutations.js
CHANGED
data/app/base/store/state.js
CHANGED
data/app/package.json
CHANGED
data/app/webpack/entry.js
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
-
const
|
1
|
+
const reduce = require('lodash/reduce')
|
2
|
+
const filter = require('lodash/filter')
|
3
|
+
const config = require('../appril.json')
|
2
4
|
|
3
|
-
module.exports = config.
|
5
|
+
module.exports = reduce(filter(config.components, 'entry_path'), function(entries,component) {
|
6
|
+
entries[component.name] = 'base/components/' + component.entry_path + '/index.js'
|
7
|
+
return entries
|
8
|
+
}, {app: 'base/app.js'})
|
data/app/webpack/output.js
CHANGED
data/lib/appril-cli/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.7
|
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-08-
|
11
|
+
date: 2016-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Appril CLI
|
14
14
|
email:
|
@@ -25,7 +25,7 @@ files:
|
|
25
25
|
- app/Gemfile
|
26
26
|
- app/Rakefile
|
27
27
|
- app/base/app.js
|
28
|
-
- app/base/assets/
|
28
|
+
- app/base/assets/app.css
|
29
29
|
- app/base/boot.rb
|
30
30
|
- app/base/component.js
|
31
31
|
- app/base/components/base_controller.rb
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- app/base/components/rtcp_controller.rb
|
36
36
|
- app/base/helpers/application_helpers.rb
|
37
37
|
- app/base/helpers/index.js
|
38
|
+
- app/base/helpers/user.rb
|
38
39
|
- app/base/load.rb
|
39
40
|
- app/base/models/base_model.rb
|
40
41
|
- app/base/store/modules.js
|
@@ -113,5 +114,5 @@ rubyforge_project:
|
|
113
114
|
rubygems_version: 2.5.1
|
114
115
|
signing_key:
|
115
116
|
specification_version: 4
|
116
|
-
summary: '["appril-cli-0.2.
|
117
|
+
summary: '["appril-cli-0.2.7", "Appril CLI"]'
|
117
118
|
test_files: []
|
File without changes
|