much-rails 0.2.1 → 0.2.2

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: d5a9113cb9c28d12b0bcffbf5df47f43c2efe956dcb3eae246643461029af788
4
- data.tar.gz: 95d5050085a06b6b747217b61d04197972948de584f48125bad8c858896913dc
3
+ metadata.gz: 65f11e22f8ed34e4bd1e940584390a1487e1c69d2c35d6641fb6352fc6179d4f
4
+ data.tar.gz: 1824ade309dee8f599074986d52b120d3fcecc79ba302f725500177d353274bd
5
5
  SHA512:
6
- metadata.gz: 9699a1c4fede48c47b4e7e47148a3dc256b0d3ee29d8b681041614719b9d734946fc001599704f26237637bacaf204013ed01b5c8ff72d3cbceeb049bb5ea407
7
- data.tar.gz: c550915e3af0b1142e73ad28b60e2e6944f5d789e769bbc31dcd35f07ace0ed16ba1bb18f253b8392b53b363167da70b33539589448d73bc1e21992341748768
6
+ metadata.gz: c0c4c70fbaeec9574a8b66465fbf11668242a521d9693a52f8f7f737558e28ed04a77047c6d634ebed576266fc5f5b4c065dd729a02108cadb07bce05f87bb86
7
+ data.tar.gz: 630142f5702e5ad4694a758ded2c8eff9487a19acc0c8611075fd606f0ada5e0d8e486ef7ff0003e28b128d8ce0e8ce80bbe26d4e0cf89dd630b6b780a6114cc
@@ -12,20 +12,16 @@ end
12
12
  module MuchRails::Assets
13
13
  def self.configure_for_rails(rails)
14
14
  MuchRails::Assets.configure do |config|
15
- # Cache fingerprints in memory for performance gains.
16
- config.fingerprint_cache MuchRails::Assets::MemCache.new
17
-
18
- # Cache compiled content in memory in development/test for performance
19
- # gains since we aren't caching to the file system. Otherwise, don't
20
- # cache in memory as we are caching to the file system and won't benefit
21
- # from the in memory cache.
22
- much_rails_content_cache =
23
- if rails.env.development? || rails.env.test?
24
- MuchRails::Assets::MemCache.new
25
- else
26
- MuchRails::Assets::NoCache.new
27
- end
28
- config.content_cache much_rails_content_cache
15
+ # Cache fingerprints/content in memory in non-development for performance
16
+ # gains. Don't cache in memory in developlemnt so changes are reflected
17
+ # without restarting the server.
18
+ if !rails.env.development?
19
+ config.fingerprint_cache MuchRails::Assets::MemCache.new
20
+ config.content_cache MuchRails::Assets::MemCache.new
21
+ else
22
+ config.fingerprint_cache MuchRails::Assets::NoCache.new
23
+ config.content_cache MuchRails::Assets::NoCache.new
24
+ end
29
25
 
30
26
  # Cache out compiled file content to the public folder in non
31
27
  # development/test environments.
@@ -33,21 +29,40 @@ module MuchRails::Assets
33
29
  config.file_store rails.root.join("public")
34
30
  end
35
31
 
36
- # Look for asset files in the app/assets folder. Support ERB processing
37
- # on all .js and .scss files. Support compilation of .scss files.
38
- config.source rails.root.join("app", "assets") do |s|
32
+ # Look for asset files in the app/assets/css folder. Support ERB
33
+ # on all .scss files. Support compilation of .scss files.
34
+ config.source rails.root.join("app", "assets", "css") do |s|
35
+ s.base_path "css"
36
+
39
37
  # Reject SCSS partials
40
38
  s.filter do |paths|
41
39
  paths.reject{ |p| File.basename(p) =~ /^_.*\.scss$/ }
42
40
  end
43
41
 
44
- s.engine "js", MuchRails::Assets::Erubi::Engine
45
42
  s.engine "scss", MuchRails::Assets::Erubi::Engine
46
43
  s.engine "scss", MuchRails::Assets::Sass::Engine, {
47
44
  syntax: "scss",
48
45
  output_style: "compressed",
49
46
  }
50
47
  end
48
+
49
+ # Look for asset files in the app/assets/img folder.
50
+ config.source rails.root.join("app", "assets", "img") do |s|
51
+ s.base_path "img"
52
+ end
53
+
54
+ # Look for asset files in the app/assets/js folder. Support ERB
55
+ # on all .js files.
56
+ config.source rails.root.join("app", "assets", "js") do |s|
57
+ s.base_path "js"
58
+
59
+ s.engine "js", MuchRails::Assets::Erubi::Engine
60
+ end
61
+
62
+ # Look for asset files in the app/assets/vendor folder
63
+ config.source rails.root.join("app", "assets", "vendor") do |s|
64
+ s.base_path "vendor"
65
+ end
51
66
  end
52
67
  MuchRails::Assets.init
53
68
  end
@@ -10,7 +10,7 @@ class MuchRails::ServiceValidationErrors
10
10
  end
11
11
 
12
12
  def add(exception_class, &block)
13
- unless exception_class < Exception
13
+ unless exception_class && exception_class < Exception
14
14
  raise(ArgumentError, "#{exception_class} is not an Exception")
15
15
  end
16
16
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MuchRails
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
@@ -29,7 +29,7 @@ Gem::Specification.new do |gem|
29
29
 
30
30
  gem.add_dependency("activerecord", ["> 5.0", "< 7.0"])
31
31
  gem.add_dependency("activesupport", ["> 5.0", "< 7.0"])
32
- gem.add_dependency("dassets", ["~> 0.15.1"])
32
+ gem.add_dependency("dassets", ["~> 0.15.2"])
33
33
  gem.add_dependency("dassets-erubi", ["~> 0.1.1"])
