-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Thanks Vesa Vänskä, Matias Korhonen, and Antti Salonen for all the contributions to this gem.
- Loading branch information
0 parents
commit ee2c6e3
Showing
51 changed files
with
718 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.bundle/ | ||
log/*.log | ||
pkg/ | ||
spec/dummy/db/*.sqlite3 | ||
spec/dummy/log/*.log | ||
spec/dummy/tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
source :rubygems | ||
|
||
gem "rails", "3.0.7" | ||
gem "rake", "~> 0.9.2" | ||
gem "capybara", ">= 0.4.0" | ||
|
||
gem "autotest-standalone" | ||
gem "rspec-rails" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
abstract (1.0.0) | ||
actionmailer (3.0.7) | ||
actionpack (= 3.0.7) | ||
mail (~> 2.2.15) | ||
actionpack (3.0.7) | ||
activemodel (= 3.0.7) | ||
activesupport (= 3.0.7) | ||
builder (~> 2.1.2) | ||
erubis (~> 2.6.6) | ||
i18n (~> 0.5.0) | ||
rack (~> 1.2.1) | ||
rack-mount (~> 0.6.14) | ||
rack-test (~> 0.5.7) | ||
tzinfo (~> 0.3.23) | ||
activemodel (3.0.7) | ||
activesupport (= 3.0.7) | ||
builder (~> 2.1.2) | ||
i18n (~> 0.5.0) | ||
activerecord (3.0.7) | ||
activemodel (= 3.0.7) | ||
activesupport (= 3.0.7) | ||
arel (~> 2.0.2) | ||
tzinfo (~> 0.3.23) | ||
activeresource (3.0.7) | ||
activemodel (= 3.0.7) | ||
activesupport (= 3.0.7) | ||
activesupport (3.0.7) | ||
arel (2.0.10) | ||
autotest-standalone (4.5.5) | ||
builder (2.1.2) | ||
capybara (0.4.1.2) | ||
celerity (>= 0.7.9) | ||
culerity (>= 0.2.4) | ||
mime-types (>= 1.16) | ||
nokogiri (>= 1.3.3) | ||
rack (>= 1.0.0) | ||
rack-test (>= 0.5.4) | ||
selenium-webdriver (>= 0.0.27) | ||
xpath (~> 0.1.3) | ||
celerity (0.8.9) | ||
childprocess (0.1.9) | ||
ffi (~> 1.0.6) | ||
culerity (0.2.15) | ||
diff-lcs (1.1.2) | ||
erubis (2.6.6) | ||
abstract (>= 1.0.0) | ||
ffi (1.0.9) | ||
i18n (0.5.0) | ||
json_pure (1.5.1) | ||
mail (2.2.19) | ||
activesupport (>= 2.3.6) | ||
i18n (>= 0.4.0) | ||
mime-types (~> 1.16) | ||
treetop (~> 1.4.8) | ||
mime-types (1.16) | ||
nokogiri (1.4.4) | ||
polyglot (0.3.1) | ||
rack (1.2.3) | ||
rack-mount (0.6.14) | ||
rack (>= 1.0.0) | ||
rack-test (0.5.7) | ||
rack (>= 1.0) | ||
rails (3.0.7) | ||
actionmailer (= 3.0.7) | ||
actionpack (= 3.0.7) | ||
activerecord (= 3.0.7) | ||
activeresource (= 3.0.7) | ||
activesupport (= 3.0.7) | ||
bundler (~> 1.0) | ||
railties (= 3.0.7) | ||
railties (3.0.7) | ||
actionpack (= 3.0.7) | ||
activesupport (= 3.0.7) | ||
rake (>= 0.8.7) | ||
thor (~> 0.14.4) | ||
rake (0.9.2) | ||
rspec (2.6.0) | ||
rspec-core (~> 2.6.0) | ||
rspec-expectations (~> 2.6.0) | ||
rspec-mocks (~> 2.6.0) | ||
rspec-core (2.6.4) | ||
rspec-expectations (2.6.0) | ||
diff-lcs (~> 1.1.2) | ||
rspec-mocks (2.6.0) | ||
rspec-rails (2.6.1) | ||
actionpack (~> 3.0) | ||
activesupport (~> 3.0) | ||
railties (~> 3.0) | ||
rspec (~> 2.6.0) | ||
rubyzip (0.9.4) | ||
selenium-webdriver (0.2.1) | ||
childprocess (>= 0.1.7) | ||
ffi (>= 1.0.7) | ||
json_pure | ||
rubyzip | ||
thor (0.14.6) | ||
treetop (1.4.9) | ||
polyglot (>= 0.3.1) | ||
tzinfo (0.3.27) | ||
xpath (0.1.4) | ||
nokogiri (~> 1.3) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
autotest-standalone | ||
capybara (>= 0.4.0) | ||
rails (= 3.0.7) | ||
rake (~> 0.9.2) | ||
rspec-rails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2011 Kisko Labs. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
Carpentry | ||
========= | ||
|
||
____________________________________ | ||
/ Carpentry – handcrafted prototypes \ | ||
\ with ease / | ||
------------------------------------ | ||
\ ^__^ | ||
\ (oo)\_______ | ||
(__)\ )\/\ | ||
||----w | | ||
|| || | ||
|
||
|
||
Installation | ||
------------ | ||
|
||
Add Carpentry to Gemfile: | ||
|
||
gem "carpentry" | ||
|
||
Run the generator to create the prototypes folder: | ||
|
||
rails generate carpentry:install | ||
|
||
|
||
Usage | ||
----- | ||
|
||
Put your views in app/views/carpentry/prototypes and view them in | ||
browser at /p/path_to_file. | ||
|
||
Examples: | ||
|
||
| URI Path | File path | | ||
|--------------|----------------------------------------------------| | ||
| /p | app/views/carpentry/prototypes/index.html.erb | | ||
| /p/home | app/views/carpentry/prototypes/home.html.haml | | ||
| /p/posts/new | app/views/carpentry/prototypes/posts/new.html.slim | | ||
|
||
All available Rails helpers work nicely. Pure prototyping bliss! | ||
|
||
|
||
Gotchas | ||
------- | ||
|
||
When rendering a partial, you must specify the full path | ||
(e.g. `carpentry/prototypes/posts/form`) unless the partial is in | ||
`app/views/carpentry/prototypes/`. | ||
|
||
|
||
License | ||
------- | ||
|
||
MIT License. Copyright 2011 Kisko Labs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# encoding: UTF-8 | ||
require 'rubygems' | ||
begin | ||
require 'bundler/setup' | ||
rescue LoadError | ||
puts 'You must `gem install bundler` and `bundle install` to run rake tasks' | ||
end | ||
|
||
require 'rake' | ||
require 'rake/task' | ||
|
||
require 'rspec/core' | ||
require 'rspec/core/rake_task' | ||
|
||
RSpec::Core::RakeTask.new(:spec) | ||
Bundler::GemHelper.install_tasks | ||
|
||
task :default => :spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module Carpentry | ||
class PrototypesController < ApplicationController | ||
before_filter :before_carpentry, | ||
:if => proc { respond_to?(:before_carpentry, true) } | ||
|
||
def serve | ||
env["carpentry.prototype"] = true | ||
render "carpentry/prototypes/#{params[:file_path]}" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# -*- encoding: utf-8 -*- | ||
$:.push File.expand_path("../lib", __FILE__) | ||
require "carpentry/version" | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "carpentry" | ||
s.version = Carpentry::VERSION | ||
s.authors = ["Joao Carlos", "Vesa Vänskä", "Matias Korhonen", "Antti Salonen"] | ||
s.email = ["contact@kiskolabs.com"] | ||
s.homepage = "https://github.com/kiskolabs/carpentry" | ||
s.summary = "Protyping engine for Rails." | ||
s.description = "Handcrafted prototypes for Rails." | ||
s.files = Dir["{app,lib,config}/**/*"] + ["Rakefile", "Gemfile", "README.md"] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Rails.application.routes.draw do | ||
namespace "p", :module => :carpentry do | ||
root :to => "prototypes#serve", :file_path => "index" | ||
match "/*file_path" => "prototypes#serve" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require "carpentry/no_robots_middleware" | ||
|
||
module Carpentry | ||
class Engine < ::Rails::Engine | ||
config.app_middleware.use NoRobotsMiddleware | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Carpentry | ||
class NoRobotsMiddleware | ||
def initialize(app) | ||
@app = app | ||
end | ||
|
||
def call(env) | ||
status, headers, response = @app.call(env) | ||
|
||
if env["carpentry.prototype"] && status == 200 | ||
no_robots_tag = %{<meta name="robots" content="noindex, nofollow"/>\n} | ||
response.body = response.body.sub("</head>", "#{no_robots_tag}</head>") | ||
end | ||
|
||
[status, headers, response] | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module Carpentry | ||
VERSION = "1.0.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Carpentry | ||
module Generators | ||
class InstallGenerator < Rails::Generators::Base | ||
def create_directory_with_gitkeep | ||
empty_directory "app/views/carpentry/prototypes" | ||
create_file "app/views/carpentry/prototypes/.gitkeep" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Add your own tasks in files placed in lib/tasks ending in .rake, | ||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
||
require File.expand_path('../config/application', __FILE__) | ||
require 'rake' | ||
|
||
Dummy::Application.load_tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class ApplicationController < ActionController::Base | ||
protect_from_forgery | ||
|
||
private | ||
|
||
def before_carpentry | ||
@notes = "BEFORE CARPENTRY" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class NotAPrototypeController < ActionController::Base | ||
def show | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module ApplicationHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
INDEX FILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= @notes %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FORM PARTIAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
NEW POST FILE | ||
|
||
<%= render "carpentry/prototypes/posts/form" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SITES FILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Dummy</title> | ||
<%= stylesheet_link_tag :all %> | ||
<%= javascript_include_tag :defaults %> | ||
<%= csrf_meta_tag %> | ||
</head> | ||
<body> | ||
|
||
<%= yield %> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
NOT A PROTOTYPE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This file is used by Rack-based servers to start the application. | ||
|
||
require ::File.expand_path('../config/environment', __FILE__) | ||
run Dummy::Application |
Oops, something went wrong.