appril 0.2.6 → 0.2.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: a3d9542b800a9f25bfd6d252291654d0bc560636
4
- data.tar.gz: 7c7ddeb2c45eb5ca7a6fbac9370d02311a1532ba
3
+ metadata.gz: 1846892903be65518c75dff571cb9b7c03389432
4
+ data.tar.gz: eb72df3e542930ac832e57ac63c857b41c6e73e4
5
5
  SHA512:
6
- metadata.gz: 7467a4574bc80aaef10dbade04dfcb0167a2b89991d683ec2551fafe773473e20b3ef0afb6f27bc4442a24c5c0cbead668e10f48ea97e6d5fc45760a41e09f71
7
- data.tar.gz: dac771c515bf760a93ce9c1ef43583b6ac0928eaa64f1fa92d10a61e65e9b6a7014e18cace80e39d36d09110a95c7f21dc5a577c8bca12c694d5c34f9048318f
6
+ metadata.gz: ad2bccf19301a3a7caeb9cd3bacc17995ceefc1a76d81ad3028f93bd1e3d2867a61e52d824c2f53b02bc6d4e9ea08edf4dec75813c4830b783b0c520fab2cebb
7
+ data.tar.gz: 09668c515ef0fa85e848ba3babfc5070b525416a7eb5e1231e29b31a90d097e5fea059c71072c794fb37c2e700b76319693c6344fba8c379330b7d28a48937a2
@@ -16,6 +16,6 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.required_ruby_version = '>= 2.2'
18
18
 
19
- spec.add_runtime_dependency 'rocketio', '>= 0.4.1'
20
- spec.add_runtime_dependency 'tubesock', '>= 0.2.7'
19
+ spec.add_runtime_dependency 'rocketio', '~> 0.4'
20
+ spec.add_runtime_dependency 'tubesock', '~> 0.2'
21
21
  end
@@ -1,3 +1,3 @@
1
1
  module Appril
2
- VERSION = '0.2.6'.freeze
2
+ VERSION = '0.2.7'.freeze
3
3
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appril
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.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-08-12 00:00:00.000000000 Z
11
+ date: 2016-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rocketio
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.4.1
19
+ version: '0.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.4.1
26
+ version: '0.4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: tubesock
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.2.7
33
+ version: '0.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.2.7
40
+ version: '0.2'
41
41
  description: Opinionated framework for building opinionated web applications
42
42
  email:
43
43
  - mail@sleewoo.com
@@ -51,8 +51,6 @@ files:
51
51
  - appril.gemspec
52
52
  - lib/appril.rb
53
53
  - lib/appril/base_controller.rb
54
- - lib/appril/generate_configs.rb
55
- - lib/appril/load_configs.rb
56
54
  - lib/appril/rtcp_controller.rb
57
55
  - lib/appril/version.rb
58
56
  homepage: https://github.com/appril/ruby-server
@@ -78,5 +76,5 @@ rubyforge_project:
78
76
  rubygems_version: 2.5.1
79
77
  signing_key:
80
78
  specification_version: 4
81
- summary: '["appril-0.2.6", "Opinionated framework for building opinionated web applications"]'
79
+ summary: '["appril-0.2.7", "Opinionated framework for building opinionated web applications"]'
82
80
  test_files: []
