opal_hot_reloader 0.1.2 → 0.1.3

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: 9e5c0101353676019555c6b6ae5bd7867828a197
4
- data.tar.gz: f5989763d95b5bff149be5dbf9455a06931be275
3
+ metadata.gz: 865340375e8aa257f1549b30bbd885936945cf4b
4
+ data.tar.gz: ddeda2019446cfb76d09697480307151448603e1
5
5
  SHA512:
6
- metadata.gz: 5f14434378f9fdf91f829fbaa642df70be32d7b4fd7959172fbe262fa103af02080d6af8f0fa265a95b093c742034444f03c40d948ef69202d73b93664cecc18
7
- data.tar.gz: 4a8b4c79d456fdafa18c7399fcd64f05a1d11b25cff112a0c5d1998eb12da39e2bd19eb21d17e2e429d4de45b9e6e3e385156f055634dae7658b5a3d690f0e21
6
+ metadata.gz: 368168c04d5cfacb65812fbe28eb7db1234921141546b69da816c479ea0add8de3c60a62b614b4baa8f821014403ac2f47e8695ed83ed9bc0d406b0443e223d7
7
+ data.tar.gz: baa7598ef9b20d827dbde90d92ac883c7c2f1c05627a189b092207c181bfafa64a148e396a2a973b570ecafb0d98aca8548e91fab7a83dce8d45ce2cdf30c077
@@ -1,3 +1,5 @@
1
+ * 0.1.3
2
+ - handle Rails 5 asset pipeline css change
1
3
  * 0.1.2
2
4
  - take out app/ as default directory to load, if doing a dedicated opal app, one is going to have to specify the dir1
3
5
  - add app/assets/stylesheets as a path to add if it exists
@@ -1,3 +1,3 @@
1
1
  module OpalHotReloader
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -30,7 +30,7 @@ class OpalHotReloader
30
30
  else
31
31
  # Rails asset pipeline match
32
32
  url_base = File.basename(url).sub(/\.s?css+/, '').sub(/\.s?css+/, '')
33
- href_base = File.basename(href).sub(/\.self-.*.css.+/, '')
33
+ href_base = File.basename(href).sub(/\.self-?.*.css.+/, '')
34
34
  url_base == href_base
35
35
  end
36
36
 
@@ -78,5 +78,32 @@ describe OpalHotReloader::CssReloader do
78
78
  fail("new link_path is broken")
79
79
  end
80
80
  end
81
+
82
+ context "Rails 5" do
83
+ it 'should append t_hot_reload to a css path' do
84
+ css_path = "http://localhost:8080/assets/company.selfe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css?body=1"
85
+ doubles = fake_links_document(css_path)
86
+ link = Native(doubles[:link])
87
+ expect(link[:href]).to match /#{Regexp.escape(css_path)}$/
88
+ raw_scss_path = "app/assets/stylesheets/company.css.css"
89
+ subject.reload({ url: raw_scss_path}, doubles[:document])
90
+ expect(link[:href]).to match /#{Regexp.escape(css_path)}\&t_hot_reload=\d+/
91
+ end
92
+
93
+ it 'should update t_hot_reload arguments' do
94
+ css_path ="http://localhost:8080/assets/company.self055b3f2f4bbc772b1161698989ee095020c65e0283f4e732c66153e06b266ca8.css?body=1&t_hot_reload=1464733023"
95
+ doubles = fake_links_document(css_path)
96
+ link = Native(doubles[:link])
97
+ expect(link[:href]).to match /#{Regexp.escape(css_path)}$/
98
+ raw_scss_path = "app/assets/stylesheets/company.css.css"
99
+ subject.reload({ url: raw_scss_path}, doubles[:document])
100
+ if link[:href] =~ /(.+)\&t_hot_reload=(\d+)/
101
+ new_timestamp = $2
102
+ expect(new_timestamp).to_not eq("1464733023")
103
+ else
104
+ fail("new link_path is broken")
105
+ end
106
+ end
107
+ end
81
108
  end
82
109
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal_hot_reloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Forrest Chang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-21 00:00:00.000000000 Z
11
+ date: 2017-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler