bread 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/Gemfile +17 -2
- data/LICENSE.txt +0 -0
- data/README.md +0 -0
- data/Rakefile +34 -1
- data/bread.gemspec +0 -0
- data/lib/bread/commands/config_command.rb +15 -0
- data/lib/bread/commands/controller_layout_command.rb +44 -0
- data/lib/bread/commands/crumb_to_command.rb +23 -0
- data/lib/bread/commands/ivars_command.rb +16 -0
- data/lib/bread/config.rb +30 -0
- data/lib/bread/controller.rb +4 -9
- data/lib/bread/crumb.rb +24 -0
- data/lib/bread/helper.rb +12 -19
- data/lib/bread/version.rb +1 -1
- data/lib/bread.rb +8 -1
- data/lib/generators/bread/USAGE +2 -0
- data/lib/generators/bread/install_generator.rb +12 -0
- data/lib/generators/bread/templates/skeleton.rb +15 -0
- data/test/bread_test.rb +7 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/javascripts/products.js +2 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/assets/stylesheets/products.css +4 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/controllers/products_controller.rb +79 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/products_helper.rb +2 -0
- data/test/dummy/app/mailers/.keep +0 -0
- data/test/dummy/app/models/.keep +0 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/models/product.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +22 -0
- data/test/dummy/app/views/products/_form.html.erb +25 -0
- data/test/dummy/app/views/products/edit.html.erb +6 -0
- data/test/dummy/app/views/products/index.html.erb +29 -0
- data/test/dummy/app/views/products/new.html.erb +5 -0
- data/test/dummy/app/views/products/show.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +9 -0
- data/test/dummy/config/breadcrumbs.rb +18 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +27 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +12 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20140203163238_create_products.rb +10 -0
- data/test/dummy/db/schema.rb +23 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/log/development.log +886 -0
- data/test/dummy/log/test.log +14262 -0
- data/test/dummy/public/404.html +27 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/test/controllers/products_controller_test.rb +50 -0
- data/test/dummy/test/fixtures/products.yml +9 -0
- data/test/dummy/test/helpers/products_helper_test.rb +4 -0
- data/test/dummy/test/models/product_test.rb +7 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- metadata +137 -5
- data/lib/bread/command.rb +0 -16
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
|
5
|
+
<style>
|
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
7
|
+
div.dialog {
|
|
8
|
+
width: 25em;
|
|
9
|
+
padding: 0 4em;
|
|
10
|
+
margin: 4em auto 0 auto;
|
|
11
|
+
border: 1px solid #ccc;
|
|
12
|
+
border-right-color: #999;
|
|
13
|
+
border-bottom-color: #999;
|
|
14
|
+
}
|
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<!-- This file lives in public/404.html -->
|
|
21
|
+
<div class="dialog">
|
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
|
24
|
+
</div>
|
|
25
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
26
|
+
</body>
|
|
27
|
+
</html>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
|
5
|
+
<style>
|
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
7
|
+
div.dialog {
|
|
8
|
+
width: 25em;
|
|
9
|
+
padding: 0 4em;
|
|
10
|
+
margin: 4em auto 0 auto;
|
|
11
|
+
border: 1px solid #ccc;
|
|
12
|
+
border-right-color: #999;
|
|
13
|
+
border-bottom-color: #999;
|
|
14
|
+
}
|
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<!-- This file lives in public/422.html -->
|
|
21
|
+
<div class="dialog">
|
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
|
24
|
+
</div>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
|
5
|
+
<style>
|
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
7
|
+
div.dialog {
|
|
8
|
+
width: 25em;
|
|
9
|
+
padding: 0 4em;
|
|
10
|
+
margin: 4em auto 0 auto;
|
|
11
|
+
border: 1px solid #ccc;
|
|
12
|
+
border-right-color: #999;
|
|
13
|
+
border-bottom-color: #999;
|
|
14
|
+
}
|
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<!-- This file lives in public/500.html -->
|
|
21
|
+
<div class="dialog">
|
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
|
23
|
+
</div>
|
|
24
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
|
File without changes
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class ProductsControllerTest < ActionController::TestCase
|
|
4
|
+
setup do
|
|
5
|
+
@product = Product.create(name: "aaa", category: "bbb")
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
test "should get index" do
|
|
9
|
+
get :index
|
|
10
|
+
assert_response :success
|
|
11
|
+
assert_not_nil assigns(:products)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
test "should get new" do
|
|
15
|
+
get :new
|
|
16
|
+
assert_response :success
|
|
17
|
+
assert response.body.include? ("Add")
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
test "should create product" do
|
|
21
|
+
assert_difference('Product.count') do
|
|
22
|
+
post :create, product: { category: @product.category, name: @product.name }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
assert_redirected_to product_path(assigns(:product))
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
test "should show product" do
|
|
29
|
+
get :show, id: @product
|
|
30
|
+
assert_response :success
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
test "should get edit" do
|
|
34
|
+
get :edit, id: @product
|
|
35
|
+
assert_response :success
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
test "should update product" do
|
|
39
|
+
patch :update, id: @product, product: { category: @product.category, name: @product.name }
|
|
40
|
+
assert_redirected_to product_path(assigns(:product))
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
test "should destroy product" do
|
|
44
|
+
assert_difference('Product.count', -1) do
|
|
45
|
+
delete :destroy, id: @product
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
assert_redirected_to products_path
|
|
49
|
+
end
|
|
50
|
+
end
|
data/test/test_helper.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Configure Rails Environment
|
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
|
3
|
+
|
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
|
5
|
+
require "rails/test_help"
|
|
6
|
+
|
|
7
|
+
Rails.backtrace_cleaner.remove_silencers!
|
|
8
|
+
|
|
9
|
+
# Load support files
|
|
10
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
|
11
|
+
|
|
12
|
+
# Load fixtures from the engine
|
|
13
|
+
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
|
14
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
|
15
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bread
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thiago Pinto
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2014-02-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -52,10 +52,80 @@ files:
|
|
|
52
52
|
- Rakefile
|
|
53
53
|
- bread.gemspec
|
|
54
54
|
- lib/bread.rb
|
|
55
|
-
- lib/bread/
|
|
55
|
+
- lib/bread/commands/config_command.rb
|
|
56
|
+
- lib/bread/commands/controller_layout_command.rb
|
|
57
|
+
- lib/bread/commands/crumb_to_command.rb
|
|
58
|
+
- lib/bread/commands/ivars_command.rb
|
|
59
|
+
- lib/bread/config.rb
|
|
56
60
|
- lib/bread/controller.rb
|
|
61
|
+
- lib/bread/crumb.rb
|
|
57
62
|
- lib/bread/helper.rb
|
|
58
63
|
- lib/bread/version.rb
|
|
64
|
+
- lib/generators/bread/USAGE
|
|
65
|
+
- lib/generators/bread/install_generator.rb
|
|
66
|
+
- lib/generators/bread/templates/skeleton.rb
|
|
67
|
+
- test/bread_test.rb
|
|
68
|
+
- test/dummy/README.rdoc
|
|
69
|
+
- test/dummy/Rakefile
|
|
70
|
+
- test/dummy/app/assets/javascripts/application.js
|
|
71
|
+
- test/dummy/app/assets/javascripts/products.js
|
|
72
|
+
- test/dummy/app/assets/stylesheets/application.css
|
|
73
|
+
- test/dummy/app/assets/stylesheets/products.css
|
|
74
|
+
- test/dummy/app/assets/stylesheets/scaffold.css
|
|
75
|
+
- test/dummy/app/controllers/application_controller.rb
|
|
76
|
+
- test/dummy/app/controllers/concerns/.keep
|
|
77
|
+
- test/dummy/app/controllers/products_controller.rb
|
|
78
|
+
- test/dummy/app/helpers/application_helper.rb
|
|
79
|
+
- test/dummy/app/helpers/products_helper.rb
|
|
80
|
+
- test/dummy/app/mailers/.keep
|
|
81
|
+
- test/dummy/app/models/.keep
|
|
82
|
+
- test/dummy/app/models/concerns/.keep
|
|
83
|
+
- test/dummy/app/models/product.rb
|
|
84
|
+
- test/dummy/app/views/layouts/application.html.erb
|
|
85
|
+
- test/dummy/app/views/products/_form.html.erb
|
|
86
|
+
- test/dummy/app/views/products/edit.html.erb
|
|
87
|
+
- test/dummy/app/views/products/index.html.erb
|
|
88
|
+
- test/dummy/app/views/products/new.html.erb
|
|
89
|
+
- test/dummy/app/views/products/show.html.erb
|
|
90
|
+
- test/dummy/bin/bundle
|
|
91
|
+
- test/dummy/bin/rails
|
|
92
|
+
- test/dummy/bin/rake
|
|
93
|
+
- test/dummy/config.ru
|
|
94
|
+
- test/dummy/config/application.rb
|
|
95
|
+
- test/dummy/config/boot.rb
|
|
96
|
+
- test/dummy/config/breadcrumbs.rb
|
|
97
|
+
- test/dummy/config/database.yml
|
|
98
|
+
- test/dummy/config/environment.rb
|
|
99
|
+
- test/dummy/config/environments/development.rb
|
|
100
|
+
- test/dummy/config/environments/production.rb
|
|
101
|
+
- test/dummy/config/environments/test.rb
|
|
102
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
|
103
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
|
104
|
+
- test/dummy/config/initializers/inflections.rb
|
|
105
|
+
- test/dummy/config/initializers/mime_types.rb
|
|
106
|
+
- test/dummy/config/initializers/secret_token.rb
|
|
107
|
+
- test/dummy/config/initializers/session_store.rb
|
|
108
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
|
109
|
+
- test/dummy/config/locales/en.yml
|
|
110
|
+
- test/dummy/config/routes.rb
|
|
111
|
+
- test/dummy/db/development.sqlite3
|
|
112
|
+
- test/dummy/db/migrate/20140203163238_create_products.rb
|
|
113
|
+
- test/dummy/db/schema.rb
|
|
114
|
+
- test/dummy/db/test.sqlite3
|
|
115
|
+
- test/dummy/lib/assets/.keep
|
|
116
|
+
- test/dummy/log/.keep
|
|
117
|
+
- test/dummy/log/development.log
|
|
118
|
+
- test/dummy/log/test.log
|
|
119
|
+
- test/dummy/public/404.html
|
|
120
|
+
- test/dummy/public/422.html
|
|
121
|
+
- test/dummy/public/500.html
|
|
122
|
+
- test/dummy/public/favicon.ico
|
|
123
|
+
- test/dummy/test/controllers/products_controller_test.rb
|
|
124
|
+
- test/dummy/test/fixtures/products.yml
|
|
125
|
+
- test/dummy/test/helpers/products_helper_test.rb
|
|
126
|
+
- test/dummy/test/models/product_test.rb
|
|
127
|
+
- test/integration/navigation_test.rb
|
|
128
|
+
- test/test_helper.rb
|
|
59
129
|
homepage: https://github.com/yakko/bread
|
|
60
130
|
licenses:
|
|
61
131
|
- MIT
|
|
@@ -76,8 +146,70 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
76
146
|
version: '0'
|
|
77
147
|
requirements: []
|
|
78
148
|
rubyforge_project:
|
|
79
|
-
rubygems_version: 2.0.
|
|
149
|
+
rubygems_version: 2.0.7
|
|
80
150
|
signing_key:
|
|
81
151
|
specification_version: 4
|
|
82
152
|
summary: Set up all your breadcrumbs with on a dependency-based simple block of code
|
|
83
|
-
test_files:
|
|
153
|
+
test_files:
|
|
154
|
+
- test/bread_test.rb
|
|
155
|
+
- test/dummy/README.rdoc
|
|
156
|
+
- test/dummy/Rakefile
|
|
157
|
+
- test/dummy/app/assets/javascripts/application.js
|
|
158
|
+
- test/dummy/app/assets/javascripts/products.js
|
|
159
|
+
- test/dummy/app/assets/stylesheets/application.css
|
|
160
|
+
- test/dummy/app/assets/stylesheets/products.css
|
|
161
|
+
- test/dummy/app/assets/stylesheets/scaffold.css
|
|
162
|
+
- test/dummy/app/controllers/application_controller.rb
|
|
163
|
+
- test/dummy/app/controllers/concerns/.keep
|
|
164
|
+
- test/dummy/app/controllers/products_controller.rb
|
|
165
|
+
- test/dummy/app/helpers/application_helper.rb
|
|
166
|
+
- test/dummy/app/helpers/products_helper.rb
|
|
167
|
+
- test/dummy/app/mailers/.keep
|
|
168
|
+
- test/dummy/app/models/.keep
|
|
169
|
+
- test/dummy/app/models/concerns/.keep
|
|
170
|
+
- test/dummy/app/models/product.rb
|
|
171
|
+
- test/dummy/app/views/layouts/application.html.erb
|
|
172
|
+
- test/dummy/app/views/products/_form.html.erb
|
|
173
|
+
- test/dummy/app/views/products/edit.html.erb
|
|
174
|
+
- test/dummy/app/views/products/index.html.erb
|
|
175
|
+
- test/dummy/app/views/products/new.html.erb
|
|
176
|
+
- test/dummy/app/views/products/show.html.erb
|
|
177
|
+
- test/dummy/bin/bundle
|
|
178
|
+
- test/dummy/bin/rails
|
|
179
|
+
- test/dummy/bin/rake
|
|
180
|
+
- test/dummy/config.ru
|
|
181
|
+
- test/dummy/config/application.rb
|
|
182
|
+
- test/dummy/config/boot.rb
|
|
183
|
+
- test/dummy/config/breadcrumbs.rb
|
|
184
|
+
- test/dummy/config/database.yml
|
|
185
|
+
- test/dummy/config/environment.rb
|
|
186
|
+
- test/dummy/config/environments/development.rb
|
|
187
|
+
- test/dummy/config/environments/production.rb
|
|
188
|
+
- test/dummy/config/environments/test.rb
|
|
189
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
|
190
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
|
191
|
+
- test/dummy/config/initializers/inflections.rb
|
|
192
|
+
- test/dummy/config/initializers/mime_types.rb
|
|
193
|
+
- test/dummy/config/initializers/secret_token.rb
|
|
194
|
+
- test/dummy/config/initializers/session_store.rb
|
|
195
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
|
196
|
+
- test/dummy/config/locales/en.yml
|
|
197
|
+
- test/dummy/config/routes.rb
|
|
198
|
+
- test/dummy/db/development.sqlite3
|
|
199
|
+
- test/dummy/db/migrate/20140203163238_create_products.rb
|
|
200
|
+
- test/dummy/db/schema.rb
|
|
201
|
+
- test/dummy/db/test.sqlite3
|
|
202
|
+
- test/dummy/lib/assets/.keep
|
|
203
|
+
- test/dummy/log/.keep
|
|
204
|
+
- test/dummy/log/development.log
|
|
205
|
+
- test/dummy/log/test.log
|
|
206
|
+
- test/dummy/public/404.html
|
|
207
|
+
- test/dummy/public/422.html
|
|
208
|
+
- test/dummy/public/500.html
|
|
209
|
+
- test/dummy/public/favicon.ico
|
|
210
|
+
- test/dummy/test/controllers/products_controller_test.rb
|
|
211
|
+
- test/dummy/test/fixtures/products.yml
|
|
212
|
+
- test/dummy/test/helpers/products_helper_test.rb
|
|
213
|
+
- test/dummy/test/models/product_test.rb
|
|
214
|
+
- test/integration/navigation_test.rb
|
|
215
|
+
- test/test_helper.rb
|
data/lib/bread/command.rb
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
module Bread
|
|
2
|
-
class Command
|
|
3
|
-
|
|
4
|
-
def initialize(controller)
|
|
5
|
-
@controller = controller
|
|
6
|
-
@controller._bread_trees = {}
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def action(action_name, &block)
|
|
10
|
-
parent_name = nil
|
|
11
|
-
action_name, parent_name = action_name.first if action_name.is_a? Hash
|
|
12
|
-
@controller._bread_trees[action_name] = {block: block, parent: @controller._bread_trees[parent_name]}
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
end
|
|
16
|
-
end
|