appril-cli 0.3.0 → 0.4.0
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 +1 -1
- data/app/base/app.js +7 -11
- data/app/base/assets/app.css +2 -0
- data/app/base/assets/spinner.css +32 -0
- data/app/base/components/base_controller.rb +0 -7
- data/app/base/components/rtcp_controller.rb +1 -1
- data/app/base/helpers/application_helpers.rb +2 -2
- data/app/base/layouts/loading/index.js +3 -0
- data/app/base/layouts/loading/template.html +3 -0
- data/app/base/layouts/main/index.js +3 -0
- data/app/base/layouts/main/template.html +3 -0
- data/app/base/{api.js → setup/api.js} +0 -0
- data/app/base/setup/build_component.js +65 -0
- data/app/base/{bootstrap → setup}/components.js +1 -1
- data/app/base/setup/load_component.js +35 -0
- data/app/base/setup/router.js +25 -0
- data/app/base/{bootstrap → setup}/rtcp.js +1 -1
- data/app/base/{bootstrap → setup}/store.js +0 -0
- data/app/base/setup/vue_directives.js +1 -0
- data/app/base/setup/vue_filters.js +1 -0
- data/app/base/setup/vue_plugins.js +21 -0
- data/app/base/templates/{layouts/app.html → layout.html} +0 -0
- data/app/package.json +7 -9
- data/app/webpack/alias.js +3 -1
- data/app/webpack/plugins.js +0 -5
- data/lib/appril-cli/version.rb +1 -1
- metadata +19 -11
- data/app/base/bootstrap/component.js +0 -19
- data/app/base/bootstrap/router.js +0 -64
- data/app/base/bootstrap/vue_plugins.js +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85a66e9654989e986c381b45f174a7da1fd42c1d
|
4
|
+
data.tar.gz: 67ec790ebc2913a72b081f1dc38f6dfea0401267
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db84371f8aa1045fe52f2d444f2d8e7ad45e18a7d1983af4e18fb851982367edc323231f5131a2b7072999af09ad5a9b3306c4258c7fa4d911d1cc6d07b26dc0
|
7
|
+
data.tar.gz: 3e02bda49fd24d922e6b66186ef48ffa09d98f18aaa0ba9a8cab541f5f6ef85e75742bba0ab4efe6086565ebde5d7575523f0791db59f14329face95f5c82661
|
data/app/Gemfile
CHANGED
data/app/base/app.js
CHANGED
@@ -1,22 +1,18 @@
|
|
1
|
-
const DEVELOPMENT = APP_ENV === 'development'
|
2
|
-
|
3
1
|
import Vue from 'vue'
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
2
|
+
import store from './setup/store'
|
3
|
+
import router from './setup/router'
|
4
|
+
import './setup/vue_plugins'
|
5
|
+
import './setup/vue_filters'
|
6
|
+
import './setup/vue_directives'
|
8
7
|
import './assets/app.css'
|
9
8
|
|
10
|
-
Vue.config.devtools =
|
11
|
-
|
12
|
-
for (let plugin of vue_plugins)
|
13
|
-
Vue.use(plugin)
|
9
|
+
Vue.config.devtools = APP_ENV === 'development'
|
14
10
|
|
15
11
|
document.addEventListener('DOMContentLoaded', function() {
|
16
12
|
new Vue({
|
17
13
|
router,
|
18
14
|
store,
|
19
15
|
el: '#app',
|
20
|
-
template: require('templates/
|
16
|
+
template: require('templates/layout.html')
|
21
17
|
})
|
22
18
|
})
|
data/app/base/assets/app.css
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
.spinner {
|
2
|
+
margin: auto;
|
3
|
+
position: relative;
|
4
|
+
text-indent: -9999em;
|
5
|
+
border-top: 0.15em solid rgba(0,0,0, 0.5);
|
6
|
+
border-right: 0.15em solid rgba(0,0,0, 0.5);
|
7
|
+
border-bottom: 0.15em solid rgba(0,0,0, 0.5);
|
8
|
+
border-left: 0.15em solid #ffffff;
|
9
|
+
border-left-color: transparent;
|
10
|
+
transform: translateZ(0);
|
11
|
+
animation: spinner-animation 1.1s infinite linear;
|
12
|
+
}
|
13
|
+
|
14
|
+
.spinner, .spinner:after {
|
15
|
+
border-radius: 50%;
|
16
|
+
width: 1.5em;
|
17
|
+
height: 1.5em;
|
18
|
+
}
|
19
|
+
|
20
|
+
.spinner-btn-lg, .spinner-btn-lg:after {
|
21
|
+
width: 1.2em;
|
22
|
+
height: 1.2em;
|
23
|
+
}
|
24
|
+
|
25
|
+
@keyframes spinner-animation {
|
26
|
+
0% {
|
27
|
+
transform: rotate(0deg);
|
28
|
+
}
|
29
|
+
100% {
|
30
|
+
transform: rotate(360deg);
|
31
|
+
}
|
32
|
+
}
|
@@ -23,11 +23,4 @@ class BaseController < Appril::BaseController
|
|
23
23
|
e.backtrace && e.backtrace.each {|l| puts " \e[0;36m%s\e[0m" % l}
|
24
24
|
e.message
|
25
25
|
end
|
26
|
-
|
27
|
-
private
|
28
|
-
# fetch user using authorization_token
|
29
|
-
def user?
|
30
|
-
# return unless authorization_token = params[:__authorization_token__] || cookies[:__authorization_token__]
|
31
|
-
# User.find_by(authorization_token: authorization_token)
|
32
|
-
end
|
33
26
|
end
|
File without changes
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import {cloneDeep, find} from 'lodash'
|
2
|
+
import Loading from 'layouts/loading'
|
3
|
+
import MainLayout from 'layouts/main'
|
4
|
+
import components from './components'
|
5
|
+
|
6
|
+
export default function(component, constructor) {
|
7
|
+
let layout = cloneDeep(constructor.layout || MainLayout)
|
8
|
+
|
9
|
+
if (layout.default)
|
10
|
+
layout = layout.default
|
11
|
+
|
12
|
+
delete constructor.layout
|
13
|
+
|
14
|
+
/** comment or delete this line to pipe component through Crudle builder
|
15
|
+
const Crudle = require('crudle').default
|
16
|
+
Crudle.Menu = {
|
17
|
+
template: require('templates/menu'),
|
18
|
+
data() {return {
|
19
|
+
...components,
|
20
|
+
is_active(...a) {return find(a, ({name}) => name == component.name) ? true : false}
|
21
|
+
}}
|
22
|
+
}
|
23
|
+
constructor = Crudle(constructor)
|
24
|
+
/* */
|
25
|
+
|
26
|
+
let mixin
|
27
|
+
|
28
|
+
if (component.api.client_env) {
|
29
|
+
mixin = {
|
30
|
+
|
31
|
+
data() {return {
|
32
|
+
component,
|
33
|
+
env: null
|
34
|
+
}},
|
35
|
+
|
36
|
+
beforeCreate() {
|
37
|
+
component.api.client_env(
|
38
|
+
...(
|
39
|
+
location.pathname.replace(/\/+/g, '/').
|
40
|
+
replace(component.url.toString().replace(/\/+$/, ''), '').split('/')
|
41
|
+
),
|
42
|
+
this.$route.query
|
43
|
+
).get({
|
44
|
+
success: (env) => this.env = env
|
45
|
+
})
|
46
|
+
},
|
47
|
+
|
48
|
+
computed: {
|
49
|
+
page_view() {return this.env ? constructor : Loading}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
} else {
|
53
|
+
mixin = {
|
54
|
+
data() {return {
|
55
|
+
component,
|
56
|
+
page_view: constructor
|
57
|
+
}}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
layout.mixins || (layout.mixins = [])
|
62
|
+
layout.mixins.push(mixin)
|
63
|
+
|
64
|
+
return layout
|
65
|
+
}
|
@@ -2,7 +2,7 @@ import {reduce} from 'lodash'
|
|
2
2
|
import {urlify} from 'appril-utils'
|
3
3
|
import xhr from 'appril-api/xhr'
|
4
4
|
import rtcp from './rtcp'
|
5
|
-
import * as callbacks_and_headers from '
|
5
|
+
import * as callbacks_and_headers from './api'
|
6
6
|
import {components, default_api} from 'app/appril.json'
|
7
7
|
|
8
8
|
export default reduce(components, function(map,component) {
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import {compact} from 'lodash'
|
2
|
+
import {dev_server_url, client_url} from 'app/appril.json'
|
3
|
+
|
4
|
+
const BASEURL = compact([
|
5
|
+
APP_ENV === 'development' ? dev_server_url : null,
|
6
|
+
client_url,
|
7
|
+
APP_ENV
|
8
|
+
]).join('')
|
9
|
+
|
10
|
+
export default function(component, resolve) {
|
11
|
+
const xhr = new XMLHttpRequest()
|
12
|
+
|
13
|
+
xhr.onreadystatechange = function() {
|
14
|
+
if (xhr.readyState !== XMLHttpRequest.DONE)
|
15
|
+
return
|
16
|
+
|
17
|
+
if (parseInt(xhr.status / 100) !== 2)
|
18
|
+
return console.error(xhr.responseText)
|
19
|
+
|
20
|
+
resolve(_eval(xhr.responseText))
|
21
|
+
}
|
22
|
+
|
23
|
+
xhr.onerror = function(error = 'Network error occurred') {
|
24
|
+
console.error(error)
|
25
|
+
}
|
26
|
+
|
27
|
+
xhr.open('GET', `${BASEURL}/${component.entry_path}.js`)
|
28
|
+
xhr.send()
|
29
|
+
}
|
30
|
+
|
31
|
+
function _eval(text) {
|
32
|
+
window.module = {exports: null}
|
33
|
+
eval.call(window, text)
|
34
|
+
return window.module.exports.default
|
35
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import {map, filter} from 'lodash'
|
2
|
+
import Vue from 'vue'
|
3
|
+
import VueRouter from 'vue-router'
|
4
|
+
|
5
|
+
import components from './components'
|
6
|
+
import build_component from './build_component'
|
7
|
+
import load_component from './load_component'
|
8
|
+
|
9
|
+
Vue.use(VueRouter)
|
10
|
+
|
11
|
+
export default new VueRouter({
|
12
|
+
mode: 'history',
|
13
|
+
base: __dirname,
|
14
|
+
routes: map(filter(components, 'entry_path'), function(component) {
|
15
|
+
return {
|
16
|
+
name: component.name,
|
17
|
+
path: component.url_pattern,
|
18
|
+
component: function(resolve) {
|
19
|
+
load_component(component, function(constructor) {
|
20
|
+
resolve(build_component(component, constructor))
|
21
|
+
})
|
22
|
+
}
|
23
|
+
}
|
24
|
+
})
|
25
|
+
})
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
import Vue from 'vue'
|
@@ -0,0 +1 @@
|
|
1
|
+
import Vue from 'vue'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import Vue from 'vue'
|
2
|
+
import components from './components'
|
3
|
+
import rtcp from './rtcp'
|
4
|
+
|
5
|
+
Vue.use(function(vue) {
|
6
|
+
|
7
|
+
vue.prototype.components = components
|
8
|
+
vue.prototype.rtcp = rtcp
|
9
|
+
|
10
|
+
Object.defineProperty(vue.prototype, 'component', {
|
11
|
+
get() {return this.$parent.component}
|
12
|
+
})
|
13
|
+
|
14
|
+
Object.defineProperty(vue.prototype, 'api', {
|
15
|
+
get() {return this.component.api}
|
16
|
+
})
|
17
|
+
|
18
|
+
Object.defineProperty(vue.prototype, 'env', {
|
19
|
+
get() {return this.$parent.env}
|
20
|
+
})
|
21
|
+
})
|
File without changes
|
data/app/package.json
CHANGED
@@ -3,11 +3,9 @@
|
|
3
3
|
"version": "0.0.0",
|
4
4
|
"description": "...",
|
5
5
|
"devDependencies": {
|
6
|
-
"appril-api": ">= 0.0.
|
6
|
+
"appril-api": ">= 0.0.2",
|
7
7
|
"appril-alert": ">= 0.0.5",
|
8
|
-
"appril-
|
9
|
-
"appril-url": ">= 0.0.5",
|
10
|
-
"appril-utils": ">= 0.1.5",
|
8
|
+
"appril-utils": ">= 0.2.1",
|
11
9
|
"babel-core": "6",
|
12
10
|
"babel-loader": "6",
|
13
11
|
"babel-plugin-transform-object-rest-spread": "6",
|
@@ -16,17 +14,17 @@
|
|
16
14
|
"babel-preset-stage-2": "6",
|
17
15
|
"babel-preset-stage-3": "6",
|
18
16
|
"css-loader": "*",
|
19
|
-
"deep-freeze-strict": "1",
|
20
17
|
"extract-text-webpack-plugin": "^2.0.0-beta.2",
|
21
18
|
"file-loader": "*",
|
22
19
|
"json-loader": "*",
|
20
|
+
"lodash": "^4.15.0",
|
23
21
|
"optimize-css-assets-webpack-plugin": "1",
|
24
22
|
"style-loader": "*",
|
25
23
|
"url-loader": "*",
|
26
|
-
"vue": "^2.0.0-rc.
|
27
|
-
"vue-router": "^2.0.0-rc.
|
24
|
+
"vue": "^2.0.0-rc.4",
|
25
|
+
"vue-router": "^2.0.0-rc.4",
|
28
26
|
"vue-html-loader": "1",
|
29
|
-
"vuex": "^2.0.0-rc.
|
30
|
-
"webpack": "^2.1.0-beta.
|
27
|
+
"vuex": "^2.0.0-rc.5",
|
28
|
+
"webpack": "^2.1.0-beta.20"
|
31
29
|
}
|
32
30
|
}
|
data/app/webpack/alias.js
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
const path = require('path')
|
2
2
|
|
3
3
|
module.exports = {
|
4
|
+
vue: 'vue/dist/vue.js',
|
5
|
+
|
4
6
|
app: path.resolve(__dirname, '..'),
|
5
7
|
base: 'app/base',
|
6
8
|
assets: 'base/assets',
|
7
9
|
components: 'base/components',
|
8
10
|
helpers: 'base/helpers',
|
11
|
+
layouts: 'base/layouts',
|
9
12
|
templates: 'base/templates',
|
10
|
-
vue: 'vue/dist/vue.js'
|
11
13
|
}
|
data/app/webpack/plugins.js
CHANGED
@@ -5,11 +5,6 @@ const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
|
|
5
5
|
const plugins = [
|
6
6
|
new webpack.optimize.CommonsChunkPlugin({names: ['app'], minChunks: 2}),
|
7
7
|
|
8
|
-
// new webpack.ProvidePlugin({
|
9
|
-
// $: 'jquery',
|
10
|
-
// jQuery: 'jquery'
|
11
|
-
// }),
|
12
|
-
|
13
8
|
new webpack.DefinePlugin({
|
14
9
|
APP_ENV: JSON.stringify(APP_ENV),
|
15
10
|
'process.env': {
|
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.
|
4
|
+
version: 0.4.0
|
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-
|
11
|
+
date: 2016-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Appril CLI
|
14
14
|
email:
|
@@ -24,16 +24,10 @@ files:
|
|
24
24
|
- app/.pryrc
|
25
25
|
- app/Gemfile
|
26
26
|
- app/Rakefile
|
27
|
-
- app/base/api.js
|
28
27
|
- app/base/app.js
|
29
28
|
- app/base/assets/app.css
|
29
|
+
- app/base/assets/spinner.css
|
30
30
|
- app/base/boot.rb
|
31
|
-
- app/base/bootstrap/component.js
|
32
|
-
- app/base/bootstrap/components.js
|
33
|
-
- app/base/bootstrap/router.js
|
34
|
-
- app/base/bootstrap/rtcp.js
|
35
|
-
- app/base/bootstrap/store.js
|
36
|
-
- app/base/bootstrap/vue_plugins.js
|
37
31
|
- app/base/components/base_controller.rb
|
38
32
|
- app/base/components/index/index.js
|
39
33
|
- app/base/components/index/server.rb
|
@@ -42,13 +36,27 @@ files:
|
|
42
36
|
- app/base/helpers/application_helpers.rb
|
43
37
|
- app/base/helpers/index.js
|
44
38
|
- app/base/helpers/user.rb
|
39
|
+
- app/base/layouts/loading/index.js
|
40
|
+
- app/base/layouts/loading/template.html
|
41
|
+
- app/base/layouts/main/index.js
|
42
|
+
- app/base/layouts/main/template.html
|
45
43
|
- app/base/load.rb
|
46
44
|
- app/base/models/base_model.rb
|
45
|
+
- app/base/setup/api.js
|
46
|
+
- app/base/setup/build_component.js
|
47
|
+
- app/base/setup/components.js
|
48
|
+
- app/base/setup/load_component.js
|
49
|
+
- app/base/setup/router.js
|
50
|
+
- app/base/setup/rtcp.js
|
51
|
+
- app/base/setup/store.js
|
52
|
+
- app/base/setup/vue_directives.js
|
53
|
+
- app/base/setup/vue_filters.js
|
54
|
+
- app/base/setup/vue_plugins.js
|
47
55
|
- app/base/store/components.js
|
48
56
|
- app/base/store/mutations.js
|
49
57
|
- app/base/store/state.js
|
58
|
+
- app/base/templates/layout.html
|
50
59
|
- app/base/templates/layout.liquid
|
51
|
-
- app/base/templates/layouts/app.html
|
52
60
|
- app/compiled/.ignore
|
53
61
|
- app/config.ru
|
54
62
|
- app/config/config.rb
|
@@ -121,5 +129,5 @@ rubyforge_project:
|
|
121
129
|
rubygems_version: 2.5.1
|
122
130
|
signing_key:
|
123
131
|
specification_version: 4
|
124
|
-
summary: '["appril-cli-0.
|
132
|
+
summary: '["appril-cli-0.4.0", "Appril CLI"]'
|
125
133
|
test_files: []
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import {find} from 'lodash'
|
2
|
-
|
3
|
-
// /** default deployer
|
4
|
-
export default function(components, component, constructor) {
|
5
|
-
return constructor
|
6
|
-
} /* */
|
7
|
-
|
8
|
-
/** Crudle deployer
|
9
|
-
import Crudle from 'crudle'
|
10
|
-
export default function(components, component, constructor) {
|
11
|
-
Crudle.Menu = {
|
12
|
-
template: require('templates/menu'),
|
13
|
-
data() {return {
|
14
|
-
...components,
|
15
|
-
is_active(...a) {return find(a, (c) => c.url == component.url) ? true : false}
|
16
|
-
}}
|
17
|
-
}
|
18
|
-
return Crudle(constructor)
|
19
|
-
} /* */
|
@@ -1,64 +0,0 @@
|
|
1
|
-
import {map, filter, compact} from 'lodash'
|
2
|
-
import Vue from 'vue'
|
3
|
-
import VueRouter from 'vue-router'
|
4
|
-
|
5
|
-
import components from './components'
|
6
|
-
import store from './store'
|
7
|
-
import componentify from './component'
|
8
|
-
import {dev_server_url, client_url} from 'app/appril.json'
|
9
|
-
|
10
|
-
Vue.use(VueRouter)
|
11
|
-
|
12
|
-
const BASEURL = compact([dev_server_url, client_url, APP_ENV]).join('')
|
13
|
-
|
14
|
-
export default new VueRouter({
|
15
|
-
mode: 'history',
|
16
|
-
base: __dirname,
|
17
|
-
routes: map(filter(components, 'entry_path'), function(component) {
|
18
|
-
return {
|
19
|
-
name: component.name,
|
20
|
-
path: component.url_pattern,
|
21
|
-
component: (resolve) => load_component(component, resolve)
|
22
|
-
}
|
23
|
-
})
|
24
|
-
})
|
25
|
-
|
26
|
-
function resolve_component(component, constructor, resolve) {
|
27
|
-
if (component.api._env) {
|
28
|
-
component.api._env().get({
|
29
|
-
success(env) {
|
30
|
-
store.commit('__SET_ENV__', {component: component.name, env})
|
31
|
-
resolve(componentify(components, component, constructor))
|
32
|
-
}
|
33
|
-
})
|
34
|
-
} else {
|
35
|
-
resolve(componentify(components, component, constructor))
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
|
-
function load_component(component, resolve) {
|
40
|
-
const xhr = new XMLHttpRequest()
|
41
|
-
|
42
|
-
xhr.onreadystatechange = function() {
|
43
|
-
if (xhr.readyState !== XMLHttpRequest.DONE)
|
44
|
-
return
|
45
|
-
|
46
|
-
if (parseInt(xhr.status / 100) !== 2)
|
47
|
-
return console.error(xhr.responseText)
|
48
|
-
|
49
|
-
resolve_component(component, _eval(xhr.responseText), resolve)
|
50
|
-
}
|
51
|
-
|
52
|
-
xhr.onerror = function(error = 'Network error occurred') {
|
53
|
-
console.error(error)
|
54
|
-
}
|
55
|
-
|
56
|
-
xhr.open('GET', `${BASEURL}/${component.entry_path}.js`)
|
57
|
-
xhr.send()
|
58
|
-
}
|
59
|
-
|
60
|
-
function _eval(text) {
|
61
|
-
window.module = {exports: null}
|
62
|
-
eval.call(window, text)
|
63
|
-
return window.module.exports.default
|
64
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import components from './components'
|
2
|
-
import rtcp from './rtcp'
|
3
|
-
|
4
|
-
export default [
|
5
|
-
|
6
|
-
function(vue) {
|
7
|
-
|
8
|
-
vue.prototype.rtcp = rtcp
|
9
|
-
|
10
|
-
Object.defineProperty(vue.prototype, 'env', {
|
11
|
-
get() {return this.$store ? this.$store.state.__ENV__[this.$router.currentRoute.name] || {} : {}}
|
12
|
-
})
|
13
|
-
|
14
|
-
Object.defineProperty(vue.prototype, 'components', {
|
15
|
-
get() {return components}
|
16
|
-
})
|
17
|
-
|
18
|
-
Object.defineProperty(vue.prototype, 'component', {
|
19
|
-
get() {return components[this.$router.currentRoute.name]}
|
20
|
-
})
|
21
|
-
|
22
|
-
Object.defineProperty(vue.prototype, 'api', {
|
23
|
-
get() {return components[this.$router.currentRoute.name].api}
|
24
|
-
})
|
25
|
-
}
|
26
|
-
|
27
|
-
]
|