appril-cli 0.0.6 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df94510f4634b8d7a6de0e38c6f7898a2c7ba4b4
4
- data.tar.gz: 96cd232120ea588f7f0766804ee0872f884665f3
3
+ metadata.gz: 61b2c49ff11c5fedcc25016cc70eed0b218d2211
4
+ data.tar.gz: 46a6420c5cf7d573f0e4110719523823c7681238
5
5
  SHA512:
6
- metadata.gz: 53068e6bde2328fffe044db9fa35d222fe474380def23e88ca01265f63b7d2b31629da5843a94a10595c8ded38cf8a6f35f4203de1a7e7834a2a120b46b3e52c
7
- data.tar.gz: c6768da8a34b875d6e19925476fe8e102fb78823e97d053870f778bec197b572f50c5309df01ed1da37270ffe541e91ede99b893e25ac49f7b0f90f945377083
6
+ metadata.gz: d72448e5413aa4b19450adbf1caaec339a94539b2e90d0a55baaa08eaa9a4e82b8db4cf8266d762c0c5783b6410452d5726409ca9817a00c977927a15b7f7ccc
7
+ data.tar.gz: 1a4eb3f49d4fd871e254850ed1ba51a00baa322dfacca01c0e965b9e4f85e812572a65990c8619c2056777aba631c58c91f0364aa3354c254c1dee0b758f25df
@@ -1,5 +1,5 @@
1
1
  class RTCPController < Appril::RTCPController
2
- map File.join(Cfg.server_url, '__rtcp__')
2
+ map BaseController.url('__rtcp__')
3
3
 
4
4
  private
5
5
  # called after socket connection established
@@ -1,2 +1,2 @@
1
1
  # first file to be loaded when app starts.
2
- # it is loaded on bare metal, e.g. before any gems, configs, helpers.
2
+ # it is loaded on bare metal, e.g. before any gems, configs etc.
@@ -0,0 +1,2 @@
1
+ # this file runs after app booted and before helpers, models and api loaded.
2
+ # at this stage all gems and configs available.
@@ -1,9 +1,14 @@
1
1
 
2
- # loading .yml configs from current directory. config.yml will be loaded first.
2
+ # loading .yml configs from current directory.
3
+ # config.yml will be loaded first.
3
4
  Cfg = Appril.load_config(File.expand_path('..', __FILE__))
4
5
 
5
6
  # it is highly recommended to freeze configs so they stay unaltered on runtime.
6
7
  Cfg.freeze
7
8
 
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)}
9
+ # loading any .rb files in current dir.
10
+ # this one will be skipped automatically.
11
+ %w[
12
+ ../*.rb
13
+ ../**/*.rb
14
+ ].each {|p| Dir[File.expand_path(p, __FILE__)].each {|f| require(f)} }
@@ -6,34 +6,47 @@ require 'appril'
6
6
  module Appril
7
7
  extend self
8
8
 
