Skip to content

Commit

Permalink
Move testing options from config.ru to .dugway.json
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwigham committed Apr 22, 2015
1 parent a259206 commit cf272a9
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 43 deletions.
34 changes: 27 additions & 7 deletions CHANGELOG.md
@@ -1,16 +1,36 @@
## Version History

#### 0.10.3

* Added `.dugway.json` as a better way to [test your theme](https://github.com/bigcartel/dugway#testing-your-theme) without needing to modify `config.ru`

#### 0.10.2

* Misc bug fixes and improvements

#### 0.10.1

* Misc bug fixes and improvements

#### 0.10.0

* Added support for default images in `settings.json`

#### 0.9.0
* Added support for `theme_font_url` liquid filter
* Added fonts directory, serve fonts from there
* `dugway build` will include font files in the zip

* Added support for `theme_font_url` liquid filter
* Added fonts directory, serve fonts from there
* `dugway build` will include font files in the zip

#### 0.8.4
* Support `image_sets` in `settings.json`
* Support the new [constrain](http://help.bigcartel.com/developers/themes/#constrainurl-width-height) filter

* Support `image_sets` in `settings.json`
* Support the new [constrain](http://help.bigcartel.com/developers/themes/#constrainurl-width-height) filter

#### 0.7.0
* Rename `scripts.js` and `styles.css` to `theme.js` and `theme.css`

* Rename `scripts.js` and `styles.css` to `theme.js` and `theme.css`

#### Pre-0.7.0
* Initial launch and bug fixes

* Initial launch and bug fixes
34 changes: 18 additions & 16 deletions README.md
Expand Up @@ -134,32 +134,34 @@ Tired of all the manual starting and stopping? Good news, Dugway is built on top

## Testing your theme

Part of building a great theme is making sure it works well in a variety of contexts and with a variety of content. Dugway makes it easy to test your theme's versatility by customizing the **options** in the **config.ru** file.
Part of building a great theme is making sure it works well in a variety of contexts and with a variety of content. Dugway makes it easy to test your theme's versatility by utilizing the **.dugway.json** file. This file will be specific to your computer for your own testing, and shouldn't be checked into source control.

*Note:* changing the **config.ru** file will require you to restart the [server](#running-your-theme).
*Note:* changing **.dugway.json** will require you to restart the [server](#running-your-theme).

### Store content

The best way to see your theme under a different light is by previewing it with a different store's products, categories, pages, currency, and other content. To do this, simply set the **:store** option to any Big Cartel store's subdomain, and Dugway will bring in their content using the standard [Big Cartel API](http://help.bigcartel.com/developers/api/). By default we use **dugway** for [dugway.bigcartel.com](http://dugway.bigcartel.com).
The best way to see your theme under a different light is by previewing it with a different store's products, categories, pages, currency, and other content. To do this, simply set the **store.subdomain** variable in **.dugway.json** to any Big Cartel store's subdomain, and Dugway will bring in their content using the standard [Big Cartel API](http://help.bigcartel.com/developers/api/). By default we use **dugway** for [dugway.bigcartel.com](http://dugway.bigcartel.com).

options[:store] = 'beeteeth'
"store": {
"subdomain": "beeteeth"
}

*Note:* don't worry, any sensitive data like inventory levels and discount codes is faked by Dugway.

### Store customization

Another important thing to consider is how store owners will customize your theme. You establish what can be customized in your [settings.json](#settings) file, and Dugway allows you to simulate potential values people could choose by setting them in the **:customization** option. By default we use the **default** values from your **[settings.json](#settings)** file.

options[:customization] = {
:logo => {
:url => 'http://placehold.it/200x50/000000/ffffff&text=My+Logo',
:width => 200,
:height => 50
},
:background_color => '#CCCCCC',
:show_search => true,
:twitter_username => 'mytwitter'
}
Another important thing to consider is how store owners will customize your theme. You establish what can be customized in your [settings.json](#settings) file, and Dugway allows you to simulate potential values people could choose by setting them in the **customization** variable in **.dugway.json**. By default we use the **default** values from your **[settings.json](#settings)** file.

"customization": {
"logo": {
"url": "http://placehold.it/200x50/000000/ffffff&text=My+Logo",
"width": 200,
"height": 50
},
"background_color": "#CCCCCC",
"show_search": true,
"twitter_username": "bigcartel"
}

## Building your theme

Expand Down
2 changes: 1 addition & 1 deletion lib/dugway.rb
Expand Up @@ -48,7 +48,7 @@ def application(options={})
end

def store
@store ||= Store.new(options && options[:store] || 'dugway')
@store ||= Store.new(options && options[:store] && options[:store][:subdomain] || 'dugway')
end

def theme
Expand Down
1 change: 1 addition & 0 deletions lib/dugway/cli/create.rb
Expand Up @@ -26,6 +26,7 @@ def variables

def core
template('config.tt', "#{ @theme_dir }/config.ru")
template('dugway.tt', "#{ @theme_dir }/.dugway.json")
template('source/settings.json', "#{ source_dir }/settings.json")
end

Expand Down
26 changes: 8 additions & 18 deletions lib/dugway/cli/templates/config.tt
@@ -1,22 +1,12 @@
require 'dugway'

options = {}

# Use data from any store to make sure your theme looks great with all sorts of products, pages,
# categories, and more. Just give us the subdomain. Default is "dugway" for dugway.bigcartel.com.
# options[:store] = 'mystore'

# Simulate the customization done by store owners by passing values to different variables.
# Default values are based on the "default" for each setting in your settings.json.
# options[:customization] = {
# :logo => {
# :url => 'http://placehold.it/200x50/000000/ffffff&text=My+Logo',
# :width => 200,
# :height => 50
# },
# :background_color => '#CCCCCC',
# :show_search => true,
# :twitter_username => 'mytwitter'
# }
begin
file = File.read('.dugway.json')
json = JSON.parse(file)
options = HashWithIndifferentAccess.new(json)
rescue Exception => e
puts e
options = {}
end

run Dugway.application(options)
27 changes: 27 additions & 0 deletions lib/dugway/cli/templates/dugway.tt
@@ -0,0 +1,27 @@
// Use this file to test your theme with different stores and customization variations.
// Learn more at: // https://github.com/bigcartel/dugway#testing-your-theme
// DON'T CHECK THIS FILE INTO SOURCE CONTROL

{

// Use data from any store to make sure your theme looks great with all sorts of products, pages,
// categories, and more. Just give us the subdomain. Default is "dugway" for dugway.bigcartel.com.

// "store": {
// "subdomain": "mystore"
// },

// Simulate the customization done by store owners by passing values to different variables.
// Default values are based on the "default" for each setting in your settings.json.

// "customization": {
// "logo": {
// "url": "http://placehold.it/200x50/000000/ffffff&text=My+Logo",
// "width": 200,
// "height": 50
// },
// "background_color": "#CCCCCC",
// "show_search": true,
// "twitter_username": "bigcartel"
// }
}
1 change: 1 addition & 0 deletions lib/dugway/cli/templates/gitignore.tt
@@ -1,6 +1,7 @@
.bundle
.DS_Store
.sass-cache
.dugway.json

build
tmp
Expand Down
2 changes: 1 addition & 1 deletion lib/dugway/version.rb
@@ -1,3 +1,3 @@
module Dugway
VERSION = "0.10.2"
VERSION = "0.10.3"
end

0 comments on commit cf272a9

Please sign in to comment.