appril-cli 0.1.1 → 0.2.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.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/app/base/assets/styles.css +2 -0
  3. data/{boilerplate/app/base/api → app/base/components}/base_controller.rb +3 -1
  4. data/app/base/components/deploy.js +25 -0
  5. data/app/base/components/index/index.js +3 -0
  6. data/app/base/components/index/server.rb +13 -0
  7. data/{boilerplate/app/base/api → app/base/components}/rtcp_controller.rb +5 -7
  8. data/app/base/core.js +77 -0
  9. data/app/base/templates/layout.liquid +13 -0
  10. data/app/config/config.rb +11 -0
  11. data/{sandbox → app}/config/config.yml +8 -4
  12. data/{boilerplate/app → app}/core/Gemfile +2 -2
  13. data/{sandbox → app}/core/boot.rb +2 -4
  14. data/app/core/generate_configs.rb +7 -0
  15. data/{boilerplate/app → app}/core/load.rb +2 -2
  16. data/{boilerplate/app/core/load_api.rb → app/core/load_components.rb} +2 -1
  17. data/app/generators/_component/index.js +3 -0
  18. data/app/generators/_component/template.html +3 -0
  19. data/app/generators/component +29 -0
  20. data/app/package.json +30 -0
  21. data/{boilerplate/app → app}/webpack/alias.js +3 -3
  22. data/app/webpack/entry.js +3 -0
  23. data/{boilerplate/app → app}/webpack/extensions.js +1 -2
  24. data/app/webpack/loaders.js +47 -0
  25. data/app/webpack/output.js +9 -0
  26. data/app/webpack/plugins.js +38 -0
  27. data/app/webpack.config.js +29 -0
  28. data/lib/appril-cli/assertions.rb +5 -21
  29. data/lib/appril-cli/docker/build.rb +35 -31
  30. data/lib/appril-cli/docker/install.rb +18 -11
  31. data/lib/appril-cli/docker/update.rb +20 -11
  32. data/lib/appril-cli/docker.rb +14 -43
  33. data/lib/appril-cli/helpers.rb +7 -9
  34. data/lib/appril-cli/install.rb +30 -0
  35. data/lib/appril-cli/update.rb +34 -0
  36. data/lib/appril-cli/version.rb +1 -1
  37. data/lib/appril-cli.rb +62 -47
  38. metadata +52 -109
  39. data/boilerplate/app/base/api/deploy.coffee +0 -45
  40. data/boilerplate/app/base/api/index/client.coffee +0 -4
  41. data/boilerplate/app/base/api/index/server.rb +0 -3
  42. data/boilerplate/app/base/core.coffee +0 -113
  43. data/boilerplate/app/base/helpers/application_helpers.coffee +0 -1
  44. data/boilerplate/app/base/templates/access_denied.html +0 -3
  45. data/boilerplate/app/base/templates/layout.liquid +0 -11
  46. data/boilerplate/app/base/templates/layouts/main.html +0 -1
  47. data/boilerplate/app/base/templates/layouts/none.html +0 -1
  48. data/boilerplate/app/config/config.rb +0 -14
  49. data/boilerplate/app/config/config.yml +0 -18
  50. data/boilerplate/app/core/boot.rb +0 -72
  51. data/boilerplate/app/core/generate_configs.rb +0 -79
  52. data/boilerplate/app/generators/api/client.coffee +0 -4
  53. data/boilerplate/app/generators/api/server.rb +0 -3
  54. data/boilerplate/app/package.json +0 -10
  55. data/boilerplate/app/webpack/config.js +0 -6
  56. data/boilerplate/app/webpack/entry.js +0 -3
  57. data/boilerplate/app/webpack/loaders.js +0 -15
  58. data/boilerplate/app/webpack/output.js +0 -11
  59. data/boilerplate/app/webpack/plugins.js +0 -19
  60. data/boilerplate/app/webpack.config.js +0 -19
  61. data/boilerplate/crudle/Gemfile +0 -7
  62. data/boilerplate/crudle/base/api/deploy.coffee +0 -51
  63. data/boilerplate/crudle/base/api/index/client.coffee +0 -5
  64. data/boilerplate/crudle/base/api/index/layout.html +0 -5
  65. data/boilerplate/crudle/base/api/index/server.rb +0 -7
  66. data/boilerplate/crudle/base/templates/menu.html +0 -3
  67. data/boilerplate/crudle/generators/api/client.coffee +0 -17
  68. data/boilerplate/crudle/generators/api/editor/layout.html +0 -3
  69. data/boilerplate/crudle/generators/api/list/item.html +0 -3
  70. data/boilerplate/crudle/generators/api/server.rb +0 -26
  71. data/boilerplate/crudle/package.json +0 -13
  72. data/boilerplate/crudle/webpack/loaders.js +0 -16
  73. data/lib/appril-cli/app/install.rb +0 -47
  74. data/lib/appril-cli/app/update.rb +0 -28
  75. data/lib/appril-cli/app.rb +0 -46
  76. data/lib/appril-cli/generator/api.rb +0 -16
  77. data/lib/appril-cli/generator.rb +0 -32
  78. data/sandbox/.gitignore +0 -6
  79. data/sandbox/.pryrc +0 -1
  80. data/sandbox/Gemfile +0 -7
  81. data/sandbox/Rakefile +0 -1
  82. data/sandbox/base/api/base_controller.rb +0 -21
  83. data/sandbox/base/api/index/client.coffee +0 -4
  84. data/sandbox/base/api/index/layout.html +0 -3
  85. data/sandbox/base/api/index/server.rb +0 -3
  86. data/sandbox/base/api/rtcp_controller.rb +0 -22
  87. data/sandbox/base/assets/styles.css +0 -0
  88. data/sandbox/base/boot.rb +0 -2
  89. data/sandbox/base/core.coffee +0 -128
  90. data/sandbox/base/helpers/application_helpers.coffee +0 -1
  91. data/sandbox/base/helpers/application_helpers.rb +0 -4
  92. data/sandbox/base/load.rb +0 -0
  93. data/sandbox/base/models/base_model.rb +0 -0
  94. data/sandbox/base/templates/access_denied.html +0 -3
  95. data/sandbox/base/templates/layout.liquid +0 -11
  96. data/sandbox/base/templates/layouts/main.html +0 -1
  97. data/sandbox/base/templates/layouts/none.html +0 -1
  98. data/sandbox/base/templates/menu.html +0 -3
  99. data/sandbox/config/config.rb +0 -9
  100. data/sandbox/config/env/development.yml +0 -0
  101. data/sandbox/config/env/production.yml +0 -0
  102. data/sandbox/config/env/stage.yml +0 -0
  103. data/sandbox/config/env/test.yml +0 -0
  104. data/sandbox/config.ru +0 -3
  105. data/sandbox/core/Gemfile +0 -4
  106. data/sandbox/core/generate_configs.rb +0 -125
  107. data/sandbox/core/load.rb +0 -14
  108. data/sandbox/core/load_controllers.rb +0 -14
  109. data/sandbox/generators/api/client.coffee +0 -11
  110. data/sandbox/generators/api/editor.html +0 -0
  111. data/sandbox/generators/api/layout.html +0 -0
  112. data/sandbox/generators/api/server.rb +0 -26
  113. data/sandbox/package.json +0 -15
  114. data/sandbox/webpack.config.js +0 -54
  115. /data/{boilerplate/app → app}/.gitignore +0 -0
  116. /data/{boilerplate/app → app}/.pryrc +0 -0
  117. /data/{boilerplate/app → app}/Gemfile +0 -0
  118. /data/{boilerplate/app → app}/Rakefile +0 -0
  119. /data/{boilerplate/app → app}/base/boot.rb +0 -0
  120. /data/{boilerplate/app/base/api/index/layout.html → app/base/components/index/template.html} +0 -0
  121. /data/{boilerplate/app → app}/base/helpers/application_helpers.rb +0 -0
  122. /data/{boilerplate/app/base/assets/styles.css → app/base/helpers/index.js} +0 -0
  123. /data/{boilerplate/app → app}/base/load.rb +0 -0
  124. /data/{boilerplate/app → app}/base/models/base_model.rb +0 -0
  125. /data/{boilerplate/app/public → app/compiled}/.ignore +0 -0
  126. /data/{boilerplate/app → app}/config/env/development.yml +0 -0
  127. /data/{boilerplate/app → app}/config/env/production.yml +0 -0
  128. /data/{boilerplate/app → app}/config/env/stage.yml +0 -0
  129. /data/{boilerplate/app → app}/config/env/test.yml +0 -0
  130. /data/{boilerplate/app → app}/config.ru +0 -0
  131. /data/{boilerplate/app → app}/core/load_helpers.rb +0 -0
  132. /data/{boilerplate/app → app}/core/load_models.rb +0 -0
  133. /data/{boilerplate/app/tmp → app/public}/.ignore +0 -0
  134. /data/{boilerplate/app/var → app/tmp}/.ignore +0 -0
  135. /data/{boilerplate/app/generators/api/layout.html → app/var/.ignore} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c4ee73b112f5a00aab967429c4d6f5625f23764
