hyperloop-config 1.0.0.lap24 → 1.0.0.lap25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37c9a487aef028c0f85a5e248afdfd45b79993ca151c3a7a2ca47af9c7b2431c
4
- data.tar.gz: 18b89433cc2905c8f2885d96d2edeb7d2b3373ccf361ce207715613e7bc5a4b9
3
+ metadata.gz: b01e331e16c1b91acd0530ed1dd128772590bffb3c91392632e849f6011ee027
4
+ data.tar.gz: 3a3d6d14a208092c9a610edeaded25d19f356388e1b3537806395b9c7964309b
5
5
  SHA512:
6
- metadata.gz: eecaacd03125fc8693667b0d8e7591be24f025e30623647136885a3f80f7f60cfa4ff5b621a974e836e6e0d5c50e99a1955e58397593b47f45f38f03b8e60f9d
7
- data.tar.gz: 316ee91b079d449e0b238dd9f44d0583099caa8c974bb70675dd782d7c5c07cca82e18cfd3bf3328f8dffaee98872e864064c873523c5db97dfc2f95ada2ccc9
6
+ metadata.gz: f0721d8a72abeea3a66690d7ef3b1ca0b90215702d63709b5cf1c7dd098204eaf041d3d52b9dec1ee36b6092af798daf35c27f45fdedaa39286cc5306a3054a1
7
+ data.tar.gz: b74e69b3b0d2ccef5dafad817a46071cadd0fcf2b03bcf211dad64bca0eeb0c038ab67184da3daa731315bb851c7ce6dc04dca45867cf97c5db58e31879c8e29
@@ -2,6 +2,8 @@ if RUBY_ENGINE == 'opal'
2
2
  require 'hyperloop/client_stubs'
3
3
  require 'hyperloop/context'
4
4
  require 'hyperloop/on_client'
5
+ require 'hyperloop/active_support_string_inquirer.rb'
6
+ require 'hyperloop_env'
5
7
  else
6
8
  require 'opal'
7
9
  require 'opal-browser'
@@ -12,11 +14,15 @@ else
12
14
  require 'hyperloop/client_readers'
13
15
  require 'hyperloop/on_client'
14
16
  require 'hyperloop/rail_tie' if defined? Rails
17
+ require 'hyperloop/active_support_string_inquirer.rb' unless defined? ActiveSupport
18
+ require 'hyperloop/env'
15
19
  Hyperloop.import 'opal', gem: true
16
20
  Hyperloop.import 'browser', client_only: true
17
21
  Hyperloop.import 'hyperloop-config', gem: true
18
22
  Hyperloop.import 'hyperloop/autoloader'
19
23
  Hyperloop.import 'hyperloop/autoloader_starter'
20
-
24
+ # based on the environment pick the directory containing the file with the matching
25
+ # value for the client. This avoids use of ERB for builds outside of sprockets environment
26
+ Opal.append_path(File.expand_path("../hyperloop/environment/#{Hyperloop.env}/", __FILE__).untaint)
21
27
  Opal.append_path(File.expand_path('../', __FILE__).untaint)
22
28
  end
@@ -0,0 +1,32 @@
1
+ module ActiveSupport
2
+ # Wrapping a string in this class gives you a prettier way to test
3
+ # for equality. The value returned by <tt>Rails.env</tt> is wrapped
4
+ # in a StringInquirer object, so instead of calling this:
5
+ #
6
+ # Rails.env == 'production'
7
+ #
8
+ # you can call this:
9
+ #
10
+ # Rails.env.production?
11
+ #
12
+ # == Instantiating a new StringInquirer
13
+ #
14
+ # vehicle = ActiveSupport::StringInquirer.new('car')
15
+ # vehicle.car? # => true
16
+ # vehicle.bike? # => false
17
+ class StringInquirer < String
18
+ private
19
+
20
+ def respond_to_missing?(method_name, include_private = false)
21
+ (method_name[-1] == "?") || super
22
+ end
23
+
24
+ def method_missing(method_name, *arguments)
25
+ if method_name[-1] == "?"
26
+ self == method_name[0..-2]
27
+ else
28
+ super
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,5 +1,5 @@
1
1
  module Hyperloop
2
2
  module Config
3
- VERSION = '1.0.0.lap24'
3
+ VERSION = '1.0.0.lap25'
4
4
  end
5
5
  end
@@ -0,0 +1,10 @@
1
+ module Hyperloop
2
+ def self.env
3
+ @environment ||= begin
4
+ env = Rails.env if defined? Rails
5
+ env ||= ENV['RACK_ENV']
6
+ env = 'development' unless %w[development production test staging].include? env
7
+ ActiveSupport::StringInquirer.new(env)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ module Hyperloop
2
+ def self.env
3
+ @environment ||= ActiveSupport::StringInquirer.new('development')
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Hyperloop
2
+ def self.env
3
+ @environment ||= ActiveSupport::StringInquirer.new('production')
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Hyperloop
2
+ def self.env
3
+ @environment ||= ActiveSupport::StringInquirer.new('staging')
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Hyperloop
2
+ def self.env
3
+ @environment ||= ActiveSupport::StringInquirer.new('test')
4
+ end
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyperloop-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.lap24
4
+ version: 1.0.0.lap25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitch VanDuyn
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-02-28 00:00:00.000000000 Z
12
+ date: 2018-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: opal
@@ -79,14 +79,14 @@ dependencies:
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 1.0.0.lap24
82
+ version: 1.0.0.lap25
83
83
  type: :development
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 1.0.0.lap24
89
+ version: 1.0.0.lap25
90
90
  - !ruby/object:Gem::Dependency
91
91
  name: mini_racer
92
92
  requirement: !ruby/object:Gem::Requirement
@@ -223,6 +223,7 @@ files:
223
223
  - lib/hyperloop-prerender-loader-application.rb.erb
224
224
  - lib/hyperloop-prerender-loader-system-code.rb.erb
225
225
  - lib/hyperloop-prerender-loader.js
226
+ - lib/hyperloop/active_support_string_inquirer.rb
226
227
  - lib/hyperloop/autoloader.rb
227
228
  - lib/hyperloop/autoloader_starter.rb
228
229
  - lib/hyperloop/client_readers.rb
@@ -230,6 +231,11 @@ files:
230
231
  - lib/hyperloop/config/version.rb
231
232
  - lib/hyperloop/config_settings.rb
232
233
  - lib/hyperloop/context.rb
234
+ - lib/hyperloop/env.rb
235
+ - lib/hyperloop/environment/development/hyperloop_env.rb
236
+ - lib/hyperloop/environment/production/hyperloop_env.rb
237
+ - lib/hyperloop/environment/staging/hyperloop_env.rb
238
+ - lib/hyperloop/environment/test/hyperloop_env.rb
233
239
  - lib/hyperloop/imports.rb
234
240
  - lib/hyperloop/on_client.rb
235
241
  - lib/hyperloop/rail_tie.rb