Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
attempting to fix the generator for rails 3 and failing miserably
Browse files Browse the repository at this point in the history
  • Loading branch information
qrush committed Oct 13, 2010
1 parent e4d5e52 commit 8f0f431
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 21 deletions.
4 changes: 1 addition & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
11 changes: 0 additions & 11 deletions generators/paul_revere/paul_revere_generator.rb

This file was deleted.

3 changes: 1 addition & 2 deletions init.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# Include hook code here

require 'paul_revere'
8 changes: 8 additions & 0 deletions lib/generators/paul_revere/USAGE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Description:
Explain the generator

Example:
rails generate paul_revere Thing

This will create:
what/will/it/create
10 changes: 10 additions & 0 deletions lib/generators/paul_revere/paul_revere_generator.rb
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions paul_revere.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
5 changes: 2 additions & 3 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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:'
Expand Down

0 comments on commit 8f0f431

Please sign in to comment.