34
34
  gem.add_dependency("dassets-sass", ["~> 0.5.1"])
35
35
  gem.add_dependency("much-boolean", ["~> 0.2.1"])
@@ -23,7 +23,7 @@ module MuchRails::Assets
23
23
  setup do
24
24
  subject.reset
25
25
 
26
- in_development_env = Factory.boolean
26
+ in_development_env = true
27
27
  Assert.stub(FakeRails.env, :development?){ in_development_env }
28
28
  Assert.stub(FakeRails.env, :test?){ !in_development_env }
29
29
 
@@ -34,14 +34,11 @@ module MuchRails::Assets
34
34
  subject.configure_for_rails(FakeRails)
35
35
  end
36
36
 
37
- should "configure the fingerprint cache to use a memory cache" do
37
+ should "configure the fingerprint/content cache to use no cache" do
38
38
  assert_that(subject.config.fingerprint_cache)
39
- .is_instance_of(subject::MemCache)
40
- end
41
-
42
- should "configure the content cache to use a memory cache" do
39
+ .is_instance_of(subject::NoCache)
43
40
  assert_that(subject.config.content_cache)
44
- .is_instance_of(subject::MemCache)
41
+ .is_instance_of(subject::NoCache)
45
42
  end
46
43
 
47
44
  should "not configure a file store" do
@@ -49,16 +46,14 @@ module MuchRails::Assets
49
46
  .is_not_equal_to(FakeRails.root.join("public"))
50
47
  end
51
48
 
52
- should "configure the app's app/assets folder as a source" do
49
+ should "configure the app's app/assets/css folder as a source" do
53
50
  source =
54
51
  subject.config.sources.detect do |source|
55
- source.path == FakeRails.root.join("app", "assets").to_s
52
+ source.path == FakeRails.root.join("app", "assets", "css").to_s
56
53
  end
57
54
 
58
55
  assert_that(source).is_not_nil
59
- assert_that(source.engines["js"].size).equals(1)
60
- assert_that(source.engines["js"].first)
61
- .is_instance_of(subject::Erubi::Engine)
56
+ assert_that(source.base_path).equals("css")
62
57
  assert_that(source.engines["scss"].size).equals(2)
63
58
  assert_that(source.engines["scss"].first)
64
59
  .is_instance_of(subject::Erubi::Engine)
@@ -66,6 +61,41 @@ module MuchRails::Assets
66
61
  .is_instance_of(subject::Sass::Engine)
67
62
  end
68
63
 
64
+ should "configure the app's app/assets/img folder as a source" do
65
+ source =
66
+ subject.config.sources.detect do |source|
67
+ source.path == FakeRails.root.join("app", "assets", "img").to_s
68
+ end
69
+
70
+ assert_that(source).is_not_nil
71
+ assert_that(source.base_path).equals("img")
72
+ assert_that(source.engines.empty?).is_true
73
+ end
74
+
75
+ should "configure the app's app/assets/js folder as a source" do
76
+ source =
77
+ subject.config.sources.detect do |source|
78
+ source.path == FakeRails.root.join("app", "assets", "js").to_s
79
+ end
80
+
81
+ assert_that(source).is_not_nil
82
+ assert_that(source.base_path).equals("js")
83
+ assert_that(source.engines["js"].size).equals(1)
84
+ assert_that(source.engines["js"].first)
85
+ .is_instance_of(subject::Erubi::Engine)
86
+ end
87
+
88
+ should "configure the app's app/assets/vendor folder as a source" do
89
+ source =
90
+ subject.config.sources.detect do |source|
91
+ source.path == FakeRails.root.join("app", "assets", "vendor").to_s
92
+ end
93
+
94
+ assert_that(source).is_not_nil
95
+ assert_that(source.base_path).equals("vendor")
96
+ assert_that(source.engines.empty?).is_true
97
+ end
98
+
69
99
  should "initialize itself" do
70
100
  assert_that(@init_call).is_not_nil
71
101
  end
@@ -84,9 +114,11 @@ module MuchRails::Assets
84
114
  subject.configure_for_rails(FakeRails)
85
115
  end
86
116
 
87
- should "configure the content cache to use no cache" do
117
+ should "configure the fingerprint/content cache to use a memory cache" do
118
+ assert_that(subject.config.fingerprint_cache)
119
+ .is_instance_of(subject::MemCache)
88
120
  assert_that(subject.config.content_cache)
89
- .is_instance_of(subject::NoCache)
121
+ .is_instance_of(subject::MemCache)
90
122
  end
91
123
 
92
124
  should "configure a file store for the app's public folder" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: much-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Redding
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-01-26 00:00:00.000000000 Z
12
+ date: 2021-02-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: much-style-guide
@@ -105,14 +105,14 @@ dependencies:
105
105
  requirements:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
- version: 0.15.1
108
+ version: 0.15.2
109
109
  type: :runtime
110
110
  prerelease: false
111
111
  version_requirements: !ruby/object:Gem::Requirement
112
112
  requirements:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
- version: 0.15.1
115
+ version: 0.15.2
116
116
  - !ruby/object:Gem::Dependency
117
117
  name: dassets-erubi
118
118
  requirement: !ruby/object:Gem::Requirement
@@ -369,8 +369,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
369
369
  - !ruby/object:Gem::Version
370
370
  version: '0'
371
371
  requirements: []
372
- rubyforge_project:
373
- rubygems_version: 2.7.6.2
372
+ rubygems_version: 3.2.4
374
373
  signing_key:
375
374
  specification_version: 4
376
375
  summary: Rails utilities.