fontello_rails_converter 0.4.0 → 0.4.1
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/.travis.yml +0 -1
- data/CHANGELOG.md +5 -0
- data/README.md +2 -0
- data/fontello_rails_converter.gemspec +2 -0
- data/lib/fontello_rails_converter/cli.rb +1 -1
- data/lib/fontello_rails_converter/version.rb +1 -1
- data/spec/cli_spec.rb +10 -2
- data/spec/fixtures/empty_name_config.json +3 -0
- data/spec/fontello_api_spec.rb +8 -8
- data/spec/spec_helper.rb +1 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5afdb7c6c5608e0f122a1499f94627629404fdd
|
4
|
+
data.tar.gz: 609b452ae1eb3c22a070bd33f2a9552375de9e9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 899b64f286cb557adad4f8686755daa6210f49ef17ca28bcf7179c291d5b3c7f783427787972d6f9f36d8231a42077aee13656c62b6ba607bf44d26a23396f00
|
7
|
+
data.tar.gz: 0d9de066d925af2234362a9f5e9b6ab6dc2809f51e23b428b8acdd6205304fdd1360345e522f8d6820f12fd467fca7582f8c97c2511ff774240bb41978cac72a
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -16,6 +16,8 @@ Main features:
|
|
16
16
|
|
17
17
|
Add the gem to your Gemfile `gem 'fontello_rails_converter'` and run `bundle install`
|
18
18
|
|
19
|
+
Read the [note](https://github.com/railslove/fontello_rails_converter#gemfile-environment) below to decide whether to put the gem into the `production` or `development` group in your Gemfile.
|
20
|
+
|
19
21
|
#### Get your icon font
|
20
22
|
|
21
23
|
1. Download your initial `.zip` file from [http://fontello.com](http://fontello.com) and save it to `myapp/tmp/fontello.zip`
|
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.required_ruby_version = '~> 2.0'
|
22
|
+
|
21
23
|
spec.add_runtime_dependency "rubyzip", "~> 1.0"
|
22
24
|
spec.add_runtime_dependency "launchy"
|
23
25
|
spec.add_runtime_dependency "rest-client"
|
@@ -183,7 +183,7 @@ module FontelloRailsConverter
|
|
183
183
|
|
184
184
|
def fontello_name
|
185
185
|
@_fontello_name ||= if config_file_exists?
|
186
|
-
JSON.parse(File.read(@options[:config_file]))['name']
|
186
|
+
JSON.parse(File.read(@options[:config_file]))['name'].presence || 'fontello'
|
187
187
|
end
|
188
188
|
end
|
189
189
|
end
|
data/spec/cli_spec.rb
CHANGED
@@ -29,21 +29,29 @@ describe FontelloRailsConverter::Cli do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
describe '#fontello_name' do
|
32
|
-
context 'no config_file
|
32
|
+
context 'no config_file specified' do
|
33
33
|
let(:cli) { described_class.new({}) }
|
34
34
|
specify do
|
35
35
|
expect(cli.send(:fontello_name)).to eql nil
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
context 'config file doesnt exist' do
|
39
|
+
context 'specified config file doesnt exist' do
|
40
40
|
let(:cli) { described_class.new(config_file: 'foo') }
|
41
41
|
specify do
|
42
42
|
expect(cli.send(:fontello_name)).to eql nil
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
context 'name is empty' do
|
47
|
+
let(:cli) { described_class.new(config_file: 'spec/fixtures/empty_name_config.json') }
|
48
|
+
it 'should fall back to "fontello"' do
|
49
|
+
expect(cli.send(:fontello_name)).to eql 'fontello'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
46
53
|
context 'correct config file' do
|
54
|
+
|
47
55
|
specify do
|
48
56
|
expect(cli.send(:fontello_name)).to eql 'makerist'
|
49
57
|
end
|
data/spec/fontello_api_spec.rb
CHANGED
@@ -5,23 +5,23 @@ describe FontelloRailsConverter::FontelloApi do
|
|
5
5
|
subject { described_class.new config_file: File.expand_path('../fixtures/minimal-config.json', __FILE__), fontello_session_id_file: File.expand_path('../fixtures/fontello_session_id_persisted', __FILE__) }
|
6
6
|
|
7
7
|
before do
|
8
|
-
subject.
|
8
|
+
allow(subject).to receive(:persist_session)
|
9
9
|
end
|
10
10
|
|
11
11
|
describe '#new_session_from_config' do
|
12
12
|
before do
|
13
|
-
RestClient.
|
13
|
+
expect(RestClient).to receive(:post).and_return 'NEWIDFROMCONFIG'
|
14
14
|
end
|
15
15
|
|
16
16
|
specify do
|
17
|
-
subject.
|
17
|
+
expect(subject).to receive(:persist_session)
|
18
18
|
expect(subject.new_session_from_config).to eql 'NEWIDFROMCONFIG'
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
describe '#session_url' do
|
23
23
|
before do
|
24
|
-
subject.
|
24
|
+
expect(subject).to receive(:session_id).and_return "12345"
|
25
25
|
end
|
26
26
|
|
27
27
|
specify do
|
@@ -43,7 +43,7 @@ describe FontelloRailsConverter::FontelloApi do
|
|
43
43
|
describe '#session_id' do
|
44
44
|
context 'session_id NOT set on initialization' do
|
45
45
|
specify do
|
46
|
-
subject.
|
46
|
+
expect(subject).to receive(:read_or_create_session).and_return 'foo'
|
47
47
|
expect(subject.send(:session_id)).to eql 'foo'
|
48
48
|
end
|
49
49
|
end
|
@@ -60,7 +60,7 @@ describe FontelloRailsConverter::FontelloApi do
|
|
60
60
|
describe '#read_or_create_session' do
|
61
61
|
context 'read from existing file' do
|
62
62
|
specify do
|
63
|
-
subject.
|
63
|
+
expect(subject).not_to receive(:new_session_from_config)
|
64
64
|
expect(subject.send(:read_or_create_session)).to eql 'MYPERSISTEDSESSION'
|
65
65
|
end
|
66
66
|
end
|
@@ -71,7 +71,7 @@ describe FontelloRailsConverter::FontelloApi do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
specify do
|
74
|
-
subject.
|
74
|
+
expect(subject).to receive(:new_session_from_config).and_return 'NEWSESSION'
|
75
75
|
expect(subject.send(:read_or_create_session)).to eql 'NEWSESSION'
|
76
76
|
end
|
77
77
|
end
|
@@ -82,7 +82,7 @@ describe FontelloRailsConverter::FontelloApi do
|
|
82
82
|
end
|
83
83
|
|
84
84
|
specify do
|
85
|
-
subject.
|
85
|
+
expect(subject).to receive(:new_session_from_config).and_return 'NEWSESSION'
|
86
86
|
expect(subject.send(:read_or_create_session)).to eql 'NEWSESSION'
|
87
87
|
end
|
88
88
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fontello_rails_converter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakob Hilden
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- spec/dummy/public/favicon.ico
|
138
138
|
- spec/fixtures/config.json
|
139
139
|
- spec/fixtures/converted/fontello-demo.html
|
140
|
+
- spec/fixtures/empty_name_config.json
|
140
141
|
- spec/fixtures/fontello-demo.html
|
141
142
|
- spec/fixtures/fontello_session_id_changing
|
142
143
|
- spec/fixtures/fontello_session_id_empty
|
@@ -154,9 +155,9 @@ require_paths:
|
|
154
155
|
- lib
|
155
156
|
required_ruby_version: !ruby/object:Gem::Requirement
|
156
157
|
requirements:
|
157
|
-
- - "
|
158
|
+
- - "~>"
|
158
159
|
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
+
version: '2.0'
|
160
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
162
|
requirements:
|
162
163
|
- - ">="
|
@@ -215,6 +216,7 @@ test_files:
|
|
215
216
|
- spec/dummy/public/favicon.ico
|
216
217
|
- spec/fixtures/config.json
|
217
218
|
- spec/fixtures/converted/fontello-demo.html
|
219
|
+
- spec/fixtures/empty_name_config.json
|
218
220
|
- spec/fixtures/fontello-demo.html
|
219
221
|
- spec/fixtures/fontello_session_id_changing
|
220
222
|
- spec/fixtures/fontello_session_id_empty
|