mbj-assets 0.0.5 → 0.0.6

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: 6d996f9fe46d686ff3e3a7a53ab924f757517ecc
4
- data.tar.gz: 177760b2c163deaa7ec55fef2660cd83379de976
3
+ metadata.gz: 79d1542ef2aed78690af3be9cfdd925ab50bb4eb
4
+ data.tar.gz: 27dc15a635cec56b509af19cd91767005a2e84ee
5
5
  SHA512:
6
- metadata.gz: 192d7d3b26f56f0f4197ca298ca7398aa0ad296692ec179a089ef9cc0e5c825c48399e4d81a69804b7c432c20798edabe625ca20ad874aac34128c878918c6ef
7
- data.tar.gz: bd727981a3461da0af95bacf7ffc78e2a4d68aa54a99848ab51a516129213dc53cab7cdee68f409f771756328002d9db379a5f377416f04592fda59b68eebfb2
6
+ metadata.gz: db9f17a77b914750ccf744e526dddf0cddcf5bdf0af4d4f2335367673ca1568517979fad9b8ce4e5e1af61da5b15ca11bc1b84ce1d52ca6fbfcc0490e9b5c2eb
7
+ data.tar.gz: d5c967f2655042e3cae778fc45d44ab9fd801b5946b193725ce4ff63a2096b7c18d4dd068fb4e2f66de3978c2380ebbfcc0fc9126d64b95614120d8e82b768ed
data/assets.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = 'mbj-assets'
5
- gem.version = '0.0.5'
5
+ gem.version = '0.0.6'
6
6
  gem.authors = [ 'Markus Schirp' ]
7
7
  gem.email = [ 'mbj@schirp-dso.com' ]
8
8
  gem.description = 'Playground for a small assets system'
data/config/flay.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  ---
2
- threshold: 14
3
- total_score: 118
2
+ threshold: 15
3
+ total_score: 119
data/config/reek.yml CHANGED
@@ -8,7 +8,7 @@ UncommunicativeParameterName:
8
8
  - !ruby/regexp /[0-9]$/
9
9
  - !ruby/regexp /[A-Z]/
10
10
  TooManyMethods:
11
- max_methods: 10
11
+ max_methods: 10
12
12
  exclude: []
13
13
  enabled: true
14
14
  max_instance_variables: 3
@@ -22,13 +22,14 @@ UncommunicativeMethodName:
22
22
  - !ruby/regexp /[0-9]$/
23
23
  - !ruby/regexp /[A-Z]/
24
24
  LongParameterList:
25
- max_params: 2
25
+ max_params: 2
26
26
  exclude: []
27
27
  enabled: true
28
28
  overrides: {}
29
29
  FeatureEnvy:
30
30
  exclude:
31
31
  - Assets::Environment::Cache#miss # False positive
32
+ - Assets::Rule#binary # False positive
32
33
  enabled: true
33
34
  ClassVariable:
34
35
  exclude: []
@@ -52,17 +53,18 @@ NestedIterators:
52
53
  enabled: true
53
54
  max_allowed_nesting: 1
54
55
  TooManyStatements:
55
- max_statements: 8
56
+ max_statements: 8
56
57
  exclude: []
57
58
  enabled: true
58
59
  DuplicateMethodCall:
59
60
  allow_calls: []
60
61
  exclude: []
61
62
  enabled: true
62
- max_calls: 1
63
+ max_calls: 1
63
64
  UtilityFunction:
64
- max_helper_calls: 0
65
- exclude: []
65
+ max_helper_calls: 0
66
+ exclude:
67
+ - Assets::Rule#binary # Okay
66
68
  enabled: true
67
69
  Attribute:
68
70
  exclude: []
@@ -78,12 +80,12 @@ UncommunicativeVariableName:
78
80
  RepeatedConditional:
79
81
  exclude: []
80
82
  enabled: true
81
- max_ifs: 1
83
+ max_ifs: 1
82
84
  DataClump:
83
85
  exclude: []
84
86
  enabled: true
85
- max_copies: 2
86
- min_clump_size: 2
87
+ max_copies: 2
88
+ min_clump_size: 2
87
89
  ControlParameter:
88
90
  exclude: []
89
91
  enabled: true
data/lib/assets/rule.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Assets
2
2
 
3
3
  # Abstract base class for rules that generate assets
4
- class Rule
4
+ class Rule
5
5
  include Adamantium, AbstractType
6
6
 
7
7
  # Return asset
@@ -22,7 +22,7 @@ module Assets
22
22
  #
23
23
  abstract_method :body
24
24
 
25
- # Return mime
25
+ # Return mime
26
26
  #
27
27
  # @return [Mime]
28
28
  #
@@ -41,7 +41,7 @@ module Assets
41
41
  # Return renamed asset
