rjson 0.1.3 → 0.1.4

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 (48) hide show
  1. data/Gemfile +16 -0
  2. data/Gemfile.lock +126 -0
  3. data/Rakefile +23 -8
  4. data/VERSION +1 -1
  5. data/lib/rjson/handler.rb +12 -11
  6. data/rjson.gemspec +82 -12
  7. data/test/dummy/Rakefile +7 -0
  8. data/test/dummy/app/assets/javascripts/application.js +9 -0
  9. data/test/dummy/app/assets/stylesheets/application.css +7 -0
  10. data/test/dummy/app/controllers/application_controller.rb +3 -0
  11. data/test/dummy/app/controllers/people_controller.rb +7 -0
  12. data/test/dummy/app/helpers/application_helper.rb +2 -0
  13. data/test/dummy/app/mailers/.gitkeep +0 -0
  14. data/test/dummy/app/models/.gitkeep +0 -0
  15. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  16. data/test/dummy/app/views/people/_person.json.rjson +4 -0
  17. data/test/dummy/app/views/people/index.json.rjson +3 -0
  18. data/test/dummy/app/views/people/show.json.rjson +1 -0
  19. data/test/dummy/config.ru +4 -0
  20. data/test/dummy/config/application.rb +45 -0
  21. data/test/dummy/config/boot.rb +10 -0
  22. data/test/dummy/config/database.yml +25 -0
  23. data/test/dummy/config/environment.rb +5 -0
  24. data/test/dummy/config/environments/development.rb +30 -0
  25. data/test/dummy/config/environments/production.rb +60 -0
  26. data/test/dummy/config/environments/test.rb +42 -0
  27. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  28. data/test/dummy/config/initializers/inflections.rb +10 -0
  29. data/test/dummy/config/initializers/mime_types.rb +5 -0
  30. data/test/dummy/config/initializers/secret_token.rb +7 -0
  31. data/test/dummy/config/initializers/session_store.rb +8 -0
  32. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  33. data/test/dummy/config/locales/en.yml +5 -0
  34. data/test/dummy/config/routes.rb +3 -0
  35. data/test/dummy/db/development.sqlite3 +0 -0
  36. data/test/dummy/db/test.sqlite3 +0 -0
  37. data/test/dummy/lib/assets/.gitkeep +0 -0
  38. data/test/dummy/log/.gitkeep +0 -0
  39. data/test/dummy/log/development.log +16 -0
  40. data/test/dummy/log/test.log +106 -0
  41. data/test/dummy/public/404.html +26 -0
  42. data/test/dummy/public/422.html +26 -0
  43. data/test/dummy/public/500.html +26 -0
  44. data/test/dummy/public/favicon.ico +0 -0
  45. data/test/dummy/script/rails +6 -0
  46. data/test/rjson_test.rb +27 -0
  47. data/test/test_helper.rb +19 -0
  48. metadata +173 -57
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in rjson.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gem 'jeweler'
7
+
8
+ gemspec
9
+
10
+ # Declare any dependencies that are still in development here instead of in
11
+ # your gemspec. These might include edge Rails or gems from your path or
12
+ # Git. Remember to move these dependencies to your gemspec before releasing
13
+ # your gem to rubygems.org.
14
+
15
+ # To use debugger
16
+ # gem 'ruby-debug19', :require => 'ruby-debug'
@@ -0,0 +1,126 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rjson (0.1.4)
5
+ jeweler
6
+ rails (< 3.2.0, > 3.0.0)
7
+ rjson
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ actionmailer (3.1.0)
13
+ actionpack (= 3.1.0)
14
+ mail (~> 2.3.0)
15
+ actionpack (3.1.0)
16
+ activemodel (= 3.1.0)
17
+ activesupport (= 3.1.0)
18
+ builder (~> 3.0.0)
19
+ erubis (~> 2.7.0)
20
+ i18n (~> 0.6)
21
+ rack (~> 1.3.2)
22
+ rack-cache (~> 1.0.3)
23
+ rack-mount (~> 0.8.2)
24
+ rack-test (~> 0.6.1)
25
+ sprockets (~> 2.0.0)
26
+ activemodel (3.1.0)
27
+ activesupport (= 3.1.0)
28
+ bcrypt-ruby (~> 3.0.0)
29
+ builder (~> 3.0.0)
30
+ i18n (~> 0.6)
31
+ activerecord (3.1.0)
32
+ activemodel (= 3.1.0)
33
+ activesupport (= 3.1.0)
34
+ arel (~> 2.2.1)
35
+ tzinfo (~> 0.3.29)
36
+ activeresource (3.1.0)
37
+ activemodel (= 3.1.0)
38
+ activesupport (= 3.1.0)
39
+ activesupport (3.1.0)
40
+ multi_json (~> 1.0)
41
+ arel (2.2.1)
42
+ bcrypt-ruby (3.0.1)
43
+ builder (3.0.0)
44
+ capybara (1.1.1)
45
+ mime-types (>= 1.16)
46
+ nokogiri (>= 1.3.3)
47
+ rack (>= 1.0.0)
48
+ rack-test (>= 0.5.4)
49
+ selenium-webdriver (~> 2.0)
50
+ xpath (~> 0.1.4)
51
+ childprocess (0.2.2)
52
+ ffi (~> 1.0.6)
53
+ erubis (2.7.0)
54
+ ffi (1.0.9)
55
+ git (1.2.5)
56
+ hike (1.2.1)
57
+ i18n (0.6.0)
58
+ jeweler (1.6.4)
59
+ bundler (~> 1.0)
60
+ git (>= 1.2.5)
61
+ rake
62
+ json_pure (1.5.4)
63
+ spruz (~> 0.2.8)
64
+ mail (2.3.0)
65
+ i18n (>= 0.4.0)
66
+ mime-types (~> 1.16)
67
+ treetop (~> 1.4.8)
68
+ mime-types (1.16)
69
+ multi_json (1.0.3)
70
+ nokogiri (1.5.0)
71
+ polyglot (0.3.2)
72
+ rack (1.3.3)
73
+ rack-cache (1.0.3)
74
+ rack (>= 0.4)
75
+ rack-mount (0.8.3)
76
+ rack (>= 1.0.0)
77
+ rack-ssl (1.3.2)
78
+ rack
79
+ rack-test (0.6.1)
80
+ rack (>= 1.0)
81
+ rails (3.1.0)
82
+ actionmailer (= 3.1.0)
83
+ actionpack (= 3.1.0)
84
+ activerecord (= 3.1.0)
85
+ activeresource (= 3.1.0)
86
+ activesupport (= 3.1.0)
87
+ bundler (~> 1.0)
88
+ railties (= 3.1.0)
89
+ railties (3.1.0)
90
+ actionpack (= 3.1.0)
91
+ activesupport (= 3.1.0)
92
+ rack-ssl (~> 1.3.2)
93
+ rake (>= 0.8.7)
94
+ rdoc (~> 3.4)
95
+ thor (~> 0.14.6)
96
+ rake (0.9.2)
97
+ rdoc (3.9.4)
98
+ rubyzip (0.9.4)
99
+ selenium-webdriver (2.5.0)
100
+ childprocess (>= 0.2.1)
101
+ ffi (>= 1.0.7)
102
+ json_pure
103
+ rubyzip
104
+ sprockets (2.0.0)
105
+ hike (~> 1.2)
106
+ rack (~> 1.0)
107
+ tilt (!= 1.3.0, ~> 1.1)
108
+ spruz (0.2.13)
109
+ sqlite3 (1.3.4)
110
+ thor (0.14.6)
111
+ tilt (1.3.3)
112
+ treetop (1.4.10)
113
+ polyglot
114
+ polyglot (>= 0.3.1)
115
+ tzinfo (0.3.29)
116
+ xpath (0.1.4)
117
+ nokogiri (~> 1.3)
118
+
119
+ PLATFORMS
120
+ ruby
121
+
122
+ DEPENDENCIES
123
+ capybara
124
+ jeweler
125
+ rjson!
126
+ sqlite3
data/Rakefile CHANGED
@@ -1,6 +1,11 @@
1
- require 'rake'
2
- require 'jeweler'
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
3
7
 
