catalyst-rails 0.0.9 → 0.1.0

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
  SHA256:
3
- metadata.gz: a0d65247f97e19b2d6535248e8396850700204b4e0d607148532ef90097c5c2d
4
- data.tar.gz: 4bbb24b41713f1027ca20c2b0bd9f7aa23e8043bcfb12d13597dc2735bcc7d1f
3
+ metadata.gz: b0345647f1600899692a28f86ba64bee05a2adae74642c6811ea4407749ed2c7
4
+ data.tar.gz: 6216abe9d5636d97d68b85dea0748799bf6eaa8f81335fb81c83b0573fb4cfe8
5
5
  SHA512:
6
- metadata.gz: 7aaef005bfa1705c4e801425f0be77f0235aee7bc9fa1d81affbeb722b33880ee299473775261fb7981500a42cfaf7053b22f104b4a8b9c88b233cde44acbf12
7
- data.tar.gz: c22f77a41573433610b10c4884c51bf17586cd7723e47dc613299f31f3121e72cdfbe780d9277e7b56c2fa2765f712acbd7672a83aaa3cbfbba7ecfe6149a55c
6
+ metadata.gz: 0b1fe8900c64bb2a5897cfce78276fbb2bec7f4a0b53d380161a6393566565e33129b1cd62552ac99e9e40b1f9c2f86fff6ec9e8d6dd138554acd7182eb35de0
7
+ data.tar.gz: 624c6253b5e8e6e0249e3529244fd2bd5b116cb5971dfb9baf31a82f4cbf32ca4dfecb30d97f4169ce58b9a2f6ceba12430b595191be9677e1e5f58b884d14ec
@@ -18,7 +18,6 @@ module Catalyst
18
18
 
19
19
  setting :environment, default_environment
20
20
  setting :manifest_path, default_manifest_path
21
- setting :assets_base_path, '/assets'
22
21
  setting :assets_host, ENV.fetch('HOST') { nil }
23
22
  setting :assets_host_protocol, 'https'
24
23
  setting :dev_server_host, ENV.fetch('DEV_SERVER_HOST') { 'localhost' }
@@ -81,9 +81,11 @@ module Catalyst
81
81
  end
82
82
 
83
83
  def asset_paths
84
- if ::Catalyst::Config.root_path
85
- Dir.glob(File.join(::Catalyst::Config.root_path, '**/*.{js,ts,tsx,scss}')) + [
86
- File.join(Dir.pwd, 'yarn.lock')
84
+ if ::Catalyst::Config.context_path
85
+ Dir.glob(File.join(::Catalyst::Config.context_path, '**/*.{js,ts,tsx,scss}')) + [
86
+ File.join(Dir.pwd, 'package.json'),
87
+ File.join(Dir.pwd, 'yarn.lock'),
88
+ File.join(Dir.pwd, 'catalyst.config.json')
87
89
  ]
88
90
  else
89
91
  []
@@ -7,23 +7,26 @@ require_relative './errors'
7
7
 
8
8
  module Catalyst
9
9
  class Config
10
+ CATALYST_CONFIG_PATH = File.expand_path('./catalyst.config.json', Dir.pwd)
10
11
  PACKAGE_PATH = File.expand_path('./package.json', Dir.pwd)
11
12
 
12
13
  include Singleton
13
14
 
14
15
  class << self
15
16
  extend Forwardable
16
- def_delegators :instance, :root_path, :build_path
17
+ def_delegators :instance, :context_path
17
18
  end
18
19
 
19
20
  def initialize
20
- unless File.exists?(PACKAGE_PATH)
21
+ @values = if File.exists?(CATALYST_CONFIG_PATH)
22
+ JSON.parse(File.read(CATALYST_CONFIG_PATH))
23
+ elsif File.exists?(PACKAGE_PATH)
24
+ JSON.parse(File.read(PACKAGE_PATH))['catalyst']
25
+ else
21
26
  raise ::Catalyst::MissingConfig,
22
- "Missing package.json file in: #{Dir.pwd}"
27
+ "Missing 'catalyst.config.json' or 'package.json' file in: #{Dir.pwd}"
23
28
  end
24
29
 
25
- @values = JSON.parse(File.read(PACKAGE_PATH))['catalyst']
26
-
27
30
  if @values.nil?
28
31
  raise ::Catalyst::MissingConfig, <<~MESSAGE
29
32
  Missing "catalyst" config in package.json file.
@@ -33,12 +36,8 @@ module Catalyst
33
36
  end
34
37
  end
35
38
 
36
- def root_path
37
- File.join(Dir.pwd, @values['rootPath'])
38
- end
39
-
40
- def build_path
41
- File.join(Dir.pwd, @values['buildPath'])
39
+ def context_path
40
+ File.join(Dir.pwd, @values['contextPath'] || @values['rootPath'])
42
41
  end
43
42
  end
44
43
  end
@@ -57,13 +57,7 @@ module Catalyst
57
57
  return "http://#{dev_server_host}:#{dev_server_port}/#{path}"
58
58
  else
59
59
  if @manifest.key?(path)
60
- assets_base_path = Catalyst.config.assets_base_path
61
-
62
- if assets_base_path.nil?
63
- return @manifest[path]
64
- end
65
-
66
- return "#{assets_base_path}/#{@manifest[path]}"
60
+ return @manifest[path]
67
61
  else
68
62
  raise AssetMissing, "Couldn't find an asset for path: #{path}"
69
63
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Catalyst
4
4
  def self.version
5
- Gem::Version.new('0.0.9')
5
+ Gem::Version.new('0.1.0')
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catalyst-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Martens
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-24 00:00:00.000000000 Z
11
+ date: 2019-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  version: '0'
80
80
  requirements: []
81
81
  rubyforge_project:
82
- rubygems_version: 2.7.3
82
+ rubygems_version: 2.7.6.2
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: Ruby helpers for the "catalyst" node package