appril-cli 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -0
  3. data/Rakefile +1 -0
  4. data/appril-cli.gemspec +19 -0
  5. data/bin/appril +4 -0
  6. data/boilerplate/app/.gitignore +6 -0
  7. data/boilerplate/app/.pryrc +1 -0
  8. data/boilerplate/app/Gemfile +6 -0
  9. data/boilerplate/app/Rakefile +1 -0
  10. data/boilerplate/app/base/api/base_controller.rb +21 -0
  11. data/boilerplate/app/base/api/index/client.coffee +4 -0
  12. data/boilerplate/app/base/api/index/layout.html +3 -0
  13. data/boilerplate/app/base/api/index/server.rb +3 -0
  14. data/boilerplate/app/base/api/rtcp_controller.rb +22 -0
  15. data/boilerplate/app/base/assets/styles.css +0 -0
  16. data/boilerplate/app/base/boot.rb +2 -0
  17. data/boilerplate/app/base/core.coffee +143 -0
  18. data/boilerplate/app/base/helpers/application_helpers.coffee +1 -0
  19. data/boilerplate/app/base/helpers/application_helpers.rb +4 -0
  20. data/boilerplate/app/base/load.rb +0 -0
  21. data/boilerplate/app/base/models/base_model.rb +0 -0
  22. data/boilerplate/app/base/templates/access_denied.html +3 -0
  23. data/boilerplate/app/base/templates/layout.liquid +11 -0
  24. data/boilerplate/app/base/templates/layouts/main.html +1 -0
  25. data/boilerplate/app/base/templates/layouts/none.html +1 -0
  26. data/boilerplate/app/config/config.rb +9 -0
  27. data/boilerplate/app/config/config.yml +18 -0
  28. data/boilerplate/app/config/env/development.yml +0 -0
  29. data/boilerplate/app/config/env/production.yml +0 -0
  30. data/boilerplate/app/config/env/stage.yml +0 -0
  31. data/boilerplate/app/config/env/test.yml +0 -0
  32. data/boilerplate/app/config.ru +3 -0
  33. data/boilerplate/app/core/Gemfile +4 -0
  34. data/boilerplate/app/core/boot.rb +16 -0
  35. data/boilerplate/app/core/generate_configs.rb +125 -0
  36. data/boilerplate/app/core/load.rb +14 -0
  37. data/boilerplate/app/core/load_controllers.rb +14 -0
  38. data/boilerplate/app/generators/api/client.coffee +4 -0
  39. data/boilerplate/app/generators/api/layout.html +0 -0
  40. data/boilerplate/app/generators/api/server.rb +3 -0
  41. data/boilerplate/app/package.json +10 -0
  42. data/boilerplate/app/public/.ignore +0 -0
  43. data/boilerplate/app/tmp/.ignore +0 -0
  44. data/boilerplate/app/var/.ignore +0 -0
  45. data/boilerplate/app/webpack.config.js +53 -0
  46. data/boilerplate/crudle/Gemfile +7 -0
  47. data/boilerplate/crudle/base/core.coffee +128 -0
  48. data/boilerplate/crudle/base/templates/menu.html +3 -0
  49. data/boilerplate/crudle/generators/api/client.coffee +11 -0
  50. data/boilerplate/crudle/generators/api/editor.html +0 -0
  51. data/boilerplate/crudle/generators/api/server.rb +26 -0
  52. data/boilerplate/crudle/package.json +15 -0
  53. data/boilerplate/crudle/webpack.config.js +54 -0
  54. data/docker/Dockerfile +5 -0
  55. data/docker/run +66 -0
  56. data/docker/skel/build.sh +1 -0
  57. data/docker/skel/cleanup.sh +7 -0
  58. data/docker/skel/config.yml +24 -0
  59. data/docker/skel/prepare_build.sh +5 -0
  60. data/docker/skel/start.sh +1 -0
  61. data/docker/start +7 -0
  62. data/lib/appril-cli/app/install.rb +46 -0
  63. data/lib/appril-cli/app/update.rb +27 -0
  64. data/lib/appril-cli/app.rb +46 -0
  65. data/lib/appril-cli/assertions.rb +60 -0
  66. data/lib/appril-cli/docker/build.rb +152 -0
  67. data/lib/appril-cli/docker/install.rb +23 -0
  68. data/lib/appril-cli/docker/update.rb +26 -0
  69. data/lib/appril-cli/docker.rb +61 -0
  70. data/lib/appril-cli/generator/api.rb +16 -0
  71. data/lib/appril-cli/generator.rb +32 -0
  72. data/lib/appril-cli/helpers.rb +47 -0
  73. data/lib/appril-cli/version.rb +5 -0
  74. data/lib/appril-cli.rb +102 -0
  75. data/sandbox/.gitignore +6 -0
  76. data/sandbox/.pryrc +1 -0
  77. data/sandbox/Gemfile +7 -0
  78. data/sandbox/Rakefile +1 -0
  79. data/sandbox/base/api/base_controller.rb +21 -0
  80. data/sandbox/base/api/index/client.coffee +4 -0
  81. data/sandbox/base/api/index/layout.html +3 -0
  82. data/sandbox/base/api/index/server.rb +3 -0
  83. data/sandbox/base/api/rtcp_controller.rb +22 -0
  84. data/sandbox/base/assets/styles.css +0 -0
  85. data/sandbox/base/boot.rb +2 -0
  86. data/sandbox/base/core.coffee +128 -0
  87. data/sandbox/base/helpers/application_helpers.coffee +1 -0
  88. data/sandbox/base/helpers/application_helpers.rb +4 -0
  89. data/sandbox/base/load.rb +0 -0
  90. data/sandbox/base/models/base_model.rb +0 -0
  91. data/sandbox/base/templates/access_denied.html +3 -0
  92. data/sandbox/base/templates/layout.liquid +11 -0
  93. data/sandbox/base/templates/layouts/main.html +1 -0
  94. data/sandbox/base/templates/layouts/none.html +1 -0
  95. data/sandbox/base/templates/menu.html +3 -0
  96. data/sandbox/config/config.rb +9 -0
  97. data/sandbox/config/config.yml +18 -0
  98. data/sandbox/config/env/development.yml +0 -0
  99. data/sandbox/config/env/production.yml +0 -0
  100. data/sandbox/config/env/stage.yml +0 -0
  101. data/sandbox/config/env/test.yml +0 -0
  102. data/sandbox/config.ru +3 -0
  103. data/sandbox/core/Gemfile +4 -0
  104. data/sandbox/core/boot.rb +16 -0
  105. data/sandbox/core/generate_configs.rb +125 -0
  106. data/sandbox/core/load.rb +14 -0
  107. data/sandbox/core/load_controllers.rb +14 -0
  108. data/sandbox/generators/api/client.coffee +11 -0
  109. data/sandbox/generators/api/editor.html +0 -0
  110. data/sandbox/generators/api/layout.html +0 -0
  111. data/sandbox/generators/api/server.rb +26 -0
  112. data/sandbox/package.json +15 -0
  113. data/sandbox/webpack.config.js +54 -0
  114. metadata +157 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8a468b9220ed3756961ef37806e0938466aa53af