9
- def load_config dir, env = RocketIO.environment
10
-
11
- config = load_config_file("#{dir}/config.yml")
12
- config.update(load_config_file("#{dir}/env/#{env}.yml"))
13
- config[:environment] = env.to_s.freeze
14
-
15
- Dir["#{dir}/**/*.yml"].each do |file|
16
- next if File.dirname(file) == './env'
17
-
18
- key = File.basename(file, '.yml')
19
- next if key == 'config' || key == 'appril'
20
-
21
- key_config = load_config_file(file)
22
- key_config_keys = key_config.keys.map(&:to_s)
23
-
24
- config[key] = if key_config_keys.include?(env.to_s)
25
- # current environment found, use it
26
- key_config[env]
27
- else
28
- if RocketIO::ENVIRONMENTS.keys.find {|k| key_config_keys.include?(k)}
29
- # there are some environment(s), but no current one so set current environment to nil
30
- nil
31
- else
32
- # there are no environments, so this config is available on any environment
33
- key_config
9
+ def load_config *dirs, env: RocketIO.environment
10
+
11
+ config = RocketIO.indifferent_params({environment: env.to_s.freeze})
12
+
13
+ dirs.each do |dir|
14
+ config.update(load_config_file("#{dir}/config.yml"))
15
+ config.update(load_config_file("#{dir}/env/#{env}.yml"))
16
+
17
+ loaded = [
18
+ File.expand_path("config.yml", dir),
19
+ File.expand_path("env/#{env}.yml", dir)
20
+ ]
21
+
22
+ %w[
23
+ *.yml
24
+ **/*.yml
25
+ ].each do |pattern|
26
+ Dir[File.join(dir, pattern)].each do |file|
27
+
28
+ path = File.expand_path(file, dir)
29
+ next if loaded.include?(path)
30
+ loaded << path
31
+
32
+ key = File.basename(file, '.yml')
33
+ key_config = load_config_file(file)
34
+ key_config_keys = key_config.keys.map(&:to_s)
35
+
36
+ config[key] = if key_config_keys.include?(config[:environment])
37
+ # current environment found, use it
38
+ key_config[config[:environment]]
39
+ else
40
+ if RocketIO::ENVIRONMENTS.keys.find {|k| key_config_keys.include?(k)}
41
+ # there are some environment(s), but no current one so set current environment to nil
42
+ nil
43
+ else
44
+ # there are no environments, so this config is available on any environment
45
+ key_config
46
+ end
47
+ end
34
48
  end
35
49
  end
36
-
37
50
  end
38
51
 
39
52
  def config.method_missing key
@@ -56,13 +69,4 @@ Dir.chdir File.expand_path('../..', __FILE__) do
56
69
  Bundler.require(RocketIO.environment)
57
70
 
58
71
  require './config/config'
59
-
60
- require './base/helpers/application_helpers'
61
- Dir['./base/helpers/**/*.rb'].each {|f| require(f)}
62
-
63
- %w[
64
- base_model.rb
65
- *.rb
66
- **/*.rb
67
- ].each {|p| Dir[File.expand_path("../../base/models/#{p}", __FILE__)].each {|f| require(f)}}
68
72
  end
@@ -8,7 +8,7 @@ module Appril
8
8
  extend self
9
9
 
10
10
  def generate_configs dir
11
- config = load_config("#{dir}/config", :development)
11
+ config = load_config("#{dir}/config", env: :development)
12
12
 
13
13
  controllers = controllers_map(dir)
14
14
  webpack_entries = webpack_entries(dir, controllers)
@@ -1,13 +1,9 @@
1
1
  # do NOT edit this file, edit ../base/load.rb instead
2
2
 
3
3
  Dir.chdir File.expand_path('../..', __FILE__) do
4
-
5
4
  require './core/boot'
6
5
  require './base/load'
7
- require './base/api/base_controller'
8
- require './base/api/rtcp_controller'
9
-
10
- Dir['./base/api/**/server.rb'].sort {|a,b|
11
- a.split(/\/+/).size <=> b.split(/\/+/).size
12
- }.each {|f| require(f)}
6
+ require './core/load_helpers'
7
+ require './core/load_models'
8
+ require './core/load_api'
13
9
  end
@@ -0,0 +1,10 @@
1
+
2
+ %w[
3
+ base_controller.rb
4
+ rtcp_controller.rb
5
+ **/server.rb
6
+ ].each do |p|
7
+ Dir[File.expand_path("../../base/api/#{p}", __FILE__)].sort {|a,b|
8
+ a.split(/\/+/).size <=> b.split(/\/+/).size
9
+ }.each {|f| require(f)}
10
+ end
@@ -0,0 +1,6 @@
1
+
2
+ %w[
3
+ application_helpers.rb
4
+ *.rb
5
+ **/*.rb
6
+ ].each {|p| Dir[File.expand_path("../../base/helpers/#{p}", __FILE__)].each {|f| require(f)}}
@@ -0,0 +1,6 @@
1
+
2
+ %w[
3
+ base_model.rb
4
+ *.rb
5
+ **/*.rb
6
+ ].each {|p| Dir[File.expand_path("../../base/models/#{p}", __FILE__)].each {|f| require(f)}}
@@ -0,0 +1,5 @@
1
+
2
+ module.exports = (env) ->
3
+ env.render
4
+ el: 'body'
5
+ template: require('./layout')
@@ -0,0 +1,5 @@
1
+ <div class="jumbotron">
2
+ <h4>
3
+ Crudle Successfully Installed!
4
+ </h4>
5
+ </div>
@@ -0,0 +1,3 @@
1
+ class Index < BaseController
2
+ map Cfg.server_url
3
+ end
@@ -1,5 +1,5 @@
1
1
  module Appril
2
2
  class CLI
3
- VERSION = '0.0.6'.freeze
3
+ VERSION = '0.0.7'.freeze
4
4
  end
5
5
  end
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.0.6
4
+ version: 0.0.7
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-05-02 00:00:00.000000000 Z
11
+ date: 2016-05-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Appril CLI
14
14
  email:
@@ -53,6 +53,9 @@ files:
53
53
  - boilerplate/app/core/boot.rb
54
54
  - boilerplate/app/core/generate_configs.rb
55
55
  - boilerplate/app/core/load.rb
56
+ - boilerplate/app/core/load_api.rb
57
+ - boilerplate/app/core/load_helpers.rb
58
+ - boilerplate/app/core/load_models.rb
56
59
  - boilerplate/app/generators/api/client.coffee
57
60
  - boilerplate/app/generators/api/layout.html
58
61
  - boilerplate/app/generators/api/server.rb
@@ -62,6 +65,9 @@ files:
62
65
  - boilerplate/app/var/.ignore
63
66
  - boilerplate/app/webpack.config.js
64
67
  - boilerplate/crudle/Gemfile
68
+ - boilerplate/crudle/base/api/index/client.coffee
69
+ - boilerplate/crudle/base/api/index/layout.html
70
+ - boilerplate/crudle/base/api/index/server.rb
65
71
  - boilerplate/crudle/base/core.coffee
66
72
  - boilerplate/crudle/base/templates/menu.html
67
73
  - boilerplate/crudle/generators/api/client.coffee
@@ -152,5 +158,5 @@ rubyforge_project:
152
158
  rubygems_version: 2.5.1
153
159
  signing_key:
154
160
  specification_version: 4
155
- summary: '["appril-cli-0.0.6", "Appril CLI"]'
161
+ summary: '["appril-cli-0.0.7", "Appril CLI"]'
156
162
  test_files: []