has_addresses 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,11 @@
1
1
  == master
2
2
 
3
+ == 0.5.2 / 2010-03-07
4
+
5
+ * Add a generator for db migrations
6
+ * Release gems via rake-gemcutter instead of rubyforge
7
+ * Fix Region / Country models failing to load in Ruby 1.9+ due to character encoding
8
+
3
9
  == 0.5.1 / 2009-05-01
4
10
 
5
11
  * Update to enumerate_by 0.4.1's #fast_bootstrap for speed boost
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2009 Aaron Pfeifer
1
+ Copyright (c) 2006-2010 Aaron Pfeifer
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -38,6 +38,17 @@ terms of the type of data required.
38
38
  Note that this is a reference implementation and, most likely, should be
39
39
  modified for your own usage.
40
40
 
41
+ === Installation
42
+
43
+ +has_addresses+ requires additional database tables to work. You can generate
44
+ a migration for these tables like so:
45
+
46
+ script/generate has_addresses
47
+
48
+ Then simply migrate your database:
49
+
50
+ rake db:migrate
51
+
41
52
  === Example
42
53
 
43
54
  address = Address.new(
data/Rakefile CHANGED
@@ -1,15 +1,17 @@
1
+ require 'rubygems'
2
+ require 'rake'
1
3
  require 'rake/testtask'
2
4
  require 'rake/rdoctask'
3
5
  require 'rake/gempackagetask'
4
- require 'rake/contrib/sshpublisher'
5
6
 
6
7
  spec = Gem::Specification.new do |s|
7
8
  s.name = 'has_addresses'
8
- s.version = '0.5.1'
9
+ s.version = '0.5.2'
9
10
  s.platform = Gem::Platform::RUBY
10
- s.summary = 'Demonstrates a reference implementation for handling countries, regions, and addresses.'
11
+ s.summary = 'Demonstrates a reference implementation for handling countries, regions, and addresses in ActiveRecord'
12
+ s.description = s.summary
11
13
 
12
- s.files = FileList['{app,db,lib,test}/**/*'] + %w(CHANGELOG.rdoc init.rb LICENSE Rakefile README.rdoc) - FileList['test/app_root/{log,log/*,script,script/*}']
14
+ s.files = FileList['{app,generators,lib,test}/**/*'] + %w(CHANGELOG.rdoc init.rb LICENSE Rakefile README.rdoc) - FileList['test/app_root/{log,log/*,script,script/*}']
13
15
  s.require_path = 'lib'
14
16
  s.has_rdoc = true
15
17
  s.test_files = Dir['test/**/*_test.rb']
@@ -53,20 +55,27 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
53
55
  rdoc.options << '--line-numbers' << '--inline-source'
54
56
  rdoc.rdoc_files.include('README.rdoc', 'CHANGELOG.rdoc', 'LICENSE', 'lib/**/*.rb', 'app/**/*.rb')
55
57
  end
56
-
58
+
59
+ desc 'Generate a gemspec file.'
60
+ task :gemspec do
61
+ File.open("#{spec.name}.gemspec", 'w') do |f|
62
+ f.write spec.to_ruby
63
+ end
64
+ end
65
+
57
66
  Rake::GemPackageTask.new(spec) do |p|
58
67
  p.gem_spec = spec
59
- p.need_tar = true
60
- p.need_zip = true
61
68
  end
62
69
 
63
70
  desc 'Publish the beta gem.'
64
71
  task :pgem => [:package] do
72
+ require 'rake/contrib/sshpublisher'
65
73
  Rake::SshFilePublisher.new('aaron@pluginaweek.org', '/home/aaron/gems.pluginaweek.org/public/gems', 'pkg', "#{spec.name}-#{spec.version}.gem").upload
66
74
  end
67
75
 
68
76
  desc 'Publish the API documentation.'
69
77
  task :pdoc => [:rdoc] do
78
+ require 'rake/contrib/sshpublisher'
70
79
  Rake::SshDirPublisher.new('aaron@pluginaweek.org', "/home/aaron/api.pluginaweek.org/public/#{spec.name}", 'rdoc').upload
71
80
  end
72
81
 
@@ -75,15 +84,8 @@ task :publish => [:pgem, :pdoc, :release]
75
84
 
76
85
  desc 'Publish the release files to RubyForge.'
77
86
  task :release => [:gem, :package] do
78
- require 'rubyforge'
79
-
80
- ruby_forge = RubyForge.new.configure
81
- ruby_forge.login
87
+ require 'rake/gemcutter'
82
88
 
83
- %w(gem tgz zip).each do |ext|
84
- file = "pkg/#{spec.name}-#{spec.version}.#{ext}"
85
- puts "Releasing #{File.basename(file)}..."
86
-
87
- ruby_forge.add_release(spec.rubyforge_project, spec.name, spec.version, file)
88
- end
89
+ Rake::Gemcutter::Tasks.new(spec)
90
+ Rake::Task['gem:push'].invoke
89
91
  end
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  # Defined by the ISO 3166 standard. The ISO 3166 standard includes a
2
3
  # "Country Subdivision Code", giving a code for the names of the principal
3
4
  # administrative subdivisions of the countries coded in ISO 3166.
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  # Defined by the ISO 3166-2 standard. This is a standard that gives short
2
3
  # codes for states, provinces, etc. within a country.
3
4
  #
@@ -0,0 +1,5 @@
1
+ Usage:
2
+
3
+ script/generate has_addresses
4
+
5
+ This will create migrations that will add the proper tables to store addresses.
@@ -0,0 +1,11 @@
1
+ class HasAddressesGenerator < Rails::Generator::Base
2
+ def manifest
3
+ record do |m|
4
+ m.migration_template '001_create_countries.rb', 'db/migrate', :migration_file_name => 'create_countries'
5
+ m.sleep 1
6
+ m.migration_template '002_create_regions.rb', 'db/migrate', :migration_file_name => 'create_regions'
7
+ m.sleep 1
8
+ m.migration_template '003_create_addresses.rb', 'db/migrate', :migration_file_name => 'create_addresses'
9
+ end
10
+ end
11
+ end
@@ -1,12 +1,12 @@
1
1
  class MigrateHasAddressesToVersion3 < ActiveRecord::Migration
2
2
  def self.up
3
- ActiveRecord::Migrator.new(:up, "#{Rails.root}/../../db/migrate", 0).migrations.each do |migration|
3
+ ActiveRecord::Migrator.new(:up, "#{Rails.root}/../../generators/has_addresses/templates", 0).migrations.each do |migration|
4
4
  migration.migrate(:up)
5
5
  end
6
6
  end
7
7
 
8
8
  def self.down
9
- ActiveRecord::Migrator.new(:up, "#{Rails.root}/../../db/migrate", 0).migrations.each do |migration|
9
+ ActiveRecord::Migrator.new(:down, "#{Rails.root}/../../generators/has_addresses/templates", 0).migrations.each do |migration|
10
10
  migration.migrate(:down)
11
11
  end
12
12
  end
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/../test_helper"
1
+ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2
2
 
3
3
  class AddressByDefaultTest < ActiveRecord::TestCase
4
4
  def setup
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/../test_helper"
1
+ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2
2
 
3
3
  class CountryByDefaultTest < ActiveRecord::TestCase
4
4
  def setup
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/../test_helper"
1
+ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2
2
 
3
3
  class RegionByDefaultTest < ActiveRecord::TestCase
4
4
  def setup
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_addresses
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Pfeifer
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-01 00:00:00 -04:00
12
+ date: 2010-03-07 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,7 +22,7 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 0.4.1
24
24
  version:
25
- description:
25
+ description: Demonstrates a reference implementation for handling countries, regions, and addresses in ActiveRecord
26
26
  email: aaron@pluginaweek.org
27
27
  executables: []
28
28
 
@@ -31,33 +31,25 @@ extensions: []
31
31
  extra_rdoc_files: []
32
32
 
33
33
  files:
34
- - app/models
34
+ - app/models/address.rb
35
35
  - app/models/country.rb
36
36
  - app/models/region.rb
37
- - app/models/address.rb
38
- - db/migrate
39
- - db/migrate/001_create_countries.rb
40
- - db/migrate/002_create_regions.rb
41
- - db/migrate/003_create_addresses.rb
37
+ - generators/has_addresses/has_addresses_generator.rb
38
+ - generators/has_addresses/USAGE
39
+ - generators/has_addresses/templates/001_create_countries.rb
40
+ - generators/has_addresses/templates/003_create_addresses.rb
41
+ - generators/has_addresses/templates/002_create_regions.rb
42
42
  - lib/has_addresses.rb
43
- - test/factory.rb
44
- - test/test_helper.rb
45
- - test/functional
46
- - test/functional/has_addresses_test.rb
47
- - test/unit
48
- - test/unit/address_test.rb
49
43
  - test/unit/region_test.rb
50
44
  - test/unit/country_test.rb
51
- - test/app_root
52
- - test/app_root/db
53
- - test/app_root/db/migrate
54
- - test/app_root/db/migrate/002_migrate_has_addresses_to_version_3.rb
45
+ - test/unit/address_test.rb
55
46
  - test/app_root/db/migrate/001_create_companies.rb
56
- - test/app_root/config
57
- - test/app_root/config/environment.rb
58
- - test/app_root/app
59
- - test/app_root/app/models
47
+ - test/app_root/db/migrate/002_migrate_has_addresses_to_version_3.rb
60
48
  - test/app_root/app/models/company.rb
49
+ - test/app_root/config/environment.rb
50
+ - test/test_helper.rb
51
+ - test/factory.rb
52
+ - test/functional/has_addresses_test.rb
61
53
  - CHANGELOG.rdoc
62
54
  - init.rb
63
55
  - LICENSE
@@ -65,6 +57,8 @@ files:
65
57
  - README.rdoc
66
58
  has_rdoc: true
67
59
  homepage: http://www.pluginaweek.org
60
+ licenses: []
61
+
68
62
  post_install_message:
69
63
  rdoc_options: []
70
64
 
@@ -85,12 +79,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
79
  requirements: []
86
80
 
87
81
  rubyforge_project: pluginaweek
88
- rubygems_version: 1.3.1
82
+ rubygems_version: 1.3.5
89
83
  signing_key:
90
- specification_version: 2
91
- summary: Demonstrates a reference implementation for handling countries, regions, and addresses.
84
+ specification_version: 3
85
+ summary: Demonstrates a reference implementation for handling countries, regions, and addresses in ActiveRecord
92
86
  test_files:
93
- - test/functional/has_addresses_test.rb
94
- - test/unit/address_test.rb
95
87
  - test/unit/region_test.rb
96
88
  - test/unit/country_test.rb
89
+ - test/unit/address_test.rb
90
+ - test/functional/has_addresses_test.rb