8
+ require 'jeweler'
4
9
  Jeweler::Tasks.new do |gem|
5
10
  gem.name = "rjson"
6
11
  gem.homepage = "http://github.com/DefV/rjson"
@@ -9,13 +14,23 @@ Jeweler::Tasks.new do |gem|
9
14
  gem.description = %Q{Template Handler for JSON}
10
15
  gem.email = "jan@sumocoders.be"
11
16
  gem.authors = ["Jan De Poorter"]
12
- gem.add_runtime_dependency 'actionpack', ['> 3.0.0', '< 3.2.0']
17
+
18
+ gem.add_runtime_dependency 'rails', ['> 3.0.0', '< 3.2.0']
19
+
20
+ gem.add_development_dependency "sqlite3"
21
+ gem.add_development_dependency "capybara"
13
22
  end
14
23
  Jeweler::RubygemsDotOrgTasks.new
15
24
 
25
+ Bundler::GemHelper.install_tasks
26
+
16
27
  require 'rake/testtask'
17
- Rake::TestTask.new(:test) do |test|
18
- test.libs << 'lib' << 'test'
19
- test.pattern = 'test/**/test_*.rb'
20
- test.verbose = true
21
- end
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'lib'
31
+ t.libs << 'test'
32
+ t.pattern = 'test/**/*_test.rb'
33
+ t.verbose = false
34
+ end
35
+
36
+ task :default => :test
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -2,19 +2,20 @@ require 'action_view/template'
2
2
  require 'rjson/string'
