dugway 0.6.7 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +9 -9
  3. data/dugway.gemspec +2 -0
  4. data/lib/dugway.rb +3 -2
  5. data/lib/dugway/application.rb +4 -4
  6. data/lib/dugway/cli/templates/source/{styles.css → theme.css} +0 -0
  7. data/lib/dugway/cli/templates/source/{scripts.js → theme.js} +0 -0
  8. data/lib/dugway/controller.rb +4 -7
  9. data/lib/dugway/liquid/filters/url_filters.rb +2 -2
  10. data/lib/dugway/liquifier.rb +1 -1
  11. data/lib/dugway/theme.rb +3 -3
  12. data/lib/dugway/version.rb +1 -1
  13. data/spec/features/page_rendering_spec.rb +22 -6
  14. data/spec/fixtures/theme/javascripts/one.js +1 -3
  15. data/spec/fixtures/theme/javascripts/two.js.coffee +1 -2
  16. data/spec/fixtures/theme/{styles.css → theme.css} +0 -0
  17. data/spec/fixtures/theme/{scripts.js → theme.js} +0 -0
  18. data/spec/units/dugway/request_spec.rb +42 -42
  19. data/spec/units/dugway/template_spec.rb +31 -31
  20. data/spec/units/dugway/theme_spec.rb +11 -11
  21. metadata +41 -91
  22. data/lib/dugway/data/locales/cs.yml +0 -26
  23. data/lib/dugway/data/locales/da.yml +0 -26
  24. data/lib/dugway/data/locales/en-AU.yml +0 -26
  25. data/lib/dugway/data/locales/en-GB.yml +0 -26
  26. data/lib/dugway/data/locales/en-PH.yml +0 -27
  27. data/lib/dugway/data/locales/en-US.yml +0 -26
  28. data/lib/dugway/data/locales/es-MX.yml +0 -26
  29. data/lib/dugway/data/locales/eu.yml +0 -26
  30. data/lib/dugway/data/locales/gsw-CH.yml +0 -26
  31. data/lib/dugway/data/locales/hu.yml +0 -26
  32. data/lib/dugway/data/locales/il.yml +0 -26
  33. data/lib/dugway/data/locales/ja.yml +0 -30
  34. data/lib/dugway/data/locales/ms-MY.yml +0 -26
  35. data/lib/dugway/data/locales/nb.yml +0 -22
  36. data/lib/dugway/data/locales/pl.yml +0 -27
  37. data/lib/dugway/data/locales/pt-BR.yml +0 -26
  38. data/lib/dugway/data/locales/sv-SE.yml +0 -26
  39. data/lib/dugway/data/locales/th.yml +0 -26
  40. data/lib/dugway/data/locales/tr.yml +0 -29
  41. data/lib/dugway/data/locales/zh-TW.yml +0 -30
  42. data/lib/dugway/data/theme_fonts.yml +0 -151
  43. data/lib/dugway/theme_font.rb +0 -68
  44. data/spec/units/dugway/theme_font_spec.rb +0 -136
@@ -1,26 +0,0 @@
1
- th:
2
- number:
3
- format:
4
- separator: "."
5
- delimiter: ","
6
- precision: 2
7
- significant: false
8
- strip_insignificant_zeros: false
9
-
10
- currency:
11
- format:
12
- format: "%n%u"
13
- unit: "฿"
14
- separator: "."
15
- delimiter: ","
16
- precision: 2
17
- significant: false
18
- strip_insignificant_zeros: false
19
-
20
- percentage:
21
- format:
22
- delimiter: ""
23
-
24
- precision:
25
- format:
26
- delimiter: ","
@@ -1,29 +0,0 @@
1
- tr:
2
- number:
3
- format:
4
- separator: ","
5
- delimiter: "."
6
- precision: 2
7
- significant: false
8
- strip_insignificant_zeros: false
9
-
10
- currency:
11
- format:
12
- format: "%n %u"
13
- unit: "TL"
14
- separator: ","
15
- delimiter: "."
16
- precision: 2
17
- significant: false
18
- strip_insignificant_zeros: false
19
-
20
- percentage:
21
- format:
22
- delimiter: '.'
23
- separator: ','
24
- precision: 2
25
-
26
- precision:
27
- format:
28
- delimiter: '.'
29
- separator: ','
@@ -1,30 +0,0 @@
1
- "zh-TW":
2
- number:
3
- format:
4
- separator: "."
5
- delimiter: ","
6
- precision: 2
7
- significant: false
8
- strip_insignificant_zeros: false
9
-
10
- currency:
11
- format:
12
- format: "%u%n"
13
- unit: "NT$"
14
- separator: "."
15
- delimiter: ","
16
- precision: 2
17
- significant: false
18
- strip_insignificant_zeros: false
19
-
20
- percentage:
21
- format:
22
- delimiter: ""
23
-
24
- precision:
25
- format:
26
- delimiter: ","
27
-
28
- paypal:
29
- format:
30
- precision: 0
@@ -1,151 +0,0 @@
1
- # Default browser fonts
2
-
3
- default:
4
- arial:
5
- name: Arial
6
- family: 'Arial, Helvetica, sans-serif'
7
-
8
- arial_black:
9
- name: Arial Black
10
- family: 'Arial Black, Gadget, sans-serif'
11
-
12
- courier_new:
13
- name: Courier New
14
- family: '"Courier New", Courier, monospace'
15
-
16
- georgia:
17
- name: Georgia
18
- family: 'Georgia, "Times New Roman", Times, serif'
19
-
20
- helvetica:
21
- name: Helvetica
22
- family: '"Helvetica Neue", Helvetica, Arial, sans-serif'
23
-
24
- impact:
25
- name: Impact
26
- family: 'Impact, Charcoal, sans-serif'
27
-
28
- lucida_grande:
29
- name: Lucida Grande
30
- family: '"Lucida Grande", Lucida, Verdana, sans-serif'
31
-
32
- palatino_linotype:
33
- name: Palatino Linotype
34
- family: '"Palatino Linotype", "Book Antiqua", Palatino, serif'
35
-
36
- tahoma:
37
- name: Tahoma
38
- family: 'Tahoma, Geneva, sans-serif'
39
-
40
- times_new_roman:
41
- name: Times New Roman
42
- family: '"Times New Roman", Times, serif'
43
-
44
- trebuchet_ms:
45
- name: Trebuchet MS
46
- family: '"Trebuchet MS", Arial, sans-serif'
47
-
48
- verdana:
49
- name: Verdana
50
- family: 'Verdana, Arial, Helvetica, sans-serif'
51
-
52
-
53
- # Google web fonts
54
-
55
- google:
56
- amaranth:
57
- name: Amaranth
58
- family: '"Amaranth", serif'
59
-
60
- arvo:
61
- name: Arvo
62
- family: '"Arvo", serif'
63
-
64
- asap:
65
- name: Asap
66
- family: '"Asap", sans-serif'
67
-
68
- copse:
69
- name: Copse
70
- family: '"Copse", serif'
71
-
72
- cutive_mono:
73
- name: Cutive Mono
74
- family: '"Cutive Mono", serif'
75
-
76
- delius:
77
- name: Delius
78
- family: '"Delius", cursive'
79
-
80
- dosis:
81
- name: Dosis
82
- family: '"Dosis", sans-serif'
83
-
84
- enriqueta:
85
- name: Enriqueta
86
- family: '"Enriqueta", serif'
87
-
88
- gentium_book_basic:
89
- name: Gentium Book Basic
90
- family: '"Gentium Book Basic", serif'
91
-
92
- glegoo:
93
- name: Glegoo
94
- family: '"Glegoo", serif'
95
-
96
- inconsolata:
97
- name: Inconsolata
98
- family: '"Inconsolata", sans-serif'
99
-
100
- lekton:
101
- name: Lekton
102
- family: '"Lekton", sans-serif'
103
-
104
- lobster_two:
105
- name: Lobster Two
106
- family: '"Lobster Two", cursive'
107
-
108
- merriweather:
109
- name: Merriweather
110
- family: '"Merriweather", serif'
111
-
112
- open_sans:
113
- name: Open Sans
114
- family: '"Open Sans", sans-serif'
115
-
116
- overlock:
117
- name: Overlock
118
- family: '"Overlock", cursive'
119
-
120
- noticia_text:
121
- name: Noticia Text
122
- family: '"Noticia Text", serif'
123
-
124
- playfair_display:
125
- name: Playfair Display
126
- family: '"Playfair Display", serif'
127
-
128
- raleway:
129
- name: Raleway
130
- family: '"Raleway", sans-serif'
131
-
132
- rokkitt:
133
- name: Rokkitt
134
- family: '"Rokkitt", serif'
135
-
136
- signika:
137
- name: Signika
138
- family: '"Signika", sans-serif'
139
-
140
- source_sans_pro:
141
- name: Source Sans Pro
142
- family: '"Source Sans Pro", sans-serif'
143
-
144
- titillium_web:
145
- name: Titillium Web
146
- family: '"Titillium Web", sans-serif'
147
-
148
- varela_round:
149
- name: Varela Round
150
- family: '"Varela Round", sans-serif'
151
-
@@ -1,68 +0,0 @@
1
- require 'yaml'
2
-
3
- module Dugway
4
- class ThemeFont < Struct.new(:name, :family, :collection)
5
- class << self
6
- def all
7
- @@all ||= Array.new.tap { |fonts|
8
- source.each_pair { |collection, collection_fonts|
9
- collection_fonts.values.each { |font|
10
- fonts << ThemeFont.new(font[:name], font[:family], collection)
11
- }
12
- }
13
- }.sort_by { |font| font.name }
14
- end
15
-
16
- def options
17
- @@options ||= all.map(&:name)
18
- end
19
-
20
- def find_by_name(name)
21
- all.find { |font|
22
- name.downcase == font.name.downcase
23
- }
24
- end
25
-
26
- def find_family_by_name(name)
27
- if font = find_by_name(name)
28
- font.family
29
- else
30
- name
31
- end
32
- end
33
-
34
- def google_font_names
35
- @@google_font_names ||= all.select { |font|
36
- font.collection == 'google'
37
- }.map(&:name)
38
- end
39
-
40
- def google_font_url_for_fonts(fonts)
41
- "//fonts.googleapis.com/css?family=#{ fonts.map { |font| font.gsub(' ', '+') }.join('|') }"
42
- end
43
-
44
- def google_font_url_for_all_fonts
45
- google_font_url_for_fonts(google_font_names)
46
- end
47
-
48
- def google_font_url_for_theme
49
- theme = Dugway.theme
50
- fonts = theme.fonts.keys.map { |key|
51
- theme.customization[key] }.select { |font_name|
52
- google_font_names.include? font_name }.sort
53
-
54
- if fonts.present?
55
- google_font_url_for_fonts(fonts)
56
- else
57
- nil
58
- end
59
- end
60
-
61
- private
62
-
63
- def source
64
- @@source ||= HashWithIndifferentAccess.new(YAML.load(File.read(File.join(File.dirname(__FILE__), 'data', 'theme_fonts.yml'))))
65
- end
66
- end
67
- end
68
- end
@@ -1,136 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Dugway::ThemeFont do
4
- before(:each) do
5
- # Start fresh each time, so stubs work
6
- Dugway::ThemeFont.send(:remove_class_variable, :@@source) rescue nil
7
- Dugway::ThemeFont.send(:remove_class_variable, :@@all) rescue nil
8
- Dugway::ThemeFont.send(:remove_class_variable, :@@options) rescue nil
9
- Dugway::ThemeFont.send(:remove_class_variable, :@@google_font_names) rescue nil
10
- end
11
-
12
- describe ".all" do
13
- it "should return all theme fonts" do
14
- Dugway::ThemeFont.all.should be_present
15
- end
16
-
17
- it "should be in alphabetical order" do
18
- Dugway::ThemeFont.all.first.name.should == 'Amaranth'
19
- Dugway::ThemeFont.all.last.name.should == 'Verdana'
20
- end
21
- end
22
-
23
- describe ".options" do
24
- before(:each) do
25
- Dugway::ThemeFont.stub(:all) {[
26
- Dugway::ThemeFont.new('One'),
27
- Dugway::ThemeFont.new('Two'),
28
- Dugway::ThemeFont.new('Three')
29
- ]}
30
- end
31
-
32
- it "should return an array of all font names" do
33
- Dugway::ThemeFont.options.should == ['One', 'Two', 'Three']
34
- end
35
- end
36
-
37
- describe ".find_by_name" do
38
- it "should return a font by its name" do
39
- georgia = Dugway::ThemeFont.find_by_name('Georgia')
40
- georgia.name.should == 'Georgia'
41
- georgia.family.should == 'Georgia, "Times New Roman", Times, serif'
42
- georgia.collection.should == 'default'
43
- end
44
-
45
- it "should return nil if the font doesn't exist" do
46
- Dugway::ThemeFont.find_by_name('Blah').should be_nil
47
- end
48
- end
49
-
50
- describe ".find_family_by_name" do
51
- it "should return the font family by its name" do
52
- Dugway::ThemeFont.find_family_by_name('Georgia').should == 'Georgia, "Times New Roman", Times, serif'
53
- end
54
-
55
- it "should return the font name if no font is found" do
56
- Dugway::ThemeFont.find_family_by_name('Blah').should == 'Blah'
57
- end
58
- end
59
-
60
- describe ".google_font_names" do
61
- before(:each) do
62
- Dugway::ThemeFont.stub(:all) {[
63
- Dugway::ThemeFont.new('One Font', 'One Family', 'google'),
64
- Dugway::ThemeFont.new('Two', 'Two Family', 'default'),
65
- Dugway::ThemeFont.new('Three', 'Three Family', 'google')
66
- ]}
67
- end
68
-
69
- it "returns a sorted array of font names in the google collection" do
70
- Dugway::ThemeFont.google_font_names.should == ['One Font', 'Three']
71
- end
72
- end
73
-
74
- describe ".google_font_url_for_fonts" do
75
- it "should return a url for a given array of font names" do
76
- Dugway::ThemeFont.google_font_url_for_fonts(['Matt Rules', 'Dude', 'Yeah']).should == "//fonts.googleapis.com/css?family=Matt+Rules|Dude|Yeah"
77
- end
78
-
79
- it "should return a url for a singular font in an array" do
80
- Dugway::ThemeFont.google_font_url_for_fonts(['Matt Rules']).should == "//fonts.googleapis.com/css?family=Matt+Rules"
81
- end
82
- end
83
-
84
- describe ".google_font_url_for_all_fonts" do
85
- before(:each) do
86
- Dugway::ThemeFont.stub(:all) {[
87
- Dugway::ThemeFont.new('One Font', 'One Family', 'google'),
88
- Dugway::ThemeFont.new('Two', 'Two Family', 'default'),
89
- Dugway::ThemeFont.new('Three', 'Three Family', 'google')
90
- ]}
91
- end
92
-
93
- it "should return a URL for all Google fonts" do
94
- Dugway::ThemeFont.google_font_url_for_all_fonts.should == "//fonts.googleapis.com/css?family=One+Font|Three"
95
- end
96
- end
97
-
98
- describe ".google_font_url_for_theme" do
99
- let(:fonts) { { :header_font => {}, :body_font => {}, :paragraph_font => {} } }
100
-
101
- before(:each) do
102
- Dugway::Theme.any_instance.stub(:customization) { fonts }
103
- Dugway::Theme.any_instance.stub(:fonts) { fonts }
104
-
105
- Dugway::ThemeFont.stub(:all) {[
106
- Dugway::ThemeFont.new('One Font', 'One Family', 'google'),
107
- Dugway::ThemeFont.new('Two', 'Two Family', 'default'),
108
- Dugway::ThemeFont.new('Three', 'Three Family', 'google')
109
- ]}
110
- end
111
-
112
- describe "when it has multiple Google fonts" do
113
- let(:fonts) { { :header_font => 'One Font', :body_font => 'Two', :paragraph_font => 'Three' } }
114
-
115
- it "should return the correct URL" do
116
- Dugway::ThemeFont.google_font_url_for_theme.should == "//fonts.googleapis.com/css?family=One+Font|Three"
117
- end
118
- end
119
-
120
- describe "when it has one Google font" do
121
- let(:fonts) { { :header_font => 'One Font', :body_font => 'Two' } }
122
-
123
- it "should return the correct URL" do
124
- Dugway::ThemeFont.google_font_url_for_theme.should == "//fonts.googleapis.com/css?family=One+Font"
125
- end
126
- end
127
-
128
- describe "when it has no Google fonts" do
129
- let(:fonts) { { :body_font => 'Two' } }
130
-
131
- it "should return the correct URL" do
132
- Dugway::ThemeFont.google_font_url_for_theme.should be_nil
133
- end
134
- end
135
- end
136
- end