Skip to content

Commit

Permalink
House Keeping
Browse files Browse the repository at this point in the history
  • Loading branch information
E-Max committed Oct 27, 2012
1 parent 7a29fb8 commit ab4c795
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 7 deletions.
25 changes: 23 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
source "http://rubygems.org"

# Specify your gem's dependencies in a_a_n.gemspec
gemspec
group :development do
gem "rake", "~> 0.9.2"

gem "rspec"

gem "activerecord", :require => false
gem "activesupport", :require => false

gem "yard", "~> 0.6.0"
gem "jeweler", "~> 1.6.4"

gem 'shoulda-context'
gem "mocha"

gem "simplecov", "~> 0.6.4", :platform => :ruby_19
gem "rcov", "~> 1.0.0", :platform => :ruby_18

gem "debugger", "~> 1.1.3", :platform => :ruby_19
gem 'ruby-debug', :platform => :ruby_18

gem "database_cleaner", :group => :test
gem "sqlite3", :group => :test
end
32 changes: 31 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
require "bundler/gem_tasks"
require 'rubygems'
require 'bundler'

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
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 = "a_a_n"
gem.homepage = "https://github.com/kot-begemot/association_as_name"
gem.license = "MIT"
gem.summary = %Q{Association as name}
gem.description = %Q{Whenever you need assign an association by its attribute,
like name, this gem comes to business.}
gem.email = "test@example.com"
gem.authors = ["E-Max"]
# dependencies defined in Gemfile
end
Jeweler::RubygemsDotOrgTasks.new


require 'yard'
YARD::Rake::YardocTask.new
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.0
0.2.5
2 changes: 1 addition & 1 deletion a_a_n.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require "a_a_n/version"
Gem::Specification.new do |s|
s.name = "a_a_n"
s.version = AAN::VERSION
s.authors = ["E-Max","shell"]
s.authors = ["E-Max"]
s.email = ["developers@studentify.nl"]
s.homepage = "https://github.com/Studentify/association_as_name"
s.summary = %q{Association as name}
Expand Down
3 changes: 2 additions & 1 deletion lib/a_a_n/association_as_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ def acts_as_aan &block
class_eval <<EOF
# Could not use delegate for that, since attribute and aliased method could have different names
def #{aliased_method}
self.send(:#{association}).try(:#{attribute})
@#{aliased_method} ||= self.send(:#{association}).try(:#{attribute})
end
def #{aliased_method}=(value)
@#{aliased_method} = nil
self.send(:#{association}_id=, association(:#{association}).klass.find_by_#{attribute}(value).try(:id))
end
EOF
Expand Down
2 changes: 1 addition & 1 deletion lib/a_a_n/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module AAN
VERSION = "0.2.5"
VERSION = File.read(File.expand_path("./../../../VERSION", __FILE__))
end
3 changes: 3 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'rubygems'
require 'bundler'
require 'logger'
Bundler.setup(:default, :development)

require 'active_record'
Expand All @@ -12,6 +13,8 @@
:database => ':memory:'
)

#ActiveRecord::Base.logger = Logger.new(STDOUT)

RSpec.configure do |config|
config.before(:each) do
ActiveRecord::Base.connection.increment_open_transactions
Expand Down

0 comments on commit ab4c795

Please sign in to comment.