Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Update for Rails 3 #1

Merged
merged 1 commit into from

2 participants

@wlaurance

Rid of deprecated RAILS_ROOT for rails.root

Added a new example for Haml. Using Rails 3.1.1

@antono
Owner

Cool thanks :)

@antono antono merged commit ede4504 into antono:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 31, 2012
  1. @wlaurance

    Adjust tasks for Rails 3

    wlaurance authored
    update readme
This page is out of date. Refresh to see the latest.
Showing with 20 additions and 9 deletions.
  1. +11 −0 README.md
  2. +9 −9 lib/tasks/sh2_tasks.rake
View
11 README.md
@@ -64,3 +64,14 @@ Availible code-brushes and themes:
Copyright (c) 2009 Antono Vasiljev, released under LGPLv3 license
+
+
+Haml Example
+
+ Place this wherever you want all the brushes and css files included
+
+ = raw include_syntax_highlighter_assets(:themes => :midnight, :brushes => :all)
+
+ When all code to be highlighted is present call this helper method
+
+ = raw sh2_highlight_code
View
18 lib/tasks/sh2_tasks.rake
@@ -1,31 +1,31 @@
namespace :sh2 do
- PLUGIN_ROOT = File.dirname(__FILE__) + '/..'
+ PLUGIN_ROOT = Rails.root + 'vendor/plugins/sh2'
+ STYLESHEETS = Dir[PLUGIN_ROOT.to_s + '/assets/stylesheets/*'].select { |e| File.file?(e) }
+ JAVASCRIPTS = Dir[PLUGIN_ROOT.to_s + '/assets/javascripts/*'].select { |e| File.file?(e) }
- STYLESHEETS = Dir[PLUGIN_ROOT + '/assets/stylesheets/*'].select { |e| File.file?(e) }
- JAVASCRIPTS = Dir[PLUGIN_ROOT + '/assets/javascripts/*'].select { |e| File.file?(e) }
-
- desc "Copies syntax highlighter assets (css+js) to public dir"
+
+ desc "Copies syntax highlighter assets (css+js) to assets dirs"
task :install do
%w{javascripts stylesheets}.each do |atype|
- dest = File.join(RAILS_ROOT, 'public', atype, 'sh2')
+ dest = File.join(Rails.root.to_s, '/app/assets/', atype, 'sh2/')
FileUtils.mkdir(dest)
FileUtils.cp atype.upcase.constantize, dest, :verbose => true
end
puts "\n==> Syntax Highlighter assets installed!"
end
- desc "Updates syntax highlighter assets (css+js) in public dir"
+ desc "Updates syntax highlighter assets (css+js) in assets dir"
task :update do
Rake::Task['sh2:uninstall'].invoke
Rake::Task['sh2:install'].invoke
puts "\n==> Syntax Highlighter assets updated!"
end
- desc "Deletes syntax highlighter assets (css+js) from public dir"
+ desc "Deletes syntax highlighter assets (css+js) from assets dir"
task :uninstall do
%w{javascripts stylesheets}.each do |atype|
- FileUtils.rm_rf(File.join(RAILS_ROOT, 'public', atype, 'sh2'))
+ FileUtils.rm_rf(File.join(Rails.root.to_s, '/app/assets', atype, 'sh2'))
end
puts "\n==> Syntax Highlighter assets uninstalled!"
end
Something went wrong with that request. Please try again.