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 +4 -4
- data/assets.gemspec +1 -1
- data/config/flay.yml +2 -2
- data/config/reek.yml +11 -9
- data/lib/assets/rule.rb +19 -5
- data/lib/assets/rule/compile.rb +1 -1
- data/lib/assets/rule/compile/css.rb +4 -5
- data/lib/assets/rule/compile/javascript.rb +4 -4
- data/lib/assets/rule/compile/javascript/coffescript.rb +6 -6
- data/lib/assets/rule/file.rb +1 -1
- data/lib/assets/rule/rename.rb +1 -1
- data/spec/integration/assets/spike_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79d1542ef2aed78690af3be9cfdd925ab50bb4eb
|
4
|
+
data.tar.gz: 27dc15a635cec56b509af19cd91767005a2e84ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db9f17a77b914750ccf744e526dddf0cddcf5bdf0af4d4f2335367673ca1568517979fad9b8ce4e5e1af61da5b15ca11bc1b84ce1d52ca6fbfcc0490e9b5c2eb
|
7
|
+
data.tar.gz: d5c967f2655042e3cae778fc45d44ab9fd801b5946b193725ce4ff63a2096b7c18d4dd068fb4e2f66de3978c2380ebbfcc0fc9126d64b95614120d8e82b768ed
|
data/assets.gemspec
CHANGED
data/config/flay.yml
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
---
|
2
|
-
threshold:
|
3
|
-
total_score:
|
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
|
-
|
69
|
-
|
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
|
data/lib/assets/rule/compile.rb
CHANGED
@@ -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 #
|
39
|
+
end # Scss
|
41
40
|
|
42
41
|
end # Css
|
43
42
|
end # Compile
|
@@ -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
|
data/lib/assets/rule/file.rb
CHANGED
data/lib/assets/rule/rename.rb
CHANGED
@@ -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.
|
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.
|
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.
|
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-
|
11
|
+
date: 2013-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: adamantium
|