4
- data.tar.gz: 8290fa13dd21b4de97b87603bfc83d1dbcc9a640
3
+ metadata.gz: 8622cacea4e9095a3daeb67ca1bdba3d8605b7d3
4
+ data.tar.gz: 5faf96d70dae4558522bc115a79a92bbe9f4e0e7
5
5
  SHA512:
6
- metadata.gz: 103fcc739853591314068ea3c2571542bd02449c97197968bb67d05b4f6284b93252ea8bb7786ea18323a522d4578e6c94591e78df74fac2301ba519f293a47d
7
- data.tar.gz: 5ed2ec0f096f78bdbabff15bedb0ada7635b7cfb92bc2e568ce4754c2c7685cdbb4756fe4ba50813c25a58f6adf0b19ed05cec8821bc1151608a02ede9309f3e
6
+ metadata.gz: 6941fa537bc497e8bc123348a4f80d721872ad2c4c4ad4a51c515df5e375e5efd19508c5c6360ee627f83c342c32d15909c8df9bbfa972abdf341505187a6951
7
+ data.tar.gz: c96ab1b7493828767ed27771fa7717a8e59aeac5cbf80d719ec3826c60e90aa9ac5418dd25d3f843d3e70e78ea201ba1d6b880f4d0fca64ba0f014962f75b014
@@ -0,0 +1,2 @@
1
+ /** delete this line to enable Crudle styles
2
+ @import url(~crudle/styles.css); /* */
@@ -7,7 +7,9 @@ class BaseController < Appril::BaseController
7
7
  layout :layout
