puffer_pages 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/Gemfile +11 -7
  2. data/Gemfile.lock +130 -114
  3. data/Guardfile +20 -0
  4. data/README.md +3 -3
  5. data/VERSION +1 -1
  6. data/app/assets/javascripts/puffer/codemirror-base.js +1 -0
  7. data/app/assets/javascripts/puffer/codemirror-parser.js +1 -0
  8. data/app/assets/javascripts/puffer/codemirror.js +1 -0
  9. data/{spec/dummy/public/puffer/javascripts → app/assets/javascripts/puffer}/puffer_pages.js +11 -0
  10. data/{lib/generators/puffer_pages/install/templates/puffer/javascripts → app/assets/javascripts/puffer}/right-dialog.js +0 -0
  11. data/{lib/generators/puffer_pages/install/templates/puffer/javascripts → app/assets/javascripts/puffer}/right-tabs.js +0 -0
  12. data/app/assets/stylesheets/codemirror.css +135 -0
  13. data/app/assets/stylesheets/puffer_pages.css +12 -0
  14. data/{lib/generators/puffer_pages/install/templates/puffer → app/assets}/stylesheets/puffer_tree.css +0 -0
  15. data/{lib/generators/puffer_pages/install/templates/controllers → app/controllers/admin}/layouts_controller.rb +0 -0
  16. data/{lib/generators/puffer_pages/install/templates/controllers → app/controllers/admin}/pages_controller.rb +0 -0
  17. data/{lib/generators/puffer_pages/install/templates/controllers → app/controllers/admin}/snippets_controller.rb +0 -0
  18. data/app/controllers/pages_controller.rb +2 -2
  19. data/app/controllers/puffer_pages/layouts_controller.rb +2 -2
  20. data/app/controllers/puffer_pages/pages_controller.rb +1 -2
  21. data/app/controllers/puffer_pages/snippets_controller.rb +2 -2
  22. data/app/helpers/puffer_pages_helper.rb +1 -1
  23. data/app/models/layout.rb +1 -5
  24. data/app/models/page.rb +1 -105
  25. data/app/models/page_part.rb +1 -20
  26. data/app/models/puffer_pages/layout.rb +8 -0
  27. data/app/models/puffer_pages/page.rb +107 -0
  28. data/app/models/puffer_pages/page_part.rb +23 -0
  29. data/app/models/puffer_pages/snippet.rb +6 -0
  30. data/app/models/snippet.rb +1 -3
  31. data/app/views/{puffer_tree → puffer/tree_base}/_record.html.erb +0 -0
  32. data/app/views/{puffer_tree → puffer/tree_base}/toggle.js.erb +0 -0
  33. data/app/views/{puffer_tree → puffer/tree_base}/tree.html.erb +0 -0
  34. data/app/views/puffer_pages/{_page_part_builder.html.erb → pages/_page_part_builder.html.erb} +1 -1
  35. data/app/views/puffer_pages/{_page_parts.html.erb → pages/_page_parts.html.erb} +0 -0
  36. data/app/views/puffer_pages/{_tree_page.html.erb → pages/_tree_page.html.erb} +0 -0
  37. data/config/locales/en.yml +3 -1
  38. data/{lib/generators/puffer_pages/install/templates → db}/migrate/20090422092419_create_pages.rb +0 -0
  39. data/{lib/generators/puffer_pages/install/templates → db}/migrate/20090504132337_create_page_parts.rb +0 -0
  40. data/{lib/generators/puffer_pages/install/templates → db}/migrate/20090506102004_create_layouts.rb +0 -0
  41. data/{lib/generators/puffer_pages/install/templates → db}/migrate/20090510121824_create_snippets.rb +0 -0
  42. data/lib/puffer/inputs/page_parts.rb +0 -1
  43. data/lib/puffer/inputs/page_parts_body.rb +0 -1
  44. data/lib/puffer/tree_base.rb +1 -2
  45. data/lib/puffer_pages/engine.rb +0 -4
  46. data/lib/puffer_pages/liquid/file_system.rb +7 -3
  47. data/lib/puffer_pages/liquid/page_drop.rb +13 -6
  48. data/lib/puffer_pages.rb +0 -5
  49. data/puffer_pages.gemspec +63 -107
  50. data/spec/dummy/Rakefile +1 -1
  51. data/spec/dummy/app/assets/images/rails.png +0 -0
  52. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  53. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  54. data/spec/dummy/app/controllers/puffer/dashboard_controller.rb +1 -1
  55. data/spec/dummy/app/controllers/puffer/sessions_controller.rb +1 -1
  56. data/spec/dummy/app/views/layouts/application.html.erb +3 -3
  57. data/spec/dummy/config/application.rb +4 -8
  58. data/spec/dummy/config/application.rb.orig +43 -0
  59. data/spec/dummy/config/boot.rb +5 -7
  60. data/spec/dummy/config/boot.rb.orig +6 -0
  61. data/spec/dummy/config/environments/development.rb +4 -3
  62. data/spec/dummy/config/environments/pg_test.rb +5 -1
  63. data/spec/dummy/config/environments/production.rb +14 -12
  64. data/spec/dummy/config/environments/test.rb +5 -1
  65. data/spec/dummy/config/initializers/secret_token.rb +1 -1
  66. data/spec/dummy/config/initializers/session_store.rb +1 -1
  67. data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
  68. data/spec/dummy/config/locales/en.yml +1 -1
  69. data/spec/dummy/config/routes.rb +3 -1
  70. data/spec/dummy/config/routes.rb.orig +58 -0
  71. data/spec/dummy/db/seeds.rb +7 -0
  72. data/spec/dummy/public/robots.txt +5 -0
  73. data/spec/fabricators/pages_fabricator.rb +1 -0
  74. data/spec/lib/core_spec.rb +1 -1
  75. data/spec/lib/drops_spec.rb +13 -8
  76. data/spec/models/page_spec.rb +4 -3
  77. data/spec/spec_helper.rb +14 -1
  78. metadata +200 -288
  79. data/autotest/discover.rb +0 -2
  80. data/lib/generators/puffer_pages/install/USAGE +0 -6
  81. data/lib/generators/puffer_pages/install/install_generator.rb +0 -24
  82. data/lib/generators/puffer_pages/install/templates/puffer/javascripts/puffer_pages.js +0 -35
  83. data/lib/generators/puffer_pages/install/templates/puffer/stylesheets/puffer_pages.css +0 -4
  84. data/lib/generators/puffer_pages/install/templates/puffer_pages.rb +0 -16
  85. data/spec/dummy/app/controllers/admin/layouts_controller.rb +0 -3
  86. data/spec/dummy/app/controllers/admin/pages_controller.rb +0 -3
  87. data/spec/dummy/app/controllers/admin/snippets_controller.rb +0 -3
  88. data/spec/dummy/config/initializers/puffer.rb +0 -12
  89. data/spec/dummy/config/initializers/puffer_pages.rb +0 -16
  90. data/spec/dummy/public/javascripts/application.js +0 -2
  91. data/spec/dummy/public/javascripts/controls.js +0 -965
  92. data/spec/dummy/public/javascripts/dragdrop.js +0 -974
  93. data/spec/dummy/public/javascripts/effects.js +0 -1123
  94. data/spec/dummy/public/javascripts/prototype.js +0 -6001
  95. data/spec/dummy/public/javascripts/rails.js +0 -175
  96. data/spec/dummy/public/puffer/javascripts/puffer.js +0 -10
  97. data/spec/dummy/public/puffer/javascripts/rails.js +0 -57
  98. data/spec/dummy/public/puffer/javascripts/right-autocompleter.js +0 -621
  99. data/spec/dummy/public/puffer/javascripts/right-calendar.js +0 -1461
  100. data/spec/dummy/public/puffer/javascripts/right-dialog.js +0 -764
  101. data/spec/dummy/public/puffer/javascripts/right-tabs.js +0 -1144
  102. data/spec/dummy/public/puffer/javascripts/right.js +0 -5892
  103. data/spec/dummy/public/puffer/stylesheets/puffer.css +0 -469
  104. data/spec/dummy/public/puffer/stylesheets/puffer_pages.css +0 -4
  105. data/spec/dummy/public/puffer/stylesheets/puffer_tree.css +0 -64
  106. data/spec/dummy/public/puffer/stylesheets/reset.css +0 -60
  107. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