4
+ data.tar.gz: 4736ac8b5010e66752ef32408d618d4182c34957
5
+ SHA512:
6
+ metadata.gz: e4f4202bb9d97ece3954089d69d26fc0176f0cc18cca2d2a7cb29c2d811fd0d4066f5a0cbe3ce6a3ba37c98cf1e9e33cd720402b21d37becce6e012add85e8fb
7
+ data.tar.gz: f3f8421cd5b27f03a65d6163d3922ae1874f52e32da2699a09e1bf8cd7504fa5ad1d75ac0ac0595c35f86c3a470b7121238c3fa85c99e69a4f90e05ad02cc354
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg
2
+ *.gem
3
+ sandbox
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,19 @@
1
+ # coding: utf-8
2
+ require File.expand_path('../lib/appril-cli/version', __FILE__)
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = 'appril-cli'
6
+ spec.version = Appril::CLI::VERSION
7
+ spec.authors = ['Slee Woo']
8
+ spec.email = ['mail@sleewoo.com']
9
+ spec.summary = [spec.name, spec.version]*'-',
10
+ spec.description = 'Appril CLI'
11
+ spec.homepage = 'https://github.com/appril/appril-cli'
12
+ spec.license = 'MIT'
13
+
14
+ spec.files = Dir['**/{*,.[a-z]*}'].reject {|e| e =~ /(gem|lock)\z/}
15
+ spec.require_paths = ['lib']
16
+ spec.executables = Dir['bin/*'].map {|f| File.basename(f)}
17
+
18
+ spec.required_ruby_version = '~> 2.0'
19
+ end
data/bin/appril ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift(File.expand_path('../../lib', __FILE__))
3
+ require 'appril-cli'
4
+ Appril::CLI.new($*)
@@ -0,0 +1,6 @@
1
+ .git
2
+ node_modules
3
+ var
4
+ tmp
5
+ Gemfile.lock
6
+ __tmpbuildir__
@@ -0,0 +1 @@
1
+ require File.expand_path('../core/load', __FILE__)
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+ # keep this line
3
+ eval File.read(File.expand_path('../core/Gemfile', __FILE__))
4
+
5
+ # add your gems here
6
+ gem 'liquid', '~> 3'
@@ -0,0 +1 @@
1
+ require File.expand_path('../core/load', __FILE__)
@@ -0,0 +1,21 @@
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
@@ -0,0 +1,4 @@
1
+
2
+ module.exports = (env) ->
3
+ env.render
4
+ template: require('./layout')
@@ -0,0 +1,3 @@
1
+ <h4>
2
+ Appril Successfully Installed!
3
+ </h4>
@@ -0,0 +1,3 @@
1
+ class Index < BaseController
2
+ map Cfg.server_url
3
+ end
@@ -0,0 +1,22 @@
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
@@ -0,0 +1,2 @@
1
+ # first file to be loaded when app starts.
2
+ # it is loaded on bare metal, e.g. before any gems, configs, helpers.
@@ -0,0 +1,143 @@
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
+ #end
48
+
49
+ for k, v of msg.data
50
+ App[k] = v
51
+ #end
52
+
53
+ Reporter CONSIDER_IDLE_AFTER, (status) ->
54
+ # close connection if user went away
55
+ Core.disconnect() if status == 'away'
56
+ #end
57
+ #end
58
+
59
+ templates =
60
+ none: require('templates/layouts/none')
61
+ main: require('templates/layouts/main')
62
+ access_denied: require('templates/access_denied')
63
+ #end
64
+
65
+ partials = {}
66
+
67
+ deploy_api = (api) ->
68
+
69
+ env = _.merge({
70
+ render: Render,
71
+ render_component: Render.component,
72
+ render_string: Render.string
73
+ }, new Page)
74
+
75
+ layout = if _.has(api, 'layout')
76
+ if api.layout == false
77
+ 'none'
78
+ else
79
+ api.layout
80
+ else
81
+ 'main'
82
+ #end
83
+
84
+ if App.body
85
+ # do not re-render body if current api uses same layout as previous one
86
+ return new api(env) if App.body.layout == layout
87
+ #end
88
+
89
+ components = {}
90
+
91
+ App.body = env.render
92
+ el: 'body'
93
+ template: templates[layout] || templates.none
94
+ partials: partials
95
+ components: components
96
+ data: {}
97
+
98
+ oncomplete: ->
99
+ this.layout = layout
100
+ new api(env)
101
+ #end
102
+ #end
103
+ #end
104
+
105
+ previous_api = null
106
+ Core.on_controller_matched = (controller, context) ->
107
+
108
+ controller.load (api) ->
109
+ context.save()
110
+
111
+ api.controller = controller
112
+
113
+ if previous_api?.teardown
114
+ previous_api.teardown()
115
+ #end
116
+ previous_api = api
117
+
118
+ if _.has(api, 'acl')
119
+ unless _.isFunction(api.acl)
120
+ throw new Error("#{controller.name}.acl should be a function")
121
+
122
+ if api.acl()
123
+ deploy_api(api)
124
+ else
125
+ Render
126
+ el: 'body'
127
+ template: templates.main
128
+ partials: partials
129
+ oncomplete: ->
130
+ Render(template: templates.access_denied)
131
+ #end
132
+
133
+ else
134
+ deploy_api(api)
135
+ #end
136
+
137
+ #end
138
+ #end
139
+
140
+ document.addEventListener 'DOMContentLoaded', ->
141
+ # make sure this matches the RTCPController URL
142
+ Core.connect('__rtcp__')
143
+ #end
@@ -0,0 +1 @@
1
+ # this file will be loaded before other files found in helpers/ folder
@@ -0,0 +1,4 @@
1
+ # this file will be loaded before other files found in helpers/ folder
2
+ module Helpers
3
+
4
+ end
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ <h4>
2
+ Please authorize to view this page
3
+ </h4>
@@ -0,0 +1,11 @@
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>
@@ -0,0 +1 @@
1
+ <div id="content"></div>
@@ -0,0 +1 @@
1
+ <div id="content"></div>
@@ -0,0 +1,9 @@
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)}
@@ -0,0 +1,18 @@
1
+
2
+ # configs here will be the same on all environments.
3
+ # if some configs differs on some environment,
4
+ # put them into appropriate env/[ENVIRONMENT].yml file
5
+
6
+ # multiple .yml files allowed in config folder.
7
+ # for example config/db.yml file will be loaded into Cfg.db in server app.
8
+ # arbitrary .yml files can have environment related configs.
9
+
10
+
11
+ # base URL for server app
12
+ server_url: /
13
+
14
+ # base URL for compiled client app
15
+ client_url: /app
16
+
17
+ # where webpack should install compiled app. relative to webpack.config.js
18
+ client_path: ./public
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ require File.expand_path('../core/load', __FILE__)
2
+
3
+ run RocketIO::Application.new
@@ -0,0 +1,4 @@
1
+ # do NOT edit this file, edit ../Gemfile instead
2
+ gem 'appril'
3
+ gem 'rocketio', '~> 0.0.8'
4
+ gem 'tubesock'
@@ -0,0 +1,16 @@
1
+ # do NOT edit this file, edit base/boot.rb instead
2
+
3
+ require 'yaml'
4
+
5
+ Dir.chdir File.expand_path('../..', __FILE__) do
6
+ require './base/boot'
7
+
8
+ require 'bundler/setup'
9
+ Bundler.require(:default)
10
+ Bundler.require(RocketIO.environment)
11
+
12
+ require './config/config'
13
+
14
+ require './base/helpers/application_helpers'
15
+ Dir['./base/helpers/**/*.rb'].each {|f| require(f)}
16
+ end
@@ -0,0 +1,125 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # do NOT edit this file
4
+
5
+ require File.expand_path('../load', __FILE__)
6
+
7
+ module ApprilTools
8
+ extend self
9
+
10
+ def load_config dir, env = RocketIO.environment
11
+
12
+ config = load_config_file("#{dir}/config.yml")
13
+ config.update(load_config_file("#{dir}/env/#{env}.yml"))
14
+ config[:environment] = env.to_s.freeze
15
+
16
+ Dir["#{dir}/**/*.yml"].each do |file|
17
+ next if File.dirname(file) == './env'
18
+
19
+ key = File.basename(file, '.yml')
20
+ next if key == 'config' || key == 'appril'
21
+
22
+ key_config = load_config_file(file)
23
+ key_config_keys = key_config.keys.map(&:to_s)
24
+
25
+ config[key] = if key_config_keys.include?(env.to_s)
26
+ # current environment found, use it
27
+ key_config[env]
28
+ else
29
+ if RocketIO::ENVIRONMENTS.keys.find {|k| key_config_keys.include?(k)}
30
+ # there are some environment(s), but no current one so set current environment to nil
31
+ nil
32
+ else
33
+ # there are no environments, so this config is available on any environment
34
+ key_config
35
+ end
36
+ end
37
+
38
+ end
39
+
40
+ def config.method_missing key
41
+ self[key]
42
+ end
43
+
44
+ config
45
+ end
46
+
47
+
48
+ def load_config_file file
49
+ RocketIO.indifferent_params(YAML.load(File.read(file)) || {})
50
+ end
51
+
52
+
53
+ def controllers_map dir
54
+ path_to_api = File.expand_path('base/api', dir)
55
+ RocketIO.controllers.each_with_object([]) do |controller,o|
56
+ next unless controller.superclass == ::BaseController
57
+
58
+ o << {
59
+ path: controller.dirname.sub(path_to_api, '').gsub(/\A\/|\/\Z/, ''),
60
+ url: controller.url,
61
+ url_pattern: url_pattern(controller),
62
+ name: controller.name.gsub('::', '__'),
63
+ api: controller.api
64
+ }
65
+ end.sort do |a,b|
66
+ b[:url].split('/').size <=> a[:url].split('/').size
67
+ end
68
+ end
69
+
70
+
71
+ def webpack_entries dir, controllers
72
+ entries = controllers.each_with_object({}) do |controller,o|
73
+
74
+ next unless entry = %w[
75
+ ./base/api/%s/client.js
76
+ ./base/api/%s/client.coffee
77
+ ].map {|p| p % controller[:path]}.find {|f| File.file?(File.expand_path(f, dir))}
78
+
79
+ o[controller[:path]] = File.join('./base/api', controller[:path], File.basename(entry))
80
+ end
81
+
82
+ if core = %w[
83
+ ./base/core.js
84
+ ./base/core.coffee
85
+ ].find {|f| File.file?(File.expand_path(f, dir))}
86
+ entries[:core] = core
87
+ end
88
+
89
+ entries
90
+ end
91
+
92
+
93
+ def generate_configs dir
94
+ config = load_config("#{dir}/config", :development)
95
+
96
+ controllers = controllers_map(dir)
97
+ webpack_entries = webpack_entries(dir, controllers)
98
+
99
+ File.open File.expand_path('config.json', dir), 'w' do |f|
100
+ f << JSON.pretty_generate({
101
+ controllers: controllers,
102
+ webpack: {
103
+ path: config[:client_path],
104
+ url: config[:client_url],
105
+ entries: webpack_entries
106
+ }
107
+ })
108
+ end
109
+ end
110
+
111
+ def url_pattern controller
112
+ controller.url *controller.instance_method(:get).parameters.each_with_object([]) {|param,o|
113
+ pattern = if param[0] == :rest
114
+ "*"
115
+ elsif param[0] == :req
116
+ ":#{param[1]}"
117
+ elsif param[0] == :opt
118
+ ":#{param[1]}?"
119
+ end
120
+ o << pattern if pattern
121
+ }
122
+ end
123
+ end
124
+
125
+ ApprilTools.generate_configs(File.expand_path('../..', __FILE__))
@@ -0,0 +1,14 @@
1
+ # do NOT edit this file, edit base/load.rb instead
2
+
3
+ %w[
4
+ boot
5
+ ../base/load
6
+ ].each {|f| require File.expand_path("../#{f}", __FILE__)}
7
+
8
+ %w[
9
+ base_model.rb
10
+ *.rb
11
+ **/*.rb
12
+ ].each {|p| Dir[File.expand_path("../../base/models/#{p}", __FILE__)].each {|f| require(f)}}
13
+
14
+ require File.expand_path('../load_controllers', __FILE__)
@@ -0,0 +1,14 @@
1
+ # do NOT edit this file, edit base/load_controllers.rb instead
2
+
3
+ Dir.chdir File.expand_path('../../base/api', __FILE__) do
4
+
5
+ require './base_controller'
6
+ require './rtcp_controller'
7
+
8
+ %w[
9
+ ./**/server.rb
10
+ ].each_with_object([]) {|pattern,o| o.concat(Dir[pattern])}.sort {|a,b|
11
+ a.split(/\/+/).size <=> b.split(/\/+/).size
12
+ }.each {|f| require(f)}
13
+
14
+ end
@@ -0,0 +1,4 @@
1
+
2
+ module.exports = (env) ->
3
+ env.render
4
+ template: require('./layout')
File without changes
@@ -0,0 +1,3 @@
1
+ class CONTROLLER_NAME < BaseController
2
+
3
+ end
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "MyApp",
3
+ "version": "0.0.0",
4
+ "description": "...",
5
+ "dependencies": {
6
+ "appril": "*",
7
+ "appril-ractive": "*",
8
+ "extract-text-webpack-plugin": "1"
9
+ }
10
+ }
File without changes
File without changes
File without changes
@@ -0,0 +1,53 @@
1
+ var webpack = require('webpack'),
2
+ fs = require('fs'),
3
+ ExtractTextPlugin = require("extract-text-webpack-plugin"),
4
+ child_process = require('child_process')
5
+ ;
6
+
7
+ if (process.env.APP_ENV == 'development') {
8
+ console.log('Generating configs...');
9
+ child_process.execSync('./core/generate_configs.rb');
10
+ }
11
+
12
+ var setup = JSON.parse(fs.readFileSync('./config.json')).webpack;
13
+ console.log(JSON.stringify(setup, null, 2))
14
+
15
+ module.exports = {
16
+ entry: setup.entries,
17
+ output: {
18
+ path: [setup.path, setup.url].join('/'),
19
+ filename: '[name].js',
20
+ publicPath: setup.url + '/', // trailing slash required
21
+ libraryTarget: 'commonjs2'
22
+ },
23
+ module: {
24
+ loaders: [
25
+ { test: /\.coffee$/, loader: 'coffee-loader' },
26
+ { test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader") },
27
+ { test: /\.json$/, loader: 'json-loader' },
28
+ { test: /\.otf($|\?)/, loader: require.resolve('file-loader') },
29
+ { test: /\.ttf($|\?)/, loader: require.resolve('file-loader') },
30
+ { test: /\.eot($|\?)/, loader: require.resolve('file-loader') },
31
+ { test: /\.svg($|\?)/, loader: require.resolve('file-loader') },
32
+ { test: /\.png($|\?)/, loader: require.resolve('url-loader') + '?limit=10000&mimetype=image/png' },
33
+ { test: /\.jpg($|\?)/, loader: require.resolve('file-loader') },
34
+ { test: /\.gif($|\?)/, loader: require.resolve('file-loader') },
35
+ { test: /\.woff[2]?($|\?)/, loader: require.resolve('url-loader') + '?limit=10000&mimetype=application/font-woff' },
36
+ ]
37
+ },
38
+ resolve: {
39
+ extensions: ['', '.js', '.css', '.json', '.coffee', '.html'],
40
+ alias: {
41
+ app: __dirname,
42
+ base: 'app/base',
43
+ api: 'base/api',
44
+ helpers: 'base/helpers',
45
+ assets: 'base/assets',
46
+ templates: 'base/templates'
47
+ }
48
+ },
49
+ plugins: [
50
+ new webpack.optimize.CommonsChunkPlugin('core', 'core.js'),
51
+ new ExtractTextPlugin("[name].css")
52
+ ]
53
+ }
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+ # keep this line
3
+ eval File.read(File.expand_path('../core/Gemfile', __FILE__))
4
+
5
+ # add your gems here
6
+ gem 'crudle'
7
+ gem 'liquid', '~> 3'