8
8
  engine :Liquid
9
9
  define_template(:index) {''}
10
- define_template_var(:client_url, Cfg.client_url)
10
+
11
+ # highly important setup, do NOT remove
12
+ define_template_var(:client_url, File.join(Cfg.client_url, environment).freeze)
11
13
 
12
14
  def index
13
15
  render
@@ -0,0 +1,25 @@
1
+ import {find} from 'lodash'
2
+ import Vue from 'vue/dist/vue.js'
3
+
4
+ import 'assets/styles'
5
+ // import 'appril-polyfills'
6
+
7
+ /** default deployer */
8
+ export default function(components, component, constructor) {
9
+ return constructor
10
+ } /* */
11
+
12
+ /** Crudle deployer
13
+ import Crudle from 'crudle'
14
+ export default function(components, component, constructor) {
15
+ Crudle.Menu = {
16
+ template: require('templates/menu'),
17
+ data() {
18
+ return {
19
+ ...components,
20
+ is_active(...a) {return find(a, (c) => c.url == component.url) ? true : false}
21
+ }
22
+ }
23
+ }
24
+ return Crudle(constructor)
25
+ } /* */
@@ -0,0 +1,3 @@
1
+ export default {
2
+ template: require('./template')
3
+ }
@@ -0,0 +1,13 @@
1
+ class Index < BaseController
2
+ map Cfg.server_url
3
+
4
+ # environmental data to be sent to client at App initialization
5
+ def _env
6
+ {}
7
+ end
8
+
9
+ # data to be sent to client at Component initialization
10
+ def _options
11
+ {}
12
+ end
13
+ end
@@ -7,15 +7,13 @@ class RTCPController < Appril::RTCPController
7
7
  def connected
8
8
  end
9
9
 
10
- # data sent to client after connection established
11
- def initialization_data
12
- {
13
- client_url: Cfg.client_url, # this is highly important setup, do NOT remove
14
- }
10
+ # environmental data to be sent to client at App initialization
11
+ def _env
12
+ {}
15
13
  end
