potatochop-erector 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +101 -0
- data/Rakefile +1 -0
- data/bin/potatochop +5 -0
- data/lib/potatochop.rb +16 -0
- data/lib/potatochop/cli_parser.rb +43 -0
- data/lib/potatochop/file_system_interface.rb +19 -0
- data/lib/potatochop/github_interface.rb +23 -0
- data/lib/potatochop/spud.rb +27 -0
- data/lib/potatochop/version.rb +3 -0
- data/lib/potatochop/web.rb +36 -0
- data/potatochop-erector.gemspec +28 -0
- data/script/cibuild +3 -0
- data/script/console +3 -0
- data/script/release +38 -0
- data/spec/fake_mockups/bar.html +23 -0
- data/spec/fake_mockups/css/bar.css +1 -0
- data/spec/fake_mockups/css/foo.css.scss +5 -0
- data/spec/fake_mockups/foo.html.rb +21 -0
- data/spec/fake_mockups/img/potatochop_cs4_box.png +0 -0
- data/spec/fake_mockups/js/bar.js +3 -0
- data/spec/file_system_interface_spec.rb +33 -0
- data/spec/helper.rb +9 -0
- data/spec/potatochop_spec.rb +63 -0
- metadata +209 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3dc2cb524e639de569102fbfca77d06ebb6bdc0d
|
4
|
+
data.tar.gz: 0e2bfef89b13d7260944d1c4567b2935ed24c9b3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ac978dd81d505d9552fb5308a7cf6f84e95bad8d403a0773a9e111be8b098e3d45c860c332165e1475fcaf659a3ea77958cb453af18f0298bd2545d37b0b6248
|
7
|
+
data.tar.gz: 74af38596170c72589ba2656aa009d2af9e0aa75eae25aa5a272451e7a46c9880395f7963cb0d44989718ea0b938e37f3e1dc5f425103683996093adacffc678
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Department of Better Technology, Inc
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# Potatochop
|
2
|
+
_A simple server for ~~HAML~~ [Erector](https://github.com/ajb/erector-rails4) & SASS mock ups_
|
3
|
+
|
4
|
+
[![Build Status](https://travis-ci.org/dobtco/potatochop-erector.svg?branch=master)](https://travis-ci.org/dobtco/potatochop-erector)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/potatochop-erector.svg)](http://badge.fury.io/rb/potatochop-erector)
|
6
|
+
|
7
|
+
[Forked from VersaHQ, thanks y'all!](https://github.com/VersaHQ/potatochop)
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Install Potatochop as a gem in the usual way:
|
12
|
+
|
13
|
+
$ gem install potatochop-erector
|
14
|
+
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
To use Potatochop, you also need a folder where you keep your mock ups. Ideally this folder would be under version control, but it is not required.
|
19
|
+
|
20
|
+
Once the Potatochop gem is installed, cd into your comps directory and run `potatochop`.
|
21
|
+
|
22
|
+
```
|
23
|
+
$ cd ~/mock_ups # or wherever you keep your mock_ups
|
24
|
+
$ potatochop
|
25
|
+
```
|
26
|
+
or pass in the path to your mock ups folder with the `--mockups` flag
|
27
|
+
|
28
|
+
```
|
29
|
+
$ potatochop --mockups ~/mock_ups
|
30
|
+
```
|
31
|
+
|
32
|
+
This will start up the Potatochop server on port 4567. By default, Potatochop will serve files in the same hierarchy as the mock ups folder.
|
33
|
+
|
34
|
+
For example, if you start Potatochop in a folder with a file called `new_homepage.html.rb` you can see it in your browser at `http://localhost:4567/new_homepage.html`
|
35
|
+
|
36
|
+
## Erector.inline & `eval`
|
37
|
+
|
38
|
+
Potatochop uses `eval` to interface with Erector, so **be sure to only serve files whose contents you trust.** Furthermore, you must use `Erector.inline`, instead of defining a class for each view. Your views should look like this:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
# index.html.rb
|
42
|
+
|
43
|
+
Erector.inline {
|
44
|
+
rawtext '<!doctype html>'
|
45
|
+
html {
|
46
|
+
head {
|
47
|
+
title 'Fake batch of mock ups.'
|
48
|
+
}
|
49
|
+
body {
|
50
|
+
text 'Hi!'
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
```
|
55
|
+
|
56
|
+
## The Mock Ups folder
|
57
|
+
|
58
|
+
For lack of a better name, the folder where you store your erector views, sass, js, etc. files is called the mock ups folder.
|
59
|
+
|
60
|
+
Out of the box, Potatochop processes and serves any erector or sass file in this folder. Vanilla HTML & JavaScript files are served directly. For example, your mock ups folder could be organized like this:
|
61
|
+
|
62
|
+
```
|
63
|
+
~/mock_ups
|
64
|
+
about.html
|
65
|
+
faq.html.rb
|
66
|
+
index.html.rb
|
67
|
+
css/
|
68
|
+
about.css
|
69
|
+
faq.css.scss
|
70
|
+
index.css.scss
|
71
|
+
js/
|
72
|
+
interactions.js
|
73
|
+
```
|
74
|
+
|
75
|
+
**ProTip:** There is an example mock ups folder in the [spec/fake_mockups](https://github.com/dobtco/potatochop-erector/tree/master/spec/fake_mockups) folder (it's used by our automated tests).
|
76
|
+
|
77
|
+
When you want to include stylesheets in your haml/html pages, refer to them only by their `.css` extension.
|
78
|
+
|
79
|
+
## Serving files from a GitHub repo
|
80
|
+
Let's say you have a repository on GitHub where you keep your mockups (i.e [https://github.com/mertonium/potatochop_comps](https://github.com/mertonium/potatochop_comps)).
|
81
|
+
|
82
|
+
You can serve this repo by passing `potatochop` the `--interface` flag along with the repo path:
|
83
|
+
|
84
|
+
```
|
85
|
+
# Serve files from a public repository on GitHub
|
86
|
+
$ potatochop --interface github --repo mertonium/potatochop_comps
|
87
|
+
```
|
88
|
+
If your mock ups folder is in a private repo, you must also pass `potatochop` the `--token` flag, along with a [personal access token](https://github.com/settings/tokens/new):
|
89
|
+
|
90
|
+
```
|
91
|
+
# Serve files from a private repository on GitHub
|
92
|
+
$ potatochop --interface github --repo mertonium/potatochop_comps_private --token=GITHUB_ACCESS_TOKEN
|
93
|
+
```
|
94
|
+
|
95
|
+
## Contributing
|
96
|
+
|
97
|
+
1. Fork it
|
98
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
99
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
100
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
101
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/potatochop
ADDED
data/lib/potatochop.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'potatochop/version'
|
2
|
+
require 'potatochop/spud'
|
3
|
+
require 'potatochop/file_system_interface'
|
4
|
+
require 'potatochop/github_interface'
|
5
|
+
require 'potatochop/cli_parser'
|
6
|
+
require 'potatochop/web'
|
7
|
+
require 'erector'
|
8
|
+
require 'sass'
|
9
|
+
require 'octokit'
|
10
|
+
|
11
|
+
module Potatochop
|
12
|
+
def self.start_up(args)
|
13
|
+
options = Potatochop::CliParser.parse(args)
|
14
|
+
Potatochop::Web.run!(:tater => Potatochop::Spud.new(options[:interface]))
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module Potatochop
|
4
|
+
class CliParser
|
5
|
+
def self.parse(args)
|
6
|
+
options = {
|
7
|
+
:interface => nil,
|
8
|
+
:interface_class => Potatochop::FileSystemInterface,
|
9
|
+
:mockups_path => '.',
|
10
|
+
:gh_options => {}
|
11
|
+
}
|
12
|
+
|
13
|
+
opts = OptionParser.new do |opts|
|
14
|
+
opts.banner = "Usage: potatochop [options]"
|
15
|
+
|
16
|
+
opts.separator ""
|
17
|
+
opts.separator "Specific options:"
|
18
|
+
|
19
|
+
opts.on("-i", "--interface [INTERFACE]", "How to find the files to serve (possible options are 'local' and 'github')") do |interface|
|
20
|
+
if interface == 'github'
|
21
|
+
options[:interface_class] = Potatochop::GithubInterface
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on("-d", "--mockups [PATH]", "Path to the mockups folder you want to serve") do |wd|
|
26
|
+
options[:mockups_path] = wd
|
27
|
+
end
|
28
|
+
|
29
|
+
opts.on("--repo [GITHUB REPOSITORY]", "username/reponame on GitHub") do |repo|
|
30
|
+
options[:mockups_path] = repo
|
31
|
+
end
|
32
|
+
|
33
|
+
opts.on("--token [GITHUB ACCESS TOKEN]", "GitHub access token (needed to access private repositories)") do |token|
|
34
|
+
options[:gh_options][:access_token] = token
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
opts.parse!(args)
|
39
|
+
options[:interface] = options[:interface_class].send(:new, options[:mockups_path], options[:gh_options])
|
40
|
+
options
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Potatochop
|
2
|
+
class FileSystemInterface
|
3
|
+
attr_reader :source
|
4
|
+
|
5
|
+
def initialize(source, options = {})
|
6
|
+
@source = source
|
7
|
+
end
|
8
|
+
|
9
|
+
def exists?(file_name)
|
10
|
+
file_path = File.join(@source, file_name)
|
11
|
+
File.exists? file_path
|
12
|
+
end
|
13
|
+
|
14
|
+
def read(file_name)
|
15
|
+
file_path = File.join(@source, file_name)
|
16
|
+
File.read(file_path)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Potatochop
|
2
|
+
class GithubInterface
|
3
|
+
attr_reader :source
|
4
|
+
|
5
|
+
def initialize(repo, gh_options = {})
|
6
|
+
@source = repo
|
7
|
+
@gh_client = Octokit::Client.new access_token: gh_options[:access_token]
|
8
|
+
end
|
9
|
+
|
10
|
+
def exists?(file_name)
|
11
|
+
begin
|
12
|
+
@gh_client.contents(@source, path: file_name, accept: 'application/vnd.github.raw')
|
13
|
+
true
|
14
|
+
rescue Octokit::NotFound
|
15
|
+
false
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def read(file_name)
|
20
|
+
@gh_client.contents(@source, path: file_name, accept: 'application/vnd.github.raw')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Potatochop
|
2
|
+
class Spud
|
3
|
+
def initialize(interface)
|
4
|
+
@interface = interface
|
5
|
+
end
|
6
|
+
|
7
|
+
def get_file(file_name)
|
8
|
+
@interface.exists?(file_name) ? @interface.read(file_name) : nil
|
9
|
+
end
|
10
|
+
|
11
|
+
def get_html(file_name)
|
12
|
+
if @interface.exists?("#{file_name}.html") # Static html first
|
13
|
+
@interface.read("#{file_name}.html")
|
14
|
+
elsif @interface.exists?("#{file_name}.html.rb") # Erector next
|
15
|
+
eval(@interface.read("#{file_name}.html.rb")).to_html
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_css(file_name)
|
20
|
+
if @interface.exists?("#{file_name}.css") # Static css
|
21
|
+
@interface.read("#{file_name}.css")
|
22
|
+
elsif @interface.exists?("#{file_name}.css.scss") # Sass css
|
23
|
+
Sass::Engine.new(@interface.read("#{file_name}.css.scss"), :syntax => :scss).render
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
|
3
|
+
module Potatochop
|
4
|
+
class Web < Sinatra::Base
|
5
|
+
get '/*.html' do
|
6
|
+
return_str = settings.tater.get_html(params[:splat][0])
|
7
|
+
return_str.nil? ? 404 : return_str
|
8
|
+
end
|
9
|
+
|
10
|
+
get '/*.css' do
|
11
|
+
return_str = settings.tater.get_css(params[:splat][0])
|
12
|
+
content_type 'text/css', :charset => 'utf-8'
|
13
|
+
return_str.nil? ? 404 : return_str
|
14
|
+
end
|
15
|
+
|
16
|
+
get %r{/(.*).(png|jpg|jpeg|gif)} do
|
17
|
+
image_file = settings.tater.get_file("#{params[:captures][0]}.#{params[:captures][1]}")
|
18
|
+
if image_file.nil?
|
19
|
+
404
|
20
|
+
else
|
21
|
+
content_type "image/#{params[:captures].last}"
|
22
|
+
image_file
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
get '/*.js' do
|
27
|
+
js_file = settings.tater.get_file("#{params[:splat][0]}.js")
|
28
|
+
if js_file.nil?
|
29
|
+
404
|
30
|
+
else
|
31
|
+
content_type "application/javascript", :charset => 'utf-8'
|
32
|
+
js_file
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'potatochop/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "potatochop-erector"
|
8
|
+
gem.version = Potatochop::VERSION
|
9
|
+
gem.authors = ["Adam Becker"]
|
10
|
+
gem.email = ["adam@dobt.co"]
|
11
|
+
gem.description = %q{Potatochop - because F$%k Photoshop, that's why.}
|
12
|
+
gem.summary = %q{Potatochop is a simple server that compiles and serves up Erector views and SASS files. The goal is to reduce friction between designers and devs in a Rails project.}
|
13
|
+
gem.homepage = "https://github.com/VersaHQ/potatochop"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
gem.add_runtime_dependency 'sinatra'
|
20
|
+
gem.add_runtime_dependency 'thin', '~> 1.6'
|
21
|
+
gem.add_runtime_dependency 'erector-rails4'
|
22
|
+
gem.add_runtime_dependency 'sass'
|
23
|
+
gem.add_runtime_dependency 'octokit'
|
24
|
+
gem.add_development_dependency 'rspec'
|
25
|
+
gem.add_development_dependency 'rake'
|
26
|
+
gem.add_development_dependency 'simplecov'
|
27
|
+
gem.add_development_dependency 'rack-test'
|
28
|
+
end
|
data/script/cibuild
ADDED
data/script/console
ADDED
data/script/release
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
# Tag and push a release.
|
3
|
+
|
4
|
+
set -e
|
5
|
+
|
6
|
+
# Make sure we're in the project root.
|
7
|
+
|
8
|
+
cd $(dirname "$0")/..
|
9
|
+
|
10
|
+
# Build a new gem archive.
|
11
|
+
|
12
|
+
rm -rf potatochop-erector-*.gem
|
13
|
+
gem build -q potatochop-erector.gemspec
|
14
|
+
|
15
|
+
# Make sure we're on the master branch.
|
16
|
+
|
17
|
+
(git branch | grep -q '* master') || {
|
18
|
+
echo "Only release from the master branch."
|
19
|
+
exit 1
|
20
|
+
}
|
21
|
+
|
22
|
+
# Figure out what version we're releasing.
|
23
|
+
|
24
|
+
tag=v`ls potatochop-erector-*.gem | sed 's/^potatochop-erector-\(.*\)\.gem$/\1/'`
|
25
|
+
|
26
|
+
# Make sure we haven't released this version before.
|
27
|
+
|
28
|
+
git fetch -t origin
|
29
|
+
|
30
|
+
(git tag -l | grep -q "$tag") && {
|
31
|
+
echo "Whoops, there's already a '${tag}' tag."
|
32
|
+
exit 1
|
33
|
+
}
|
34
|
+
|
35
|
+
# Tag it and bag it.
|
36
|
+
|
37
|
+
gem push potatochop-erector-*.gem && git tag "$tag" &&
|
38
|
+
git push origin master && git push origin "$tag"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>
|
5
|
+
Fake batch of mock ups.
|
6
|
+
</title>
|
7
|
+
<link href='css/bar.css' media='screen' rel='stylesheet' type='text/css' />
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<h1>
|
11
|
+
This page is static HTML.
|
12
|
+
</h1>
|
13
|
+
<p>
|
14
|
+
This a paragraph.
|
15
|
+
</p>
|
16
|
+
<p>
|
17
|
+
And here is an image taken from the internet:
|
18
|
+
<br />
|
19
|
+
<img src='img/potatochop_cs4_box.png' />
|
20
|
+
</p>
|
21
|
+
<script src="js/bar.js" type="text/javascript"></script>
|
22
|
+
</body>
|
23
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
body h1 { color: blue; }
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Erector.inline {
|
2
|
+
rawtext '<!doctype html>'
|
3
|
+
html {
|
4
|
+
head {
|
5
|
+
title 'Fake batch of mock ups.'
|
6
|
+
link href: 'css/foo.css', media: 'screen', rel: 'stylesheet', type: 'text/css'
|
7
|
+
}
|
8
|
+
body {
|
9
|
+
h1 'This is an H1!'
|
10
|
+
p 'This a paragraph.'
|
11
|
+
p {
|
12
|
+
text 'And here is an image taken from '
|
13
|
+
a 'the internet', href: 'http://uncyclopedia.wikia.com/wiki/File:Adobe_potatochop_cs4_box.png'
|
14
|
+
text ':'
|
15
|
+
br
|
16
|
+
img src: 'img/potatochop_cs4_box.png'
|
17
|
+
text '✓'
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
Binary file
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Potatochop::FileSystemInterface do
|
4
|
+
describe '#new' do
|
5
|
+
it 'creates a new FileSystemInterface object with the proper source' do
|
6
|
+
fs = Potatochop::FileSystemInterface.new('spec/fake_mockups')
|
7
|
+
fs.source.should == "spec/fake_mockups"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
describe '#exists?' do
|
11
|
+
it 'returns true if the given file exists' do
|
12
|
+
fs = Potatochop::FileSystemInterface.new('spec/fake_mockups')
|
13
|
+
fs.exists?('foo.html.rb').should eq true
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'returns false if the given file does not exist' do
|
17
|
+
fs = Potatochop::FileSystemInterface.new('spec/fake_mockups')
|
18
|
+
fs.exists?('not_real.html').should eq false
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#read' do
|
23
|
+
it 'returns the content of the given files' do
|
24
|
+
fs = Potatochop::FileSystemInterface.new('spec/fake_mockups')
|
25
|
+
fs.read('foo.html.rb').should == File.read('spec/fake_mockups/foo.html.rb')
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'returns false if the given file does not exist' do
|
29
|
+
fs = Potatochop::FileSystemInterface.new('spec/fake_mockups')
|
30
|
+
expect { fs.read('not_real.html') }.to raise_error
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/spec/helper.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
def app
|
4
|
+
Potatochop::Web
|
5
|
+
end
|
6
|
+
|
7
|
+
describe 'Potatochop' do
|
8
|
+
describe 'Web' do
|
9
|
+
app.set(:tater => Potatochop::Spud.new(Potatochop::FileSystemInterface.new('spec/fake_mockups')))
|
10
|
+
include Rack::Test::Methods
|
11
|
+
|
12
|
+
it 'returns an error when an erector page does not exist' do
|
13
|
+
get 'no_exist.html'
|
14
|
+
last_response.should_not be_ok
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'renders an erector page that exists' do
|
18
|
+
get '/foo.html'
|
19
|
+
last_response.body.should match('<h1>This is an H1!</h1>')
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'renders an html page that exists' do
|
23
|
+
get '/bar.html'
|
24
|
+
last_response.body.should match('This page is static HTML')
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'returns an error when a sass file does not exist' do
|
28
|
+
get 'no_exist.css'
|
29
|
+
last_response.should_not be_ok
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'renders a sass stylesheet that exists' do
|
33
|
+
get '/css/foo.css'
|
34
|
+
last_response.body.should match('body h1 {\s+color: red; }')
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'renders a static stylesheet that exists' do
|
38
|
+
get '/css/bar.css'
|
39
|
+
last_response.body.should match('body h1 { color: blue; }')
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'returns an error when a requested image file does not exist' do
|
43
|
+
get 'no_exist.png'
|
44
|
+
last_response.should_not be_ok
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'returns a requested image file when it exists' do
|
48
|
+
get '/img/potatochop_cs4_box.png'
|
49
|
+
last_response.should be_ok
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'returns an error when a requested javascript file does not exist' do
|
53
|
+
get '/no_exist.js'
|
54
|
+
last_response.should_not be_ok
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'returns the requested javascript file if it exists' do
|
58
|
+
get '/js/bar.js'
|
59
|
+
last_response.should be_ok
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
metadata
ADDED
@@ -0,0 +1,209 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: potatochop-erector
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam Becker
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sinatra
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thin
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: erector-rails4
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sass
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: octokit
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rack-test
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Potatochop - because F$%k Photoshop, that's why.
|
140
|
+
email:
|
141
|
+
- adam@dobt.co
|
142
|
+
executables:
|
143
|
+
- potatochop
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files: []
|
146
|
+
files:
|
147
|
+
- ".gitignore"
|
148
|
+
- ".rspec"
|
149
|
+
- ".travis.yml"
|
150
|
+
- Gemfile
|
151
|
+
- LICENSE.txt
|
152
|
+
- README.md
|
153
|
+
- Rakefile
|
154
|
+
- bin/potatochop
|
155
|
+
- lib/potatochop.rb
|
156
|
+
- lib/potatochop/cli_parser.rb
|
157
|
+
- lib/potatochop/file_system_interface.rb
|
158
|
+
- lib/potatochop/github_interface.rb
|
159
|
+
- lib/potatochop/spud.rb
|
160
|
+
- lib/potatochop/version.rb
|
161
|
+
- lib/potatochop/web.rb
|
162
|
+
- potatochop-erector.gemspec
|
163
|
+
- script/cibuild
|
164
|
+
- script/console
|
165
|
+
- script/release
|
166
|
+
- spec/fake_mockups/bar.html
|
167
|
+
- spec/fake_mockups/css/bar.css
|
168
|
+
- spec/fake_mockups/css/foo.css.scss
|
169
|
+
- spec/fake_mockups/foo.html.rb
|
170
|
+
- spec/fake_mockups/img/potatochop_cs4_box.png
|
171
|
+
- spec/fake_mockups/js/bar.js
|
172
|
+
- spec/file_system_interface_spec.rb
|
173
|
+
- spec/helper.rb
|
174
|
+
- spec/potatochop_spec.rb
|
175
|
+
homepage: https://github.com/VersaHQ/potatochop
|
176
|
+
licenses: []
|
177
|
+
metadata: {}
|
178
|
+
post_install_message:
|
179
|
+
rdoc_options: []
|
180
|
+
require_paths:
|
181
|
+
- lib
|
182
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
187
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
|
+
requirements:
|
189
|
+
- - ">="
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
version: '0'
|
192
|
+
requirements: []
|
193
|
+
rubyforge_project:
|
194
|
+
rubygems_version: 2.2.2
|
195
|
+
signing_key:
|
196
|
+
specification_version: 4
|
197
|
+
summary: Potatochop is a simple server that compiles and serves up Erector views and
|
198
|
+
SASS files. The goal is to reduce friction between designers and devs in a Rails
|
199
|
+
project.
|
200
|
+
test_files:
|
201
|
+
- spec/fake_mockups/bar.html
|
202
|
+
- spec/fake_mockups/css/bar.css
|
203
|
+
- spec/fake_mockups/css/foo.css.scss
|
204
|
+
- spec/fake_mockups/foo.html.rb
|
205
|
+
- spec/fake_mockups/img/potatochop_cs4_box.png
|
206
|
+
- spec/fake_mockups/js/bar.js
|
207
|
+
- spec/file_system_interface_spec.rb
|
208
|
+
- spec/helper.rb
|
209
|
+
- spec/potatochop_spec.rb
|