Skip to content

Commit

Permalink
Dont require rubigen in the gemspec
Browse files Browse the repository at this point in the history
  • Loading branch information
quirkey committed Apr 28, 2011
1 parent f8596f5 commit ec50a07
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Rakefile
Expand Up @@ -14,7 +14,7 @@ begin
s.description = %q{StaticModel provides a Base class much like ActiveRecord which supports reading from a YAML file and basic associations to ActiveRecord}
s.rubyforge_project = %q{quirkey}
s.add_runtime_dependency(%q<activesupport>, ["~>2.3.8"])
s.add_runtime_dependency(%q<rubigen>, [">= 1.5.1"])
# s.add_runtime_dependency(%q<rubigen>, [">= 1.5.1"])
s.add_development_dependency(%q<Shoulda>, [">= 1.2.0"])
end
Jeweler::GemcutterTasks.new
Expand All @@ -30,4 +30,4 @@ end

Dir['tasks/**/*.rake'].each { |t| load t }

task :default => :test
task :default => :test
14 changes: 10 additions & 4 deletions generators/static_model/static_model_generator.rb
@@ -1,3 +1,9 @@
begin
require 'rubigen'
rescue => LoadError
warn "Please install rubigen"
end

class StaticModelGenerator < RubiGen::Base

default_options :author => nil
Expand Down Expand Up @@ -29,15 +35,15 @@ def banner
USAGE: #{$0} #{spec.name} ModelName
EOS
end

def class_name
@name.classify
end

def table_name
@name.tableize
end

def add_options!(opts)
# opts.separator ''
# opts.separator 'Options:'
Expand All @@ -54,4 +60,4 @@ def extract_options
@lib_dir = options[:lib_dir] || File.join('app', 'models')
@data_dir = options[:data_dir] || File.join('config', 'data')
end
end
end
2 changes: 1 addition & 1 deletion lib/static_model.rb
Expand Up @@ -8,7 +8,7 @@
require 'active_support'

module StaticModel
VERSION = '0.3.1'
VERSION = '0.3.2'
end

require 'static_model/errors'
Expand Down
10 changes: 5 additions & 5 deletions lib/static_model/associations.rb
Expand Up @@ -14,7 +14,7 @@ def associations
def has_many(association_name, options = {})
self.associations[association_name.to_sym] = HasManyAssociation.new(self, association_name.to_sym, {:foreign_key => "#{self.to_s.foreign_key}"}.merge(options))
end

def belongs_to(association_name, options = {})
self.associations[association_name.to_sym] = BelongsToAssociation.new(self, association_name.to_sym, {:foreign_key => "#{association_name.to_s.foreign_key}"}.merge(options))
end
Expand All @@ -33,10 +33,10 @@ def initialize(klass, name, options = {})
@foreign_key = @options[:foreign_key]
define_association_methods
end

def reflection_klass
Object.const_get(@reflection_klass_name)
rescue
rescue
eval <<-EOT
class #{@reflection_klass_name}; end;
#{@reflection_klass_name}
Expand Down Expand Up @@ -68,7 +68,7 @@ def #{name}
end

class BelongsToAssociation < Association

def define_association_methods
klass.module_eval <<-EOT
def #{name}
Expand All @@ -79,4 +79,4 @@ def #{name}
end

end
end
end
2 changes: 1 addition & 1 deletion static_model.gemspec
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Aaron Quint"]
s.date = %q{2009-12-03}
s.date = %q{2010-10-22}
s.description = %q{StaticModel provides a Base class much like ActiveRecord which supports reading from a YAML file and basic associations to ActiveRecord}
s.email = %q{aaron at quirkey dot com}
s.extra_rdoc_files = [
Expand Down

0 comments on commit ec50a07

Please sign in to comment.