google_visualr 2.0.6 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/Gemfile.lock +67 -1
  2. data/README.rdoc +7 -2
  3. data/google_visualr.gemspec +1 -0
  4. data/lib/google_visualr.rb +3 -0
  5. data/lib/google_visualr/app/helpers/view_helper.rb +23 -0
  6. data/lib/google_visualr/app/railtie.rb +19 -0
  7. data/lib/google_visualr/version.rb +1 -1
  8. data/spec/dummy/Gemfile +0 -0
  9. data/spec/dummy/Gemfile.lock +7 -0
  10. data/spec/dummy/Rakefile +7 -0
  11. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  12. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  13. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  14. data/spec/dummy/config.ru +4 -0
  15. data/spec/dummy/config/application.rb +38 -0
  16. data/spec/dummy/config/boot.rb +6 -0
  17. data/spec/dummy/config/database.yml +22 -0
  18. data/spec/dummy/config/environment.rb +5 -0
  19. data/spec/dummy/config/environments/development.rb +26 -0
  20. data/spec/dummy/config/environments/production.rb +49 -0
  21. data/spec/dummy/config/environments/test.rb +35 -0
  22. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  23. data/spec/dummy/config/initializers/inflections.rb +10 -0
  24. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  25. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  26. data/spec/dummy/config/initializers/session_store.rb +8 -0
  27. data/spec/dummy/config/locales/en.yml +5 -0
  28. data/spec/dummy/config/routes.rb +58 -0
  29. data/spec/dummy/db/seeds.rb +7 -0
  30. data/spec/dummy/doc/README_FOR_APP +2 -0
  31. data/spec/dummy/lib/tasks/.gitkeep +0 -0
  32. data/spec/dummy/log/development.log +0 -0
  33. data/spec/dummy/log/production.log +0 -0
  34. data/spec/dummy/log/server.log +0 -0
  35. data/spec/dummy/log/test.log +0 -0
  36. data/spec/dummy/public/404.html +26 -0
  37. data/spec/dummy/public/422.html +26 -0
  38. data/spec/dummy/public/500.html +26 -0
  39. data/spec/dummy/public/favicon.ico +0 -0
  40. data/spec/dummy/public/images/rails.png +0 -0
  41. data/spec/dummy/public/index.html +239 -0
  42. data/spec/dummy/public/javascripts/application.js +2 -0
  43. data/spec/dummy/public/javascripts/controls.js +965 -0
  44. data/spec/dummy/public/javascripts/dragdrop.js +974 -0
  45. data/spec/dummy/public/javascripts/effects.js +1123 -0
  46. data/spec/dummy/public/javascripts/prototype.js +6001 -0
  47. data/spec/dummy/public/javascripts/rails.js +191 -0
  48. data/spec/dummy/public/robots.txt +5 -0
  49. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  50. data/spec/dummy/script/rails +6 -0
  51. data/spec/dummy/test/performance/browsing_test.rb +9 -0
  52. data/spec/dummy/test/test_helper.rb +13 -0
  53. data/spec/dummy/vendor/plugins/.gitkeep +0 -0
  54. data/spec/google_visualr/app/helpers/view_helper_spec.rb +23 -0
  55. data/spec/google_visualr/base_chart_spec.rb +3 -27
  56. data/spec/google_visualr/formatters_spec.rb +1 -0
  57. data/spec/spec_helper.rb +7 -2
  58. data/spec/support/common.rb +33 -0
  59. metadata +63 -2
