panoramic 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/.travis.yml +3 -4
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +124 -111
  6. data/README.md +26 -9
  7. data/Rakefile +18 -1
  8. data/gemfiles/active_record.gemfile +5 -0
  9. data/lib/panoramic/orm/active_record.rb +3 -3
  10. data/lib/panoramic/resolver.rb +8 -5
  11. data/panoramic.gemspec +3 -3
  12. data/spec/controllers/rendering_spec.rb +7 -7
  13. data/spec/dummy/Rakefile +1 -2
  14. data/spec/dummy/app/controllers/application_controller.rb +3 -1
  15. data/spec/dummy/app/models/.keep +0 -0
  16. data/spec/dummy/app/views/layouts/application.html.erb +3 -1
  17. data/spec/dummy/bin/bundle +3 -0
  18. data/spec/dummy/bin/rails +4 -0
  19. data/spec/dummy/bin/rake +4 -0
  20. data/spec/dummy/bin/setup +29 -0
  21. data/spec/dummy/config.ru +2 -2
  22. data/spec/dummy/config/application.rb +7 -21
  23. data/spec/dummy/config/boot.rb +4 -9
  24. data/spec/dummy/config/database.yml +11 -8
  25. data/spec/dummy/config/environment.rb +3 -3
  26. data/spec/dummy/config/environments/development.rb +28 -13
  27. data/spec/dummy/config/environments/production.rb +58 -28
  28. data/spec/dummy/config/environments/test.rb +22 -15
  29. data/spec/dummy/config/initializers/assets.rb +11 -0
  30. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  31. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  32. data/spec/dummy/config/initializers/inflections.rb +9 -3
  33. data/spec/dummy/config/initializers/mime_types.rb +0 -1
  34. data/spec/dummy/config/initializers/session_store.rb +1 -6
  35. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  36. data/spec/dummy/config/locales/en.yml +20 -2
  37. data/spec/dummy/config/routes.rb +1 -1
  38. data/spec/dummy/config/secrets.yml +22 -0
  39. data/spec/orm/active_record_spec.rb +26 -26
  40. data/spec/resolver_spec.rb +36 -8
  41. metadata +77 -46
data/panoramic.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "panoramic"
5
- s.version ='0.0.4'
5
+ s.version ='0.0.6'
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ["Andrea Pavoni"]
8
8
  s.email = ["andrea.pavoni@gmail.com"]
@@ -11,11 +11,11 @@ Gem::Specification.new do |s|
11
11
  s.description = %q{Stores rails views on database}
12
12
 
13
13
  s.add_dependency 'rails', ">= 3.0.7"
14
- s.add_development_dependency "capybara", "~> 1.1.2"
14
+ s.add_development_dependency "capybara", "~> 2.5.0"
15
15
  s.add_development_dependency "factory_girl"
16
16
  s.add_development_dependency "simplecov"
17
17
  s.add_development_dependency "sqlite3"
18
- s.add_development_dependency "rspec-rails", '~> 2.10.0'
18
+ s.add_development_dependency "rspec-rails", '~> 3.0'
19
19
 
20
20
  s.files = `git ls-files`.split("\n")
21
21
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe FooController do
3
+ describe FooController, type: :controller do
4
4
  include Capybara::DSL
5
5
  render_views
6
6
 
@@ -10,8 +10,8 @@ describe FooController do
10
10
 
11
11
  visit '/foo/default_layout'
12
12
 
13
- response.should render_template("foo/default_layout" )
14
- page.body.should match(/something here in the body of the page: 4/)
13
+ expect(response).to render_template("foo/default_layout" )
14
+ expect(page.body).to match(/something here in the body of the page: 4/)
15
15
  end
16
16
 
17
17
  it "a custom layout" do
@@ -20,10 +20,10 @@ describe FooController do
20
20
 
21
21
  visit '/foo/custom_layout'
22
22
 
23
- response.should render_template("layouts/custom" )
24
- response.should render_template("foo/custom_layout" )
25
- page.body.should match(/This is a layout with body:/)
26
- page.body.should match(/something here in the body of the page:/)
23
+ expect(response).to render_template("layouts/custom" )
24
+ expect(response).to render_template("foo/custom_layout" )
25
+ expect(page.body).to match(/This is a layout with body:/)
26
+ expect(page.body).to match(/something here in the body of the page:/)
27
27
  end
28
28
  end
29
29
  end
data/spec/dummy/Rakefile CHANGED
@@ -2,6 +2,5 @@
2
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
4
  require File.expand_path('../config/application', __FILE__)
5
- require 'rake'
6
5
 
7
- Dummy::Application.load_tasks
6
+ Rails.application.load_tasks
@@ -1,3 +1,5 @@
1
1
  class ApplicationController < ActionController::Base
2
- protect_from_forgery
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
3
5
  end
File without changes
@@ -2,7 +2,9 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Dummy</title>
5
- <%= csrf_meta_tag %>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
6
8
  </head>
7
9
  <body>
