puffer 0.0.1 → 0.0.2

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.
Files changed (85) hide show
  1. data/.rspec +1 -0
  2. data/.rvmrc +1 -0
  3. data/Gemfile +17 -0
  4. data/Gemfile.lock +130 -0
  5. data/Rakefile +3 -2
  6. data/VERSION +1 -0
  7. data/app/views/layouts/puffer.html.erb +38 -0
  8. data/app/views/puffer/_form.html.erb +19 -0
  9. data/app/views/puffer/associated/_many.html.erb +56 -0
  10. data/app/views/puffer/associated/_one.html.erb +47 -0
  11. data/app/views/puffer/associated/many.rjs +1 -0
  12. data/app/views/puffer/associated/one.rjs +1 -0
  13. data/app/views/puffer/association/_many.html.erb +7 -0
  14. data/app/views/puffer/association/_one.html.erb +16 -0
  15. data/app/views/puffer/edit.html.erb +20 -0
  16. data/app/views/puffer/index.html.erb +83 -0
  17. data/app/views/puffer/new.html.erb +18 -0
  18. data/app/views/puffer/show.html.erb +29 -0
  19. data/app/views/puffer/toggle.rjs +1 -0
  20. data/autotest/discover.rb +2 -0
  21. data/puffer.gemspec +217 -0
  22. data/spec/dummy/Rakefile +7 -0
  23. data/spec/dummy/app/controllers/admin/categories_controller.rb +3 -0
  24. data/spec/dummy/app/controllers/admin/posts_controller.rb +3 -0
  25. data/spec/dummy/app/controllers/admin/profiles_controller.rb +3 -0
  26. data/spec/dummy/app/controllers/admin/tags_controller.rb +3 -0
  27. data/spec/dummy/app/controllers/admin/users_controller.rb +13 -0
  28. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  29. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  30. data/spec/dummy/app/models/category.rb +4 -0
  31. data/spec/dummy/app/models/post.rb +7 -0
  32. data/spec/dummy/app/models/post_category.rb +4 -0
  33. data/spec/dummy/app/models/profile.rb +5 -0
  34. data/spec/dummy/app/models/tag.rb +3 -0
  35. data/spec/dummy/app/models/tagging.rb +4 -0
  36. data/spec/dummy/app/models/user.rb +4 -0
  37. data/spec/dummy/app/views/admin/users/index.html.erb +0 -0
  38. data/spec/dummy/config.ru +4 -0
  39. data/spec/dummy/config/application.rb +45 -0
  40. data/spec/dummy/config/boot.rb +10 -0
  41. data/spec/dummy/config/database.yml +22 -0
  42. data/spec/dummy/config/environment.rb +5 -0
  43. data/spec/dummy/config/environments/development.rb +26 -0
  44. data/spec/dummy/config/environments/production.rb +49 -0
  45. data/spec/dummy/config/environments/test.rb +35 -0
  46. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  47. data/spec/dummy/config/initializers/inflections.rb +10 -0
  48. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  49. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  50. data/spec/dummy/config/initializers/session_store.rb +8 -0
  51. data/spec/dummy/config/locales/en.yml +5 -0
  52. data/spec/dummy/config/routes.rb +81 -0
  53. data/spec/dummy/db/migrate/20100930132559_create_admin_users.rb +14 -0
  54. data/spec/dummy/db/migrate/20100930132656_create_admin_posts.rb +15 -0
  55. data/spec/dummy/db/migrate/20100930132726_create_admin_categories.rb +13 -0
  56. data/spec/dummy/db/migrate/20100930132837_create_post_categories.rb +14 -0
  57. data/spec/dummy/db/migrate/20100930133425_create_admin_profiles.rb +16 -0
  58. data/spec/dummy/db/migrate/20101011155830_create_tags.rb +13 -0
  59. data/spec/dummy/db/migrate/20101011160326_create_taggings.rb +16 -0
  60. data/spec/dummy/db/schema.rb +68 -0
  61. data/spec/dummy/public/404.html +26 -0
  62. data/spec/dummy/public/422.html +26 -0
  63. data/spec/dummy/public/500.html +26 -0
  64. data/spec/dummy/public/favicon.ico +0 -0
  65. data/spec/dummy/public/javascripts/application.js +2 -0
  66. data/spec/dummy/public/javascripts/controls.js +965 -0
  67. data/spec/dummy/public/javascripts/dragdrop.js +974 -0
  68. data/spec/dummy/public/javascripts/effects.js +1123 -0
  69. data/spec/dummy/public/javascripts/prototype.js +6001 -0
  70. data/spec/dummy/public/javascripts/rails.js +175 -0
  71. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  72. data/spec/dummy/script/rails +6 -0
  73. data/spec/fabricators/categories_fabricator.rb +3 -0
  74. data/spec/fabricators/posts_fabricator.rb +8 -0
  75. data/spec/fabricators/profiles_fabricator.rb +9 -0
  76. data/spec/fabricators/tags_fabricator.rb +3 -0
  77. data/spec/fabricators/users_fabricator.rb +12 -0
  78. data/spec/integration/navigation_spec.rb +9 -0
  79. data/spec/lib/params_spec.rb +119 -0
  80. data/spec/lib/render_fallback_spec.rb +17 -0
  81. data/spec/lib/resource/routing_spec.rb +67 -0
  82. data/spec/lib/resource_spec.rb +198 -0
  83. data/spec/puffer_spec.rb +7 -0
  84. data/spec/spec_helper.rb +34 -0
  85. metadata +283 -26
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -0,0 +1,26 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the webserver when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_view.debug_rjs = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Don't care if the mailer can't send
18
+ config.action_mailer.raise_delivery_errors = false
19
+
20
+ # Print deprecation notices to the Rails logger
21
+ config.active_support.deprecation = :log
22
+
23
+ # Only use best-standards-support built into browsers
24
+ config.action_dispatch.best_standards_support = :builtin
25
+ end
26
+
@@ -0,0 +1,49 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The production environment is meant for finished, "live" apps.
5
+ # Code is not reloaded between requests
6
+ config.cache_classes = true
7
+
8
+ # Full error reports are disabled and caching is turned on
9
+ config.consider_all_requests_local = false
10
+ config.action_controller.perform_caching = true
11
+
12
+ # Specifies the header that your server uses for sending files
13
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
14
+
15
+ # For nginx:
16
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
17
+
18
+ # If you have no front-end server that supports something like X-Sendfile,
19
+ # just comment this out and Rails will serve the files
20
+
21
+ # See everything in the log (default is :info)
22
+ # config.log_level = :debug
23
+
24
+ # Use a different logger for distributed setups
25
+ # config.logger = SyslogLogger.new
26
+
27
+ # Use a different cache store in production
28
+ # config.cache_store = :mem_cache_store
29
+
30
+ # Disable Rails's static asset server
31
+ # In production, Apache or nginx will already do this
32
+ config.serve_static_assets = false
33
+
34
+ # Enable serving of images, stylesheets, and javascripts from an asset server
35
+ # config.action_controller.asset_host = "http://assets.example.com"
36
+
37
+ # Disable delivery errors, bad email addresses will be ignored
38
+ # config.action_mailer.raise_delivery_errors = false
39
+
40
+ # Enable threaded mode
41
+ # config.threadsafe!
42
+
43
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
44
+ # the I18n.default_locale when a translation can not be found)
45
+ config.i18n.fallbacks = true
46
+
47
+ # Send deprecation notices to registered listeners
48
+ config.active_support.deprecation = :notify
49
+ end
@@ -0,0 +1,35 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Tell Action Mailer not to deliver emails to the real world.
24
+ # The :test delivery method accumulates sent emails in the
25
+ # ActionMailer::Base.deliveries array.
26
+ config.action_mailer.delivery_method = :test
27
+
28
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
29
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
30
+ # like if you have constraints or database-specific column types
31
+ # config.active_record.schema_format = :sql
32
+
33
+ # Print deprecation notices to the stderr
34
+ config.active_support.deprecation = :stderr
35
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = '14a4432ff8033f97f9e6dccdc2d8f29640bb61581f7befae59ad61d67e4707fc58ba747244f150ac8bf086348a23b6b155987127c63d0688b22d113f6cc83e0d'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,81 @@
1
+ Dummy::Application.routes.draw do
2
+
3
+ namespace :admin do
4
+ resources :users do
5
+ resource :profile do
6
+ resources :tags
7
+ end
8
+ resources :posts do
9
+ resources :categories
10
+ resources :tags
11
+ end
12
+ end
13
+ resources :profiles do
14
+ resources :tags
15
+ end
16
+ resources :posts do
17
+ resource :user
18
+ resources :categories
19
+ end
20
+ resources :categories do
21
+ resources :posts
22
+ end
23
+ end
24
+
25
+ # The priority is based upon order of creation:
26
+ # first created -> highest priority.
27
+
28
+ # Sample of regular route:
29
+ # match 'products/:id' => 'catalog#view'
30
+ # Keep in mind you can assign values other than :controller and :action
31
+
32
+ # Sample of named route:
33
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
34
+ # This route can be invoked with purchase_url(:id => product.id)
35
+
36
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
37
+ # resources :products
38
+
39
+ # Sample resource route with options:
40
+ # resources :products do
41
+ # member do
42
+ # get 'short'
43
+ # post 'toggle'
44
+ # end
45
+ #
46
+ # collection do
47
+ # get 'sold'
48
+ # end
49
+ # end
50
+
51
+ # Sample resource route with sub-resources:
52
+ # resources :products do
53
+ # resources :comments, :sales
54
+ # resource :seller
55
+ # end
56
+
57
+ # Sample resource route with more complex sub-resources
58
+ # resources :products do
59
+ # resources :comments
60
+ # resources :sales do
61
+ # get 'recent', :on => :collection
62
+ # end
63
+ # end
64
+
65
+ # Sample resource route within a namespace:
66
+ # namespace :admin do
67
+ # # Directs /admin/products/* to Admin::ProductsController
68
+ # # (app/controllers/admin/products_controller.rb)
69
+ # resources :products
70
+ # end
71
+
72
+ # You can have the root of your site routed with "root"
73
+ # just remember to delete public/index.html.
74
+ # root :to => "welcome#index"
75
+
76
+ # See how all your routes lay out with "rake routes"
77
+
78
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
79
+ # Note: This route will make all actions in every controller accessible via GET requests.
80
+ # match ':controller(/:action(/:id(.:format)))'
81
+ end
@@ -0,0 +1,14 @@
1
+ class CreateAdminUsers < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :users do |t|
4
+ t.string :email
5
+ t.string :password
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+
11
+ def self.down
12
+ drop_table :users
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ class CreateAdminPosts < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :posts do |t|
4
+ t.integer :user_id
5
+ t.string :title
6
+ t.text :body
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ drop_table :posts
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ class CreateAdminCategories < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :categories do |t|
4
+ t.string :title
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+
10
+ def self.down
11
+ drop_table :categories
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ class CreatePostCategories < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :post_categories do |t|
4
+ t.integer :post_id
5
+ t.integer :category_id
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+
11
+ def self.down
12
+ drop_table :post_categories
13
+ end
14
+ end
@@ -0,0 +1,16 @@
1
+ class CreateAdminProfiles < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :profiles do |t|
4
+ t.integer :user_id
5
+ t.string :name
6
+ t.string :surname
7
+ t.date :birth_date
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ drop_table :profiles
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ class CreateTags < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :tags do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+
10
+ def self.down
11
+ drop_table :tags
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ class CreateTaggings < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :taggings do |t|
4
+ t.string :name
5
+ t.references :tag
6
+ t.references :taggable, :polymorphic => true
7
+ end
8
+
9
+ add_index :taggings, :tag_id
10
+ add_index :taggings, [:taggable_id, :taggable_type]
11
+ end
12
+
13
+ def self.down
14
+ drop_table :taggings
15
+ end
16
+ end
@@ -0,0 +1,68 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended to check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(:version => 20101011160326) do
14
+
15
+ create_table "categories", :force => true do |t|
16
+ t.string "title"
17
+ t.datetime "created_at"
18
+ t.datetime "updated_at"
19
+ end
20
+
21
+ create_table "post_categories", :force => true do |t|
22
+ t.integer "post_id"
23
+ t.integer "category_id"
24
+ t.datetime "created_at"
25
+ t.datetime "updated_at"
26
+ end
27
+
28
+ create_table "posts", :force => true do |t|
29
+ t.integer "user_id"
30
+ t.string "title"
31
+ t.text "body"
32
+ t.datetime "created_at"
33
+ t.datetime "updated_at"
34
+ end
35
+
36
+ create_table "profiles", :force => true do |t|
37
+ t.integer "user_id"
38
+ t.string "name"
39
+ t.string "surname"
40
+ t.date "birth_date"
41
+ t.datetime "created_at"
42
+ t.datetime "updated_at"
43
+ end
44
+
45
+ create_table "taggings", :force => true do |t|
46
+ t.string "name"
47
+ t.integer "tag_id"
48
+ t.integer "taggable_id"
49
+ t.string "taggable_type"
50
+ end
51
+
52
+ add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
53
+ add_index "taggings", ["taggable_id", "taggable_type"], :name => "index_taggings_on_taggable_id_and_taggable_type"
54
+
55
+ create_table "tags", :force => true do |t|
56
+ t.string "name"
57
+ t.datetime "created_at"
58
+ t.datetime "updated_at"
59
+ end
60
+
61
+ create_table "users", :force => true do |t|
62
+ t.string "email"
63
+ t.string "password"
64
+ t.datetime "created_at"
65
+ t.datetime "updated_at"
66
+ end
67
+
68
+ end
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
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
+ </body>
26
+ </html>