data/Gemfile.lock CHANGED
@@ -1,12 +1,72 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- google_visualr (2.0.5)
4
+ google_visualr (2.1.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
+ abstract (1.0.0)
10
+ actionmailer (3.0.9)
11
+ actionpack (= 3.0.9)
12
+ mail (~> 2.2.19)
13
+ actionpack (3.0.9)
14
+ activemodel (= 3.0.9)
15
+ activesupport (= 3.0.9)
16
+ builder (~> 2.1.2)
17
+ erubis (~> 2.6.6)
18
+ i18n (~> 0.5.0)
19
+ rack (~> 1.2.1)
20
+ rack-mount (~> 0.6.14)
21
+ rack-test (~> 0.5.7)
22
+ tzinfo (~> 0.3.23)
23
+ activemodel (3.0.9)
24
+ activesupport (= 3.0.9)
25
+ builder (~> 2.1.2)
26
+ i18n (~> 0.5.0)
27
+ activerecord (3.0.9)
28
+ activemodel (= 3.0.9)
29
+ activesupport (= 3.0.9)
30
+ arel (~> 2.0.10)
31
+ tzinfo (~> 0.3.23)
32
+ activeresource (3.0.9)
33
+ activemodel (= 3.0.9)
34
+ activesupport (= 3.0.9)
35
+ activesupport (3.0.9)
36
+ arel (2.0.10)
37
+ builder (2.1.2)
9
38
  diff-lcs (1.1.2)
39
+ erubis (2.6.6)
40
+ abstract (>= 1.0.0)
41
+ i18n (0.5.0)
42
+ mail (2.2.19)
43
+ activesupport (>= 2.3.6)
44
+ i18n (>= 0.4.0)
45
+ mime-types (~> 1.16)
46
+ treetop (~> 1.4.8)
47
+ mime-types (1.16)
48
+ polyglot (0.3.2)
49
+ rack (1.2.3)
50
+ rack-mount (0.6.14)
51
+ rack (>= 1.0.0)
52
+ rack-test (0.5.7)
53
+ rack (>= 1.0)
54
+ rails (3.0.9)
55
+ actionmailer (= 3.0.9)
56
+ actionpack (= 3.0.9)
57
+ activerecord (= 3.0.9)
58
+ activeresource (= 3.0.9)
59
+ activesupport (= 3.0.9)
60
+ bundler (~> 1.0)
61
+ railties (= 3.0.9)
62
+ railties (3.0.9)
63
+ actionpack (= 3.0.9)
64
+ activesupport (= 3.0.9)
65
+ rake (>= 0.8.7)
66
+ rdoc (~> 3.4)
67
+ thor (~> 0.14.4)
68
+ rake (0.9.2)
69
+ rdoc (3.9.2)
10
70
  rspec (2.6.0)
11
71
  rspec-core (~> 2.6.0)
12
72
  rspec-expectations (~> 2.6.0)
@@ -15,6 +75,11 @@ GEM
15
75
  rspec-expectations (2.6.0)
16
76
  diff-lcs (~> 1.1.2)
17
77
  rspec-mocks (2.6.0)
78
+ thor (0.14.6)
79
+ treetop (1.4.10)
80
+ polyglot
81
+ polyglot (>= 0.3.1)
82
+ tzinfo (0.3.29)
18
83
 
19
84
  PLATFORMS
20
85
  ruby
@@ -22,4 +87,5 @@ PLATFORMS
22
87
  DEPENDENCIES
23
88
  bundler (>= 1.0.15)
24
89
  google_visualr!
90
+ rails (>= 3.0.9)
25
91
  rspec (>= 2.6.0)
data/README.rdoc CHANGED
@@ -43,7 +43,7 @@ For example, Methods and Events as described in Google Chart Tools' API Docs, fo
43
43
 
44
44
  Assuming you are on Rails 3, include the gem in your Gemfile.
45
45
 
46
- gem "google_visualr", ">= 2.0"
46
+ gem "google_visualr", ">= 2.1"
47
47
 
48
48
  = Basics
49
49
 
@@ -84,7 +84,7 @@ Create a GoogleVisualr::AreaChart with data_table and configuration options.
84
84
  In your Rails view, render the Google chart.
85
85
 
86
86
  <div id='chart'></div>
87
- <%= raw @chart.to_js('chart') %>
87
+ <%= render_chart(@chart, 'chart') %>
88
88
 
89
89
  = Support
90
90
 
@@ -92,6 +92,11 @@ Please feel free to fork the project, make improvements or bug fixes and submit
92
92
 
93
93
  Please submit all feedback, bugs and feature-requests to {GitHub Issues Tracker}[http://github.com/winston/google_visualr/issues].
94
94
 
95
+ = Change Log
96
+
97
+ *Version 2.1.0*
98
+ * Added `#render_chart` as a helper method in Rails views.
99
+
95
100
  = Author
96
101
 
97
102
  GoogleVisualr is maintained by {Winston Teo}[mailto:winstonyw+googlevisualr@gmail.com].
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
 
18
18
  s.add_development_dependency "bundler", ">= 1.0.15"
19
19
  s.add_development_dependency "rspec" , ">= 2.6.0"
20
+ s.add_development_dependency "rails" , ">= 3.0.9"
20
21
 
21
22
  s.files = `git ls-files`.split("\n")
22
23
  s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
@@ -38,3 +38,6 @@ require "#{lib_path}/google_visualr/interactive/org_chart"
38
38
  # Image Charts
39
39
  require "#{lib_path}/google_visualr/image/spark_line"
40
40
 
41
+
42
+ # Rails Helper
43
+ require "#{lib_path}/google_visualr/app/railtie.rb" if defined?(Rails)
@@ -0,0 +1,23 @@
1
+ module GoogleVisualr
2
+
3
+ module Rails
4
+
5
+ module ViewHelper
6
+
7
+ extend ActiveSupport::Concern
8
+
9
+ included do
10
+ helper_method "render_chart"
11
+ end
12
+
13
+ module InstanceMethods
14
+ def render_chart(chart, dom)
15
+ chart.to_js(dom).html_safe
16
+ end
17
+ end
18
+
19
+ end
20
+
21
+ end
22
+
23
+ end
@@ -0,0 +1,19 @@
1
+ require "#{File.dirname(__FILE__)}/helpers/view_helper"
2
+
3
+ module GoogleVisualr
4
+
5
+ module Rails
6
+
7
+ class Railtie < ::Rails::Railtie
8
+
9
+ initializer "google_visualr" do
10
+ ActiveSupport.on_load(:action_controller) do
11
+ include GoogleVisualr::Rails::ViewHelper
12
+ end
13
+ end
14
+
15
+ end
16
+
17
+ end
18
+
19
+ end
@@ -1,3 +1,3 @@
1
1
  module GoogleVisualr
2
- VERSION = "2.0.6"
2
+ VERSION = "2.1.0"
3
3
  end
File without changes
@@ -0,0 +1,7 @@
1
+ GEM
2
+ specs:
3
+
4
+ PLATFORMS
5
+ ruby
6
+
7
+ DEPENDENCIES
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag :all %>
6
+ <%= javascript_include_tag :defaults %>
7
+ <%= csrf_meta_tag %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,38 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require
6
+ require "google_visualr"
7
+
8
+ module Dummy
9
+ class Application < Rails::Application
10
+ # Settings in config/environments/* take precedence over those specified here.
11
+ # Application configuration should go into files in config/initializers
12
+ # -- all .rb files in that directory are automatically loaded.
13
+
14
+ # Custom directories with classes and modules you want to be autoloadable.
15
+ # config.autoload_paths += %W(#{config.root}/extras)
16
+
17
+ # Only load the plugins named here, in the order given (default is alphabetical).
18
+ # :all can be used as a placeholder for all plugins not explicitly named.
19
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
20
+
21
+ # Activate observers that should always be running.
22
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
23
+
24
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
26
+ # config.time_zone = 'Central Time (US & Canada)'
27
+
28
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
29
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30
+ # config.i18n.default_locale = :de
31
+
32
+ # Configure the default encoding used in templates for Ruby 1.9.
33
+ config.encoding = "utf-8"
34
+
35
+ # Configure sensitive parameters which will be filtered from the log file.
36
+ config.filter_parameters += [:password]
37
+ end
38
+ end
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,22 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
@@ -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!