potatochop 0.0.1.alpha → 0.0.1.beta
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.
- data/lib/potatochop/version.rb +1 -1
- data/lib/potatochop.rb +12 -0
- data/potatochop.gemspec +2 -1
- data/spec/fake_site/css/foo.css.scss +5 -0
- data/spec/fake_site/foo.html.haml +11 -5
- data/spec/potatochop_spec.rb +11 -0
- metadata +20 -2
data/lib/potatochop/version.rb
CHANGED
data/lib/potatochop.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'potatochop/version'
|
2
2
|
require 'sinatra/base'
|
3
3
|
require 'haml'
|
4
|
+
require 'sass'
|
4
5
|
|
5
6
|
module Potatochop
|
6
7
|
class Web < Sinatra::Base
|
@@ -12,5 +13,16 @@ module Potatochop
|
|
12
13
|
404
|
13
14
|
end
|
14
15
|
end
|
16
|
+
|
17
|
+
get '/*.css' do
|
18
|
+
file_path = File.join(settings.working_dir, "#{params[:splat][0]}.css.scss")
|
19
|
+
if File.exists? file_path
|
20
|
+
content_type 'text/css', :charset => 'utf-8'
|
21
|
+
Sass::Engine.new(File.read(file_path), :syntax => :scss).render
|
22
|
+
else
|
23
|
+
404
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
15
27
|
end
|
16
28
|
end
|
data/potatochop.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.email = ["john@versahq.com"]
|
11
11
|
gem.description = %q{Potatochop - because F$%k Photoshop, that's why.}
|
12
12
|
gem.summary = %q{Potatochop is a simple server that compiles and serves up HAML and SASS files. The goal is to reduce friction between designers and devs in a Rails project.}
|
13
|
-
gem.homepage = ""
|
13
|
+
gem.homepage = "https://github.com/VersaHQ/potatochop"
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
@@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
gem.add_runtime_dependency 'sinatra'
|
20
20
|
gem.add_runtime_dependency 'haml'
|
21
|
+
gem.add_runtime_dependency 'sass'
|
21
22
|
gem.add_development_dependency 'rspec'
|
22
23
|
gem.add_development_dependency 'rake'
|
23
24
|
gem.add_development_dependency 'simplecov'
|
@@ -1,5 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
%
|
4
|
-
|
5
|
-
|
1
|
+
!!! 5
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%title
|
5
|
+
Fake batch of mock ups.
|
6
|
+
%link{ :href => 'css/foo.css', :media => 'screen', :rel => 'stylesheet', :type => 'text/css' }
|
7
|
+
%body
|
8
|
+
%h1
|
9
|
+
This is an H1!
|
10
|
+
%p
|
11
|
+
This a paragraph.
|
data/spec/potatochop_spec.rb
CHANGED
@@ -18,5 +18,16 @@ describe 'Potatochop' do
|
|
18
18
|
get '/foo.html'
|
19
19
|
last_response.body.should match('<h1>\s+This is an H1!\s+</h1>')
|
20
20
|
end
|
21
|
+
|
22
|
+
it 'returns an error when a sass file does not exist' do
|
23
|
+
get 'no_exist.css'
|
24
|
+
last_response.should_not be_ok
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'renders a haml page that exists' do
|
28
|
+
get '/css/foo.css'
|
29
|
+
last_response.body.should match('body h1 {\s+color: red; }')
|
30
|
+
end
|
31
|
+
|
21
32
|
end
|
22
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: potatochop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.beta
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: sass
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: rspec
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,10 +125,11 @@ files:
|
|
109
125
|
- lib/potatochop.rb
|
110
126
|
- lib/potatochop/version.rb
|
111
127
|
- potatochop.gemspec
|
128
|
+
- spec/fake_site/css/foo.css.scss
|
112
129
|
- spec/fake_site/foo.html.haml
|
113
130
|
- spec/helper.rb
|
114
131
|
- spec/potatochop_spec.rb
|
115
|
-
homepage:
|
132
|
+
homepage: https://github.com/VersaHQ/potatochop
|
116
133
|
licenses: []
|
117
134
|
post_install_message:
|
118
135
|
rdoc_options: []
|
@@ -138,6 +155,7 @@ specification_version: 3
|
|
138
155
|
summary: Potatochop is a simple server that compiles and serves up HAML and SASS files.
|
139
156
|
The goal is to reduce friction between designers and devs in a Rails project.
|
140
157
|
test_files:
|
158
|
+
- spec/fake_site/css/foo.css.scss
|
141
159
|
- spec/fake_site/foo.html.haml
|
142
160
|
- spec/helper.rb
|
143
161
|
- spec/potatochop_spec.rb
|