16
14
 
17
- # merged into original env when calling a controller
18
- def rtcp_env
15
+ # merged into original env when calling a controller method
16
+ def controller_env
19
17
  {}
20
18
  end
21
19
 
data/app/base/core.js ADDED
@@ -0,0 +1,77 @@
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
+
8
+ import {server_url, client_url, default_api} from 'app/config.js'
9
+
10
+ import {state, mutations} from 'appril/store'
11
+ import {vue_plugin, vuex_plugins} from 'appril/plugins'
12
+ import components from 'appril/components'
13
+ import async_components_loader from 'appril/components/async_loader'
14
+ import ApiBuilder from 'appril/api'
15
+
16
+ /** delete or comment this line if your components piped through Crudle
17
+ import {state as crudle_state, mutations as crudle_mutations} from 'crudle/store'
18
+ merge(state, crudle_state)
19
+ merge(mutations, crudle_mutations) /* */
20
+
21
+ const DEVELOPMENT = APP_ENV === 'development'
22
+
23
+ Vue.use(Vuex)
24
+ if (DEVELOPMENT) {
25
+ Vue.config.devtools = true
26
+ vuex_plugins.push(VuexLogger())
27
+ }
28
+
29
+ const api = ApiBuilder(default_api)
30
+
31
+ const initialize = function(data) {
32
+ deep_freeze(data)
33
+
34
+ // /* uncomment this line to disable RealTime Communication Protocol
35
+ api.rtcp.connect({
36
+ // make sure this url to match RTCPController url
37
+ path: server_url + '__rtcp__',
38
+ // disconnect if user is idle for N seconds
39
+ disconnect_after: 60
40
+ }) /* */
41
+
42
+ Vue.use(vue_plugin({
43
+ ...data,
44
+ api,
45
+ components
46
+ }))
47
+
48
+ const router = new Router(components)
49
+
50
+ const store = new Vuex.Store({
51
+ state: cloneDeep(state),
52
+ mutations,
53
+ strict: DEVELOPMENT,
54
+ plugins: vuex_plugins
55
+ })
56
+
57
+ new Vue({
58
+ store,
59
+ el: '#app',
60
+ template: `<component :is="$store.state.__ROOT_COMPONENT__"></component>`,
61
+ components: async_components_loader(components, client_url + APP_ENV, api[default_api])
62
+ })
63
+
64
+ 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}))
68
+ }
69
+
70
+ router.start()
71
+ }
72
+
73
+ document.addEventListener('DOMContentLoaded', function() {
74
+ api.Index._env().get({
75
+ success: initialize
76
+ })
77
+ })
@@ -0,0 +1,13 @@
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
+ <link rel="stylesheet" media="all" href="{{client_url}}/core.css">
8
+ <script src="{{client_url}}/core.js"></script>
9
+ </head>
10
+ <body>
11
+ <div id="app"></div>
12
+ </body>
13
+ </html>
@@ -0,0 +1,11 @@
1
+ # loading .yml configs from current directory (config.yml will be loaded first)
2
+ Cfg = Appril.load_configs(File.expand_path('..', __FILE__))
3
+
4
+ # it is highly recommended to freeze configs so they stay unaltered on runtime
5
+ Cfg.freeze
6
+
7
+ # loading all .rb files in current dir (this one will be skipped automatically)
8
+ %w[
9
+ ../*.rb
10
+ ../**/*.rb
11
+ ].each {|p| Dir[File.expand_path(p, __FILE__)].each {|f| require(f)} }
@@ -9,10 +9,14 @@
9
9
 
10
10
 
11
11
  # base URL for server app
12
- server_url: /
12
+ server_url: / # trailing slash required
13
13
 
14
14
  # base URL for compiled client app
15
- client_url: /app
15
+ client_url: /compiled/ # trailing slash required
16
16
 
17
- # where webpack should install compiled app. relative to webpack.config.js
18
- client_path: ./public
17
+ # where webpack should install compiled app (relative to webpack.config.js)
18
+ # will append client_url so by default it will be installed in ./compiled/
19
+ build_path: ./
20
+
21
+ # either xhr or rtcp
22
+ default_api: xhr
@@ -1,4 +1,4 @@
1
1
  # do NOT edit this file, edit ../Gemfile instead
