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.
- data/CHANGELOG.rdoc +6 -0
- data/LICENSE +1 -1
- data/README.rdoc +11 -0
- data/Rakefile +19 -17
- data/app/models/country.rb +1 -0
- data/app/models/region.rb +1 -0
- data/generators/has_addresses/USAGE +5 -0
- data/generators/has_addresses/has_addresses_generator.rb +11 -0
- data/{db/migrate → generators/has_addresses/templates}/001_create_countries.rb +0 -0
- data/{db/migrate → generators/has_addresses/templates}/002_create_regions.rb +0 -0
- data/{db/migrate → generators/has_addresses/templates}/003_create_addresses.rb +0 -0
- data/test/app_root/db/migrate/002_migrate_has_addresses_to_version_3.rb +2 -2
- data/test/unit/address_test.rb +1 -1
- data/test/unit/country_test.rb +1 -1
- data/test/unit/region_test.rb +1 -1
- metadata +22 -28
data/CHANGELOG.rdoc
CHANGED
@@ -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
data/README.rdoc
CHANGED
@@ -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.
|
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,
|
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 '
|
79
|
-
|
80
|
-
ruby_forge = RubyForge.new.configure
|
81
|
-
ruby_forge.login
|
87
|
+
require 'rake/gemcutter'
|
82
88
|
|
83
|
-
|
84
|
-
|
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
|
data/app/models/country.rb
CHANGED
data/app/models/region.rb
CHANGED
@@ -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
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class MigrateHasAddressesToVersion3 < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
ActiveRecord::Migrator.new(:up, "#{Rails.root}/../../
|
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(:
|
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
|
data/test/unit/address_test.rb
CHANGED
data/test/unit/country_test.rb
CHANGED
data/test/unit/region_test.rb
CHANGED
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.
|
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:
|
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
|
-
-
|
38
|
-
-
|
39
|
-
-
|
40
|
-
-
|
41
|
-
-
|
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/
|
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/
|
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.
|
82
|
+
rubygems_version: 1.3.5
|
89
83
|
signing_key:
|
90
|
-
specification_version:
|
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
|