addresslogic 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ .DS_Store
2
+ .swp
3
+ *.log
4
+ *.sqlite3
5
+ pkg/*
6
+ coverage/*
7
+ doc/*
8
+ benchmarks/*
9
+
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ == 1.1.3
2
+
3
+ * Include into Object so that we can use this in any class we want.
4
+
1
5
  == 1.1.2
2
6
 
3
7
  * Update defaults to use changes in 1.1.1
File without changes
data/README.rdoc CHANGED
@@ -28,10 +28,14 @@ Granted the above is probably easier without using AddressLogic, but it will pur
28
28
 
29
29
  == Install and use
30
30
 
31
- As a gem:
31
+ Install from rubyforge
32
32
 
33
33
  $ sudo gem install addresslogic
34
34
 
35
+ Install from github:
36
+
37
+ $ sudo gem install binarylogic-addresslogic
38
+
35
39
  Or as a plugin
36
40
 
37
41
  $ sudo script/plugin install git://github.com/binarylogic/addresslogic.git
@@ -50,7 +54,7 @@ You can specify the fields too:
50
54
 
51
55
  == Helpful links
52
56
 
53
- * <b>Documentation:</b> http://addresslogic.rubyforge.org
57
+ * <b>Documentation:</b> http://rdoc.info/projects/binarylogic/addresslogic
54
58
 
55
59
 
56
60
  Copyright (c) 2009 Ben Johnson of [Binary Logic](http://www.binarylogic.com), released under the MIT license
data/Rakefile CHANGED
@@ -1,20 +1,41 @@
1
- ENV['RDOCOPT'] = "-S -f html -T hanna"
1
+ require 'rubygems'
2
+ require 'rake'
2
3
 
3
- require "rubygems"
4
- require "hoe"
5
- require File.dirname(__FILE__) << "/lib/addresslogic/version"
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "addresslogic"
8
+ gem.summary = "Creates a meaningful array of address parts for easy displaying."
9
+ gem.email = "bjohnson@binarylogic.com"
10
+ gem.homepage = "http://github.com/binarylogic/addresslogic"
11
+ gem.authors = ["Ben Johnson of Binary Logic"]
12
+ gem.rubyforge_project = "addresslogic"
13
+ end
14
+ Jeweler::RubyforgeTasks.new
15
+ rescue LoadError
16
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
17
+ end
6
18
 
7
- Hoe.new("Addresslogic", Addresslogic::Version::STRING) do |p|
8
- p.name = "addresslogic"
9
- p.rubyforge_name = "addresslogic"
10
- p.author = "Ben Johnson of Binary Logic"
11
- p.email = 'bjohnson@binarylogic.com'
12
- p.summary = "Easily display addresses."
13
- p.description = "Easily display addresses."
14
- p.url = "http://github.com/binarylogic/addresslogic"
15
- p.history_file = "CHANGELOG.rdoc"
16
- p.readme_file = "README.rdoc"
17
- p.extra_rdoc_files = ["CHANGELOG.rdoc", "README.rdoc"]
18
- p.remote_rdoc_dir = ''
19
- p.test_globs = ["test/*/test_*.rb", "test/*_test.rb", "test/*/*_test.rb"]
20
- end
19
+ require 'rake/testtask'
20
+ Rake::TestTask.new(:test) do |test|
21
+ test.libs << 'lib' << 'test'
22
+ test.pattern = 'test/**/*_test.rb'
23
+ test.verbose = true
24
+ end
25
+
26
+ begin
27
+ require 'rcov/rcovtask'
28
+ Rcov::RcovTask.new do |test|
29
+ test.libs << 'test'
30
+ test.pattern = 'test/**/*_test.rb'
31
+ test.verbose = true
32
+ end
33
+ rescue LoadError
34
+ task :rcov do
35
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
36
+ end
37
+ end
38
+
39
+ task :test => :check_dependencies
40
+
41
+ task :default => :test
data/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :major: 1
3
+ :minor: 1
4
+ :patch: 3
@@ -0,0 +1,52 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{addresslogic}
8
+ s.version = "1.1.3"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ben Johnson of Binary Logic"]
12
+ s.date = %q{2009-08-15}
13
+ s.email = %q{bjohnson@binarylogic.com}
14
+ s.extra_rdoc_files = [
15
+ "LICENSE",
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ "CHANGELOG.rdoc",
21
+ "LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION.yml",
25
+ "addresslogic.gemspec",
26
+ "init.rb",
27
+ "lib/addresslogic.rb",
28
+ "rails/init.rb",
29
+ "test/addresslogic_test.rb",
30
+ "test/test_helper.rb"
31
+ ]
32
+ s.homepage = %q{http://github.com/binarylogic/addresslogic}
33
+ s.rdoc_options = ["--charset=UTF-8"]
34
+ s.require_paths = ["lib"]
35
+ s.rubyforge_project = %q{addresslogic}
36
+ s.rubygems_version = %q{1.3.5}
37
+ s.summary = %q{Creates a meaningful array of address parts for easy displaying.}
38
+ s.test_files = [
39
+ "test/addresslogic_test.rb",
40
+ "test/test_helper.rb"
41
+ ]
42
+
43
+ if s.respond_to? :specification_version then
44
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
45
+ s.specification_version = 3
46
+
47
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
48
+ else
49
+ end
50
+ else
51
+ end
52
+ end
data/lib/addresslogic.rb CHANGED
@@ -1,5 +1,3 @@
1
- require 'activerecord'
2
-
3
1
  # = Address Logic
4
2
  #
5
3
  # This is a simple module that you can include into any classm as long as it has a street1, street2, city, state, zip, and country (optional)
@@ -14,7 +12,6 @@ require 'activerecord'
14
12
  #
15
13
  # This adds a sigle method: address_parts. More on this method below...
16
14
  module Addresslogic
17
-
18
15
  def self.included(base)
19
16
  base.extend ClassMethods
20
17
  end
@@ -42,7 +39,7 @@ module Addresslogic
42
39
  # * <tt>only:</tt> fields you want included in the result
43
40
  # * <tt>except:</tt> any fields you want excluded from the result
44
41
  def address_parts(*args)
45
- options = args.extract_options!
42
+ options = args.last.is_a?(Hash) ? args.pop : {}
46
43
  options[:only] = [options[:only]] if options[:only] && !options[:only].is_a?(Array)
47
44
  options[:except] = [options[:except]] if options[:except] && !options[:except].is_a?(Array)
48
45
  fields = args[0] || address_parts_fields
@@ -54,7 +51,7 @@ module Addresslogic
54
51
  has_sub_array = field.find { |item| item.is_a?(Array) }
55
52
  separator = has_sub_array ? ", " : " "
56
53
  sub_parts = address_parts(field, level + 1, options).join(separator)
57
- next if sub_parts.blank?
54
+ next if sub_parts.empty?
58
55
  parts << sub_parts
59
56
  else
60
57
  next if !respond_to?(field)
@@ -74,4 +71,4 @@ module Addresslogic
74
71
  end
75
72
  end
76
73
 
77
- ActiveRecord::Base.send(:include, Addresslogic)
74
+ Object.send(:include, Addresslogic)
data/rails/init.rb CHANGED
@@ -1,2 +1 @@
1
- require "addresslogic/version"
2
1
  require "addresslogic"
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: addresslogic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Johnson of Binary Logic
@@ -9,40 +9,31 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-14 00:00:00 -04:00
12
+ date: 2009-08-15 00:00:00 -04:00
13
13
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: hoe
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.12.2
24
- version:
25
- description: Easily display addresses.
14
+ dependencies: []
15
+
16
+ description:
26
17
  email: bjohnson@binarylogic.com
27
18
  executables: []
28
19
 
29
20
  extensions: []
30
21
 
31
22
  extra_rdoc_files:
32
- - Manifest.txt
33
- - CHANGELOG.rdoc
23
+ - LICENSE
34
24
  - README.rdoc
35
25
  files:
26
+ - .gitignore
36
27
  - CHANGELOG.rdoc
37
- - MIT-LICENSE
38
- - Manifest.txt
28
+ - LICENSE
39
29
  - README.rdoc
40
30
  - Rakefile
31
+ - VERSION.yml
32
+ - addresslogic.gemspec
41
33
  - init.rb
42
34
  - lib/addresslogic.rb
43
- - lib/addresslogic/version.rb
44
35
  - rails/init.rb
45
- - test/test_addresslogic.rb
36
+ - test/addresslogic_test.rb
46
37
  - test/test_helper.rb
47
38
  has_rdoc: true
48
39
  homepage: http://github.com/binarylogic/addresslogic
@@ -50,8 +41,7 @@ licenses: []
50
41
 
51
42
  post_install_message:
52
43
  rdoc_options:
53
- - --main
54
- - README.rdoc
44
+ - --charset=UTF-8
55
45
  require_paths:
56
46
  - lib
57
47
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -69,9 +59,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
59
  requirements: []
70
60
 
71
61
  rubyforge_project: addresslogic
72
- rubygems_version: 1.3.3
62
+ rubygems_version: 1.3.5
73
63
  signing_key:
74
64
  specification_version: 3
75
- summary: Easily display addresses.
76
- test_files: []
77
-
65
+ summary: Creates a meaningful array of address parts for easy displaying.
66
+ test_files:
67
+ - test/addresslogic_test.rb
68
+ - test/test_helper.rb
data/Manifest.txt DELETED
@@ -1,11 +0,0 @@
1
- CHANGELOG.rdoc
2
- MIT-LICENSE
3
- Manifest.txt
4
- README.rdoc
5
- Rakefile
6
- init.rb
7
- lib/addresslogic.rb
8
- lib/addresslogic/version.rb
9
- rails/init.rb
10
- test/test_addresslogic.rb
11
- test/test_helper.rb
@@ -1,56 +0,0 @@
1
- module Addresslogic
2
- # = Version
3
- #
4
- # A class for describing the current version of a library. The version
5
- # consists of three parts: the +major+ number, the +minor+ number, and the
6
- # +tiny+ (or +patch+) number.
7
- class Version
8
-
9
- include Comparable
10
-
11
- # A convenience method for instantiating a new Version instance with the
12
- # given +major+, +minor+, and +tiny+ components.
13
- def self.[](major, minor, tiny)
14
- new(major, minor, tiny)
15
- end
16
-
17
- attr_reader :major, :minor, :tiny
18
-
19
- # Create a new Version object with the given components.
20
- def initialize(major, minor, tiny)
21
- @major, @minor, @tiny = major, minor, tiny
22
- end
23
-
24
- # Compare this version to the given +version+ object.
25
- def <=>(version)
26
- to_i <=> version.to_i
27
- end
28
-
29
- # Converts this version object to a string, where each of the three
30
- # version components are joined by the '.' character. E.g., 2.0.0.
31
- def to_s
32
- @to_s ||= [@major, @minor, @tiny].join(".")
33
- end
34
-
35
- # Converts this version to a canonical integer that may be compared
36
- # against other version objects.
37
- def to_i
38
- @to_i ||= @major * 1_000_000 + @minor * 1_000 + @tiny
39
- end
40
-
41
- def to_a
42
- [@major, @minor, @tiny]
43
- end
44
-
45
- MAJOR = 1
46
- MINOR = 1
47
- TINY = 2
48
-
49
- # The current version as a Version instance
50
- CURRENT = new(MAJOR, MINOR, TINY)
51
- # The current version as a String
52
- STRING = CURRENT.to_s
53
-
54
- end
55
-
56
- end