appril-cli 0.2.3 → 0.2.6
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 +4 -4
- data/app/Gemfile +7 -2
- data/app/base/app.js +93 -64
- data/app/base/{components/deploy.js → component.js} +6 -9
- data/app/base/components/index/server.rb +0 -13
- data/app/base/store/modules.js +1 -0
- data/app/base/store/mutations.js +7 -0
- data/app/base/store/state.js +4 -0
- data/app/package.json +2 -1
- data/app/webpack/alias.js +2 -1
- data/app/webpack/entry.js +1 -1
- data/app/webpack/output.js +1 -1
- data/app/webpack/plugins.js +9 -12
- data/lib/appril-cli/version.rb +1 -1
- metadata +7 -5
- data/app/core/Gemfile +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4f003f894639dd5000c890286eee557d61ac557
|
4
|
+
data.tar.gz: 5f0240d5e5325d50795c949348b0c6eb41bc0fc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94416ea1fde160d5c67958797beba36756619a36556797611d47b5e2dda4be0f9a7006a1b444792465d1e34595274d6be9bc0ef6a29829e76e4a8209df0bbcb8
|
7
|
+
data.tar.gz: cc66b95a1d2eba91759224eafd6926bc80e3a6871483235b908ed5ecd15e839f2cc95a2c0eddb2564588ea38eeaed3d339dbc5c0602cf4cc5d19e57838f01fd8
|
data/app/Gemfile
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
|
2
|
+
|
3
|
+
begin # keep these gems
|
4
|
+
gem 'appril', '~> 0.2', '>= 0.2.5'
|
5
|
+
gem 'rocketio', '~> 0.4', '>= 0.4.2'
|
6
|
+
gem 'rocketio-views', '~> 0.4'
|
7
|
+
gem 'tubesock', '~> 0.2'
|
8
|
+
end
|
4
9
|
|
5
10
|
# add your gems here
|
6
11
|
gem 'liquid', '~> 3'
|
data/app/base/app.js
CHANGED
@@ -1,33 +1,22 @@
|
|
1
|
-
import {merge, cloneDeep} from 'lodash'
|
2
|
-
import deep_freeze from 'deep-freeze-strict'
|
3
|
-
import Router from 'appril/router'
|
4
|
-
import Vue from 'vue/dist/vue.js'
|
5
|
-
import Vuex from 'vuex'
|
6
|
-
import VuexLogger from 'vuex/logger'
|
7
1
|
|
8
|
-
|
2
|
+
const FRESH_STATE_FOR_EVERY_COMPONENT = true
|
3
|
+
const DEVELOPMENT = APP_ENV === 'development'
|
9
4
|
|
10
|
-
import {
|
5
|
+
import {merge, reduce, cloneDeep} from 'lodash'
|
6
|
+
import Vue from 'vue'
|
7
|
+
import Vuex from 'vuex'
|
8
|
+
import VuexLogger from 'vuex/logger'
|
9
|
+
import Alert from 'appril-alert'
|
11
10
|
import {vue_plugin, vuex_plugins} from 'appril/plugins'
|
12
|
-
import
|
13
|
-
import
|
14
|
-
import ApiBuilder from 'appril/api'
|
15
|
-
import Layout from 'templates/layouts/app.html'
|
11
|
+
import {state, mutations} from 'appril/store'
|
12
|
+
import {server_url, client_url, default_api} from 'app/config.json'
|
16
13
|
|
17
14
|
/** delete or comment this line if your components piped through Crudle
|
18
15
|
import {state as crudle_state, mutations as crudle_mutations} from 'crudle/store'
|
19
16
|
merge(state, crudle_state)
|
20
17
|
merge(mutations, crudle_mutations) /* */
|
21
18
|
|
22
|
-
const FRESH_STATE_FOR_EVERY_COMPONENT = false
|
23
|
-
const DEVELOPMENT = APP_ENV === 'development'
|
24
|
-
|
25
19
|
Vue.use(Vuex)
|
26
|
-
if (DEVELOPMENT) {
|
27
|
-
Vue.config.devtools = true
|
28
|
-
vuex_plugins.push(VuexLogger())
|
29
|
-
}
|
30
|
-
|
31
20
|
const store = new Vuex.Store({
|
32
21
|
state: cloneDeep(state),
|
33
22
|
mutations,
|
@@ -35,62 +24,102 @@ const store = new Vuex.Store({
|
|
35
24
|
plugins: vuex_plugins
|
36
25
|
})
|
37
26
|
|
38
|
-
const
|
27
|
+
const api_callbacks = {
|
28
|
+
|
29
|
+
// 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
|
+
},
|
39
35
|
|
40
|
-
|
41
|
-
|
36
|
+
// 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
|
+
},
|
42
40
|
|
43
|
-
|
44
|
-
|
41
|
+
// to be used for requests that does not define a error handler
|
42
|
+
on_error(error) {
|
43
|
+
Alert.error(error)
|
45
44
|
}
|
45
|
+
}
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
path: server_url + '__rtcp__',
|
51
|
-
// disconnect if user is idle for N seconds
|
52
|
-
disconnect_after: 60
|
53
|
-
}) /* */
|
47
|
+
// RealTime Communication Protocol
|
48
|
+
import RTCP from 'appril/rtcp'
|
49
|
+
const rtcp = new RTCP(api_callbacks)
|
54
50
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
51
|
+
rtcp.connect({
|
52
|
+
// make sure this URL is matching RTCPController URL
|
53
|
+
path: server_url + '__rtcp__',
|
54
|
+
// disconnect if user is idle for N seconds (it will reconnect on user activity)
|
55
|
+
disconnect_after: 60
|
56
|
+
})
|
60
57
|
|
61
|
-
|
58
|
+
import {urlify} from 'appril-utils'
|
59
|
+
import api_builder from 'appril/api'
|
60
|
+
const components = reduce(require('app/components.json'), function(map,component) {
|
61
|
+
component.url = urlify(component.url)
|
62
|
+
component.xhr = api_builder.xhr(component, api_callbacks)
|
63
|
+
component.rtcp = api_builder.rtcp(component, rtcp)
|
64
|
+
Object.defineProperty(component, 'api', {get() {return component[default_api]}})
|
65
|
+
map[component.name] = component
|
66
|
+
return map
|
67
|
+
}, {})
|
62
68
|
|
63
|
-
|
64
|
-
store,
|
65
|
-
el: '#app',
|
66
|
-
template: Layout,
|
67
|
-
components: async_components_loader(components, client_url + APP_ENV, api[default_api])
|
68
|
-
})
|
69
|
+
const handle_state = function(component, env) {
|
69
70
|
|
70
|
-
|
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
|
-
}
|
71
|
+
if (!store.state.__ROOT_COMPONENT__)
|
72
|
+
return store.replaceState(merge(cloneDeep(state), {__ROOT_COMPONENT__: component.name, __ENV__: env}))
|
86
73
|
|
87
|
-
|
74
|
+
if (store.state.__ROOT_COMPONENT__ === component.name)
|
75
|
+
return // do nothing if component did not change
|
88
76
|
|
89
|
-
|
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)
|
90
82
|
}
|
91
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
|
+
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
|
+
|
92
108
|
document.addEventListener('DOMContentLoaded', function() {
|
93
|
-
|
94
|
-
|
109
|
+
|
110
|
+
Vue.use(vue_plugin({components, rtcp}))
|
111
|
+
|
112
|
+
if (DEVELOPMENT) {
|
113
|
+
Vue.config.devtools = true
|
114
|
+
vuex_plugins.push(VuexLogger())
|
115
|
+
}
|
116
|
+
|
117
|
+
new Vue({
|
118
|
+
store,
|
119
|
+
el: '#app',
|
120
|
+
template: require('templates/layouts/app.html'),
|
121
|
+
components: component_loaders
|
95
122
|
})
|
123
|
+
|
124
|
+
router.start()
|
96
125
|
})
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import {find} from 'lodash'
|
2
|
-
import Vue from 'vue
|
2
|
+
import Vue from 'vue'
|
3
3
|
|
4
4
|
import 'assets/styles'
|
5
|
-
// import 'appril-polyfills'
|
6
5
|
|
7
|
-
/** default deployer
|
6
|
+
// /** default deployer
|
8
7
|
export default function(components, component, constructor) {
|
9
8
|
return constructor
|
10
9
|
} /* */
|
@@ -14,12 +13,10 @@ import Crudle from 'crudle'
|
|
14
13
|
export default function(components, component, constructor) {
|
15
14
|
Crudle.Menu = {
|
16
15
|
template: require('templates/menu'),
|
17
|
-
data() {
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
}
|
22
|
-
}
|
16
|
+
data() {return {
|
17
|
+
...components,
|
18
|
+
is_active(...a) {return find(a, (c) => c.url == component.url) ? true : false}
|
19
|
+
}}
|
23
20
|
}
|
24
21
|
return Crudle(constructor)
|
25
22
|
} /* */
|
@@ -1,16 +1,3 @@
|
|
1
1
|
class Index < BaseController
|
2
2
|
map Cfg.server_url
|
3
|
-
|
4
|
-
# environmental data to be sent to client at App initialization
|
5
|
-
def _env
|
6
|
-
user = user? # see BaseController#user?
|
7
|
-
{
|
8
|
-
user: user
|
9
|
-
}
|
10
|
-
end
|
11
|
-
|
12
|
-
# data to be sent to client at Component initialization
|
13
|
-
def _options
|
14
|
-
{}
|
15
|
-
end
|
16
3
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
// auto-generated file, do not edit
|
data/app/package.json
CHANGED
data/app/webpack/alias.js
CHANGED
data/app/webpack/entry.js
CHANGED
data/app/webpack/output.js
CHANGED
data/app/webpack/plugins.js
CHANGED
@@ -21,18 +21,15 @@ const plugins = [
|
|
21
21
|
]
|
22
22
|
|
23
23
|
if (APP_ENV === 'production') {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
plugins.push(
|
34
|
-
new OptimizeCssAssetsPlugin
|
35
|
-
)
|
24
|
+
|
25
|
+
plugins.push(new webpack.optimize.UglifyJsPlugin({
|
26
|
+
compress: { warnings: false },
|
27
|
+
screwIE8: true,
|
28
|
+
sourceMap: false,
|
29
|
+
mangle: true
|
30
|
+
}))
|
31
|
+
|
32
|
+
plugins.push(new OptimizeCssAssetsPlugin)
|
36
33
|
}
|
37
34
|
|
38
35
|
module.exports = plugins
|
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.6
|
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-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Appril CLI
|
14
14
|
email:
|
@@ -27,8 +27,8 @@ files:
|
|
27
27
|
- app/base/app.js
|
28
28
|
- app/base/assets/styles.css
|
29
29
|
- app/base/boot.rb
|
30
|
+
- app/base/component.js
|
30
31
|
- app/base/components/base_controller.rb
|
31
|
-
- app/base/components/deploy.js
|
32
32
|
- app/base/components/index/index.js
|
33
33
|
- app/base/components/index/server.rb
|
34
34
|
- app/base/components/index/template.html
|
@@ -37,6 +37,9 @@ files:
|
|
37
37
|
- app/base/helpers/index.js
|
38
38
|
- app/base/load.rb
|
39
39
|
- app/base/models/base_model.rb
|
40
|
+
- app/base/store/modules.js
|
41
|
+
- app/base/store/mutations.js
|
42
|
+
- app/base/store/state.js
|
40
43
|
- app/base/templates/layout.liquid
|
41
44
|
- app/base/templates/layouts/app.html
|
42
45
|
- app/compiled/.ignore
|
@@ -47,7 +50,6 @@ files:
|
|
47
50
|
- app/config/env/production.yml
|
48
51
|
- app/config/env/stage.yml
|
49
52
|
- app/config/env/test.yml
|
50
|
-
- app/core/Gemfile
|
51
53
|
- app/core/boot.rb
|
52
54
|
- app/core/generate_configs.rb
|
53
55
|
- app/core/load.rb
|
@@ -111,5 +113,5 @@ rubyforge_project:
|
|
111
113
|
rubygems_version: 2.5.1
|
112
114
|
signing_key:
|
113
115
|
specification_version: 4
|
114
|
-
summary: '["appril-cli-0.2.
|
116
|
+
summary: '["appril-cli-0.2.6", "Appril CLI"]'
|
115
117
|
test_files: []
|