Skip to content

Commit

Permalink
Upgraded to support Rails 3.2 with the asset pipeline. Also added a g…
Browse files Browse the repository at this point in the history
…enerator test and a dummy app to test it on.
  • Loading branch information
freakent committed Mar 15, 2012
1 parent 9596300 commit 1cff9cb
Show file tree
Hide file tree
Showing 57 changed files with 1,056 additions and 108 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Expand Up @@ -14,6 +14,14 @@ doc
# jeweler generated
pkg

# OS Files
.DS_Store

# Transient Files
tmp
log
*.sqlite3

# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
#
# * Create a file at ~/.gitignore
Expand Down
18 changes: 18 additions & 0 deletions .project
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>nested_scaffold</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.aptana.ide.core.unifiedBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.radrails.rails.core.railsnature</nature>
<nature>com.aptana.ruby.core.rubynature</nature>
</natures>
</projectDescription>
26 changes: 16 additions & 10 deletions Gemfile
@@ -1,11 +1,17 @@
source "http://rubygems.org"
# Add dependencies required to use your gem here.
# Example:
# gem "activesupport", ">= 2.3.5"

# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.5.1"
end

# Declare your gem's dependencies in nested_scaffold.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec

# jquery-rails is used by the dummy application
gem "jquery-rails"

# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
97 changes: 89 additions & 8 deletions Gemfile.lock
@@ -1,16 +1,97 @@
PATH
remote: .
specs:
nested_scaffold (0.1.0)
rails (~> 3.2.2)

GEM
remote: http://rubygems.org/
specs:
git (1.2.5)
jeweler (1.5.1)
bundler (~> 1.0.0)
git (>= 1.2.5)
rake
rake (0.8.7)
actionmailer (3.2.2)
actionpack (= 3.2.2)
mail (~> 2.4.0)
actionpack (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.1)
rack (~> 1.4.0)
rack-cache (~> 1.1)
rack-test (~> 0.6.1)
sprockets (~> 2.1.2)
activemodel (3.2.2)
activesupport (= 3.2.2)
builder (~> 3.0.0)
activerecord (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
activesupport (3.2.2)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
builder (3.0.0)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.3)
jquery-rails (2.0.1)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.6.5)
mail (2.4.3)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.17.2)
multi_json (1.1.0)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.2.2)
actionmailer (= 3.2.2)
actionpack (= 3.2.2)
activerecord (= 3.2.2)
activeresource (= 3.2.2)
activesupport (= 3.2.2)
bundler (~> 1.0)
railties (= 3.2.2)
railties (3.2.2)
actionpack (= 3.2.2)
activesupport (= 3.2.2)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.5)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.32)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.0.0)
jeweler (~> 1.5.1)
jquery-rails
nested_scaffold!
sqlite3
66 changes: 29 additions & 37 deletions Rakefile
@@ -1,46 +1,38 @@
require 'rubygems'
require 'bundler'
#!/usr/bin/env rake
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
require 'rake'

require 'jeweler'
Jeweler::Tasks.new do |gem|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
gem.name = "nested_scaffold"
gem.homepage = "http://github.com/amatsuda/nested_scaffold"
gem.license = "MIT"
gem.summary = 'Nested scaffold generator for Rails 3'
gem.description = 'Nested scaffold generator for Rails 3'
gem.email = "ronnie@dio.jp"
gem.authors = ["Akira Matsuda"]
# Include your dependencies below. Runtime dependencies are required when using your gem,
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
# gem.add_development_dependency 'rspec', '> 1.2.3'
begin
require 'rdoc/task'
rescue LoadError
require 'rdoc/rdoc'
require 'rake/rdoctask'
RDoc::Task = Rake::RDocTask
end
Jeweler::RubygemsDotOrgTasks.new

require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/**/test_*.rb'
test.verbose = true
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Nested Scaffold'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end

task :default => :test

require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""

rdoc.rdoc_dir = 'rdoc'
rdoc.title = "nested_scaffold #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')

Bundler::GemHelper.install_tasks

require 'rake/testtask'

Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
end


task :default => :test
2 changes: 1 addition & 1 deletion lib/generators/USAGE
@@ -1,5 +1,5 @@
Description:
Generats nested scaffold
Generates nested scaffold

