Permalink
Browse files

attempting to fix the generator for rails 3 and failing miserably

  • Loading branch information...
1 parent e4d5e52 commit 8f0f43104d7fb5cbb89072abd74dea4237b24e63 @qrush qrush committed Oct 13, 2010
View
4 Rakefile
@@ -25,16 +25,14 @@ end
spec = Gem::Specification.new do |s|
s.name = "paul_revere"
- s.version = "0.1.0"
+ s.version = "0.1.1"
s.summary = "Simple announcement plugin to include 'one off' style announcements in Rails web apps."
s.author = "Thoughtbot"
s.email = "support@thoughtbot.com"
s.homepage = "http://thoughtbot.com/community"
-
s.has_rdoc = true
s.extra_rdoc_files = %w(README.textile)
s.rdoc_options = %w(--main README.textile)
-
s.files = %w(init.rb install.rb MIT-LICENSE Rakefile README.textile uninstall.rb) + Dir.glob("{test,lib/**/*}")
s.require_paths = ["lib"]
View
11 generators/paul_revere/paul_revere_generator.rb
@@ -1,11 +0,0 @@
-class PaulRevereGenerator < Rails::Generator::Base
- def manifest
- record do |m|
- m.migration_template "migration.rb",
- 'db/migrate',
- :migration_file_name => "create_announcements"
- m.directory 'public/javascripts'
- m.file "announcements.js", "public/javascripts/announcements.js"
- end
- end
-end
View
3 init.rb
@@ -1,2 +1 @@
-# Include hook code here
-
+require 'paul_revere'
View
8 lib/generators/paul_revere/USAGE
@@ -0,0 +1,8 @@
+Description:
+ Explain the generator
+
+Example:
+ rails generate paul_revere Thing
+
+ This will create:
+ what/will/it/create
View
10 lib/generators/paul_revere/paul_revere_generator.rb
@@ -0,0 +1,10 @@
+class PaulRevereGenerator < Rails::Generator::Base
+ desc "Put the javascript and migration in place"
+ source_root File.join(File.dirname(__FILE__), "templates")
+
+ def install
+ directory "public/javascripts"
+ file "announcements.js", "public/javascripts/announcements.js"
+ migration_template "migration.rb", "db/migrate/create_announcements.rb"
+ end
+end
View
0 ...rs/paul_revere/templates/announcements.js → ...rs/paul_revere/templates/announcements.js
File renamed without changes.
View
0 ...rators/paul_revere/templates/migration.rb → ...rators/paul_revere/templates/migration.rb
File renamed without changes.
View
4 paul_revere.gemspec
@@ -2,14 +2,14 @@
Gem::Specification.new do |s|
s.name = %q{paul_revere}
- s.version = "0.1.0"
+ s.version = "0.1.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Thoughtbot"]
s.date = %q{2010-10-12}
s.email = %q{support@thoughtbot.com}
s.extra_rdoc_files = ["README.textile"]
- s.files = ["init.rb", "install.rb", "MIT-LICENSE", "Rakefile", "README.textile", "uninstall.rb", "lib/paul_revere.rb"]
+ s.files = ["init.rb", "install.rb", "MIT-LICENSE", "Rakefile", "README.textile", "uninstall.rb", "lib/generators/paul_revere/paul_revere_generator.rb", "lib/generators/paul_revere/templates/announcements.js", "lib/generators/paul_revere/templates/migration.rb", "lib/generators/paul_revere/USAGE", "lib/paul_revere.rb"]
s.homepage = %q{http://thoughtbot.com/community}
s.rdoc_options = ["--main", "README.textile"]
s.require_paths = ["lib"]
View
5 test/test_helper.rb
@@ -1,7 +1,5 @@
ENV['RAILS_ENV'] = 'test'
-PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
-
require 'rubygems'
require 'rails/all'
require 'shoulda'
@@ -19,7 +17,8 @@ class ActiveSupport::TestCase
end
end
-load File.join(PROJECT_ROOT, 'generators', 'paul_revere', 'templates', 'migration.rb')
+PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
+require File.join(PROJECT_ROOT, 'lib', 'generators', 'paul_revere', 'templates', 'migration')
ActiveRecord::Base.establish_connection(
:adapter => 'sqlite3',
:database => ':memory:'

0 comments on commit 8f0f431

Please sign in to comment.