3
3
 
4
4
  module RJSON
5
- class Handler < ActionView::TemplateHandler
6
- include ActionView::Template::Handlers::Compilable
7
-
5
+ class Handler
6
+ class_attribute :default_format
8
7
  self.default_format = Mime::JSON
9
8
 
10
- def compile(template)
11
- <<-COMPILED_METHOD
12
- contents=begin;
13
- #{template.source}
14
- end
9
+ class << self
10
+ def call(template)
11
+ <<-COMPILED_METHOD
12
+ contents=begin;
13
+ #{template.source}
14
+ end
15
15
 
16
- RJSON::String.new(contents.to_json)
17
- COMPILED_METHOD
16
+ RJSON::String.new(contents.to_json)
17
+ COMPILED_METHOD
18
+ end
18
19
  end
19
20
  end
20
- end
21
+ end
@@ -4,19 +4,21 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{rjson}
8
- s.version = "0.1.3"
7
+ s.name = "rjson"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jan De Poorter"]
12
- s.date = %q{2011-03-29}
13
- s.description = %q{Template Handler for JSON}
14
- s.email = %q{jan@sumocoders.be}
12
+ s.date = "2011-09-27"
13
+ s.description = "Template Handler for JSON"
14
+ s.email = "jan@sumocoders.be"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
17
  "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
+ "Gemfile",
21
+ "Gemfile.lock",
20
22
  "LICENSE.txt",
21
23
  "README.rdoc",
22
24
  "Rakefile",
@@ -25,24 +27,92 @@ Gem::Specification.new do |s|
25
27
  "lib/rjson/handler.rb",
26
28
  "lib/rjson/railtie.rb",
27
29
  "lib/rjson/string.rb",
28
- "rjson.gemspec"
30
+ "rjson.gemspec",
31
+ "test/dummy/Rakefile",
32
+ "test/dummy/app/assets/javascripts/application.js",
33
+ "test/dummy/app/assets/stylesheets/application.css",
34
+ "test/dummy/app/controllers/application_controller.rb",
35
+ "test/dummy/app/controllers/people_controller.rb",
36
+ "test/dummy/app/helpers/application_helper.rb",
37
+ "test/dummy/app/mailers/.gitkeep",
38
+ "test/dummy/app/models/.gitkeep",
39
+ "test/dummy/app/views/layouts/application.html.erb",
40
+ "test/dummy/app/views/people/_person.json.rjson",
41
+ "test/dummy/app/views/people/index.json.rjson",
42
+ "test/dummy/app/views/people/show.json.rjson",
43
+ "test/dummy/config.ru",
44
+ "test/dummy/config/application.rb",
45
+ "test/dummy/config/boot.rb",
46
+ "test/dummy/config/database.yml",
47
+ "test/dummy/config/environment.rb",
48
+ "test/dummy/config/environments/development.rb",
49
+ "test/dummy/config/environments/production.rb",
50
+ "test/dummy/config/environments/test.rb",
51
+ "test/dummy/config/initializers/backtrace_silencers.rb",
52
+ "test/dummy/config/initializers/inflections.rb",
53
+ "test/dummy/config/initializers/mime_types.rb",
54
+ "test/dummy/config/initializers/secret_token.rb",
55
+ "test/dummy/config/initializers/session_store.rb",
56
+ "test/dummy/config/initializers/wrap_parameters.rb",
57
+ "test/dummy/config/locales/en.yml",
58
+ "test/dummy/config/routes.rb",
59
+ "test/dummy/db/development.sqlite3",
60
+ "test/dummy/db/test.sqlite3",
61
+ "test/dummy/lib/assets/.gitkeep",
62
+ "test/dummy/log/.gitkeep",
63
+ "test/dummy/log/development.log",
64
+ "test/dummy/log/test.log",
65
+ "test/dummy/public/404.html",
66
+ "test/dummy/public/422.html",
67
+ "test/dummy/public/500.html",
68
+ "test/dummy/public/favicon.ico",
69
+ "test/dummy/script/rails",
70
+ "test/rjson_test.rb",
71
+ "test/test_helper.rb"
29
72
  ]
