appril-cli 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/base/assets/styles.css +2 -0
- data/{boilerplate/app/base/api → app/base/components}/base_controller.rb +3 -1
- data/app/base/components/deploy.js +25 -0
- data/app/base/components/index/index.js +3 -0
- data/app/base/components/index/server.rb +13 -0
- data/{boilerplate/app/base/api → app/base/components}/rtcp_controller.rb +5 -7
- data/app/base/core.js +77 -0
- data/app/base/templates/layout.liquid +13 -0
- data/app/config/config.rb +11 -0
- data/{sandbox → app}/config/config.yml +8 -4
- data/{boilerplate/app → app}/core/Gemfile +2 -2
- data/{sandbox → app}/core/boot.rb +2 -4
- data/app/core/generate_configs.rb +7 -0
- data/{boilerplate/app → app}/core/load.rb +2 -2
- data/{boilerplate/app/core/load_api.rb → app/core/load_components.rb} +2 -1
- data/app/generators/_component/index.js +3 -0
- data/app/generators/_component/template.html +3 -0
- data/app/generators/component +29 -0
- data/app/package.json +30 -0
- data/{boilerplate/app → app}/webpack/alias.js +3 -3
- data/app/webpack/entry.js +3 -0
- data/{boilerplate/app → app}/webpack/extensions.js +1 -2
- data/app/webpack/loaders.js +47 -0
- data/app/webpack/output.js +9 -0
- data/app/webpack/plugins.js +38 -0
- data/app/webpack.config.js +29 -0
- data/lib/appril-cli/assertions.rb +5 -21
- data/lib/appril-cli/docker/build.rb +35 -31
- data/lib/appril-cli/docker/install.rb +18 -11
- data/lib/appril-cli/docker/update.rb +20 -11
- data/lib/appril-cli/docker.rb +14 -43
- data/lib/appril-cli/helpers.rb +7 -9
- data/lib/appril-cli/install.rb +30 -0
- data/lib/appril-cli/update.rb +34 -0
- data/lib/appril-cli/version.rb +1 -1
- data/lib/appril-cli.rb +62 -47
- metadata +52 -109
- data/boilerplate/app/base/api/deploy.coffee +0 -45
- data/boilerplate/app/base/api/index/client.coffee +0 -4
- data/boilerplate/app/base/api/index/server.rb +0 -3
- data/boilerplate/app/base/core.coffee +0 -113
- data/boilerplate/app/base/helpers/application_helpers.coffee +0 -1
- data/boilerplate/app/base/templates/access_denied.html +0 -3
- data/boilerplate/app/base/templates/layout.liquid +0 -11
- data/boilerplate/app/base/templates/layouts/main.html +0 -1
- data/boilerplate/app/base/templates/layouts/none.html +0 -1
- data/boilerplate/app/config/config.rb +0 -14
- data/boilerplate/app/config/config.yml +0 -18
- data/boilerplate/app/core/boot.rb +0 -72
- data/boilerplate/app/core/generate_configs.rb +0 -79
- data/boilerplate/app/generators/api/client.coffee +0 -4
- data/boilerplate/app/generators/api/server.rb +0 -3
- data/boilerplate/app/package.json +0 -10
- data/boilerplate/app/webpack/config.js +0 -6
- data/boilerplate/app/webpack/entry.js +0 -3
- data/boilerplate/app/webpack/loaders.js +0 -15
- data/boilerplate/app/webpack/output.js +0 -11
- data/boilerplate/app/webpack/plugins.js +0 -19
- data/boilerplate/app/webpack.config.js +0 -19
- data/boilerplate/crudle/Gemfile +0 -7
- data/boilerplate/crudle/base/api/deploy.coffee +0 -51
- data/boilerplate/crudle/base/api/index/client.coffee +0 -5
- data/boilerplate/crudle/base/api/index/layout.html +0 -5
- data/boilerplate/crudle/base/api/index/server.rb +0 -7
- data/boilerplate/crudle/base/templates/menu.html +0 -3
- data/boilerplate/crudle/generators/api/client.coffee +0 -17
- data/boilerplate/crudle/generators/api/editor/layout.html +0 -3
- data/boilerplate/crudle/generators/api/list/item.html +0 -3
- data/boilerplate/crudle/generators/api/server.rb +0 -26
- data/boilerplate/crudle/package.json +0 -13
- data/boilerplate/crudle/webpack/loaders.js +0 -16
- data/lib/appril-cli/app/install.rb +0 -47
- data/lib/appril-cli/app/update.rb +0 -28
- data/lib/appril-cli/app.rb +0 -46
- data/lib/appril-cli/generator/api.rb +0 -16
- data/lib/appril-cli/generator.rb +0 -32
- data/sandbox/.gitignore +0 -6
- data/sandbox/.pryrc +0 -1
- data/sandbox/Gemfile +0 -7
- data/sandbox/Rakefile +0 -1
- data/sandbox/base/api/base_controller.rb +0 -21
- data/sandbox/base/api/index/client.coffee +0 -4
- data/sandbox/base/api/index/layout.html +0 -3
- data/sandbox/base/api/index/server.rb +0 -3
- data/sandbox/base/api/rtcp_controller.rb +0 -22
- data/sandbox/base/assets/styles.css +0 -0
- data/sandbox/base/boot.rb +0 -2
- data/sandbox/base/core.coffee +0 -128
- data/sandbox/base/helpers/application_helpers.coffee +0 -1
- data/sandbox/base/helpers/application_helpers.rb +0 -4
- data/sandbox/base/load.rb +0 -0
- data/sandbox/base/models/base_model.rb +0 -0
- data/sandbox/base/templates/access_denied.html +0 -3
- data/sandbox/base/templates/layout.liquid +0 -11
- data/sandbox/base/templates/layouts/main.html +0 -1
- data/sandbox/base/templates/layouts/none.html +0 -1
- data/sandbox/base/templates/menu.html +0 -3
- data/sandbox/config/config.rb +0 -9
- data/sandbox/config/env/development.yml +0 -0
- data/sandbox/config/env/production.yml +0 -0
- data/sandbox/config/env/stage.yml +0 -0
- data/sandbox/config/env/test.yml +0 -0
- data/sandbox/config.ru +0 -3
- data/sandbox/core/Gemfile +0 -4
- data/sandbox/core/generate_configs.rb +0 -125
- data/sandbox/core/load.rb +0 -14
- data/sandbox/core/load_controllers.rb +0 -14
- data/sandbox/generators/api/client.coffee +0 -11
- data/sandbox/generators/api/editor.html +0 -0
- data/sandbox/generators/api/layout.html +0 -0
- data/sandbox/generators/api/server.rb +0 -26
- data/sandbox/package.json +0 -15
- data/sandbox/webpack.config.js +0 -54
- /data/{boilerplate/app → app}/.gitignore +0 -0
- /data/{boilerplate/app → app}/.pryrc +0 -0
- /data/{boilerplate/app → app}/Gemfile +0 -0
- /data/{boilerplate/app → app}/Rakefile +0 -0
- /data/{boilerplate/app → app}/base/boot.rb +0 -0
- /data/{boilerplate/app/base/api/index/layout.html → app/base/components/index/template.html} +0 -0
- /data/{boilerplate/app → app}/base/helpers/application_helpers.rb +0 -0
- /data/{boilerplate/app/base/assets/styles.css → app/base/helpers/index.js} +0 -0
- /data/{boilerplate/app → app}/base/load.rb +0 -0
- /data/{boilerplate/app → app}/base/models/base_model.rb +0 -0
- /data/{boilerplate/app/public → app/compiled}/.ignore +0 -0
- /data/{boilerplate/app → app}/config/env/development.yml +0 -0
- /data/{boilerplate/app → app}/config/env/production.yml +0 -0
- /data/{boilerplate/app → app}/config/env/stage.yml +0 -0
- /data/{boilerplate/app → app}/config/env/test.yml +0 -0
- /data/{boilerplate/app → app}/config.ru +0 -0
- /data/{boilerplate/app → app}/core/load_helpers.rb +0 -0
- /data/{boilerplate/app → app}/core/load_models.rb +0 -0
- /data/{boilerplate/app/tmp → app/public}/.ignore +0 -0
- /data/{boilerplate/app/var → app/tmp}/.ignore +0 -0
- /data/{boilerplate/app/generators/api/layout.html → app/var/.ignore} +0 -0
@@ -1,19 +0,0 @@
|
|
1
|
-
var child_process = require('child_process');
|
2
|
-
|
3
|
-
if ((process.env.APP_ENV || 'development') == 'development') {
|
4
|
-
console.log('Generating configs...');
|
5
|
-
child_process.execSync('./core/generate_configs.rb');
|
6
|
-
}
|
7
|
-
|
8
|
-
module.exports = {
|
9
|
-
entry: require('./webpack/entry.js'),
|
10
|
-
output: require('./webpack/output.js'),
|
11
|
-
module: {
|
12
|
-
loaders: require('./webpack/loaders.js')
|
13
|
-
},
|
14
|
-
resolve: {
|
15
|
-
extensions: require('./webpack/extensions.js'),
|
16
|
-
alias: require('./webpack/alias.js')
|
17
|
-
},
|
18
|
-
plugins: require('./webpack/plugins.js')
|
19
|
-
}
|
data/boilerplate/crudle/Gemfile
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
_ = {
|
2
|
-
has: require('lodash/has')
|
3
|
-
isFunction: require('lodash/isFunction')
|
4
|
-
}
|
5
|
-
|
6
|
-
Crudle = require('crudle')
|
7
|
-
|
8
|
-
templates = {
|
9
|
-
none: require('templates/layouts/none')
|
10
|
-
main: require('templates/layouts/main')
|
11
|
-
}
|
12
|
-
|
13
|
-
previous_layout = null
|
14
|
-
module.exports = (api, env) ->
|
15
|
-
|
16
|
-
crudle = Crudle(env)
|
17
|
-
crudle.partials.menu = require('templates/menu')
|
18
|
-
crudle.data.url = env.controller.url
|
19
|
-
|
20
|
-
layout = if _.has(api, 'layout')
|
21
|
-
|
22
|
-
api_layout = if _.isFunction(api.layout)
|
23
|
-
api.layout(env)
|
24
|
-
else
|
25
|
-
api.layout
|
26
|
-
#end
|
27
|
-
|
28
|
-
if api_layout == false
|
29
|
-
'none'
|
30
|
-
else
|
31
|
-
api_layout || 'main'
|
32
|
-
#end
|
33
|
-
|
34
|
-
else
|
35
|
-
'main'
|
36
|
-
#end
|
37
|
-
|
38
|
-
if layout == previous_layout
|
39
|
-
# do not re-render body if current api uses same layout as previous one
|
40
|
-
return api(env, crudle)
|
41
|
-
#end
|
42
|
-
previous_layout = layout
|
43
|
-
|
44
|
-
env.render
|
45
|
-
el: 'body'
|
46
|
-
template: templates[layout] || templates.none
|
47
|
-
oncomplete: ->
|
48
|
-
api(env, crudle)
|
49
|
-
#end
|
50
|
-
#end
|
51
|
-
#end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
|
2
|
-
self = (env, {layout, list, editor}) ->
|
3
|
-
list.partials.item = require('./list/item')
|
4
|
-
editor.template = require('./editor/layout')
|
5
|
-
env.render(layout)
|
6
|
-
#end
|
7
|
-
|
8
|
-
module.exports = self
|
9
|
-
|
10
|
-
# list partials:
|
11
|
-
# - header
|
12
|
-
# - footer
|
13
|
-
# - items
|
14
|
-
# - item
|
15
|
-
|
16
|
-
# filters partials:
|
17
|
-
# - filters
|
@@ -1,26 +0,0 @@
|
|
1
|
-
class CONTROLLER_NAME < BaseController
|
2
|
-
include Crudle::Controller
|
3
|
-
|
4
|
-
private
|
5
|
-
def model; MODEL_NAME end
|
6
|
-
|
7
|
-
# def order; end
|
8
|
-
|
9
|
-
# def name_filter params, dataset
|
10
|
-
# return if params[:name].nil? || params[:name].empty?
|
11
|
-
# dataset.where('name LIKE ?', params[:name] + '%')
|
12
|
-
# end
|
13
|
-
|
14
|
-
# def list_serializer item
|
15
|
-
# serializer(item)
|
16
|
-
# end
|
17
|
-
|
18
|
-
# def editor_serializer item
|
19
|
-
# serializer(item)
|
20
|
-
# end
|
21
|
-
|
22
|
-
# def serializer item
|
23
|
-
# item
|
24
|
-
# end
|
25
|
-
|
26
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
var ExtractTextPlugin = require("extract-text-webpack-plugin");
|
2
|
-
|
3
|
-
module.exports = [
|
4
|
-
{ test: /\.html$/, loader: 'ractive-loader' },
|
5
|
-
{ test: /\.coffee$/, loader: 'coffee-loader' },
|
6
|
-
{ test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader") },
|
7
|
-
{ test: /\.json$/, loader: 'json-loader' },
|
8
|
-
{ test: /\.otf($|\?)/, loader: require.resolve('file-loader') },
|
9
|
-
{ test: /\.ttf($|\?)/, loader: require.resolve('file-loader') },
|
10
|
-
{ test: /\.eot($|\?)/, loader: require.resolve('file-loader') },
|
11
|
-
{ test: /\.svg($|\?)/, loader: require.resolve('file-loader') },
|
12
|
-
{ test: /\.png($|\?)/, loader: require.resolve('url-loader') + '?limit=10000&mimetype=image/png' },
|
13
|
-
{ test: /\.jpg($|\?)/, loader: require.resolve('file-loader') },
|
14
|
-
{ test: /\.gif($|\?)/, loader: require.resolve('file-loader') },
|
15
|
-
{ test: /\.woff[2]?($|\?)/, loader: require.resolve('url-loader') + '?limit=10000&mimetype=application/font-woff' },
|
16
|
-
]
|
@@ -1,47 +0,0 @@
|
|
1
|
-
module Appril
|
2
|
-
class CLI
|
3
|
-
module App
|
4
|
-
|
5
|
-
class Install
|
6
|
-
include Helpers
|
7
|
-
|
8
|
-
def initialize dir, namespace: nil, working_dir_opted: false, crudle_app: false
|
9
|
-
install(dir, working_dir_opted, crudle_app)
|
10
|
-
make_executable(dir / 'core/generate_configs.rb')
|
11
|
-
add_namespace(dir, namespace) if namespace
|
12
|
-
puts "Done. All files installed into #{dir}"
|
13
|
-
end
|
14
|
-
|
15
|
-
def install dir, working_dir_opted, crudle_app
|
16
|
-
src = working_dir_opted ? APP_DIR.to_path + '/.' : APP_DIR
|
17
|
-
FileUtils.cp_r(src, dir)
|
18
|
-
if crudle_app
|
19
|
-
FileUtils.rm_rf(dir / 'generators/api')
|
20
|
-
FileUtils.cp_r(CRUDLE_DIR.to_path + '/.', dir)
|
21
|
-
end
|
22
|
-
cleanup(dir)
|
23
|
-
end
|
24
|
-
|
25
|
-
def add_namespace dir, namespace
|
26
|
-
%w[
|
27
|
-
base/base_controller.rb
|
28
|
-
base/rtcp_controller.rb
|
29
|
-
config/config.rb
|
30
|
-
].each do |file|
|
31
|
-
code = File.read(dir / file)
|
32
|
-
File.open dir / file, 'w' do |f|
|
33
|
-
f.puts "module #{namespace}"
|
34
|
-
code.split("\n").each {|l| f.puts " #{l}"}
|
35
|
-
f.puts "end"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def cleanup dir
|
41
|
-
Dir[dir / "**/.ignore"].each {|f| FileUtils.rm_f(f)}
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module Appril
|
2
|
-
class CLI
|
3
|
-
module App
|
4
|
-
|
5
|
-
class Update
|
6
|
-
include Helpers
|
7
|
-
|
8
|
-
def initialize dir
|
9
|
-
FileUtils.rm_rf(dir / 'core')
|
10
|
-
Dir.chdir APP_DIR do
|
11
|
-
|
12
|
-
Dir['**/*'].select {|e| File.file?(e)}.each do |file|
|
13
|
-
next if file['generators/']
|
14
|
-
next if File.file?(dir / file)
|
15
|
-
create_dirname_for(dir / file)
|
16
|
-
puts "Installing #{File.basename(dir)}/#{file}"
|
17
|
-
FileUtils.cp(file, dir / file)
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
make_executable(dir / 'core/generate_configs.rb')
|
22
|
-
puts "Done"
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
data/lib/appril-cli/app.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
module Appril
|
2
|
-
class CLI
|
3
|
-
module App
|
4
|
-
|
5
|
-
APP_DIR = BOILERPLATE_DIR / 'app'
|
6
|
-
CRUDLE_DIR = BOILERPLATE_DIR / 'crudle'
|
7
|
-
|
8
|
-
def app args
|
9
|
-
opted_dir = args[2]
|
10
|
-
assert_directory_provided(opted_dir)
|
11
|
-
dir = expanded_path(opted_dir)
|
12
|
-
|
13
|
-
case instruction = args[1]
|
14
|
-
when 'i', 'install'
|
15
|
-
|
16
|
-
app_install(dir, {
|
17
|
-
working_dir_opted: working_dir_opted?(opted_dir),
|
18
|
-
namespace: extract_namespace(args),
|
19
|
-
crudle_app: args.find {|a| a == '-crudle'}
|
20
|
-
})
|
21
|
-
|
22
|
-
when 'u', 'update'
|
23
|
-
|
24
|
-
app_update(dir)
|
25
|
-
|
26
|
-
else
|
27
|
-
unknown_instruction_error!(instruction, 'install (or i)', 'update (or u)')
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def app_install dir, opts
|
32
|
-
create_dirname_for(dir)
|
33
|
-
assert_installable_dir(dir, opts[:working_dir_opted])
|
34
|
-
App::Install.new(dir, opts)
|
35
|
-
end
|
36
|
-
|
37
|
-
def app_update dir
|
38
|
-
assert_is_app_dir(dir)
|
39
|
-
App::Update.new(dir)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
require 'appril-cli/app/install'
|
46
|
-
require 'appril-cli/app/update'
|
data/lib/appril-cli/generator.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
module Appril
|
2
|
-
class CLI
|
3
|
-
module Generator
|
4
|
-
|
5
|
-
def generator args
|
6
|
-
|
7
|
-
case instruction = args[1]
|
8
|
-
when 'api', 'a'
|
9
|
-
api_name = args[2]
|
10
|
-
assert_valid_api_name_given(api_name)
|
11
|
-
|
12
|
-
app_dir = args[3]
|
13
|
-
assert_directory_provided(app_dir)
|
14
|
-
app_dir = expanded_path(app_dir)
|
15
|
-
assert_is_app_dir(app_dir)
|
16
|
-
|
17
|
-
gen_dir = app_dir / 'generators/api'
|
18
|
-
assert_directory_exists(gen_dir)
|
19
|
-
|
20
|
-
api_dir = app_dir / "base/api/#{api_name}"
|
21
|
-
assert_directory_does_not_exists(api_dir)
|
22
|
-
|
23
|
-
Generator::API.new(gen_dir, api_dir, api_name)
|
24
|
-
else
|
25
|
-
unknown_instruction_error!(instruction, 'api (or a)')
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
require 'appril-cli/generator/api'
|
data/sandbox/.gitignore
DELETED
data/sandbox/.pryrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require File.expand_path('../core/load', __FILE__)
|
data/sandbox/Gemfile
DELETED
data/sandbox/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require File.expand_path('../core/load', __FILE__)
|
@@ -1,21 +0,0 @@
|
|
1
|
-
class BaseController < Appril::BaseController
|
2
|
-
include Helpers
|
3
|
-
|
4
|
-
map Cfg.server_url
|
5
|
-
|
6
|
-
define_layout :layout, file: '../templates/layout'
|
7
|
-
layout :layout
|
8
|
-
engine :Liquid
|
9
|
-
define_template(:get) {''}
|
10
|
-
define_template_var(:client_url, Cfg.client_url)
|
11
|
-
|
12
|
-
def get
|
13
|
-
render
|
14
|
-
end
|
15
|
-
|
16
|
-
error 500 do |e|
|
17
|
-
puts "\e[0;31m%s\e[0m" % e.inspect
|
18
|
-
e.backtrace && e.backtrace.each {|l| puts " \e[0;36m%s\e[0m" % l}
|
19
|
-
e.message
|
20
|
-
end
|
21
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
class RTCPController < Appril::RTCPController
|
2
|
-
map File.join(Cfg.server_url, '__rtcp__')
|
3
|
-
|
4
|
-
private
|
5
|
-
# called after socket connection established
|
6
|
-
def connected
|
7
|
-
end
|
8
|
-
|
9
|
-
# data sent to client after connection established
|
10
|
-
def initialization_data
|
11
|
-
{}
|
12
|
-
end
|
13
|
-
|
14
|
-
# merged into original env when calling a controller
|
15
|
-
def rtcp_env
|
16
|
-
{}
|
17
|
-
end
|
18
|
-
|
19
|
-
# called when socket connection closed
|
20
|
-
def disconnected
|
21
|
-
end
|
22
|
-
end
|
File without changes
|
data/sandbox/base/boot.rb
DELETED
data/sandbox/base/core.coffee
DELETED
@@ -1,128 +0,0 @@
|
|
1
|
-
_ =
|
2
|
-
merge: require('lodash/merge')
|
3
|
-
has: require('lodash/has')
|
4
|
-
isFunction: require('lodash/isFunction')
|
5
|
-
#end
|
6
|
-
|
7
|
-
Core = require('appril')
|
8
|
-
Page = require('appril-page')
|
9
|
-
Render = require('appril-ractive')
|
10
|
-
Reporter = require('appril-reporter')
|
11
|
-
require 'appril-polyfills'
|
12
|
-
require 'assets/styles.css'
|
13
|
-
|
14
|
-
CONSIDER_IDLE_AFTER = 5 * 60
|
15
|
-
|
16
|
-
window.Cfg = {}
|
17
|
-
window.Util = {}
|
18
|
-
window.App = {}
|
19
|
-
# window.Alert = require('appril-alert')
|
20
|
-
|
21
|
-
for k, v of require('appril-util')
|
22
|
-
Util[k] = v
|
23
|
-
#end
|
24
|
-
|
25
|
-
# for k, v of require('appril-datetime')
|
26
|
-
# Util[k] = v
|
27
|
-
# #end
|
28
|
-
|
29
|
-
for k, v of require('helpers/application_helpers.coffee')
|
30
|
-
Util[k] = v
|
31
|
-
#end
|
32
|
-
|
33
|
-
Object.freeze(Util)
|
34
|
-
|
35
|
-
Render.default_el = -> '#content'
|
36
|
-
Render.global_data = -> {App: App, Cfg: Cfg, Util: Util}
|
37
|
-
Render.global_handlers = -> {}
|
38
|
-
|
39
|
-
for name, controller of Core.controllers
|
40
|
-
App[name] = controller
|
41
|
-
#end
|
42
|
-
|
43
|
-
Core.on_initialize = (msg) ->
|
44
|
-
if window.Cfg = msg.data.cfg
|
45
|
-
delete msg.data.cfg
|
46
|
-
Object.freeze(Cfg)
|
47
|
-
|
48
|
-
for k, v of msg.data
|
49
|
-
App[k] = v
|
50
|
-
#end
|
51
|
-
|
52
|
-
Reporter CONSIDER_IDLE_AFTER, (status) ->
|
53
|
-
# close connection if user went away
|
54
|
-
Core.disconnect() if status == 'away'
|
55
|
-
#end
|
56
|
-
#end
|
57
|
-
|
58
|
-
templates =
|
59
|
-
none: require('templates/layouts/none.html')
|
60
|
-
main: require('templates/layouts/main.html')
|
61
|
-
access_denied: require('templates/access_denied.html')
|
62
|
-
#end
|
63
|
-
|
64
|
-
partials = {}
|
65
|
-
|
66
|
-
Crudle = require('crudle')
|
67
|
-
CrudleList = require('crudle-list')
|
68
|
-
CrudleEditor = require('crudle-editor')
|
69
|
-
|
70
|
-
deploy_api = (api) ->
|
71
|
-
|
72
|
-
page = new Page
|
73
|
-
env = _.merge({
|
74
|
-
render: Render
|
75
|
-
render_component: Render.component
|
76
|
-
render_string: Render.string
|
77
|
-
}, page)
|
78
|
-
|
79
|
-
crudle = Crudle(api.controller.ws, page)
|
80
|
-
crudle.partials.menu = require('templates/menu.html')
|
81
|
-
crudle.data.url = api.controller.url
|
82
|
-
|
83
|
-
api(
|
84
|
-
env,
|
85
|
-
crudle,
|
86
|
-
CrudleList(api.controller.ws, page),
|
87
|
-
CrudleEditor(api.controller.ws, page)
|
88
|
-
)
|
89
|
-
#end
|
90
|
-
|
91
|
-
previous_api = null
|
92
|
-
Core.on_controller_matched = (controller, context) ->
|
93
|
-
|
94
|
-
controller.load (api) ->
|
95
|
-
context.save()
|
96
|
-
|
97
|
-
api.controller = controller
|
98
|
-
|
99
|
-
if previous_api?.teardown
|
100
|
-
previous_api.teardown()
|
101
|
-
#end
|
102
|
-
previous_api = api
|
103
|
-
|
104
|
-
if _.has(api, 'acl')
|
105
|
-
unless _.isFunction(api.acl)
|
106
|
-
throw new Error("#{controller.name}.acl should be a function")
|
107
|
-
|
108
|
-
if api.acl()
|
109
|
-
deploy_api(api)
|
110
|
-
else
|
111
|
-
Render
|
112
|
-
el: 'body'
|
113
|
-
template: templates.main
|
114
|
-
partials: partials
|
115
|
-
oncomplete: ->
|
116
|
-
Render(template: templates.access_denied)
|
117
|
-
#end
|
118
|
-
|
119
|
-
else
|
120
|
-
deploy_api(api)
|
121
|
-
#end
|
122
|
-
#end
|
123
|
-
#end
|
124
|
-
|
125
|
-
document.addEventListener 'DOMContentLoaded', ->
|
126
|
-
# make sure this matches the RTCPController URL.
|
127
|
-
Core.connect('__rtcp__')
|
128
|
-
#end
|
@@ -1 +0,0 @@
|
|
1
|
-
# this file will be loaded before other files found in helpers/ folder
|
data/sandbox/base/load.rb
DELETED
File without changes
|
File without changes
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
6
|
-
<script type="text/javascript">window.module = {}</script>
|
7
|
-
<script src="{{client_url}}/core.js"></script>
|
8
|
-
<link rel="stylesheet" href="{{client_url}}/core.css">
|
9
|
-
</head>
|
10
|
-
<body></body>
|
11
|
-
</html>
|
@@ -1 +0,0 @@
|
|
1
|
-
<div id="content"></div>
|
@@ -1 +0,0 @@
|
|
1
|
-
<div id="content"></div>
|
data/sandbox/config/config.rb
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
|
2
|
-
# loading .yml configs from current directory. config.yml will be loaded first.
|
3
|
-
Cfg = Appril.load_config(File.expand_path('..', __FILE__))
|
4
|
-
|
5
|
-
# it is highly recommended to freeze configs so they stay unaltered on runtime.
|
6
|
-
Cfg.freeze
|
7
|
-
|
8
|
-
# loading any .rb files in current dir. this one will be skipped automatically.
|
9
|
-
Dir[File.expand_path('../**/*.rb', __FILE__)].each {|f| require(f)}
|
File without changes
|
File without changes
|
File without changes
|
data/sandbox/config/env/test.yml
DELETED
File without changes
|
data/sandbox/config.ru
DELETED
data/sandbox/core/Gemfile
DELETED