2
- gem 'appril', '>= 0.0.7'
3
- gem 'rocketio', '>= 0.2'
2
+ gem 'appril', '>= 0.2'
3
+ gem 'rocketio', '>= 0.3'
4
4
  gem 'tubesock', '>= 0.2.7'
@@ -1,6 +1,7 @@
1
1
  # do NOT edit this file, edit base/boot.rb instead
2
2
 
3
- require 'yaml'
3
+ require 'appril'
4
+ require 'appril/load_configs'
4
5
 
5
6
  Dir.chdir File.expand_path('../..', __FILE__) do
6
7
  require './base/boot'
@@ -10,7 +11,4 @@ Dir.chdir File.expand_path('../..', __FILE__) do
10
11
  Bundler.require(RocketIO.environment)
11
12
 
12
13
  require './config/config'
13
-
14
- require './base/helpers/application_helpers'
15
- Dir['./base/helpers/**/*.rb'].each {|f| require(f)}
16
14
  end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # do NOT edit this file
4
+
5
+ require 'appril/generate_configs'
6
+ require File.expand_path('../load', __FILE__)
7
+ Appril.generate_configs(File.expand_path('../..', __FILE__))
@@ -1,9 +1,9 @@
1
- # do NOT edit this file, edit ../base/load.rb instead
1
+ # do NOT edit this file, edit base/load.rb instead
2
2
 
3
3
  Dir.chdir File.expand_path('../..', __FILE__) do
4
4
  require './core/boot'
5
5
  require './base/load'
6
6
  require './core/load_helpers'
7
7
  require './core/load_models'
8
- require './core/load_api'
8
+ require './core/load_components'
9
9
  end
@@ -3,8 +3,9 @@
3
3
  base_controller.rb
4
4
  rtcp_controller.rb
5
5
  **/server.rb
