carpentry 1.0.0
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/Gemfile +8 -0
- data/README.md +55 -0
- data/Rakefile +18 -0
- data/app/controllers/carpentry/prototypes_controller.rb +11 -0
- data/config/routes.rb +6 -0
- data/lib/carpentry.rb +7 -0
- data/lib/carpentry/no_robots_middleware.rb +18 -0
- data/lib/carpentry/version.rb +3 -0
- data/lib/generators/carpentry/install/install_generator.rb +10 -0
- metadata +69 -0
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
Carpentry
|
2
|
+
=========
|
3
|
+
|
4
|
+
____________________________________
|
5
|
+
/ Carpentry – handcrafted prototypes \
|
6
|
+
\ with ease /
|
7
|
+
------------------------------------
|
8
|
+
\ ^__^
|
9
|
+
\ (oo)\_______
|
10
|
+
(__)\ )\/\
|
11
|
+
||----w |
|
12
|
+
|| ||
|
13
|
+
|
14
|
+
|
15
|
+
Installation
|
16
|
+
------------
|
17
|
+
|
18
|
+
Add Carpentry to Gemfile:
|
19
|
+
|
20
|
+
gem "carpentry"
|
21
|
+
|
22
|
+
Run the generator to create the prototypes folder:
|
23
|
+
|
24
|
+
rails generate carpentry:install
|
25
|
+
|
26
|
+
|
27
|
+
Usage
|
28
|
+
-----
|
29
|
+
|
30
|
+
Put your views in app/views/carpentry/prototypes and view them in
|
31
|
+
browser at /p/path_to_file.
|
32
|
+
|
33
|
+
Examples:
|
34
|
+
|
35
|
+
| URI Path | File path |
|
36
|
+
|--------------|----------------------------------------------------|
|
37
|
+
| /p | app/views/carpentry/prototypes/index.html.erb |
|
38
|
+
| /p/home | app/views/carpentry/prototypes/home.html.haml |
|
39
|
+
| /p/posts/new | app/views/carpentry/prototypes/posts/new.html.slim |
|
40
|
+
|
41
|
+
All available Rails helpers work nicely. Pure prototyping bliss!
|
42
|
+
|
43
|
+
|
44
|
+
Gotchas
|
45
|
+
-------
|
46
|
+
|
47
|
+
When rendering a partial, you must specify the full path
|
48
|
+
(e.g. `carpentry/prototypes/posts/form`) unless the partial is in
|
49
|
+
`app/views/carpentry/prototypes/`.
|
50
|
+
|
51
|
+
|
52
|
+
License
|
53
|
+
-------
|
54
|
+
|
55
|
+
MIT License. Copyright 2011 Kisko Labs.
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'rubygems'
|
3
|
+
begin
|
4
|
+
require 'bundler/setup'
|
5
|
+
rescue LoadError
|
6
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'rake'
|
10
|
+
require 'rake/task'
|
11
|
+
|
12
|
+
require 'rspec/core'
|
13
|
+
require 'rspec/core/rake_task'
|
14
|
+
|
15
|
+
RSpec::Core::RakeTask.new(:spec)
|
16
|
+
Bundler::GemHelper.install_tasks
|
17
|
+
|
18
|
+
task :default => :spec
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Carpentry
|
2
|
+
class PrototypesController < ApplicationController
|
3
|
+
before_filter :before_carpentry,
|
4
|
+
:if => proc { respond_to?(:before_carpentry, true) }
|
5
|
+
|
6
|
+
def serve
|
7
|
+
env["carpentry.prototype"] = true
|
8
|
+
render "carpentry/prototypes/#{params[:file_path]}"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/config/routes.rb
ADDED
data/lib/carpentry.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Carpentry
|
2
|
+
class NoRobotsMiddleware
|
3
|
+
def initialize(app)
|
4
|
+
@app = app
|
5
|
+
end
|
6
|
+
|
7
|
+
def call(env)
|
8
|
+
status, headers, response = @app.call(env)
|
9
|
+
|
10
|
+
if env["carpentry.prototype"] && status == 200
|
11
|
+
no_robots_tag = %{<meta name="robots" content="noindex, nofollow"/>\n}
|
12
|
+
response.body = response.body.sub("</head>", "#{no_robots_tag}</head>")
|
13
|
+
end
|
14
|
+
|
15
|
+
[status, headers, response]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: carpentry
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Joao Carlos
|
9
|
+
- "Vesa V\xC3\xA4nsk\xC3\xA4"
|
10
|
+
- Matias Korhonen
|
11
|
+
- Antti Salonen
|
12
|
+
autorequire:
|
13
|
+
bindir: bin
|
14
|
+
cert_chain: []
|
15
|
+
|
16
|
+
date: 2011-06-07 00:00:00 Z
|
17
|
+
dependencies: []
|
18
|
+
|
19
|
+
description: Handcrafted prototypes for Rails.
|
20
|
+
email:
|
21
|
+
- contact@kiskolabs.com
|
22
|
+
executables: []
|
23
|
+
|
24
|
+
extensions: []
|
25
|
+
|
26
|
+
extra_rdoc_files: []
|
27
|
+
|
28
|
+
files:
|
29
|
+
- app/controllers/carpentry/prototypes_controller.rb
|
30
|
+
- lib/carpentry/no_robots_middleware.rb
|
31
|
+
- lib/carpentry/version.rb
|
32
|
+
- lib/carpentry.rb
|
33
|
+
- lib/generators/carpentry/install/install_generator.rb
|
34
|
+
- config/routes.rb
|
35
|
+
- Rakefile
|
36
|
+
- Gemfile
|
37
|
+
- README.md
|
38
|
+
homepage: https://github.com/kiskolabs/carpentry
|
39
|
+
licenses: []
|
40
|
+
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
hash: -3962878218693987690
|
52
|
+
segments:
|
53
|
+
- 0
|
54
|
+
version: "0"
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: "0"
|
61
|
+
requirements: []
|
62
|
+
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 1.8.3
|
65
|
+
signing_key:
|
66
|
+
specification_version: 3
|
67
|
+
summary: Protyping engine for Rails.
|
68
|
+
test_files: []
|
69
|
+
|