30
- s.homepage = %q{http://github.com/DefV/rjson}
73
+ s.homepage = "http://github.com/DefV/rjson"
31
74
  s.licenses = ["MIT"]
32
75
  s.require_paths = ["lib"]
33
- s.rubygems_version = %q{1.6.2}
34
- s.summary = %q{Template Handler for JSON}
76
+ s.rubygems_version = "1.8.10"
77
+ s.summary = "Template Handler for JSON"
35
78
 
36
79
  if s.respond_to? :specification_version then
37
80
  s.specification_version = 3
38
81
 
39
82
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
40
- s.add_runtime_dependency(%q<actionpack>, ["< 3.2.0", "> 3.0.0"])
83
+ s.add_runtime_dependency(%q<jeweler>, [">= 0"])
84
+ s.add_runtime_dependency(%q<rjson>, [">= 0"])
85
+ s.add_development_dependency(%q<capybara>, [">= 0"])
86
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
87
+ s.add_development_dependency(%q<capybara>, [">= 0"])
88
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
89
+ s.add_development_dependency(%q<capybara>, [">= 0"])
90
+ s.add_runtime_dependency(%q<rails>, ["< 3.2.0", "> 3.0.0"])
91
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
92
+ s.add_development_dependency(%q<capybara>, [">= 0"])
41
93
  else
42
- s.add_dependency(%q<actionpack>, ["< 3.2.0", "> 3.0.0"])
94
+ s.add_dependency(%q<jeweler>, [">= 0"])
95
+ s.add_dependency(%q<rjson>, [">= 0"])
96
+ s.add_dependency(%q<capybara>, [">= 0"])
97
+ s.add_dependency(%q<sqlite3>, [">= 0"])
98
+ s.add_dependency(%q<capybara>, [">= 0"])
99
+ s.add_dependency(%q<sqlite3>, [">= 0"])
100
+ s.add_dependency(%q<capybara>, [">= 0"])
101
+ s.add_dependency(%q<rails>, ["< 3.2.0", "> 3.0.0"])
102
+ s.add_dependency(%q<sqlite3>, [">= 0"])
103
+ s.add_dependency(%q<capybara>, [">= 0"])
43
104
  end
44
105
  else
45
- s.add_dependency(%q<actionpack>, ["< 3.2.0", "> 3.0.0"])
106
+ s.add_dependency(%q<jeweler>, [">= 0"])
107
+ s.add_dependency(%q<rjson>, [">= 0"])
108
+ s.add_dependency(%q<capybara>, [">= 0"])
109
+ s.add_dependency(%q<sqlite3>, [">= 0"])
110
+ s.add_dependency(%q<capybara>, [">= 0"])
111
+ s.add_dependency(%q<sqlite3>, [">= 0"])
112
+ s.add_dependency(%q<capybara>, [">= 0"])
113
+ s.add_dependency(%q<rails>, ["< 3.2.0", "> 3.0.0"])
114
+ s.add_dependency(%q<sqlite3>, [">= 0"])
115
+ s.add_dependency(%q<capybara>, [">= 0"])
46
116
  end
47
117
  end
48
118
 
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,9 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery_ujs
9
+ //= require_tree .
@@ -0,0 +1,7 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *= require_self
6
+ *= require_tree .
7
+ */
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,7 @@
1
+ class PeopleController < ApplicationController
2
+ respond_to :json
3
+ layout false
4
+
5
+ def show
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,4 @@
1
+ {
2
+ first_name: "Jan",
3
+ last_name: "De Poorter"
4
+ }
@@ -0,0 +1,3 @@
1
+ 3.times.map do
2
+ render 'person'
3
+ end
@@ -0,0 +1 @@
1
+ render 'person'
@@ -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,45 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require
6
+ require "rjson"
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
+
38
+ # Enable the asset pipeline
39
+ config.assets.enabled = true
40
+
41
+ # Version of your assets, change this if you want to expire all your assets
42
+ config.assets.version = '1.0'
43
+ end
44
+ end
45
+