ember-cli-rails-assets 0.6.2 → 0.7.0

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
- SHA1:
3
- metadata.gz: 544d2add5a8d3f21fb2f2037c06161a67d782e32
4
- data.tar.gz: f47859701fbc749e6a06a1d5e68b6dbb192b1da0
2
+ SHA256:
3
+ metadata.gz: 7e9361dbdbf288e9b4945183a249ef297ec40d00d2bdbe1e5c3931e4015892e4
4
+ data.tar.gz: 91a2fbb0e865ad05e5e6f7ce07ceaa92fee88ec6f7bd10ad49dd8e265fac1b86
5
5
  SHA512:
6
- metadata.gz: be9a8ce51811cef122545cb152dc2b3e28bb87e8d01a9451a27a4ccb324027033df6a57e5e739725b5b6c9128f2d4d832d64d71db93ce33a4ea6a4f161b1c700
7
- data.tar.gz: c5ce9eb8eb4d13191f2cafe93ebb7108603430e72b84ee24feecfec086f0ce5bf1d8ce3076c7697aa8a34c2549cea29a6dad936a057c8af93e5f7c3464b7559f
6
+ metadata.gz: 2f2a291c76a50993d6e18cae3398364507ce288bc33da35f877945f5aaacbf51a45f48b260373f5708eef4d57134a3204c2b49d9d529f91da562b639a5a6fe9d
7
+ data.tar.gz: 86b8e8b0d76d40867537b97613504b131e3972eebc7c7fe386f284af1745481ffa2a81391bc26ebc0f89a67af2209c1ad1c2eae6e816d233d02b4f893b8eb608
data/Rakefile CHANGED
@@ -4,7 +4,6 @@ begin
4
4
  rescue LoadError
5
5
  puts "You must `gem install bundler` and `bundle install` to run rake tasks"
6
6
  end
7
- require "appraisal"
8
7
 
9
8
  require "rdoc/task"
10
9
 
@@ -33,7 +32,3 @@ if defined? RSpec
33
32
  t.verbose = false
34
33
  end
35
34
  end
36
-
37
- if !ENV["APPRAISAL_INITIALIZED"] && !ENV["TRAVIS"]
38
- task :default => :appraisal
39
- end
@@ -1,34 +1,36 @@
1
+ require 'nokogiri'
1
2
  require "ember_cli/assets/errors"
2
3
 
3
4
  module EmberCli
4
5
  module Assets
5
6
  class AssetMap
6
- def initialize(name:, asset_map:)
7
+ def initialize(name:, asset_map:, index_html:)
7
8
  @name = name
8
9
  @asset_map = asset_map
10
+ @index_html = index_html
9
11
  end
10
12
 
11
13
  def javascripts
12
14
  assert_asset_map!
13
15
 
14
- [
15
- asset_matching(/vendor(.*)\.js\z/),
16
- asset_matching(/#{name}(.*)\.js\z/),
17
- ]
16
+ Nokogiri::HTML(index_html.read).css('script').map {|s|
17
+ filename = File.basename(s['src'])
18
+ asset_matching(/#{Regexp.escape(filename)}\z/)
19
+ }
18
20
  end
19
21
 
20
22
  def stylesheets
21
23
  assert_asset_map!
22
24
 
23
- [
24
- asset_matching(/vendor(.*)\.css\z/),
25
- asset_matching(/#{name}(.*)\.css\z/),
26
- ]
25
+ Nokogiri::HTML(index_html.read).css('link[rel="stylesheet"]').map {|s|
26
+ filename = File.basename(s['href'])
27
+ asset_matching(/#{Regexp.escape(filename)}\z/)
28
+ }
27
29
  end
28
30
 
29
31
  private
30
32
 
31
- attr_reader :name, :asset_map
33
+ attr_reader :name, :asset_map, :index_html
32
34
 
33
35
  def asset_matching(regex)
34
36
  matching_asset = files.detect { |asset| asset =~ regex }
@@ -1,7 +1,7 @@
1
1
  module EmberCli
2
2
  module Assets
3
3
  class Engine < ::Rails::Engine
4
- initializer "ember-cli-rails-assets" do
4
+ config.to_prepare do
5
5
  ActionController::Base.helper EmberCliRailsAssetsHelper
6
6
  end
7
7
  end
@@ -25,6 +25,7 @@ module EmberCli
25
25
  AssetMap.new(
26
26
  name: name_from_package_json,
27
27
  asset_map: asset_map_hash.to_h,
28
+ index_html: paths.index_html,
28
29
  )
29
30
  end
30
31
 
@@ -33,11 +34,7 @@ module EmberCli
33
34
  end
34
35
 
35
36
  def asset_map_hash
36
- if asset_map_file.present? && asset_map_file.exist?
37
- JSON.parse(asset_map_file.read)
38
- else
39
- DirectoryAssetMap.new(paths.assets)
40
- end
37
+ DirectoryAssetMap.new(paths.assets)
41
38
  end
42
39
 
43
40
  def name_from_package_json
@@ -17,6 +17,10 @@ module EmberCli
17
17
  app.root_path.join("package.json")
18
18
  end
19
19
 
20
+ def index_html
21
+ app.dist_path.join("index.html")
22
+ end
23
+
20
24
  protected
21
25
 
22
26
  attr_reader :app
@@ -1,5 +1,5 @@
1
1
  module EmberCli
2
2
  module Assets
3
- VERSION = "0.6.2"
3
+ VERSION = "0.7.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ember-cli-rails-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Doyle
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-18 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2023-02-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nokogiri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: Include EmberCLI-generated JavaScript and CSS stylesheet tags in your
14
28
  Rails layouts
15
29
  email:
@@ -33,7 +47,7 @@ homepage: https://github.com/seanpdoyle/ember-cli-rails-assets
33
47
  licenses:
34
48
  - MIT
35
49
  metadata: {}
36
- post_install_message:
50
+ post_install_message:
37
51
  rdoc_options: []
38
52
  require_paths:
39
53
  - lib
@@ -48,9 +62,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
62
  - !ruby/object:Gem::Version
49
63
  version: '0'
50
64
  requirements: []
51
- rubyforge_project:
52
- rubygems_version: 2.4.5.1
53
- signing_key:
65
+ rubygems_version: 3.4.6
66
+ signing_key:
54
67
  specification_version: 4
55
68
  summary: Include EmberCLI-generated JavaScript and CSS stylesheet tags in your Rails
56
69
  layouts