8
10
 
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts "== Installing dependencies =="
12
+ system "gem install bundler --conservative"
13
+ system "bundle check || bundle install"
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system "bin/rake db:setup"
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system "rm -f log/*"
25
+ system "rm -rf tmp/cache"
26
+
27
+ puts "\n== Restarting application server =="
28
+ system "touch tmp/restart.txt"
29
+ end
data/spec/dummy/config.ru CHANGED
@@ -1,4 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run Dummy::Application
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -1,12 +1,14 @@
1
1
  require File.expand_path('../boot', __FILE__)
2
2
 
3
- require "active_model/railtie"
3
+ # Pick the frameworks you want:
4
4
  require "active_record/railtie"
5
5
  require "action_controller/railtie"
6
- require "action_view/railtie"
7
6
  require "action_mailer/railtie"
7
+ require "action_view/railtie"
8
+ require "sprockets/railtie"
9
+ # require "rails/test_unit/railtie"
8
10
 
9
- Bundler.require
11
+ Bundler.require(*Rails.groups)
10
12
  require "panoramic"
11
13
 
12
14
  module Dummy
@@ -15,16 +17,6 @@ module Dummy
15
17
  # Application configuration should go into files in config/initializers
16
18
  # -- all .rb files in that directory are automatically loaded.
17
19
 
18
- # Custom directories with classes and modules you want to be autoloadable.
19
- # config.autoload_paths += %W(#{config.root}/extras)
20
-
21
- # Only load the plugins named here, in the order given (default is alphabetical).
22
- # :all can be used as a placeholder for all plugins not explicitly named.
23
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
24
-
25
- # Activate observers that should always be running.
26
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
27
-
28
20
  # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
29
21
  # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
30
22
  # config.time_zone = 'Central Time (US & Canada)'
@@ -33,13 +25,7 @@ module Dummy
33
25
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
34
26
  # config.i18n.default_locale = :de
35
27
 
36
- # JavaScript files you want as :defaults (application.js is always included).
37
- # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
38
-
39
- # Configure the default encoding used in templates for Ruby 1.9.
40
- config.encoding = "utf-8"
41
-
42
- # Configure sensitive parameters which will be filtered from the log file.
43
- config.filter_parameters += [:password]
28
+ # Do not swallow errors in after_commit/after_rollback callbacks.
29
+ config.active_record.raise_in_transactional_callbacks = true
44
30
  end
45
31
  end
@@ -1,10 +1,5 @@
1
- require 'rubygems'
2
- gemfile = File.expand_path('../../../../Gemfile', __FILE__)
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
3
 
4
- if File.exist?(gemfile)
5
- ENV['BUNDLE_GEMFILE'] = gemfile
6
- require 'bundler'
7
- Bundler.setup
8
- end
9
-
10
- $:.unshift File.expand_path('../../../../lib', __FILE__)
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -1,22 +1,25 @@
1
1
  # SQLite version 3.x
2
2
  # gem install sqlite3
3
- development:
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ #
7
+ default: &default
4
8
  adapter: sqlite3
5
- database: db/development.sqlite3
6
9
  pool: 5
7
10
  timeout: 5000
8
11
 
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
9
16
  # Warning: The database defined as "test" will be erased and
10
17
  # re-generated from your development database when you run "rake".
11
18
  # Do not set this db to the same as development or production.
12
19
  test:
13
- adapter: sqlite3
20
+ <<: *default
14
21
  database: db/test.sqlite3
15
- pool: 5
16
- timeout: 5000
17
22
 
18
23
  production:
19
- adapter: sqlite3
24
+ <<: *default
20
25
  database: db/production.sqlite3
21
- pool: 5
22
- timeout: 5000
@@ -1,5 +1,5 @@
1
- # Load the rails application
1
+ # Load the Rails application.
2
2
  require File.expand_path('../application', __FILE__)
3
3
 
4
- # Initialize the rails application
5
- Dummy::Application.initialize!
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -1,26 +1,41 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
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.
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
7
  config.cache_classes = false
8
8
 
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
11
 
12
- # Show full error reports and disable caching
12
+ # Show full error reports and disable caching.
13
13
  config.consider_all_requests_local = true
14
- config.action_view.debug_rjs = true
15
14
  config.action_controller.perform_caching = false
16
15
 
17
- # Don't care if the mailer can't send
16
+ # Don't care if the mailer can't send.
18
17
  config.action_mailer.raise_delivery_errors = false
19
18
 
20
- # Print deprecation notices to the Rails logger
19
+ # Print deprecation notices to the Rails logger.
21
20
  config.active_support.deprecation = :log
22
21
 
23
- # Only use best-standards-support built into browsers
24
- config.action_dispatch.best_standards_support = :builtin
25
- end
22
+ # Raise an error on page load if there are pending migrations.
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+
30
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
31
+ # yet still be able to expire them through the digest params.
32
+ config.assets.digest = true
26
33
 