Example:
rails g nested_scaffold group/user name:string age:integer
Expand Down
9 changes: 6 additions & 3 deletions lib/generators/nested_scaffold_generator.rb
Expand Up @@ -2,7 +2,6 @@
require File.join(File.dirname(__FILE__), 'base')
require File.join(File.dirname(__FILE__), 'scaffold_controller/scaffold_controller_generator')
require File.join(File.dirname(__FILE__), 'active_record/active_record_generator')
require File.join(File.dirname(__FILE__), 'stylesheets/stylesheets_generator')

module NestedScaffold
module Generators
Expand All @@ -11,8 +10,12 @@ class NestedScaffoldGenerator < ::Rails::Generators::ScaffoldGenerator

# override ScaffoldGenerator
hook_for :scaffold_controller, :required => true
# override ScaffoldGenerator
hook_for :stylesheets

# Ensure assets get created with the correct name
hook_for :assets, :in => :rails do |source, generator|
source.invoke generator, [ source.file_name.pluralize ]
end

# override ModelGenerator
hook_for :orm, :required => true

Expand Down
56 changes: 7 additions & 49 deletions nested_scaffold.gemspec
Expand Up @@ -16,60 +16,18 @@ Gem::Specification.new do |s|
"LICENSE.txt",
"README.rdoc"
]
s.files = [
".document",
"Gemfile",
"Gemfile.lock",
"LICENSE.txt",
"README.rdoc",
"Rakefile",
"VERSION",
"lib/generators/USAGE",
"lib/generators/active_record/active_record_generator.rb",
"lib/generators/base.rb",
"lib/generators/erb/erb_generator.rb",
"lib/generators/erb/templates/_form.html.erb",
"lib/generators/erb/templates/edit.html.erb",
"lib/generators/erb/templates/index.html.erb",
"lib/generators/erb/templates/new.html.erb",
"lib/generators/erb/templates/show.html.erb",
"lib/generators/haml/haml_generator.rb",
"lib/generators/haml/templates/_form.html.haml",
"lib/generators/haml/templates/edit.html.haml",
"lib/generators/haml/templates/index.html.haml",
"lib/generators/haml/templates/new.html.haml",
"lib/generators/haml/templates/show.html.haml",
"lib/generators/helper/helper_generator.rb",
"lib/generators/nested_scaffold_generator.rb",
"lib/generators/scaffold_controller/scaffold_controller_generator.rb",
"lib/generators/scaffold_controller/templates/controller.rb",
"lib/generators/stylesheets/stylesheets_generator.rb",
"lib/generators/test_unit/helper_generator.rb",
"lib/generators/test_unit/model_generator.rb",
"lib/generators/test_unit/scaffold_generator.rb",
"lib/generators/test_unit/templates/functional_test.rb",
"nested_scaffold.gemspec"
]

s.homepage = %q{http://github.com/amatsuda/nested_scaffold}
s.licenses = ["MIT"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.7}
s.summary = %q{Nested scaffold generator for Rails 3}
s.summary = %q{Nested scaffold generator for Rails 3.2}

s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"]

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
s.add_dependency "rails", "~> 3.2.2"

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
else
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
end
else
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
end
s.add_development_dependency "sqlite3"
end

3 changes: 3 additions & 0 deletions test/dummy/README.rdoc
@@ -0,0 +1,3 @@
== This is a Dummy Rails app for testing Nested Scaffold

If the nested scaffold is generated properly, you should be able to fire up rails and run this application in the usual way.
7 changes: 7 additions & 0 deletions test/dummy/Rakefile
@@ -0,0 +1,7 @@
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)

Dummy::Application.load_tasks
15 changes: 15 additions & 0 deletions test/dummy/app/assets/javascripts/application.js
@@ -0,0 +1,15 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
2 changes: 2 additions & 0 deletions test/dummy/app/assets/javascripts/boxes.js
@@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
13 changes: 13 additions & 0 deletions test/dummy/app/assets/stylesheets/application.css
@@ -0,0 +1,13 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .
*/
4 changes: 4 additions & 0 deletions test/dummy/app/assets/stylesheets/boxes.css
@@ -0,0 +1,4 @@
/*
Place all the styles related to the matching controller here.
They will automatically be included in application.css.
*/
3 changes: 3 additions & 0 deletions test/dummy/app/controllers/application_controller.rb
@@ -0,0 +1,3 @@
class ApplicationController < ActionController::Base
protect_from_forgery
end

0 comments on commit 1cff9cb

Please sign in to comment.