push_type_core 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/front_end_controller.rb +17 -0
- data/app/models/push_type/asset.rb +9 -2
- data/lib/generators/push_type/dummy/dummy_generator.rb +2 -5
- data/lib/push_type/core/engine.rb +6 -0
- data/lib/push_type/rails/routes.rb +11 -1
- data/lib/push_type/testing/common_rake.rb +6 -3
- data/test/controllers/front_end_controller_test.rb +29 -0
- data/test/dummy/app/views/layouts/application.html.erb +1 -2
- data/test/dummy/config/secrets.yml +2 -2
- data/test/dummy/db/migrate/{20150102204403_create_push_type_users.push_type.rb → 20150108182218_create_push_type_users.push_type.rb} +0 -0
- data/test/dummy/db/migrate/{20150102204404_create_push_type_nodes.push_type.rb → 20150108182219_create_push_type_nodes.push_type.rb} +0 -0
- data/test/dummy/db/migrate/{20150102204405_create_push_type_node_hierarchies.push_type.rb → 20150108182220_create_push_type_node_hierarchies.push_type.rb} +0 -0
- data/test/dummy/db/migrate/{20150102204406_create_push_type_assets.push_type.rb → 20150108182221_create_push_type_assets.push_type.rb} +0 -0
- data/test/dummy/db/schema.rb +1 -1
- data/test/dummy/log/test.log +1026 -889
- data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/generators/config/initializers/push_type.rb +5 -0
- data/test/dummy/tmp/generators/config/routes.rb +59 -0
- data/test/models/push_type/asset_test.rb +25 -0
- metadata +24 -21
- data/app/controllers/push_type/application_controller.rb +0 -4
- data/app/controllers/push_type/front_end_controller.rb +0 -21
- data/test/controllers/push_type/front_end_controller_test.rb +0 -31
- data/test/dummy/app/assets/javascripts/application.js +0 -16
- data/test/dummy/tmp/generators/app/models/home_page.rb +0 -10
- data/test/dummy/tmp/generators/app/views/nodes/home_page.html.erb +0 -3
@@ -0,0 +1,59 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
|
3
|
+
mount_push_type
|
4
|
+
|
5
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
6
|
+
# See how all your routes lay out with "rake routes".
|
7
|
+
|
8
|
+
# You can have the root of your site routed with "root"
|
9
|
+
# root 'welcome#index'
|
10
|
+
|
11
|
+
# Example of regular route:
|
12
|
+
# get 'products/:id' => 'catalog#view'
|
13
|
+
|
14
|
+
# Example of named route that can be invoked with purchase_url(id: product.id)
|
15
|
+
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
16
|
+
|
17
|
+
# Example resource route (maps HTTP verbs to controller actions automatically):
|
18
|
+
# resources :products
|
19
|
+
|
20
|
+
# Example resource route with options:
|
21
|
+
# resources :products do
|
22
|
+
# member do
|
23
|
+
# get 'short'
|
24
|
+
# post 'toggle'
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# collection do
|
28
|
+
# get 'sold'
|
29
|
+
# end
|
30
|
+
# end
|
31
|
+
|
32
|
+
# Example resource route with sub-resources:
|
33
|
+
# resources :products do
|
34
|
+
# resources :comments, :sales
|
35
|
+
# resource :seller
|
36
|
+
# end
|
37
|
+
|
38
|
+
# Example resource route with more complex sub-resources:
|
39
|
+
# resources :products do
|
40
|
+
# resources :comments
|
41
|
+
# resources :sales do
|
42
|
+
# get 'recent', on: :collection
|
43
|
+
# end
|
44
|
+
# end
|
45
|
+
|
46
|
+
# Example resource route with concerns:
|
47
|
+
# concern :toggleable do
|
48
|
+
# post 'toggle'
|
49
|
+
# end
|
50
|
+
# resources :posts, concerns: :toggleable
|
51
|
+
# resources :photos, concerns: :toggleable
|
52
|
+
|
53
|
+
# Example resource route within a namespace:
|
54
|
+
# namespace :admin do
|
55
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
56
|
+
# # (app/controllers/admin/products_controller.rb)
|
57
|
+
# resources :products
|
58
|
+
# end
|
59
|
+
end
|
@@ -46,6 +46,31 @@ module PushType
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
describe '#media' do
|
50
|
+
let(:image) { FactoryGirl.create :image_asset }
|
51
|
+
let(:doc) { FactoryGirl.create :document_asset }
|
52
|
+
|
53
|
+
describe 'with no args' do
|
54
|
+
it { image.media.must_equal image.file }
|
55
|
+
it { doc.media.must_equal doc.file }
|
56
|
+
end
|
57
|
+
describe 'with original style' do
|
58
|
+
it { image.media(:original).must_equal image.file }
|
59
|
+
it { doc.media(:original).must_equal doc.file }
|
60
|
+
end
|
61
|
+
describe 'with a non existing style' do
|
62
|
+
it { image.media(:foo_bar).wont_equal image.file }
|
63
|
+
it { proc { image.media(:foo_bar).width }.must_raise ArgumentError }
|
64
|
+
it { doc.media(:foo_bar).must_equal doc.file }
|
65
|
+
end
|
66
|
+
describe 'with a geometry string' do
|
67
|
+
it { image.media('48x56#').wont_equal image.file }
|
68
|
+
it { image.media('48x56#').width.must_equal 48 }
|
69
|
+
it { image.media('48x56#').height.must_equal 56 }
|
70
|
+
it { doc.media('48x56#').must_equal doc.file }
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
49
74
|
describe '#preview_thumb_url' do
|
50
75
|
let(:image) { FactoryGirl.create :image_asset }
|
51
76
|
let(:doc) { FactoryGirl.create :document_asset }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: push_type_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Russell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -118,8 +118,7 @@ extra_rdoc_files: []
|
|
118
118
|
files:
|
119
119
|
- LICENSE.md
|
120
120
|
- README.md
|
121
|
-
- app/controllers/
|
122
|
-
- app/controllers/push_type/front_end_controller.rb
|
121
|
+
- app/controllers/front_end_controller.rb
|
123
122
|
- app/fields/push_type/date_field.rb
|
124
123
|
- app/fields/push_type/number_field.rb
|
125
124
|
- app/fields/push_type/rich_text_field.rb
|
@@ -162,10 +161,9 @@ files:
|
|
162
161
|
- lib/push_type/testing/support/test_page.rb
|
163
162
|
- lib/push_type_core.rb
|
164
163
|
- lib/tasks/push_type_tasks.rake
|
165
|
-
- test/controllers/
|
164
|
+
- test/controllers/front_end_controller_test.rb
|
166
165
|
- test/dummy/README.rdoc
|
167
166
|
- test/dummy/Rakefile
|
168
|
-
- test/dummy/app/assets/javascripts/application.js
|
169
167
|
- test/dummy/app/assets/stylesheets/application.css
|
170
168
|
- test/dummy/app/controllers/application_controller.rb
|
171
169
|
- test/dummy/app/helpers/application_helper.rb
|
@@ -195,10 +193,10 @@ files:
|
|
195
193
|
- test/dummy/config/locales/en.yml
|
196
194
|
- test/dummy/config/routes.rb
|
197
195
|
- test/dummy/config/secrets.yml
|
198
|
-
- test/dummy/db/migrate/
|
199
|
-
- test/dummy/db/migrate/
|
200
|
-
- test/dummy/db/migrate/
|
201
|
-
- test/dummy/db/migrate/
|
196
|
+
- test/dummy/db/migrate/20150108182218_create_push_type_users.push_type.rb
|
197
|
+
- test/dummy/db/migrate/20150108182219_create_push_type_nodes.push_type.rb
|
198
|
+
- test/dummy/db/migrate/20150108182220_create_push_type_node_hierarchies.push_type.rb
|
199
|
+
- test/dummy/db/migrate/20150108182221_create_push_type_assets.push_type.rb
|
202
200
|
- test/dummy/db/schema.rb
|
203
201
|
- test/dummy/db/seeds.rb
|
204
202
|
- test/dummy/log/test.log
|
@@ -207,8 +205,11 @@ files:
|
|
207
205
|
- test/dummy/public/500.html
|
208
206
|
- test/dummy/public/favicon.ico
|
209
207
|
- test/dummy/public/robots.txt
|
210
|
-
- test/dummy/tmp/
|
211
|
-
- test/dummy/tmp/
|
208
|
+
- test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
|
209
|
+
- test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
|
210
|
+
- test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
|
211
|
+
- test/dummy/tmp/generators/config/initializers/push_type.rb
|
212
|
+
- test/dummy/tmp/generators/config/routes.rb
|
212
213
|
- test/files/audio.m3u
|
213
214
|
- test/files/document.pdf
|
214
215
|
- test/files/image.png
|
@@ -246,13 +247,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
247
|
version: '0'
|
247
248
|
requirements: []
|
248
249
|
rubyforge_project:
|
249
|
-
rubygems_version: 2.4.
|
250
|
+
rubygems_version: 2.4.2
|
250
251
|
signing_key:
|
251
252
|
specification_version: 4
|
252
253
|
summary: The core engine for the PushType content management system.
|
253
254
|
test_files:
|
254
|
-
- test/controllers/
|
255
|
-
- test/dummy/app/assets/javascripts/application.js
|
255
|
+
- test/controllers/front_end_controller_test.rb
|
256
256
|
- test/dummy/app/assets/stylesheets/application.css
|
257
257
|
- test/dummy/app/controllers/application_controller.rb
|
258
258
|
- test/dummy/app/helpers/application_helper.rb
|
@@ -282,10 +282,10 @@ test_files:
|
|
282
282
|
- test/dummy/config/routes.rb
|
283
283
|
- test/dummy/config/secrets.yml
|
284
284
|
- test/dummy/config.ru
|
285
|
-
- test/dummy/db/migrate/
|
286
|
-
- test/dummy/db/migrate/
|
287
|
-
- test/dummy/db/migrate/
|
288
|
-
- test/dummy/db/migrate/
|
285
|
+
- test/dummy/db/migrate/20150108182218_create_push_type_users.push_type.rb
|
286
|
+
- test/dummy/db/migrate/20150108182219_create_push_type_nodes.push_type.rb
|
287
|
+
- test/dummy/db/migrate/20150108182220_create_push_type_node_hierarchies.push_type.rb
|
288
|
+
- test/dummy/db/migrate/20150108182221_create_push_type_assets.push_type.rb
|
289
289
|
- test/dummy/db/schema.rb
|
290
290
|
- test/dummy/db/seeds.rb
|
291
291
|
- test/dummy/log/test.log
|
@@ -296,8 +296,11 @@ test_files:
|
|
296
296
|
- test/dummy/public/robots.txt
|
297
297
|
- test/dummy/Rakefile
|
298
298
|
- test/dummy/README.rdoc
|
299
|
-
- test/dummy/tmp/
|
300
|
-
- test/dummy/tmp/
|
299
|
+
- test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
|
300
|
+
- test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
|
301
|
+
- test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
|
302
|
+
- test/dummy/tmp/generators/config/initializers/push_type.rb
|
303
|
+
- test/dummy/tmp/generators/config/routes.rb
|
301
304
|
- test/files/audio.m3u
|
302
305
|
- test/files/document.pdf
|
303
306
|
- test/files/image.png
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require_dependency "push_type/application_controller"
|
2
|
-
|
3
|
-
module PushType
|
4
|
-
class FrontEndController < ApplicationController
|
5
|
-
|
6
|
-
before_filter :load_node, only: :node
|
7
|
-
|
8
|
-
def node
|
9
|
-
render *@node.template_args
|
10
|
-
end
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
def load_node
|
15
|
-
@node = PushType::Node.published.find_by_path params[:permalink].split('/')
|
16
|
-
raise ActiveRecord::RecordNotFound unless @node
|
17
|
-
instance_variable_set "@#{ @node.type.underscore }", @node
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
module PushType
|
4
|
-
describe FrontEndController do
|
5
|
-
|
6
|
-
before { @routes = Rails.application.routes }
|
7
|
-
|
8
|
-
describe 'GET #node' do
|
9
|
-
let(:page) { Page.create attributes }
|
10
|
-
let(:permalink) { page.permalink }
|
11
|
-
let(:action!) { get :node, permalink: permalink }
|
12
|
-
|
13
|
-
describe 'when node does not exist' do
|
14
|
-
let(:permalink) { 'does/not/exist' }
|
15
|
-
it { proc { action! }.must_raise ActiveRecord::RecordNotFound }
|
16
|
-
end
|
17
|
-
describe 'when node not published' do
|
18
|
-
let(:attributes) { FactoryGirl.attributes_for :node, type: 'Page' }
|
19
|
-
it { proc { action! }.must_raise ActiveRecord::RecordNotFound }
|
20
|
-
end
|
21
|
-
describe 'when node is published' do
|
22
|
-
let(:attributes) { FactoryGirl.attributes_for :published_node, type: 'Page' }
|
23
|
-
before { action! }
|
24
|
-
it { response.must_render_template 'nodes/page' }
|
25
|
-
it { assigns[:node].must_equal page }
|
26
|
-
it { assigns[:page].must_equal page }
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
-
// listed below.
|
3
|
-
//
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
-
//
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// compiled file.
|
9
|
-
//
|
10
|
-
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
-
// about supported directives.
|
12
|
-
//
|
13
|
-
//= require jquery
|
14
|
-
//= require jquery_ujs
|
15
|
-
//= require turbolinks
|
16
|
-
//= require_tree .
|