Permalink
Browse files

Adds rails 4 support. Switch client-side to coffee script. Bump versi…

…on since these changes are incompatible. Adds coffeescript support in generator
  • Loading branch information...
1 parent f8c8dc0 commit 76646fcf49dda79d5878a3733dea95849b9c95f2 @elthariel elthariel committed Oct 26, 2013
View
@@ -1,98 +1,95 @@
PATH
remote: .
specs:
- rails-client-logger (0.0.2)
- rails (>= 3.1)
+ rails-client-logger (1.0.0)
+ rails (>= 4.0)
GEM
remote: http://rubygems.org/
specs:
- actionmailer (3.2.11)
- actionpack (= 3.2.11)
- mail (~> 2.4.4)
- actionpack (3.2.11)
- activemodel (= 3.2.11)
- activesupport (= 3.2.11)
- builder (~> 3.0.0)
+ actionmailer (4.0.0)
+ actionpack (= 4.0.0)
+ mail (~> 2.5.3)
+ actionpack (4.0.0)
+ activesupport (= 4.0.0)
+ builder (~> 3.1.0)
erubis (~> 2.7.0)
- journey (~> 1.0.4)
- rack (~> 1.4.0)
- rack-cache (~> 1.2)
- rack-test (~> 0.6.1)
- sprockets (~> 2.2.1)
- activemodel (3.2.11)
- activesupport (= 3.2.11)
- builder (~> 3.0.0)
- activerecord (3.2.11)
- activemodel (= 3.2.11)
- activesupport (= 3.2.11)
- arel (~> 3.0.2)
- tzinfo (~> 0.3.29)
- activeresource (3.2.11)
- activemodel (= 3.2.11)
- activesupport (= 3.2.11)
- activesupport (3.2.11)
- i18n (~> 0.6)
- multi_json (~> 1.0)
- arel (3.0.2)
- builder (3.0.4)
+ rack (~> 1.5.2)
+ rack-test (~> 0.6.2)
+ activemodel (4.0.0)
+ activesupport (= 4.0.0)
+ builder (~> 3.1.0)
+ activerecord (4.0.0)
+ activemodel (= 4.0.0)
+ activerecord-deprecated_finders (~> 1.0.2)
+ activesupport (= 4.0.0)
+ arel (~> 4.0.0)
+ activerecord-deprecated_finders (1.0.3)
+ activesupport (4.0.0)
+ i18n (~> 0.6, >= 0.6.4)
+ minitest (~> 4.2)
+ multi_json (~> 1.3)
+ thread_safe (~> 0.1)
+ tzinfo (~> 0.3.37)
+ arel (4.0.1)
+ atomic (1.1.14)
+ builder (3.1.4)
erubis (2.7.0)
- hike (1.2.1)
- i18n (0.6.1)
- journey (1.0.4)
+ hike (1.2.3)
+ i18n (0.6.5)
jquery-rails (2.2.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
- json (1.7.6)
- mail (2.4.4)
- i18n (>= 0.4.0)
+ mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
- mime-types (1.20.1)
- multi_json (1.5.0)
+ mime-types (1.25)
+ minitest (4.7.5)
+ multi_json (1.8.2)
polyglot (0.3.3)
- rack (1.4.4)
- rack-cache (1.2)
- rack (>= 0.4)
- rack-ssl (1.3.3)
- rack
+ protected_attributes (1.0.3)
+ activemodel (>= 4.0.0, < 5.0)
+ rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
- rails (3.2.11)
- actionmailer (= 3.2.11)
- actionpack (= 3.2.11)
- activerecord (= 3.2.11)
- activeresource (= 3.2.11)
- activesupport (= 3.2.11)
- bundler (~> 1.0)
- railties (= 3.2.11)
- railties (3.2.11)
- actionpack (= 3.2.11)
- activesupport (= 3.2.11)
- rack-ssl (~> 1.3.2)
+ rails (4.0.0)
+ actionmailer (= 4.0.0)
+ actionpack (= 4.0.0)
+ activerecord (= 4.0.0)
+ activesupport (= 4.0.0)
+ bundler (>= 1.3.0, < 2.0)
+ railties (= 4.0.0)
+ sprockets-rails (~> 2.0.0)
+ railties (4.0.0)
+ actionpack (= 4.0.0)
+ activesupport (= 4.0.0)
rake (>= 0.8.7)
- rdoc (~> 3.4)
- thor (>= 0.14.6, < 2.0)
- rake (10.0.3)
- rdoc (3.12)
- json (~> 1.4)
- sprockets (2.2.2)
+ thor (>= 0.18.1, < 2.0)
+ rake (10.1.0)
+ sprockets (2.10.0)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
+ sprockets-rails (2.0.1)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ sprockets (~> 2.8)
sqlite3 (1.3.7)
- thor (0.17.0)
- tilt (1.3.3)
- treetop (1.4.12)
+ thor (0.18.1)
+ thread_safe (0.1.3)
+ atomic
+ tilt (1.4.1)
+ treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
- tzinfo (0.3.35)
+ tzinfo (0.3.38)
PLATFORMS
ruby
DEPENDENCIES
jquery-rails
+ protected_attributes
rails-client-logger!
sqlite3
View
@@ -1,3 +1,8 @@
+# About this fork
+
+This forks adds Rails 4 support (permitted parameters) as well as a
+CoffeeScript implementation of the client-side code.
+
# What is that for?
Rails engine to log from Client side (Browser) javascript to server log file. To catch those nasty production Javascript errors. Provides a variety of safe logging functions e.g. jsLogger.debug(), jsLogger.error().
@@ -11,7 +16,7 @@ Add this line to your application's Gemfile:
```ruby
gem 'rails-client-logger'
```
-
+
And then execute:
```bash
@@ -32,7 +37,7 @@ $ rails g rails_client_logger
jsLogger.info("simple info message");
jsLogger.warn("a warning");
```
-
+
### Log Error
```ruby
@@ -8,5 +8,9 @@ def log
head :bad_request
end
end
+
+ def log_params
+ params.permit(:level, :message)
+ end
end
end
@@ -1,19 +1,34 @@
class RailsClientLoggerGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
-
+
desc "inserts required routes and requires the javascript files"
def generate
# add route
route(%Q{mount RailsClientLogger::Engine, :at => "logger"})
-
+
+ mode = :coffee
+ if File.exists? "app/assets/javascripts/application.js.coffee"
+ path = "app/assets/javascripts/application.js.coffee"
+ elsif File.exists? "app/assets/javascripts/application.coffee"
+ path = "app/assets/javascripts/application.coffee"
+ elsif File.exists? "app/assets/javascripts/application.js"
+ mode = :js
+ path = "app/assets/javascripts/application.js"
+ end
+
# add to application.js manifest
- original_js = File.binread("app/assets/javascripts/application.js")
- if original_js.include?("require rails_client_logger")
- say_status("skipped", "insert into app/assets/javascripts/application.js", :yellow)
+ original = File.binread(path)
+ if original.include?("require rails_client_logger")
+ say_status("skipped", "insert into #{path}", :yellow)
else
- insert_into_file "app/assets/javascripts/application.js", :after => %r{//= require ['"]?jquery['"]?\s*$} do
+ if mode == :coffee
+ insert_into_file path, :after => %r{#= require ['"]?jquery['"]?\s*$} do
+ "\n#= require rails_client_logger"
+ else
+ insert_into_file path, :after => %r{//= require ['"]?jquery['"]?\s*$} do
"\n//= require rails_client_logger"
- end
+ end
+ end
end
end
end
@@ -1,3 +1,3 @@
module RailsClientLogger
- VERSION = "0.0.2"
+ VERSION = "1.0.0"
end
@@ -7,17 +7,18 @@ require "rails-client-logger/version"
Gem::Specification.new do |s|
s.name = "rails-client-logger"
s.version = RailsClientLogger::VERSION
- s.authors = ["Girish Sonawane"]
- s.email = ["girish.sonawane@gmail.com"]
+ s.authors = ["Girish Sonawane", "Julien 'Lta' Ballet"]
+ s.email = ["girish.sonawane@gmail.com", "elthariel@gmail.com"]
s.homepage = "https://github.com/girishso/rails-client-logger"
s.summary = "Rails engine for logging from Browser Javascript to server"
s.description = "Rails engine for logging from Browser Javascript to server"
s.files = Dir["{app,config,db,lib,vendor}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.md"]
s.test_files = Dir["test/**/*"]
- s.add_dependency "rails", ">= 3.1"
+ s.add_dependency "rails", ">= 4.0"
# s.add_dependency "jquery-rails"
s.add_development_dependency "sqlite3"
+ s.add_development_dependency "protected_attributes"
end
@@ -54,6 +54,8 @@ class Application < Rails::Application
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
+
+ config.secret_key_base = "ThisIsADummyAppSoLeaveMeAlone"
end
end
@@ -11,9 +11,6 @@
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
- # Log error messages when you accidentally call methods on nil
- config.whiny_nils = true
-
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
@@ -30,8 +27,11 @@
config.action_mailer.delivery_method = :test
# Raise exception on mass assignment protection for Active Record models
- config.active_record.mass_assignment_sanitizer = :strict
+ # config.active_record.mass_assignment_sanitizer = :strict
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
+
+ # Rails 4 new stuff
+ config.eager_load = false
end
View
No changes.
@@ -6,6 +6,6 @@ class JsLoggersControllerTest < ActionController::TestCase
get :log
assert_response :success
end
-
+
end
end

0 comments on commit 76646fc

Please sign in to comment.