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
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7e47d709cb5f76d05c027d2fc10b98213ae1974f
4
+ data.tar.gz: b433d613b1bc2698655855873a292c35abc44902
5
+ SHA512:
6
+ metadata.gz: 4eb8c91e8a8feece607e54d14a7135db6b7dbb5213352576f44976a435a50a47355be11aa90063650b7e12a792a3727ec63998ea2b3dbe378bc5ce7d6e9435d0
7
+ data.tar.gz: 8d54a52bdf322b60a40aeb25a63ecde8cb9d4f4ef672b4abcbef0e46a5b929e046af8606f959b21848368ee7044050d936b6d24b935c571d57c8d1e5ee37f326
data/README.md CHANGED
@@ -41,10 +41,10 @@ This will create a new directory named *mytheme* that contains a few configurati
41
41
  │ ├── product.html
42
42
  │ ├── products.html
43
43
  │ ├── screenshot.jpg
44
- │ ├── scripts.js
45
44
  │ ├── settings.json
46
- │ ├── styles.css
47
- └── success.html
45
+ │ ├── success.html
46
+ ├── theme.css
47
+ │ └── theme.js
48
48
  └── config.ru
49
49
 
50
50
 
@@ -58,20 +58,20 @@ Develop the HTML for your theme using our [Theme API](http://help.bigcartel.com/
58
58
 
59
59
  ### CSS & JavaScript
60
60
 
61
- All CSS for your theme is handled by the **styles.css** file, and all JavaScript by **scripts.js**. If you don't have much CSS or JavaScript, or you're just a glutton for punishment, you could simply put all of your code in these two files. However, we recommend you use [Sprockets](http://getsprockets.org) to break your code into multiple files in separate directories.
61
+ All CSS for your theme is handled by the **theme.css** file, and all JavaScript by **theme.js**. If you don't have much CSS or JavaScript, or you're just a glutton for punishment, you could simply put all of your code in these two files. However, we recommend you use [Sprockets](http://getsprockets.org) to break your code into multiple files in separate directories.
62
62
 
63
63
  #### Using Sprockets
64
64
 
65
- [Sprockets](http://getsprockets.org) allows you to bring in CSS and JavaScript from different directories into a single file. We've created **stylesheets** and **javascripts** directories by default that you can put your code in, but you could delete those and put files anywhere you'd like. After that, use [Sprockets directives](https://github.com/sstephenson/sprockets#the-directive-processor) to package them into **styles.css** and **scripts.js**.
65
+ [Sprockets](http://getsprockets.org) allows you to bring in CSS and JavaScript from different directories into a single file. We've created **stylesheets** and **javascripts** directories by default that you can put your code in, but you could delete those and put files anywhere you'd like. After that, use [Sprockets directives](https://github.com/sstephenson/sprockets#the-directive-processor) to package them into **theme.css** and **theme.js**.
66
66
 
67
- ##### styles.css
67
+ ##### theme.css
68
68
 
69
69
  /*
70
70
  *= require stylesheets/example_1
71
71
  *= require stylesheets/example_2
72
72
  */
73
73
 
74
- ##### scripts.js
74
+ ##### theme.js
75
75
 
76
76
  //= require javascripts/example_1
77
77
  //= require javascripts/example_2
@@ -88,11 +88,11 @@ And finally, for you JavaScript folks, we've baked [CoffeeScript](http://coffees
88
88
 
89
89
  You can embed the CSS and JavaScript into your theme by passing the theme variable to the [theme_css_url](http://help.bigcartel.com/customer/portal/articles/772749-filters#url) and [theme_js_url](http://help.bigcartel.com/customer/portal/articles/772749-filters#url) filters.
90
90
 
91
- ##### CSS (styles.css)
91
+ ##### CSS (theme.css)
92
92
 
93
93
  <link href="{{ theme | theme_css_url }}" media="screen" rel="stylesheet" type="text/css">
94
94
 
95
- ##### JavaScript (scripts.js)
95
+ ##### JavaScript (theme.js)
96
96
 
97
97
  <script src="{{ theme | theme_js_url }}" type="text/javascript"></script>
98
98
 
@@ -38,6 +38,8 @@ Gem::Specification.new do |s|
38
38
  s.add_dependency('rubyzip', '~> 0.9.9')
39
39
  s.add_dependency('uglifier', '~> 1.3.0')
40
40
  s.add_dependency('thin', '~> 1.5.0')
41
+ s.add_dependency('bigcartel-theme-fonts')
42
+ s.add_dependency('bigcartel-currency-locales')
41
43
 
42
44
  s.add_development_dependency('rake', '~> 10.0.3')
43
45
  s.add_development_dependency('rspec', '~> 2.12.0')
@@ -7,6 +7,8 @@ $VERBOSE = old_verbose
7
7
 
8
8
  require 'active_support/all'
9
9
  require 'i18n'
10
+ require 'bigcartel-currency-locales'
11
+ require 'bigcartel/theme/fonts'
10
12
 
11
13
  require 'rack/builder'
12
14
  require 'rack/commonlogger'
@@ -21,7 +23,6 @@ require 'dugway/request'
21
23
  require 'dugway/store'
22
24
  require 'dugway/template'
23
25
  require 'dugway/theme'
24
- require 'dugway/theme_font'
25
26
  require 'dugway/extensions/time'
26
27
 
27
28
  module Dugway
@@ -29,7 +30,7 @@ module Dugway
29
30
  def application(options={})
30
31
  @options = options
31
32
 
32
- I18n.load_path += Dir[File.join(File.dirname(__FILE__), 'dugway', 'data', 'locales', '*.yml').to_s]
33
+ BigCartel::CurrencyLocales.insert
33
34
  I18n.default_locale = 'en-US'
34
35
  I18n.locale = Dugway.store.locale
35
36
 
@@ -132,12 +132,12 @@ module Dugway
132
132
 
133
133
  # Assets
134
134
 
135
- get '/styles.css' do
136
- render_file('styles.css')
135
+ get '/theme.css' do
136
+ render_file('theme.css')
137
137
  end
138
138
 
139
- get '/scripts.js' do
140
- render_file('scripts.js')
139
+ get '/theme.js' do
140
+ render_file('theme.js')
141
141
  end
142
142
 
143
143
  get %r{^/images/.+\.(jpg|jpeg|gif|png|ico)$} do
@@ -23,11 +23,11 @@ module Dugway
23
23
  else
24
24
  yield
25
25
  end
26
- }, {
27
- :request_method => method,
28
- :path_info => interpret_path(path)
26
+ }, {
27
+ :request_method => method,
28
+ :path_info => interpret_path(path)
29
29
  })
30
-
30
+
31
31
  routes.rehash
32
32
  end
33
33
 
@@ -43,9 +43,6 @@ module Dugway
43
43
  # custom pages
44
44
  when %r{^/:(#{ PERMALINK_REGEX })}
45
45
  %r{^/(?<#{ $1 }>#{ PERMALINK_REGEX })$}
46
- # styles/scripts
47
- when %r{^/(\w+)\.(js|css)}
48
- %r{^/#{ $1 }\.(?<format>(js|css))$}
49
46
  # everything else
50
47
  else
51
48
  %r{^#{ path }$}
@@ -30,7 +30,7 @@ module Dugway
30
30
 
31
31
  def theme_js_url(name)
32
32
  if name.is_a?(Drops::ThemeDrop)
33
- '/scripts.js'
33
+ '/theme.js'
34
34
  elsif name == 'api'
35
35
  'http://cache0.bigcartel.com/api/1/api.usd.js'
36
36
  else
@@ -39,7 +39,7 @@ module Dugway
39
39
  end
40
40
 
41
41
  def theme_css_url(theme)
42
- '/styles.css'
42
+ '/theme.css'
43
43
  end
44
44
 
45
45
  def theme_image_url(filename)
@@ -91,7 +91,7 @@ module Dugway
91
91
  def head_content
92
92
  content = %{<meta name="generator" content="Big Cartel">}
93
93
 
94
- if google_font_url = ThemeFont.google_font_url_for_theme
94
+ if google_font_url = ThemeFont.google_font_url_for_theme(Dugway.theme.fonts, Dugway.theme.customization)
95
95
  content << %{\n<link rel="stylesheet" type="text/css" href="#{ google_font_url }">}
96
96
  end
97
97
 
@@ -7,7 +7,7 @@ require 'uglifier'
7
7
 
8
8
  module Dugway
9
9
  class Theme
10
- REQUIRED_FILES = %w( layout.html home.html products.html product.html cart.html checkout.html success.html contact.html maintenance.html scripts.js styles.css settings.json screenshot.jpg )
10
+ REQUIRED_FILES = %w( cart.html checkout.html contact.html home.html layout.html maintenance.html product.html products.html screenshot.jpg settings.json success.html theme.css theme.js )
11
11
 
12
12
  attr_reader :errors
13
13
 
@@ -47,13 +47,13 @@ module Dugway
47
47
 
48
48
  def file_content(name)
49
49
  case name
50
- when 'scripts.js'
50
+ when 'theme.js'
51
51
  if @building
52
52
  Uglifier.new.compile(sprockets[name].to_s)
53
53
  else
54
54
  sprockets[name].to_s
55
55
  end
56
- when 'styles.css'
56
+ when 'theme.css'
57
57
  sprockets[name].to_s
58
58
  else
59
59
  read_source_file(name)
@@ -1,3 +1,3 @@
1
1
  module Dugway
2
- VERSION = "0.6.7"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -16,6 +16,22 @@ feature 'Page rendering' do
16
16
  expect(page).to have_content('$10.00')
17
17
  end
18
18
 
19
+ scenario 'products.html via artist' do
20
+ visit '/artist/artist-one'
21
+ expect(page).to have_content('Dugway') # layout.html
22
+ expect(page).to have_content('Artist One')
23
+ expect(page).to have_content('My Product')
24
+ expect(page).to have_content('$10.00')
25
+ end
26
+
27
+ scenario 'products.html via category' do
28
+ visit '/category/tees'
29
+ expect(page).to have_content('Dugway') # layout.html
30
+ expect(page).to have_content('Tees')
31
+ expect(page).to have_content('My Product')
32
+ expect(page).to have_content('$10.00')
33
+ end
34
+
19
35
  scenario 'product.html' do
20
36
  visit '/product/my-product'
21
37
  expect(page).to have_content('Dugway') # layout.html
@@ -55,16 +71,16 @@ feature 'Page rendering' do
55
71
  expect(page).to have_content("We're really cool!")
56
72
  end
57
73
 
58
- scenario 'styles.css' do
59
- visit '/styles.css'
74
+ scenario 'theme.css' do
75
+ visit '/theme.css'
60
76
  expect(page).to have_content('height: 100%;') # one.css
61
77
  expect(page).to have_content('color: red;') # two.css.sass
62
78
  expect(page).to have_content('url(/images/bc_badge.png)') # two.css.sass
63
79
  end
64
80
 
65
- scenario 'scripts.js' do
66
- visit '/scripts.js'
67
- expect(page).to have_content("console.log('One')") # one.js
68
- expect(page).to have_content("console.log('Two')") # two.js.coffee
81
+ scenario 'theme.js' do
82
+ visit '/theme.js'
83
+ expect(page).to have_content("console.log('One');") # one.js
84
+ expect(page).to have_content("console.log('Two');") # two.js.coffee
69
85
  end
70
86
  end
@@ -1,3 +1 @@
1
- $(function() {
2
- console.log('One')
3
- });
1
+ console.log('One');
@@ -1,2 +1 @@
1
- $ ->
2
- console.log 'Two'
1
+ console.log 'Two'
@@ -9,9 +9,9 @@ describe Dugway::Request do
9
9
  'PATH_INFO' => path.split('?').first,
10
10
  'QUERY_STRING' => path.split('?').last
11
11
  })}
12
-
12
+
13
13
  let(:request) { Dugway::Request.new(env) }
14
-
14
+
15
15
  before(:each) do
16
16
  request.stub(:params) { params }
17
17
  end
@@ -19,97 +19,97 @@ describe Dugway::Request do
19
19
  describe "#page_permalink" do
20
20
  describe "on the home page" do
21
21
  let(:path) { '/' }
22
-
22
+
23
23
  it "returns the correct page_permalink" do
24
24
  request.page_permalink.should == 'home'
25
25
  end
26
26
  end
27
-
27
+
28
28
  describe "on the products page" do
29
29
  let(:path) { '/products' }
30
-
30
+
31
31
  it "returns the correct page_permalink" do
32
32
  request.page_permalink.should == 'products'
33
33
  end
34
34
  end
35
-
35
+
36
36
  describe "on the products page with params" do
37
37
  let(:path) { '/products?search=test' }
38
-
38
+
39
39
  it "returns the correct page_permalink" do
40
40
  request.page_permalink.should == 'products'
41
41
  end
42
42
  end
43
-
43
+
44
44
  describe "on the categories page" do
45
45
  let(:path) { '/category/tees' }
46
-
46
+
47
47
  it "returns the correct page_permalink" do
48
48
  request.page_permalink.should == 'products'
49
49
  end
50
50
  end
51
-
51
+
52
52
  describe "on the artists page" do
53
53
  let(:path) { '/artist/beatles' }
54
-
54
+
55
55
  it "returns the correct page_permalink" do
56
56
  request.page_permalink.should == 'products'
57
57
  end
58
58
  end
59
-
59
+
60
60
  describe "on the product page" do
61
61
  let(:path) { '/product/my-thing' }
62
-
62
+
63
63
  it "returns the correct page_permalink" do
64
64
  request.page_permalink.should == 'product'
65
65
  end
66
66
  end
67
-
67
+
68
68
  describe "on the a known page" do
69
69
  let(:path) { '/cart' }
70
-
70
+
71
71
  it "returns the correct page_permalink" do
72
72
  request.page_permalink.should == 'cart'
73
73
  end
74
74
  end
75
-
75
+
76
76
  describe "on the a custom page" do
77
77
  let(:path) { '/about-us' }
78
-
78
+
79
79
  it "returns the correct page_permalink" do
80
80
  request.page_permalink.should == 'about-us'
81
81
  end
82
82
  end
83
83
  end
84
-
84
+
85
85
  describe "#extension" do
86
86
  describe "on HTML with no extension" do
87
87
  let(:path) { '/cart' }
88
-
88
+
89
89
  it "returns the correct extension" do
90
90
  request.extension.should == '.html'
91
91
  end
92
92
  end
93
-
93
+
94
94
  describe "on HTML with an extension" do
95
95
  let(:path) { '/cart.html' }
96
-
96
+
97
97
  it "returns the correct extension" do
98
98
  request.extension.should == '.html'
99
99
  end
100
100
  end
101
-
101
+
102
102
  describe "on CSS" do
103
- let(:path) { '/styles.css' }
104
-
103
+ let(:path) { '/theme.css' }
104
+
105
105
  it "returns the correct extension" do
106
106
  request.extension.should == '.css'
107
107
  end
108
108
  end
109
-
109
+
110
110
  describe "on JS" do
111
- let(:path) { '/scripts.js' }
112
-
111
+ let(:path) { '/theme.js' }
112
+
113
113
  it "returns the correct extension" do
114
114
  request.extension.should == '.js'
115
115
  end
@@ -135,7 +135,7 @@ describe Dugway::Request do
135
135
  end
136
136
 
137
137
  describe "and there is an extension in the path" do
138
- let(:path) { '/styles.css' }
138
+ let(:path) { '/theme.css' }
139
139
 
140
140
  it "should return the extension" do
141
141
  request.format.should == 'css'
@@ -143,35 +143,35 @@ describe Dugway::Request do
143
143
  end
144
144
  end
145
145
  end
146
-
146
+
147
147
  describe "#html?" do
148
148
  describe "on HTML with no extension" do
149
149
  let(:path) { '/cart' }
150
-
150
+
151
151
  it "returns true" do
152
152
  request.html?.should be_true
153
153
  end
154
154
  end
155
-
155
+
156
156
  describe "on HTML with an extension" do
157
157
  let(:path) { '/cart.html' }
158
-
158
+
159
159
  it "returns true" do
160
160
  request.html?.should be_true
161
161
  end
162
162
  end
163
-
163
+
164
164
  describe "on CSS" do
165
- let(:path) { '/styles.css' }
166
-
165
+ let(:path) { '/theme.css' }
166
+
167
167
  it "returns false" do
168
168
  request.html?.should be_false
169
169
  end
170
170
  end
171
-
171
+
172
172
  describe "on JS" do
173
- let(:path) { '/scripts.js' }
174
-
173
+ let(:path) { '/theme.js' }
174
+
175
175
  it "returns false" do
176
176
  request.html?.should be_false
177
177
  end
@@ -181,7 +181,7 @@ describe Dugway::Request do
181
181
  describe "#js?" do
182
182
  describe "on JS" do
183
183
  let(:path) { '/products.js' }
184
-
184
+
185
185
  it "returns true" do
186
186
  request.js?.should be_true
187
187
  end
@@ -189,15 +189,15 @@ describe Dugway::Request do
189
189
 
190
190
  describe "on no extension" do
191
191
  let(:path) { '/cart' }
192
-
192
+
193
193
  it "returns false" do
194
194
  request.js?.should be_false
195
195
  end
196
196
  end
197
-
197
+
198
198
  describe "on non-JS extension" do
199
199
  let(:path) { '/cart.html' }
200
-
200
+
201
201
  it "returns false" do
202
202
  request.js?.should be_false
203
203
  end