Skip to content

Commit

Permalink
Rails 3 generator update
Browse files Browse the repository at this point in the history
  • Loading branch information
rrouse committed Jul 25, 2010
1 parent 76b3034 commit c444393
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 66 deletions.
27 changes: 22 additions & 5 deletions RakeFile
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
require 'spec/rake/spectask'
if defined?(Rspec)
require 'spec/rake/spectask'

namespace :has_friends do
desc "Run all specs in spec directory (excluding plugin specs)"
Spec::Rake::SpecTask.new(:spec) do |t|
t.spec_files = FileList["spec/**/*_spec.rb"]
namespace :has_friends do
desc "Run all specs in spec directory (excluding plugin specs)"
Spec::Rake::SpecTask.new(:spec) do |t|
t.spec_files = FileList["spec/**/*_spec.rb"]
end
end
end

begin
require 'jeweler'
Jeweler::Tasks.new do |gemspec|
gemspec.name = "has_friends-rails3"
gemspec.summary = "Rails 3 version of has_friends gem"
gemspec.description = "Rails 3 version of has_friends gem"
gemspec.email = "[email protected]"
gemspec.homepage = "http://github.com/rrouse/has_friends"
gemspec.authors = ["Robert Rouse"]
gemspec.files.include %w(lib/generators/**/*.rb)
end
rescue LoadError
puts "Jeweler not available. Install it with: gem install jeweler"
end
68 changes: 68 additions & 0 deletions has_friends-rails3.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in RakeFile, and run the gemspec command
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{has_friends-rails3}
s.version = "0.0.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Robert Rouse"]
s.date = %q{2010-07-24}
s.description = %q{Rails 3 version of has_friends gem}
s.email = %q{[email protected]}
s.extra_rdoc_files = [
"README.markdown"
]
s.files = [
"MIT-LICENSE",
"README.markdown",
"RakeFile",
"VERSION",
"init.rb",
"lib/exceptions.rb",
"lib/friendship.rb",
"lib/friendship_message.rb",
"lib/friendship_relation_type.rb",
"lib/generators/has_friends.rb",
"lib/generators/has_friends/migration/migration_generator.rb",
"lib/generators/has_friends/migration/templates/create_has_friends_tables.rb",
"lib/has_friends.rb",
"lib/relation_type.rb",
"spec/fixtures/relation_types.yml",
"spec/fixtures/users.yml",
"spec/friendship_message_spec.rb",
"spec/friendship_relation_type_spec.rb",
"spec/friendship_spec.rb",
"spec/has_friends_spec.rb",
"spec/relation_type_spec.rb",
"spec/schema.rb",
"spec/spec_helper.rb"
]
s.homepage = %q{http://github.com/rrouse/has_friends}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.7}
s.summary = %q{Rails 3 version of has_friends gem}
s.test_files = [
"spec/friendship_message_spec.rb",
"spec/friendship_relation_type_spec.rb",
"spec/friendship_spec.rb",
"spec/has_friends_spec.rb",
"spec/relation_type_spec.rb",
"spec/schema.rb",
"spec/spec_helper.rb"
]

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
else
end
else
end
end

19 changes: 19 additions & 0 deletions lib/generators/has_friends.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'rails/generators/migration'

module HasFriends
module Generators
class Base < Rails::Generators::Base

include Rails::Generators::Migration

def self.source_root
@_has_friends_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'has_friends', generator_name, 'templates'))
end

def self.next_migration_number(path)
Time.now.utc.strftime("%Y%m%d%H%M%S")
end

end
end
end
14 changes: 14 additions & 0 deletions lib/generators/has_friends/migration/migration_generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'generators/has_friends'

module HasFriends
module Generators
class MigrationGenerator < Base
desc "Generate has_friends migration"

def create_migration_file
migration_template "create_has_friends_tables.rb", File.join('db', 'migrate', "create_has_friends_tables.rb")
end

end
end
end
50 changes: 0 additions & 50 deletions lib/generators/has_friends_migration/USAGE

This file was deleted.

This file was deleted.

0 comments on commit c444393

Please sign in to comment.