@@ -0,0 +1,58 @@
1
+ Dummy::Application.routes.draw do
2
+ # The priority is based upon order of creation:
3
+ # first created -> highest priority.
4
+
5
+ # Sample of regular route:
6
+ # match 'products/:id' => 'catalog#view'
7
+ # Keep in mind you can assign values other than :controller and :action
8
+
9
+ # Sample of named route:
10
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
11
+ # This route can be invoked with purchase_url(:id => product.id)
12
+
13
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
14
+ # resources :products
15
+
16
+ # Sample resource route with options:
17
+ # resources :products do
18
+ # member do
19
+ # get 'short'
20
+ # post 'toggle'
21
+ # end
22
+ #
23
+ # collection do
24
+ # get 'sold'
25
+ # end
26
+ # end
27
+
28
+ # Sample resource route with sub-resources:
29
+ # resources :products do
30
+ # resources :comments, :sales
31
+ # resource :seller
32
+ # end
33
+
34
+ # Sample resource route with more complex sub-resources
35
+ # resources :products do
36
+ # resources :comments
37
+ # resources :sales do
38
+ # get 'recent', :on => :collection
39
+ # end
40
+ # end
41
+
42
+ # Sample resource route within a namespace:
43
+ # namespace :admin do
44
+ # # Directs /admin/products/* to Admin::ProductsController
45
+ # # (app/controllers/admin/products_controller.rb)
46
+ # resources :products
47
+ # end
48
+
49
+ # You can have the root of your site routed with "root"
50
+ # just remember to delete public/index.html.
51
+ # root :to => 'welcome#index'
52
+
53
+ # See how all your routes lay out with "rake routes"
54
+
55
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
56
+ # Note: This route will make all actions in every controller accessible via GET requests.
57
+ # match ':controller(/:action(/:id(.:format)))'
58
+ end
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
+ # Mayor.create(name: 'Emanuel', city: cities.first)
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -4,4 +4,5 @@ Fabricator(:page) do
4
4
  title { Forgery::LoremIpsum.sentence }