34
+ # Adds additional error checking when serving assets at runtime.
35
+ # Checks for improperly declared sprockets dependencies.
36
+ # Raises helpful error messages.
37
+ config.assets.raise_runtime_errors = true
38
+
39
+ # Raises error for missing translations
40
+ # config.action_view.raise_on_missing_translations = true
41
+ end
@@ -1,49 +1,79 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
- # The production environment is meant for finished, "live" apps.
5
- # Code is not reloaded between requests
4
+ # Code is not reloaded between requests.
6
5
  config.cache_classes = true
7
6
 
8
- # Full error reports are disabled and caching is turned on
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both threaded web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
9
14
  config.consider_all_requests_local = false
10
15
  config.action_controller.perform_caching = true
11
16
 
12
- # Specifies the header that your server uses for sending files
13
- config.action_dispatch.x_sendfile_header = "X-Sendfile"
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like
20
+ # NGINX, varnish or squid.
21
+ # config.action_dispatch.rack_cache = true
14
22
 
15
- # For nginx:
16
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
17
26
 
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
27
+ # Compress JavaScripts and CSS.
28
+ config.assets.js_compressor = :uglifier
29
+ # config.assets.css_compressor = :sass
20
30
 
21
- # See everything in the log (default is :info)
22
- # config.log_level = :debug
31
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
32
+ config.assets.compile = false
23
33
 
24
- # Use a different logger for distributed setups
25
- # config.logger = SyslogLogger.new
34
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
35
+ # yet still be able to expire them through the digest params.
36
+ config.assets.digest = true
26
37
 
27
- # Use a different cache store in production
28
- # config.cache_store = :mem_cache_store
38
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
29
39
 
30
- # Disable Rails's static asset server
31
- # In production, Apache or nginx will already do this
32
- config.serve_static_assets = false
40
+ # Specifies the header that your server uses for sending files.
41
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
33
43
 
34
- # Enable serving of images, stylesheets, and javascripts from an asset server
35
- # config.action_controller.asset_host = "http://assets.example.com"
44
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
45
+ # config.force_ssl = true
36
46
 
37
- # Disable delivery errors, bad email addresses will be ignored
38
- # config.action_mailer.raise_delivery_errors = false
47
+ # Use the lowest log level to ensure availability of diagnostic information
48
+ # when problems arise.
49
+ config.log_level = :debug
39
50
 
40
- # Enable threaded mode
41
- # config.threadsafe!
51
+ # Prepend all log lines with the following tags.
52
+ # config.log_tags = [ :subdomain, :uuid ]
53
+
54
+ # Use a different logger for distributed setups.
55
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
56
+
57
+ # Use a different cache store in production.
58
+ # config.cache_store = :mem_cache_store
59
+
60
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
61
+ # config.action_controller.asset_host = 'http://assets.example.com'
62
+
63
+ # Ignore bad email addresses and do not raise email delivery errors.
64
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
65
+ # config.action_mailer.raise_delivery_errors = false
42
66
 
43
67
  # 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)
68
+ # the I18n.default_locale when a translation cannot be found).
45
69
  config.i18n.fallbacks = true
46
70
 
47
- # Send deprecation notices to registered listeners
71
+ # Send deprecation notices to registered listeners.
48
72
  config.active_support.deprecation = :notify
73
+
74
+ # Use default logging formatter so that PID and timestamp are not suppressed.
75
+ config.log_formatter = ::Logger::Formatter.new
76
+
77
+ # Do not dump schema after migrations.
78
+ config.active_record.dump_schema_after_migration = false
49
79
  end
@@ -1,35 +1,42 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
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
5
+ # test suite. You never need to work with it otherwise. Remember that
6
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!
7
+ # and recreated between test runs. Don't rely on the data there!
8
8
  config.cache_classes = true
9
9
 
10
- # Log error messages when you accidentally call methods on nil.
11
- config.whiny_nils = true
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
12
14
 
13
- # Show full error reports and disable caching
15
+ # Configure static file server for tests with Cache-Control for performance.
16
+ config.serve_static_files = true
17
+ config.static_cache_control = 'public, max-age=3600'
18
+
19
+ # Show full error reports and disable caching.
14
20
  config.consider_all_requests_local = true
15
21
  config.action_controller.perform_caching = false
16
22
 
17
- # Raise exceptions instead of rendering exception templates
23
+ # Raise exceptions instead of rendering exception templates.
18
24
  config.action_dispatch.show_exceptions = false
19
25
 
20
- # Disable request forgery protection in test environment
21
- config.action_controller.allow_forgery_protection = false
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
22
28
 
23
29
  # Tell Action Mailer not to deliver emails to the real world.
24
30
  # The :test delivery method accumulates sent emails in the
25
31
  # ActionMailer::Base.deliveries array.
26
32
  config.action_mailer.delivery_method = :test
27
33
 
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
34
+ # Randomize the order test cases are executed.
35
+ config.active_support.test_order = :random
32
36
 
33
- # Print deprecation notices to the stderr
37
+ # Print deprecation notices to the stderr.
34
38
  config.active_support.deprecation = :stderr
39
+
40
+ # Raises error for missing translations
41
+ # config.action_view.raise_on_missing_translations = true
35
42
  end