Skip to content

Commit

Permalink
emulate implementation from jquery-rails gem
Browse files Browse the repository at this point in the history
  • Loading branch information
maccman committed Jun 16, 2011
1 parent 275508d commit 0fbceb7
Show file tree
Hide file tree
Showing 18 changed files with 121 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
source 'http://rubygems.org'

gem 'sinatra', '~> 1.0'
gem 'shotgun', :group => :reloadable
gem 'thin', :group => :reloadable
gem 'json'
# Specify your gem's dependencies in jquery-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"
26 changes: 26 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
GEM
remote: http://rubygems.org/
specs:
daemons (1.1.3)
eventmachine (0.12.10)
json (1.5.2)
rack (1.3.0)
shotgun (0.9)
rack (>= 1.0)
sinatra (1.2.6)
rack (~> 1.1)
tilt (< 2.0, >= 1.2.2)
thin (1.2.11)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
tilt (1.3.2)

PLATFORMS
ruby

DEPENDENCIES
json
shotgun
sinatra (~> 1.0)
thin
10 changes: 10 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require 'bundler'
Bundler::GemHelper.install_tasks

# require "spec/rake/spectask"
# desc "Run all examples"
# Spec::Rake::SpecTask.new(:spec) do |t|
# t.ruby_opts = ['-r test/unit']
# t.spec_opts = %w[--color]
# end
task :default => :spec
18 changes: 18 additions & 0 deletions lib/generators/spine/install/install_generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require 'rails'

module Jquery
module Generators
class InstallGenerator < ::Rails::Generators::Base

desc "This generator installs Spine #{Spine::Rails::SPINE_VERSION}"

source_root File.expand_path('../../../../../vendor/assets/javascripts', __FILE__)

def copy_spine
say_status("copying", "Spine (#{Spine::Rails::SPINE_VERSION})", :green)
copy_file "spine.js", "public/javascripts/spine.js"
copy_file "spine.min.js", "public/javascripts/spine.min.js"
end
end
end
end if ::Rails.version < "3.1"
1 change: 1 addition & 0 deletions lib/spine-rails.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'jquery/rails'
12 changes: 12 additions & 0 deletions lib/spine/rails.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Jquery
module Rails
PROTOTYPE_JS = %w{prototype effects dragdrop controls}

if ::Rails.version < "3.1"
require 'jquery/rails/railtie'
else
require 'jquery/rails/engine'
end
require 'jquery/rails/version'
end
end
16 changes: 16 additions & 0 deletions lib/spine/rails/railtie.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module Jquery
module Rails
class Railtie < ::Rails::Railtie
config.before_configuration do
if ::Rails.root.join("public/javascripts/spine.min.js").exist?
sp_defaults = %w(spine)
sp_defaults.map! {|a| a + ".min" } if ::Rails.env.production?
else
sp_defaults = ::Rails.env.production? ? %w(spine.min) : %w(spine)
end

config.action_view.javascript_expansions[:defaults] |= sp_defaults
end
end
end
end
6 changes: 6 additions & 0 deletions lib/spine/rails/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Jquery
module Rails
VERSION = "0.0.1"
SPINE_VERSION = "0.0.4"
end
end
25 changes: 25 additions & 0 deletions spine-rails.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- encoding: utf-8 -*-
require File.expand_path('../lib/jquery/rails/version', __FILE__)

Gem::Specification.new do |s|
s.name = "jquery-rails"
s.version = Jquery::Rails::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["André Arko"]
s.email = ["andre@arko.net"]
s.homepage = "http://rubygems.org/gems/jquery-rails"
s.summary = "Use jQuery with Rails 3"
s.description = "This gem provides jQuery and the jQuery-ujs driver for your Rails 3 application."

s.required_rubygems_version = ">= 1.3.6"
s.rubyforge_project = "jquery-rails"

s.add_dependency "railties", "~> 3.0"
s.add_dependency "thor", "~> 0.14"
s.add_development_dependency "bundler", "~> 1.0.0"
s.add_development_dependency "rails", "~> 3.0"

s.files = `git ls-files`.split("\n")
s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/}
s.require_path = 'lib'
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 0fbceb7

Please sign in to comment.