5
5
  description { Forgery::LoremIpsum.sentence }
6
6
  keywords { Forgery::LoremIpsum.sentence }
7
+ status {'published'}
7
8
  end
@@ -10,7 +10,7 @@ describe 'Core' do
10
10
  @bar = Fabricate :page, :slug => 'bar', :parent => @foo
11
11
  @baz = Fabricate :page, :slug => 'baz', :parent => @root
12
12
 
13
- @root.reload.self_and_descendants.all.arrange.should == @root.reload.self_and_descendants.arrange
13
+ @root.reload.self_and_descendants.all.arranged.should == @root.reload.self_and_descendants.arrange
14
14
  end
15
15
 
16
16
  end
@@ -2,14 +2,12 @@ require 'spec_helper'
2
2
 
3
3
  describe 'Drops' do
4
4
 
5
+ include RSpec::Rails::RequestExampleGroup
6
+
5
7
  def render_page(current_page, page = nil)
6
- request = ActionController::TestRequest.new
7
- request.env["rack.url_scheme"] = "http"
8
- request.host = 'test.com'
9
- request.port = 80
10
- request.path = "/#{current_page.location}"
11
- current_page.render 'self' => PufferPages::Liquid::PageDrop.new(current_page, current_page, request),
12
- 'page' => (PufferPages::Liquid::PageDrop.new(page, current_page, request) if page)
8
+ get "/#{current_page.location}"
9
+ current_page.render 'self' => PufferPages::Liquid::PageDrop.new(current_page, current_page, controller),
10
+ 'page' => (PufferPages::Liquid::PageDrop.new(page, current_page, controller) if page)
13
11
  end
14
12
 
15
13
  describe 'page drop' do
@@ -26,7 +24,14 @@ describe 'Drops' do
26
24
  it 'should render proper url and path' do
27
25
  @layout = Fabricate :layout, :name => 'foo_layout', :body => "{{ self.path }} {{ self.url }}"
28
26
 
29
- render_page(@bar).should == '/hello/world http://test.com/hello/world'
27
+ render_page(@bar).should == '/hello/world http://www.example.com/hello/world'
28
+ end
29
+
30
+ it 'should render page_part' do
31
+ @bar.page_parts.create(:name => 'sidebar', :body => "{{ 'hello!' }}")
32
+ @layout = Fabricate :layout, :name => 'foo_layout', :body => "{{ self.sidebar }}"
33
+
34
+ render_page(@bar).should == "{{ 'hello!' }}"
30
35
  end
31
36
 
32
37
  it 'should render proper current?' do
@@ -4,7 +4,8 @@ describe Page do
4
4
 
5
5
  it 'should have only one root' do
6
6
  @root = Fabricate :page, :layout_name => 'foo_layout'
7
- @root2 = Fabricate :page, :layout_name => 'foo_layout'
7
+ @root2 = Fabricate.build :page, :layout_name => 'foo_layout'
8
+ @root2.save
8
9
 
9
10
  Page.roots.should == [@root]
10
11
  end
@@ -32,7 +33,7 @@ describe Page do
32
33
  it 'should check slug uniqueness' do
33
34
  @foo = Fabricate :page, :slug => 'foo', :parent => @root
34
35
  @bar = Fabricate :page, :slug => 'foo', :parent => @foo
35
- @baz = Fabricate :page, :slug => 'foo', :parent => @root
36
+ @baz = Fabricate.build :page, :slug => 'foo', :parent => @root
36
37
  @foo.should be_valid
37
38
  @bar.should be_valid
38
39
  @baz.should_not be_valid
@@ -129,7 +130,7 @@ describe Page do
129
130
 
130
131
  it 'should receive proper content type' do
131
132
  @root.content_type.should == 'text/html'
132
- page = Fabricate :page, :slug => 'style.css'
133
+ page = Fabricate :page, :slug => 'style.css', :parent => @root
133
134
  page.content_type.should == 'text/css'
134
135
  end
135
136
 
data/spec/spec_helper.rb CHANGED
@@ -34,5 +34,18 @@ RSpec.configure do |config|
34
34
  # == Mock Framework
35
35
  config.mock_with :rspec
36
36
 
37
- config.use_transactional_fixtures = true
37
+ config.use_transactional_fixtures = false
38
+
39
+ config.before(:suite) do
40
+ DatabaseCleaner.strategy = :transaction
41
+ DatabaseCleaner.clean_with(:truncation)
42
+ end
43
+
44
+ config.before(:each) do
45
+ DatabaseCleaner.start
46
+ end
47
+
48
+ config.after(:each) do
49
+ DatabaseCleaner.clean
50
+ end
38
51
  end