Commit
* Added google-code-prettify assets and gem spec following conventions in the jquery-rails gem. * Added generator to support rails 3.0.x or those rails apps that do not use the asset pipeline
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rvm use ruby-1.9.2@google-code-prettify-rails --create |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
source :gemcutter | ||
|
||
# Specify your gem's dependencies in google-code-prettify-rails.gemspec | ||
gemspec | ||
# Rails is already being pulled in through gemspec | ||
# gem "rails", :git => "git://github.com/rails/rails.git" | ||
gem "rack", :git => "git://github.com/rack/rack.git" | ||
gem "sprockets", :git => "git://github.com/sstephenson/sprockets.git" | ||
gem "i18n", "0.6.0beta1" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- encoding: utf-8 -*- | ||
require File.expand_path('../lib/jquery/rails/version', __FILE__) | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "google-code-prettify-rails" | ||
s.version = GoogleCodePrettify::Rails::VERSION | ||
s.platform = Gem::Platform::RUBY | ||
s.authors = ["Ryan Montgomery"] | ||
s.email = ["rmontgomery429@gmail.com"] | ||
s.homepage = "http://rubygems.org/gems/google-code-prettify-rails" | ||
s.summary = "Use Google Code Prettify with Rails 3" | ||
s.description = "This gem provides a Javascript module and CSS file that allows syntax highlighting of source code snippets in an html page for your Rails 3 application." | ||
|
||
s.required_rubygems_version = ">= 1.3.6" | ||
s.rubyforge_project = "google-code-prettify-rails" | ||
|
||
s.add_dependency "railties", ">= 3.2.0.beta", "< 5.0" | ||
s.add_dependency "thor", "~> 0.14" | ||
|
||
s.files = `git ls-files`.split("\n") | ||
s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/} | ||
s.require_path = 'lib' | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
require 'rails' | ||
|
||
# Supply generator for Rails 3.0.x or if asset pipeline is not enabled | ||
if ::Rails.version < "3.1" || !::Rails.application.config.assets.enabled | ||
module GoogleCodePrettify | ||
module Generators | ||
class InstallGenerator < ::Rails::Generators::Base | ||
LANGUAGES = [:apollo, :cli, :css, :go, :hs, :lisp, :lua, :ml, :n, :proto, :scala, :sql, :tex, :vb, :vhdl, :wiki, :xq, :yaml] | ||
|
||
desc "This generator installs Google Code Prettify #{GoogleCodePrettify::Rails::VERSION}" | ||
|
||
LANGUAGES.each do |lang| | ||
class_option lang, :type => :boolean, :default => false, :desc => "Include #{lang.to_s}" | ||
end | ||
|
||
source_root File.expand_path('../../../../../vendor/assets', __FILE__) | ||
|
||
def copy_prettify | ||
say_status("copying", "Google Code Prettify (#{GoogleCodePrettify::Rails::VERSION})", :green) | ||
copy_file "javascripts/prettify.js", "public/javascripts/prettify.js" | ||
copy_file "stylesheets/prettify.css", "public/stylesheets/prettify.css" | ||
end | ||
|
||
def copy_languages | ||
LANGUAGES.each do |lang| | ||
if options.send "#{lang}?".to_sym | ||
say_status("copying", "#{lang}", :green) | ||
copy_file "javascripts/lang-#{lang}.js", "public/javascripts/lang-#{lang}.js" | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
else | ||
module GoogleCodePrettify | ||
module Generators | ||
class InstallGenerator < ::Rails::Generators::Base | ||
desc "Just show instructions so people will know what to do when mistakenly using generator for Rails 3.1 apps" | ||
|
||
def do_nothing | ||
say_status("deprecated", "You are using Rails 3.1 with the asset pipeline enabled, so this generator is not needed.") | ||
say_status("", "The necessary files are already in your asset pipeline.") | ||
say_status("", "Just add `//= require google-code-prettify` and `//= require ` to your app/assets/javascripts/application.js") | ||
say_status("", "If you do not want the asset pipeline enabled, you may turn it off in application.rb and re-run this generator.") | ||
end | ||
end | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require 'google-code-prettify/rails' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module GoogleCodePrettify | ||
module Rails | ||
require 'google-code-prettify/rails/version' | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module GoogleCodePrettify | ||
module Rails | ||
VERSION = "1.0.0" | ||
GOOGLE_CODE_PRETTIFY_VERSION = "r187" | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
Copyright (C) 2011 Google Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
var a=null; | ||
PR.registerLangHandler(PR.createSimpleLexer([["opn",/^[([{]+/,a,"([{"],["clo",/^[)\]}]+/,a,")]}"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \xa0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:def|if|do|let|quote|var|fn|loop|recur|throw|try|monitor-enter|monitor-exit|defmacro|defn|defn-|macroexpand|macroexpand-1|for|doseq|dosync|dotimes|and|or|when|not|assert|doto|proxy|defstruct|first|rest|cons|defprotocol|deftype|defrecord|reify|defmulti|defmethod|meta|with-meta|ns|in-ns|create-ns|import|intern|refer|alias|namespace|resolve|ref|deref|refset|new|set!|memfn|to-array|into-array|aset|gen-class|reduce|map|filter|find|nil?|empty?|hash-map|hash-set|vec|vector|seq|flatten|reverse|assoc|dissoc|list|list?|disj|get|union|difference|intersection|extend|extend-type|extend-protocol|prn)\b/,a], | ||
["typ",/^:[\dA-Za-z-]+/]]),["clj"]); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.