@@ -1,96 +0,0 @@
1
- require 'fileutils'
2
- require 'rocketio'
3
- require 'appril/load_configs'
4
-
5
- module Appril
6
- extend self
7
-
8
- def generate_configs dir
9
- generate_components_file(dir)
10
- generate_config_file(dir)
11
- generate_store_modules_file(dir)
12
- end
13
-
14
- def generate_components_file dir
15
- components = JSON.pretty_generate(controllers_map(dir))
16
- File.open(File.expand_path('components.json', dir), 'w') {|f| f << components}
17
- end
18
-
19
- def generate_config_file dir
20
- config = Appril.load_configs("#{dir}/config", env: :development)
21
- File.open File.expand_path('config.json', dir), 'w' do |f|
22
- f << JSON.pretty_generate({
23
- build_path: config[:build_path],
24
- client_url: config[:client_url],
25
- server_url: config[:server_url],
26
- default_api: config[:default_api],
27
- webpack_entries: webpack_entries(dir, controllers_map(dir))
28
- })
29
- end
30
- end
31
-
32
- def generate_store_modules_file dir
33
-
34
- lines = controllers_map(dir).each_with_object([
35
- '// auto-generated file, do not edit',
36
- ]) do |c,o|
37
- next unless c[:name] # skip anonymous controllers
38
- pattern = "base/components/#{c[:path]}/store.*"
39
- next unless file = Dir[File.expand_path(pattern, dir)].find {|e| File.file?(e)}
40
- path = file.sub(dir, 'app')
41
- o << "
42
- import #{c[:name]} from '#{path}'
43
- export {#{c[:name]}}
44
- "
45
- end
46
-
47
- file = File.expand_path('base/store/modules.js', dir)
48
- FileUtils.mkdir_p(File.dirname(file))
49
- File.open(file, 'w') {|f| f << lines.join("\n")}
50
- end
51
-
52
- def controllers_map dir
53
- path_prefix = File.expand_path('base/components', dir)
54
- RocketIO.controllers.each_with_object([]) do |controller,o|
55
- next if controller.to_s =~ /BaseController|RTCPController/
56
- o << {
57
- path: controller.dirname.sub(path_prefix, '').gsub(/\A\/|\/\Z/, ''),
58
- url: controller.url,
59
- url_pattern: url_pattern(controller),
60
- name: controller.name.gsub('::', '__'),
61
- controller_name: controller.name,
62
- api: controller.api.keys
63
- }
64
- end.sort do |a,b|
65
- b[:url].split('/').size <=> a[:url].split('/').size
66
- end
67
- end
68
-
69
- def webpack_entries dir, controllers
70
- entries = controllers.each_with_object({}) do |controller,o|
71
- pattern = "base/components/#{controller[:path]}/index.*"
72
- next unless entry = Dir[File.expand_path(pattern, dir)].find {|e| File.file?(e)}
73
- o[controller[:path]] = entry.sub(dir, '.')
74
- end
75
-
76
- pattern = "base/app.*"
77
- if file = Dir[File.expand_path(pattern, dir)].find {|e| File.file?(e)}
78
- entries[:app] = file.sub(dir, '.')
79
- end
80
-
81
- entries
82
- end
83
-
84
- def url_pattern controller
85
- controller.url *controller.instance_method(:index).parameters.each_with_object([]) {|param,o|
86
- pattern = if param[0] == :rest
87
- "*"
88
- elsif param[0] == :req
89
- ":#{param[1]}"
90
- elsif param[0] == :opt
91
- ":#{param[1]}?"
92
- end
93
- o << pattern if pattern
94
- }
95
- end
96
- end
@@ -1,60 +0,0 @@
1
- require 'yaml'
2
- require 'rocketio'
3
-
4
- module Appril
5
- extend self
6
-
7
- def load_configs *dirs, env: RocketIO.environment
8
-
9
- config = RocketIO.indifferent_params({environment: env.to_s.freeze})
10
-
11
- dirs.each do |dir|
12
- config.update(load_config_file("#{dir}/config.yml"))
13
- config.update(load_config_file("#{dir}/env/#{env}.yml"))
14
-
15
- loaded = [
16
- File.expand_path("config.yml", dir),
17
- File.expand_path("env/#{env}.yml", dir)
18
- ]
19
-
20
- %w[
21
- *.yml
22
- **/*.yml
23
- ].each do |pattern|
24
- Dir[File.join(dir, pattern)].each do |file|
25
-
26
- path = File.expand_path(file, dir)
27
- next if loaded.include?(path)
28
- loaded << path
29
-
30
- key = File.basename(file, '.yml')
31
- key_config = load_config_file(file)
32
- key_config_keys = key_config.keys.map(&:to_s)
33
-
34
- config[key] = if key_config_keys.include?(config[:environment])
35
- # current environment found, use it
36
- key_config[config[:environment]]
37
- else
38
- if RocketIO::ENVIRONMENTS.keys.find {|k| key_config_keys.include?(k)}
39
- # there are some environment(s), but no current one so set current environment to nil
40
- nil
41
- else
42
- # there are no environments, so this config is available on any environment
43
- key_config
44
- end
45
- end
46
- end
47
- end
48
- end
49
-
50
- def config.method_missing key
51
- self[key]
52
- end
53
-
54
- config
55
- end
56
-
57
- def load_config_file file
58
- RocketIO.indifferent_params(YAML.load(File.read(file)) || {})
59
- end
60
- end