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.
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
@@ -1,125 +0,0 @@
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__))
data/sandbox/core/load.rb DELETED
@@ -1,14 +0,0 @@
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__)
@@ -1,14 +0,0 @@
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
@@ -1,11 +0,0 @@
1
- # refer to underlying controller as self.controller
2
-
3
- self = (env, layout, list, editor) ->
4
- editor.partials.editor = require('./editor')
5
- layout.components =
6
- list: env.render_component(list)
7
- editor: env.render_component(editor)
8
- env.render(layout)
9
- #end
10
-
11
- module.exports = self
File without changes
File without changes
@@ -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 filter_by_name 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
data/sandbox/package.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "name": "MyApp",
3
- "version": "0.0.0",
4
- "description": "...",
5
- "dependencies": {
6
- "appril": "*",
7
- "appril-ractive": "*",
8
- "appril-reporter": "*",
9
- "appril-polyfills": "*",
10
- "crudle": "*",
11
- "crudle-list": "*",
12
- "crudle-editor": "*",
13
- "extract-text-webpack-plugin": "1"
14
- }
15
- }
@@ -1,54 +0,0 @@
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: /\.html$/, loader: 'ractive-loader' },
27
- { test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader") },
28
- { test: /\.json$/, loader: 'json-loader' },
29
- { test: /\.otf($|\?)/, loader: require.resolve('file-loader') },
30
- { test: /\.ttf($|\?)/, loader: require.resolve('file-loader') },
31
- { test: /\.eot($|\?)/, loader: require.resolve('file-loader') },
32
- { test: /\.svg($|\?)/, loader: require.resolve('file-loader') },
33
- { test: /\.png($|\?)/, loader: require.resolve('url-loader') + '?limit=10000&mimetype=image/png' },
34
- { test: /\.jpg($|\?)/, loader: require.resolve('file-loader') },
35
- { test: /\.gif($|\?)/, loader: require.resolve('file-loader') },
36
- { test: /\.woff[2]?($|\?)/, loader: require.resolve('url-loader') + '?limit=10000&mimetype=application/font-woff' },
37
- ]
38
- },
39
- resolve: {
40
- extensions: ['', '.js', '.css', '.json', '.coffee', '.html'],
41
- alias: {
42
- app: __dirname,
43
- base: 'app/base',
44
- api: 'base/api',
45
- helpers: 'base/helpers',
46
- assets: 'base/assets',
47
- templates: 'base/templates'
48
- }
49
- },
50
- plugins: [
51
- new webpack.optimize.CommonsChunkPlugin('core', 'core.js'),
52
- new ExtractTextPlugin("[name].css")
53
- ]
54
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes