Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
10 changed files
with
107 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,98 +1,95 @@ | |||
PATH | PATH | ||
remote: . | remote: . | ||
specs: | specs: | ||
rails-client-logger (0.0.2) | rails-client-logger (1.0.0) | ||
rails (>= 3.1) | rails (>= 4.0) | ||
|
|
||
GEM | GEM | ||
remote: http://rubygems.org/ | remote: http://rubygems.org/ | ||
specs: | specs: | ||
actionmailer (3.2.11) | actionmailer (4.0.0) | ||
actionpack (= 3.2.11) | actionpack (= 4.0.0) | ||
mail (~> 2.4.4) | mail (~> 2.5.3) | ||
actionpack (3.2.11) | actionpack (4.0.0) | ||
activemodel (= 3.2.11) | activesupport (= 4.0.0) | ||
activesupport (= 3.2.11) | builder (~> 3.1.0) | ||
builder (~> 3.0.0) | |||
erubis (~> 2.7.0) | erubis (~> 2.7.0) | ||
journey (~> 1.0.4) | rack (~> 1.5.2) | ||
rack (~> 1.4.0) | rack-test (~> 0.6.2) | ||
rack-cache (~> 1.2) | activemodel (4.0.0) | ||
rack-test (~> 0.6.1) | activesupport (= 4.0.0) | ||
sprockets (~> 2.2.1) | builder (~> 3.1.0) | ||
activemodel (3.2.11) | activerecord (4.0.0) | ||
activesupport (= 3.2.11) | activemodel (= 4.0.0) | ||
builder (~> 3.0.0) | activerecord-deprecated_finders (~> 1.0.2) | ||
activerecord (3.2.11) | activesupport (= 4.0.0) | ||
activemodel (= 3.2.11) | arel (~> 4.0.0) | ||
activesupport (= 3.2.11) | activerecord-deprecated_finders (1.0.3) | ||
arel (~> 3.0.2) | activesupport (4.0.0) | ||
tzinfo (~> 0.3.29) | i18n (~> 0.6, >= 0.6.4) | ||
activeresource (3.2.11) | minitest (~> 4.2) | ||
activemodel (= 3.2.11) | multi_json (~> 1.3) | ||
activesupport (= 3.2.11) | thread_safe (~> 0.1) | ||
activesupport (3.2.11) | tzinfo (~> 0.3.37) | ||
i18n (~> 0.6) | arel (4.0.1) | ||
multi_json (~> 1.0) | atomic (1.1.14) | ||
arel (3.0.2) | builder (3.1.4) | ||
builder (3.0.4) | |||
erubis (2.7.0) | erubis (2.7.0) | ||
hike (1.2.1) | hike (1.2.3) | ||
i18n (0.6.1) | i18n (0.6.5) | ||
journey (1.0.4) | |||
jquery-rails (2.2.0) | jquery-rails (2.2.0) | ||
railties (>= 3.0, < 5.0) | railties (>= 3.0, < 5.0) | ||
thor (>= 0.14, < 2.0) | thor (>= 0.14, < 2.0) | ||
json (1.7.6) | mail (2.5.4) | ||
mail (2.4.4) | |||
i18n (>= 0.4.0) | |||
mime-types (~> 1.16) | mime-types (~> 1.16) | ||
treetop (~> 1.4.8) | treetop (~> 1.4.8) | ||
mime-types (1.20.1) | mime-types (1.25) | ||
multi_json (1.5.0) | minitest (4.7.5) | ||
multi_json (1.8.2) | |||
polyglot (0.3.3) | polyglot (0.3.3) | ||
rack (1.4.4) | protected_attributes (1.0.3) | ||
rack-cache (1.2) | activemodel (>= 4.0.0, < 5.0) | ||
rack (>= 0.4) | rack (1.5.2) | ||
rack-ssl (1.3.3) | |||
rack | |||
rack-test (0.6.2) | rack-test (0.6.2) | ||
rack (>= 1.0) | rack (>= 1.0) | ||
rails (3.2.11) | rails (4.0.0) | ||
actionmailer (= 3.2.11) | actionmailer (= 4.0.0) | ||
actionpack (= 3.2.11) | actionpack (= 4.0.0) | ||
activerecord (= 3.2.11) | activerecord (= 4.0.0) | ||
activeresource (= 3.2.11) | activesupport (= 4.0.0) | ||
activesupport (= 3.2.11) | bundler (>= 1.3.0, < 2.0) | ||
bundler (~> 1.0) | railties (= 4.0.0) | ||
railties (= 3.2.11) | sprockets-rails (~> 2.0.0) | ||
railties (3.2.11) | railties (4.0.0) | ||
actionpack (= 3.2.11) | actionpack (= 4.0.0) | ||
activesupport (= 3.2.11) | activesupport (= 4.0.0) | ||
rack-ssl (~> 1.3.2) | |||
rake (>= 0.8.7) | rake (>= 0.8.7) | ||
rdoc (~> 3.4) | thor (>= 0.18.1, < 2.0) | ||
thor (>= 0.14.6, < 2.0) | rake (10.1.0) | ||
rake (10.0.3) | sprockets (2.10.0) | ||
rdoc (3.12) | |||
json (~> 1.4) | |||
sprockets (2.2.2) | |||
hike (~> 1.2) | hike (~> 1.2) | ||
multi_json (~> 1.0) | multi_json (~> 1.0) | ||
rack (~> 1.0) | rack (~> 1.0) | ||
tilt (~> 1.1, != 1.3.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) | sqlite3 (1.3.7) | ||
thor (0.17.0) | thor (0.18.1) | ||
tilt (1.3.3) | thread_safe (0.1.3) | ||
treetop (1.4.12) | atomic | ||
tilt (1.4.1) | |||
treetop (1.4.15) | |||
polyglot | polyglot | ||
polyglot (>= 0.3.1) | polyglot (>= 0.3.1) | ||
tzinfo (0.3.35) | tzinfo (0.3.38) | ||
|
|
||
PLATFORMS | PLATFORMS | ||
ruby | ruby | ||
|
|
||
DEPENDENCIES | DEPENDENCIES | ||
jquery-rails | jquery-rails | ||
protected_attributes | |||
rails-client-logger! | rails-client-logger! | ||
sqlite3 | sqlite3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 22 additions & 7 deletions
29
lib/generators/rails_client_logger/rails_client_logger_generator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,19 +1,34 @@ | |||
class RailsClientLoggerGenerator < Rails::Generators::Base | class RailsClientLoggerGenerator < Rails::Generators::Base | ||
source_root File.expand_path('../templates', __FILE__) | source_root File.expand_path('../templates', __FILE__) | ||
|
|||
desc "inserts required routes and requires the javascript files" | desc "inserts required routes and requires the javascript files" | ||
def generate | def generate | ||
# add route | # add route | ||
route(%Q{mount RailsClientLogger::Engine, :at => "logger"}) | 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 | # add to application.js manifest | ||
original_js = File.binread("app/assets/javascripts/application.js") | original = File.binread(path) | ||
if original_js.include?("require rails_client_logger") | if original.include?("require rails_client_logger") | ||
say_status("skipped", "insert into app/assets/javascripts/application.js", :yellow) | say_status("skipped", "insert into #{path}", :yellow) | ||
else | 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" | "\n//= require rails_client_logger" | ||
end | end | ||
end | |||
end | end | ||
end | end | ||
end | end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,3 +1,3 @@ | |||
module RailsClientLogger | module RailsClientLogger | ||
VERSION = "0.0.2" | VERSION = "1.0.0" | ||
end | end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters