carpentry 1.0.1 → 2.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 +12 -6
- data/README.md +30 -18
- data/Rakefile +11 -8
- data/app/controllers/carpentry/prototypes_controller.rb +4 -4
- data/config/routes.rb +3 -5
- data/lib/carpentry.rb +3 -2
- data/lib/carpentry/engine.rb +11 -0
- data/lib/carpentry/version.rb +1 -1
- data/lib/generators/carpentry/install/install_generator.rb +4 -0
- data/lib/tasks/carpentry_tasks.rake +4 -0
- metadata +130 -34
data/Gemfile
CHANGED
@@ -1,8 +1,14 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
|
-
gem
|
4
|
-
|
5
|
-
|
3
|
+
# Declare your gem's dependencies in carpentry.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
11
|
+
# your gem to rubygems.org.
|
12
|
+
|
13
|
+
# To use debugger
|
14
|
+
# gem 'debugger'
|
data/README.md
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
Carpentry
|
2
2
|
=========
|
3
3
|
|
4
|
-
|
5
|
-
/ Carpentry – handcrafted prototypes \
|
6
|
-
\ with ease /
|
7
|
-
------------------------------------
|
8
|
-
\ ^__^
|
9
|
-
\ (oo)\_______
|
10
|
-
(__)\ )\/\
|
11
|
-
||----w |
|
12
|
-
|| ||
|
4
|
+
Handcrafted prototypes with ease.
|
13
5
|
|
14
6
|
|
15
7
|
Installation
|
@@ -19,7 +11,7 @@ Add Carpentry to Gemfile:
|
|
19
11
|
|
20
12
|
gem "carpentry"
|
21
13
|
|
22
|
-
Run the generator to create the prototypes folder:
|
14
|
+
Run the generator to create the prototypes folder (and inject the Carpentry route):
|
23
15
|
|
24
16
|
rails generate carpentry:install
|
25
17
|
|
@@ -27,8 +19,8 @@ Run the generator to create the prototypes folder:
|
|
27
19
|
Usage
|
28
20
|
-----
|
29
21
|
|
30
|
-
Put your views in app/views/carpentry/prototypes and view them in
|
31
|
-
browser at
|
22
|
+
Put your views in `app/views/carpentry/prototypes` and view them in
|
23
|
+
browser at `/p/path_to_file`.
|
32
24
|
|
33
25
|
Examples:
|
34
26
|
|
@@ -40,32 +32,52 @@ Examples:
|
|
40
32
|
|
41
33
|
All available Rails helpers work nicely. Pure prototyping bliss!
|
42
34
|
|
35
|
+
If you want an special layout for your prototypes, stick the layout file
|
36
|
+
to `app/views/layouts/carpentry/prototypes.html.[format]`.
|
37
|
+
|
38
|
+
|
39
|
+
You can customize the prototype URI prefix (`/p`) by editing the engine mount in your `roures.rb` file, for example:
|
40
|
+
|
41
|
+
```
|
42
|
+
mount Carpentry::Engine => "/prototype"
|
43
|
+
```
|
43
44
|
|
44
45
|
Hooks
|
45
46
|
-----
|
46
47
|
|
47
|
-
Carpentry let's you add a `#before_carpentry` method in
|
48
|
-
`ApplicationController`, that will be run before any prototype. You can
|
49
|
-
use it, for example, to provide authentication or prevent prototypes
|
48
|
+
Carpentry let's you add a `#before_carpentry` method in
|
49
|
+
`ApplicationController`, that will be run before any prototype. You can
|
50
|
+
use it, for example, to provide authentication or prevent prototypes
|
50
51
|
from being rendered in production.
|
51
52
|
|
52
53
|
|
54
|
+
Rails and Ruby compatiblity
|
55
|
+
---------------------------
|
56
|
+
|
57
|
+
Carpentry is compatible with **Rails 3.2** and **Rails 4.0**.
|
58
|
+
|
59
|
+
Only **Ruby 1.9.3** and above are supported, check [Travis CI][travis] for build details.
|
60
|
+
|
61
|
+
If you want to use Carpentry with Ruby 1.9.2 or below, use [Carpentry v1.0.1][v1].
|
62
|
+
|
53
63
|
Gotchas
|
54
64
|
-------
|
55
65
|
|
56
66
|
When rendering a partial, you must specify the full path
|
57
|
-
(e.g. `carpentry/prototypes/posts/form`) unless the partial is in
|
67
|
+
(e.g. `carpentry/prototypes/posts/form`) unless the partial is in
|
58
68
|
`app/views/carpentry/prototypes/`.
|
59
69
|
|
60
70
|
|
61
71
|
License
|
62
72
|
-------
|
63
73
|
|
64
|
-
MIT License. Copyright 2011 Kisko Labs.
|
74
|
+
MIT License. Copyright 2011-2013 Kisko Labs.
|
65
75
|
|
66
76
|
|
67
77
|
CI Build Status
|
68
78
|
---------------
|
69
79
|
|
70
|
-
[][travis]
|
71
81
|
|
82
|
+
[travis]: https://travis-ci.org/kiskolabs/carpentry
|
83
|
+
[v1]: https://github.com/kiskolabs/carpentry/tree/v1.0.1
|
data/Rakefile
CHANGED
@@ -1,18 +1,21 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
require 'rubygems'
|
3
2
|
begin
|
4
3
|
require 'bundler/setup'
|
5
4
|
rescue LoadError
|
6
5
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
7
6
|
end
|
8
7
|
|
9
|
-
require
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
require "rdoc/task"
|
9
|
+
RDoc::Task.new do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Carpentry'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
14
16
|
|
17
|
+
require "rspec/core/rake_task"
|
15
18
|
RSpec::Core::RakeTask.new(:spec)
|
16
|
-
|
19
|
+
task default: :spec
|
17
20
|
|
18
|
-
|
21
|
+
Bundler::GemHelper.install_tasks
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Carpentry
|
2
2
|
class PrototypesController < ApplicationController
|
3
3
|
before_filter :before_carpentry,
|
4
|
-
:
|
4
|
+
if: proc { respond_to?(:before_carpentry, true) }
|
5
5
|
|
6
6
|
def serve
|
7
7
|
env["carpentry.prototype"] = true
|
@@ -10,9 +10,9 @@ module Carpentry
|
|
10
10
|
if Rails.application.config.consider_all_requests_local
|
11
11
|
raise
|
12
12
|
else
|
13
|
-
render :
|
14
|
-
:
|
15
|
-
:
|
13
|
+
render file: "#{Rails.root}/public/404.html",
|
14
|
+
status: 404,
|
15
|
+
layout: false
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/config/routes.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
match "/*file_path" => "prototypes#serve"
|
5
|
-
end
|
1
|
+
Carpentry::Engine.routes.draw do
|
2
|
+
root to: "prototypes#serve", file_path: "index"
|
3
|
+
match "/*file_path" => "prototypes#serve", via: :get
|
6
4
|
end
|
data/lib/carpentry.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
require "carpentry/no_robots_middleware"
|
1
|
+
# require "carpentry/no_robots_middleware"
|
2
|
+
require "carpentry/engine"
|
2
3
|
|
3
4
|
module Carpentry
|
4
5
|
class Engine < ::Rails::Engine
|
5
|
-
config.app_middleware.use NoRobotsMiddleware
|
6
|
+
# config.app_middleware.use NoRobotsMiddleware
|
6
7
|
end
|
7
8
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path("../no_robots_middleware", __FILE__)
|
2
|
+
|
3
|
+
module Carpentry
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
isolate_namespace Carpentry
|
6
|
+
|
7
|
+
initializer "carpentry.add_middleware" do |app|
|
8
|
+
app.middleware.use Carpentry::NoRobotsMiddleware
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/carpentry/version.rb
CHANGED
metadata
CHANGED
@@ -1,69 +1,165 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: carpentry
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
4
5
|
prerelease:
|
5
|
-
version: 1.0.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Joao Carlos
|
9
|
-
-
|
9
|
+
- Vesa Vänskä
|
10
10
|
- Matias Korhonen
|
11
11
|
- Antti Salonen
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
date: 2013-10-25 00:00:00.000000000 Z
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: railties
|
19
|
+
requirement: !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ! '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 3.2.6
|
25
|
+
- - <
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '5'
|
28
|
+
type: :runtime
|
29
|
+
prerelease: false
|
30
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ! '>='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 3.2.6
|
36
|
+
- - <
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '5'
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: rdoc
|
41
|
+
requirement: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
type: :development
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 4.0.0
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ~>
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 4.0.0
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: capybara
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 0.4.0
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 0.4.0
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: autotest-standalone
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
type: :development
|
96
|
+
prerelease: false
|
97
|
+
version_requirements: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: rspec-rails
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
type: :development
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ! '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
19
119
|
description: Handcrafted prototypes for Rails.
|
20
|
-
email:
|
120
|
+
email:
|
21
121
|
- contact@kiskolabs.com
|
22
122
|
executables: []
|
23
|
-
|
24
123
|
extensions: []
|
25
|
-
|
26
124
|
extra_rdoc_files: []
|
27
|
-
|
28
|
-
files:
|
125
|
+
files:
|
29
126
|
- app/controllers/carpentry/prototypes_controller.rb
|
127
|
+
- lib/carpentry/engine.rb
|
30
128
|
- lib/carpentry/no_robots_middleware.rb
|
31
129
|
- lib/carpentry/version.rb
|
32
130
|
- lib/carpentry.rb
|
33
131
|
- lib/generators/carpentry/install/install_generator.rb
|
132
|
+
- lib/tasks/carpentry_tasks.rake
|
34
133
|
- config/routes.rb
|
35
134
|
- Rakefile
|
36
135
|
- Gemfile
|
37
136
|
- README.md
|
38
137
|
homepage: https://github.com/kiskolabs/carpentry
|
39
|
-
licenses:
|
40
|
-
|
138
|
+
licenses:
|
139
|
+
- MIT
|
41
140
|
post_install_message:
|
42
141
|
rdoc_options: []
|
43
|
-
|
44
|
-
require_paths:
|
142
|
+
require_paths:
|
45
143
|
- lib
|
46
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
145
|
none: false
|
48
|
-
requirements:
|
49
|
-
- -
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
|
52
|
-
|
53
|
-
- 0
|
54
|
-
version: "0"
|
55
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: 1.9.3
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
151
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version:
|
152
|
+
requirements:
|
153
|
+
- - ! '>='
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
segments:
|
157
|
+
- 0
|
158
|
+
hash: -507400125341853681
|
61
159
|
requirements: []
|
62
|
-
|
63
160
|
rubyforge_project:
|
64
|
-
rubygems_version: 1.8.
|
161
|
+
rubygems_version: 1.8.25
|
65
162
|
signing_key:
|
66
163
|
specification_version: 3
|
67
164
|
summary: Protyping engine for Rails.
|
68
165
|
test_files: []
|
69
|
-
|