6
+ **/*.rb
6
7
  ].each do |p|
7
- Dir[File.expand_path("../../base/api/#{p}", __FILE__)].sort {|a,b|
8
+ Dir[File.expand_path("../../base/components/#{p}", __FILE__)].sort {|a,b|
8
9
  a.split(/\/+/).size <=> b.split(/\/+/).size
9
10
  }.each {|f| require(f)}
10
11
  end
@@ -0,0 +1,3 @@
1
+ export default {
2
+ template: require('./template')
3
+ }
@@ -0,0 +1,3 @@
1
+ <div>
2
+
3
+ </div>
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ require 'pathname'
4
+
5
+ opts, args = $*.partition {|x| x =~ /\A\-/}
6
+ args[0] || fail("\n\n\t\u2716 No destination path provided\n\n")
7
+
8
+ dst = Pathname.new(args[0] =~ /\A\// ? args[0] : File.expand_path("../../base/components/#{args[0].sub(/\Abase\/+components/, '')}", __FILE__))
9
+ File.exists?(dst) && fail("\n\n\t\u2716 #{dst.sub(/.*(base\/components\/.+)/, '\1')} already exists\n\n")
10
+
11
+ FileUtils.mkdir_p(dst.dirname)
12
+ FileUtils.cp_r(File.expand_path("../_component", __FILE__), dst)
13
+
14
+ puts "\n\t\u2713 Installed #{dst.sub(/.*(base\/components\/.+)/, '\1')}"
15
+
16
+ parent_component = dst.dirname / 'index.js'
17
+ if File.file?(parent_component)
18
+ header = "import %s from './%s'\n" % [
19
+ dst.basename.to_path.split(/\W+/).map(&:capitalize).join,
20
+ dst.basename
21
+ ]
22
+ content = File.read(parent_component)
23
+ unless content =~ /#{header}/
24
+ content = header + content
25
+ File.open(parent_component, 'w') {|f| f << content}
26
+ puts "\t\u2713 Updated #{parent_component.sub(/.*(base\/components\/.+)/, '\1')}"
27
+ end
28
+ end
29
+ puts
data/app/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "MyApp",
3
+ "version": "0.0.0",
4
+ "description": "...",
5
+ "devDependencies": {
6
+ "appril": ">= 0.2.8",
7
+ "appril-polyfills": ">= 0.0.2",
8
+ "appril-url": ">= 0.0.5",
9
+ "appril-utils": ">= 0.1.5",
10
+ "babel-core": "6",
11
+ "babel-loader": "6",
12
+ "babel-plugin-transform-object-rest-spread": "6",
13
+ "babel-plugin-transform-runtime": "6",
14
+ "babel-preset-es2015": "6",
15
+ "babel-preset-stage-2": "6",
16
+ "babel-preset-stage-3": "6",
17
+ "css-loader": "*",
18
+ "deep-freeze-strict": "1",
19
+ "extract-text-webpack-plugin": "^2.0.0-beta.2",
20
+ "file-loader": "*",
21
+ "json-loader": "*",
22
+ "optimize-css-assets-webpack-plugin": "1",
23
+ "style-loader": "*",
24
+ "url-loader": "*",
25
+ "vue": "^2.0.0-beta.3",
26
+ "vue-html-loader": "1",
27
+ "vuex": "^2.0.0-rc.3",
28
+ "webpack": "^2.1.0-beta.18"
29
+ }
30
+ }
@@ -1,10 +1,10 @@
1
- var path = require('path')
1
+ const path = require('path')
2
2
 
3
3
  module.exports = {
4
4
  app: path.resolve(__dirname, '..'),
5
5
  base: 'app/base',
6
- api: 'base/api',
7
- helpers: 'base/helpers',
8
6
  assets: 'base/assets',
7
+ components: 'base/components',
8
+ helpers: 'base/helpers',
9
9
  templates: 'base/templates'
10
10
  }
@@ -0,0 +1,3 @@
1
+ const config = require('../config.js')
2
+
3
+ module.exports = config.webpack_entries
@@ -2,7 +2,6 @@ module.exports = [
2
2
  '',
3
3
  '.js',
4
4
  '.css',
5
+ '.html',
5
6
  '.json',
6
- '.coffee',
7
- '.html'
8
7
  ]
@@ -0,0 +1,47 @@
1
+ const ExtractTextPlugin = require('extract-text-webpack-plugin')
2
+
3
+ const babel_query = {
4
+ presets: ['es2015', 'stage-2'],
5
+ plugins: ['transform-runtime']
6
+ }
7
+
8
+ const assets_regex = /base\/+assets\/[^/]+\.css$/
9
+
10
+ module.exports = [
11
+ {
12
+ test: /\.js$/,
13
+ exclude: /node_modules/,
14
+ loader: 'babel',
15
+ query: babel_query
16
+ },
17
+ { // libs published as ES6 modules
18
+ test: /node_modules\/+(appril|crudle).*\.js$/,
19
+ loader: 'babel',
20
+ query: babel_query
21
+ },
22
+ { // css files inside base/assets/
23
+ test: assets_regex,
24
+ loader: ExtractTextPlugin.extract({
25
+ notExtractLoader: "style-loader",
26
+ loader: "css-loader"
27
+ })
28
+ },
29
+ { // css files outside base/assets/
30
+ test: function(path) {
31
+ if (!path.match(/\.css$/))
32
+ return false
33
+ return path.match(assets_regex) ? false : true
34
+ },
35
+ loader: 'style-loader!css-loader'
36
+ },
37
+ { test: /\.html$/, loader: 'vue-html' },
38
+ { test: /\.json$/, loader: 'json-loader' },
39
+ { test: /\.otf($|\?)/, loader: require.resolve('file-loader') },
40
+ { test: /\.ttf($|\?)/, loader: require.resolve('file-loader') },
41
+ { test: /\.eot($|\?)/, loader: require.resolve('file-loader') },
42
+ { test: /\.svg($|\?)/, loader: require.resolve('file-loader') },
43
+ { test: /\.png($|\?)/, loader: require.resolve('url-loader') + '?limit=10000&mimetype=image/png' },
44
+ { test: /\.jpg($|\?)/, loader: require.resolve('file-loader') },
45
+ { test: /\.gif($|\?)/, loader: require.resolve('file-loader') },
46
+ { test: /\.woff[2]?($|\?)/, loader: require.resolve('url-loader') + '?limit=10000&mimetype=application/font-woff' },
47
+ ]
@@ -0,0 +1,9 @@
1
+ const path = require('path')
2
+ const config = require('../config.js')
3
+
4
+ module.exports = {
5
+ path: path.join(config.build_path, config.client_url, APP_ENV),
6
+ filename: '[name].js',
7
+ publicPath: path.join(config.client_url, APP_ENV, '/'), // trailing slash required
8
+ libraryTarget: 'commonjs2'
9
+ }
@@ -0,0 +1,38 @@
1
+ const webpack = require('webpack')
2
+ const ExtractTextPlugin = require('extract-text-webpack-plugin')
3
+ const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
4
+
5
+ const plugins = [
6
+ new webpack.optimize.CommonsChunkPlugin({names: ['core'], minChunks: 2}),
7
+
8
+ // new webpack.ProvidePlugin({
9
+ // $: 'jquery',
10
+ // jQuery: 'jquery'
11
+ // }),
12
+
13
+ new webpack.DefinePlugin({
14
+ APP_ENV: JSON.stringify(APP_ENV),
15
+ 'process.env': {
16
+ NODE_ENV: JSON.stringify(APP_ENV)
17
+ }
18
+ }),
19
+
20
+ new ExtractTextPlugin('[name].css')
21
+ ]
22
+
23
+ if (APP_ENV === 'production') {
24
+ plugins.push(
25
+ new webpack.optimize.UglifyJsPlugin({
26
+ compress: { warnings: false },
27
+ screwIE8: true,
28
+ sourceMap: false,
29
+ mangle: true
30
+ })
31
+ ),
32
+
33
+ plugins.push(
34
+ new OptimizeCssAssetsPlugin
35
+ )
36
+ }
37
+
38
+ module.exports = plugins
@@ -0,0 +1,29 @@
1
+ const child_process = require('child_process')
2
+
3
+ APP_ENV = process.env.APP_ENV || 'development'
4
+
5
+ if (APP_ENV === 'development') {
6
+ process.stdout.write('Generating configs... ')
7
+ try {
8
+ child_process.execSync('./core/generate_configs.rb')
9
+ console.log('done')
10
+ } catch(e) {
11
+ console.log(e.stdout.toString() + e.stderr.toString())
12
+ process.exit(1)
13
+ }
14
+ }
15
+
16
+ process.stdout.write('Webpacking... ')
17
+
18
+ module.exports = {
19
+ entry: require('./webpack/entry.js'),
20
+ output: require('./webpack/output.js'),
21
+ module: {
22
+ loaders: require('./webpack/loaders.js')
23
+ },
24
+ resolve: {
25
+ extensions: require('./webpack/extensions.js'),
26
+ alias: require('./webpack/alias.js')
27
+ },
28
+ plugins: require('./webpack/plugins.js')
29
+ }
@@ -2,28 +2,18 @@ module Appril
2
2
  class CLI
3
3
  module Assertions
4
4
 
5
- def assert_directory_provided dir
6
- return if dir
7
- fatal_error! "Please provide a directory"
8
- end
9
-
10
- def assert_installable_dir dir, working_dir_opted
11
- if working_dir_opted
12
- assert_empty_directory(dir)
5
+ def assert_installable_path path
6
+ if path == WORKING_DIR
7
+ assert_empty_directory(path)
13
8
  else
14
- assert_directory_does_not_exists(dir)
9
+ assert_directory_does_not_exists(path)
15
10
  end
16
11
  end
17
12
 
18
- def assert_is_docker_dir dir
19
- return if File.exists?(dir / Docker::CONFIG_FILE)
20
- fatal_error! "#{dir} does not look like a Appril docker dir"
21
- end
22
-
23
13
  def assert_is_app_dir dir
24
14
  return if %w[
25
15
  core
26
- base/api
16
+ base/components
27
17
  config
28
18
  ].all? {|e| File.exists?(dir / e)}
29
19
  fatal_error! "#{dir} does not look like a Appril app dir"
@@ -49,12 +39,6 @@ module Appril
49
39
  fatal_error! "#{dir / Docker::CONFIG_FILE} file is missing"
50
40
  end
51
41
 
52
- def assert_valid_api_name_given api_name
53
- api_name || fatal_error!('Please provide api name')
54
- api_name =~ /\W/ && fatal_error!('Api name should contain only alphanumerics')
55
- api_name =~ /\A[a-z]/i || fatal_error!('Api name should start with a letter')
56
- end
57
-
58
42
  end
59
43
  end
60
44
  end