42
42
  #
43
43
  # @param [String] name
44
- #
44
+ #
45
45
  # @return [Rule::Rename]
46
46
  #
47
47
  # @api private
@@ -65,5 +65,19 @@ module Assets
65
65
  time >= updated_at
66
66
  end
67
67
 
68
- end
69
- end
68
+ private
69
+
70
+ # Helper method to tag strings as binary
71
+ #
72
+ # @param [String]
73
+ #
74
+ # @return [String]
75
+ #
76
+ # @api private
77
+ #
78
+ def binary(string)
79
+ string.force_encoding(Encoding::ASCII_8BIT)
80
+ end
81
+
82
+ end # Rule
83
+ end # Assets
@@ -1,5 +1,5 @@
1
1
  module Assets
2
- class Rule
2
+ class Rule
3
3
  class Compile < self
4
4
  include Concord.new(:input)
5
5
 
@@ -17,13 +17,12 @@ module Assets
17
17
  # @api private
18
18
  #
19
19
  def body
20
- ::Sass.compile(input.body, :syntax => :sass)
20
+ binary(::Sass.compile(input.body, :syntax => :sass))
21
21
  end
22
22
 
23
23
  end # Sass
24
24
 
25
- # Compiler for sass
26
- #
25
+ # Compiler for sass in scss flavor
27
26
  class Scss < self
28
27
  handle(Mime::SCSS)
29
28
 
@@ -34,10 +33,10 @@ module Assets
34
33
  # @api private
35
34
  #
36
35
  def body
37
- ::Sass.compile(input.body, :syntax => :scss)
36
+ binary(::Sass.compile(input.body, :syntax => :scss))
38
37
  end
39
38
 
40
- end # Sass
39
+ end # Scss
41
40
 
42
41
  end # Css
43
42
  end # Compile
@@ -6,7 +6,7 @@ module Assets
6
6
 
7
7
  MIME = Mime::JAVASCRIPT
8
8
 
9
- end
10
- end
11
- end
12
- end
9
+ end # Javascript
10
+ end # Compile
11
+ end # Rule
12
+ end # Assets
@@ -14,11 +14,11 @@ module Assets
14
14
  # @api private
15
15
  #
16
16
  def body
17
- ::CoffeeScript.compile(input.body)
17
+ binary(::CoffeeScript.compile(input.body))
18
18
  end
19
19
 
20
- end
21
- end
22
- end
23
- end
24
- end
20
+ end # Coffeescript
21
+ end # Javascript
22
+ end # Compile
23
+ end # Rule
24
+ end # Assets
@@ -39,7 +39,7 @@ module Assets
39
39
  # @api private
40
40
  #
41
41
  def body
42
- ::File.read(path)
42
+ ::File.binread(path)
43
43
  end
44
44
 
45
45
  # Return mime type
@@ -11,7 +11,7 @@ module Assets
11
11
  #
12
12
  # @param [Rule] rule
13
13
  # the rule to rename
14
- #
14
+ #
15
15
  include Concord.new(:name, :rule)
16
16
 
17
17
  # Return name
@@ -81,7 +81,7 @@ describe Assets, 'and spiking around' do
81
81
  context 'accessing image' do
82
82
  let(:name) { 'test.jpg' }
83
83
  let(:extra_hash) { {} }
84
- let(:expected_body) { File.read('spec/assets/test.jpg') }
84
+ let(:expected_body) { File.binread('spec/assets/test.jpg') }
85
85
 
86
86
  its(:content_type) { should eql('image/jpg') }
87
87
  its(:last_modified) { should eql(Time.httpdate(asset.created_at.httpdate)) }
@@ -93,7 +93,7 @@ describe Assets, 'and spiking around' do
93
93
  context 'accessing woff web font' do
94
94
  let(:name) { 'droid-sans.woff' }
95
95
  let(:extra_hash) { {} }
96
- let(:expected_body) { File.read('spec/assets/droid-sans.woff') }
96
+ let(:expected_body) { File.binread('spec/assets/droid-sans.woff') }
97
97
 
98
98
  its(:content_type) { should eql('application/font-woff') }
99
99
  its(:body) { should eql(expected_body) }
@@ -103,7 +103,7 @@ describe Assets, 'and spiking around' do
103
103
  let(:name) { 'application.js' }
104
104
  let(:extra_hash) { {} }
105
105
  let(:expected_body) do
106
- strip_indentation(<<-JAVASCRIPT)
106
+ strip_indentation(<<-JAVASCRIPT).force_encoding(Encoding::ASCII_8BIT)
107
107
  (function() {
108
108
  alert("Hello World");
109
109
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mbj-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-16 00:00:00.000000000 Z
11
+ date: 2013-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: adamantium