middleman-imageoptim 0.1.4 → 0.2.0
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/.gitignore +2 -0
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +46 -0
- data/.simplecov +7 -0
- data/.travis.yml +1 -2
- data/Gemfile +1 -11
- data/README.md +35 -19
- data/Rakefile +11 -19
- data/features/manifest.feature +31 -0
- data/features/optimization.feature +10 -0
- data/features/permissions.feature +14 -0
- data/features/support/env.rb +7 -0
- data/features/support/step_definitions.rb +39 -0
- data/fixtures/basic-app/config-disabled-manifest.rb +3 -0
- data/fixtures/basic-app/config.rb +1 -0
- data/fixtures/basic-app/source/images/oh_my_glob.gif +0 -0
- data/fixtures/basic-app/source/images/table.jpg +0 -0
- data/lib/middleman-imageoptim.rb +12 -8
- data/lib/middleman-imageoptim/extension.rb +14 -13
- data/lib/middleman-imageoptim/manifest.rb +52 -0
- data/lib/middleman-imageoptim/manifest_resource.rb +41 -0
- data/lib/middleman-imageoptim/optimizer.rb +71 -74
- data/lib/middleman-imageoptim/options.rb +46 -56
- data/lib/middleman-imageoptim/resource_list.rb +72 -0
- data/lib/middleman-imageoptim/utils.rb +42 -0
- data/lib/middleman-imageoptim/version.rb +1 -1
- data/lib/middleman_extension.rb +1 -1
- data/middleman-imageoptim.gemspec +19 -16
- data/script/spec +20 -5
- data/spec/spec_helper.rb +4 -7
- data/spec/unit/options_spec.rb +97 -48
- data/spec/unit/utils_spec.rb +55 -0
- metadata +70 -16
- data/.cane +0 -4
- data/spec/unit/optimizer_spec.rb +0 -58
- data/spec/use_coveralls.rb +0 -2
- data/spec/use_simplecov.rb +0 -15
data/.cane
DELETED
data/spec/unit/optimizer_spec.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
require_relative "../../lib/middleman-imageoptim/optimizer"
|
2
|
-
|
3
|
-
describe Middleman::Imageoptim::Optimizer do
|
4
|
-
subject(:optimizer) { Middleman::Imageoptim::Optimizer.new(app, builder, options) }
|
5
|
-
let(:options) { Middleman::Imageoptim::Options.new() }
|
6
|
-
let(:app) { double }
|
7
|
-
let(:builder) { double }
|
8
|
-
let(:size_src) { 1000 }
|
9
|
-
let(:size_dst) { 1000 }
|
10
|
-
|
11
|
-
describe "#size_change_word" do
|
12
|
-
subject { optimizer.size_change_word(size_src, size_dst) }
|
13
|
-
|
14
|
-
context "the destination file is the same size as the source file" do
|
15
|
-
it "should be the same size" do
|
16
|
-
subject.should == 'no change'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
context "the destination file is smaller" do
|
21
|
-
let(:size_dst) { 500 }
|
22
|
-
it "should be smaller" do
|
23
|
-
subject.should == 'smaller'
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context "the destination file is larger" do
|
28
|
-
let(:size_dst) { 1500 }
|
29
|
-
it "should be larger" do
|
30
|
-
subject.should == 'larger'
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe "#percentage_change" do
|
36
|
-
subject { optimizer.percentage_change(size_src, size_dst) }
|
37
|
-
|
38
|
-
context "the destination file is the same size as the source file" do
|
39
|
-
it "should be the same size" do
|
40
|
-
subject.should == "0.00%"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context "the destination file is smaller" do
|
45
|
-
let(:size_dst) { 500 }
|
46
|
-
it "should be smaller" do
|
47
|
-
subject.should == "50.00%"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context "the destination file is larger" do
|
52
|
-
let(:size_dst) { 1500 }
|
53
|
-
it "should be larger" do
|
54
|
-
subject.should == '-50.00%'
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
data/spec/use_coveralls.rb
DELETED
data/spec/use_simplecov.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
puts "[Simplecov] enabled"
|
2
|
-
require 'simplecov'
|
3
|
-
|
4
|
-
class SimpleCov::Formatter::QualityFormatter
|
5
|
-
def format(result)
|
6
|
-
SimpleCov::Formatter::HTMLFormatter.new.format(result)
|
7
|
-
File.open("coverage/covered_percent", "w") do |f|
|
8
|
-
f.puts result.source_files.covered_percent.to_f
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
SimpleCov.formatter = SimpleCov::Formatter::QualityFormatter
|
14
|
-
|
15
|
-
SimpleCov.start 'rails'
|