fontcustom 1.3.0.beta3 → 1.3.0.beta4
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/TODO.md +8 -8
- data/lib/fontcustom.rb +3 -7
- data/lib/fontcustom/base.rb +13 -17
- data/lib/fontcustom/cli.rb +0 -8
- data/lib/fontcustom/generator/font.rb +17 -15
- data/lib/fontcustom/generator/template.rb +50 -32
- data/lib/fontcustom/manifest.rb +52 -19
- data/lib/fontcustom/options.rb +31 -77
- data/lib/fontcustom/utility.rb +22 -58
- data/lib/fontcustom/version.rb +1 -1
- data/spec/fontcustom/base_spec.rb +12 -24
- data/spec/fontcustom/cli_spec.rb +1 -1
- data/spec/fontcustom/generator/font_spec.rb +17 -19
- data/spec/fontcustom/generator/template_spec.rb +5 -3
- data/spec/fontcustom/manifest_spec.rb +7 -6
- data/spec/fontcustom/options_spec.rb +108 -189
- data/spec/fontcustom/utility_spec.rb +3 -84
- data/spec/spec_helper.rb +10 -13
- metadata +2 -2
@@ -3,10 +3,11 @@ require "spec_helper"
|
|
3
3
|
describe Fontcustom::Utility do
|
4
4
|
class Generator
|
5
5
|
include Fontcustom::Utility
|
6
|
-
attr_accessor :options
|
6
|
+
attr_accessor :options, :manifest
|
7
7
|
|
8
8
|
def initialize
|
9
|
-
@options = { :
|
9
|
+
@options = { :quiet => false }
|
10
|
+
@manifest = fixture ".fontcustom-manifest.json"
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
@@ -40,27 +41,6 @@ describe Fontcustom::Utility do
|
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
43
|
-
context "#expand_path" do
|
44
|
-
it "should leave absolute paths alone" do
|
45
|
-
gen = Generator.new
|
46
|
-
path = gen.expand_path "/absolute/path"
|
47
|
-
path.should == "/absolute/path"
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should prepend paths with :project_root" do
|
51
|
-
gen = Generator.new
|
52
|
-
path = gen.expand_path "generators"
|
53
|
-
path.should == fixture("generators")
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should follow parent (../../) relative paths" do
|
57
|
-
gen = Generator.new
|
58
|
-
gen.options[:project_root] = fixture "shared/vectors"
|
59
|
-
path = gen.expand_path "../../generators"
|
60
|
-
path.should == fixture("generators")
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
44
|
context "#write_file" do
|
65
45
|
it "should replace the contents of a file" do
|
66
46
|
gen = Generator.new
|
@@ -69,67 +49,6 @@ describe Fontcustom::Utility do
|
|
69
49
|
file.should_receive(:write).with("testing")
|
70
50
|
gen.write_file fixture("shared/test"), "testing"
|
71
51
|
end
|
72
|
-
|
73
|
-
#it "should output a message"
|
74
|
-
end
|
75
|
-
|
76
|
-
#context "#garbage_collect" do
|
77
|
-
#it "should delete files from passed array"
|
78
|
-
#it "should update the manifest after completion"
|
79
|
-
#end
|
80
|
-
|
81
|
-
context "#get_manifest" do
|
82
|
-
it "should return a manifest hash" do
|
83
|
-
gen = Generator.new
|
84
|
-
options = { :project_root => fixture("generators"), :manifest => fixture("generators/.fontcustom-manifest.json") }
|
85
|
-
gen.instance_variable_set :@options, options
|
86
|
-
gen.get_manifest.keys.should == manifest_contents.keys
|
87
|
-
end
|
88
|
-
|
89
|
-
it "should raise an error if the file is empty" do
|
90
|
-
gen = Generator.new
|
91
|
-
options = { :project_root => fixture("generators"), :manifest => fixture("generators/.fontcustom-manifest-empty.json") }
|
92
|
-
gen.instance_variable_set :@options, options
|
93
|
-
expect { gen.get_manifest }.to raise_error Fontcustom::Error, /Couldn't parse/
|
94
|
-
end
|
95
|
-
|
96
|
-
it "should raise an error if the file is corrupted" do
|
97
|
-
gen = Generator.new
|
98
|
-
options = { :project_root => fixture("generators"), :manifest => fixture("generators/.fontcustom-manifest-corrupted.json") }
|
99
|
-
gen.instance_variable_set :@options, options
|
100
|
-
expect { gen.get_manifest }.to raise_error Fontcustom::Error, /Couldn't parse/
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
#context "#save_manifest" do
|
105
|
-
#it "should update the manifest" do
|
106
|
-
#end
|
107
|
-
#end
|
108
|
-
|
109
|
-
context "#delete_from_manifest" do
|
110
|
-
it "should empty key from manifest" do
|
111
|
-
gen = Generator.new
|
112
|
-
gen.stub :say_changed
|
113
|
-
manifest = {:fonts => %w|fonts/a.ttf fonts/a.eot fonts/a.woff fonts/a.svg|}
|
114
|
-
gen.instance_variable_set :@manifest, manifest
|
115
|
-
gen.should_receive(:save_manifest)
|
116
|
-
gen.delete_from_manifest :fonts
|
117
|
-
gen.instance_variable_get(:@manifest)[:fonts].should == []
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
context "#relative_path" do
|
122
|
-
it "should trim project root from paths" do
|
123
|
-
gen = Generator.new
|
124
|
-
path = gen.relative_path fixture "test/path"
|
125
|
-
path.should == "test/path"
|
126
|
-
end
|
127
|
-
|
128
|
-
it "should trim beginning slash" do
|
129
|
-
gen = Generator.new
|
130
|
-
path = gen.relative_path "/test/path"
|
131
|
-
path.should == "test/path"
|
132
|
-
end
|
133
52
|
end
|
134
53
|
|
135
54
|
#context "#say_message" do
|
data/spec/spec_helper.rb
CHANGED
@@ -78,24 +78,21 @@ RSpec.configure do |c|
|
|
78
78
|
result
|
79
79
|
end
|
80
80
|
|
81
|
-
def live_test
|
81
|
+
def live_test
|
82
82
|
testdir = fixture File.join("sandbox", "test")
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
end
|
89
|
-
ensure
|
90
|
-
FileUtils.rm_r testdir if cleanup
|
83
|
+
FileUtils.rm_r testdir
|
84
|
+
FileUtils.mkdir testdir
|
85
|
+
FileUtils.cp_r fixture("shared/vectors"), testdir
|
86
|
+
FileUtils.cd testdir do
|
87
|
+
yield(testdir)
|
91
88
|
end
|
92
89
|
end
|
93
90
|
|
94
|
-
def test_manifest(options = {:input =>
|
91
|
+
def test_manifest(options = { :input => "vectors", :quiet => true })
|
95
92
|
base = Fontcustom::Base.new options
|
96
93
|
manifest = base.instance_variable_get :@manifest
|
97
|
-
|
98
|
-
|
99
|
-
|
94
|
+
checksum = base.send :checksum
|
95
|
+
manifest.set :checksum, { :current => checksum, :previous => "" }
|
96
|
+
manifest
|
100
97
|
end
|
101
98
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fontcustom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.0.
|
4
|
+
version: 1.3.0.beta4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kai Zau
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-12-
|
12
|
+
date: 2013-12-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|