brcep 0.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -0
- data/Rakefile +13 -27
- data/lib/brcep/version.rb +2 -2
- data/lib/brcep.rb +1 -10
- data/test/test_helper.rb +1 -1
- metadata +7 -16
- data/TODO +0 -6
- data/lib/brcep/br_form_options_helper.rb +0 -58
- data/test/br_form_helper_test.rb +0 -29
data/README
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
Aqui vai o readme...
|
data/Rakefile
CHANGED
@@ -5,6 +5,7 @@ require 'rake/rdoctask'
|
|
5
5
|
require 'rake/packagetask'
|
6
6
|
require 'rake/gempackagetask'
|
7
7
|
require 'rake/contrib/sshpublisher'
|
8
|
+
|
8
9
|
require File.join(File.dirname(__FILE__), 'lib', 'brcep', 'version')
|
9
10
|
|
10
11
|
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
@@ -29,17 +30,16 @@ Rake::TestTask.new { |t|
|
|
29
30
|
}
|
30
31
|
|
31
32
|
|
32
|
-
#
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
# }
|
33
|
+
#Generate the RDoc documentation
|
34
|
+
Rake::RDocTask.new { |rdoc|
|
35
|
+
rdoc.rdoc_dir = 'doc'
|
36
|
+
rdoc.title = "Brazilian Rails -- CEP"
|
37
|
+
rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
|
38
|
+
rdoc.options << '--charset' << 'utf-8'
|
39
|
+
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
40
|
+
rdoc.rdoc_files.include('README', 'CHANGELOG')
|
41
|
+
rdoc.rdoc_files.include('lib/**/*')
|
42
|
+
}
|
43
43
|
|
44
44
|
|
45
45
|
# Create compressed packages
|
@@ -50,19 +50,17 @@ spec = Gem::Specification.new do |s|
|
|
50
50
|
s.description = %q{brcep é uma das gems que compoem o Brazilian Rails}
|
51
51
|
s.version = PKG_VERSION
|
52
52
|
|
53
|
-
s.
|
53
|
+
s.authors = ["Marcos Tapajós", "Celestino Gomes", "Andre Kupkosvki", "Vinícius Teles"]
|
54
54
|
s.email = "tapajos@gmail.com"
|
55
55
|
s.rubyforge_project = "brcep"
|
56
56
|
s.homepage = "http://www.improveit.com.br/software_livre/brazilian_rails"
|
57
57
|
|
58
|
-
s.add_dependency('actionpack', '>= 1.4.2')
|
59
|
-
|
60
58
|
s.has_rdoc = true
|
61
59
|
s.requirements << 'none'
|
62
60
|
s.require_path = 'lib'
|
63
61
|
# s.autorequire = 'brcep'
|
64
62
|
|
65
|
-
s.files = [ "Rakefile", "README", "CHANGELOG", "
|
63
|
+
s.files = [ "Rakefile", "README", "CHANGELOG", "MIT-LICENSE" ]
|
66
64
|
s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
67
65
|
s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
68
66
|
end
|
@@ -73,18 +71,6 @@ Rake::GemPackageTask.new(spec) do |p|
|
|
73
71
|
p.need_zip = true
|
74
72
|
end
|
75
73
|
|
76
|
-
|
77
|
-
# desc "Publish the API documentation"
|
78
|
-
# task :pgem => [:package] do
|
79
|
-
# Rake::SshFilePublisher.new("wrath.rubyonrails.org", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
|
80
|
-
# end
|
81
|
-
#
|
82
|
-
# desc "Publish the API documentation"
|
83
|
-
# task :pdoc => [:rdoc] do
|
84
|
-
# Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/am", "doc").upload
|
85
|
-
# end
|
86
|
-
#
|
87
|
-
|
88
74
|
desc "Publish the release files to RubyForge."
|
89
75
|
task :release => [ :package ] do
|
90
76
|
require 'rubyforge'
|
data/lib/brcep/version.rb
CHANGED
data/lib/brcep.rb
CHANGED
@@ -1,16 +1,7 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__)) unless
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
|
-
require
|
5
|
-
require 'action_controller'
|
6
|
-
require 'html/document'
|
7
|
-
require 'active_support'
|
8
|
-
require 'action_view'
|
9
|
-
|
10
|
-
|
11
|
-
%w(busca_endereco
|
12
|
-
version
|
13
|
-
br_form_options_helper).each {|req| require File.dirname(__FILE__) + "/brcep/#{req}"}
|
4
|
+
%w(busca_endereco version).each {|req| require File.dirname(__FILE__) + "/brcep/#{req}"}
|
14
5
|
|
15
6
|
|
16
7
|
module BrCep
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brcep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Marcos Tapaj\xC3\xB3s"
|
8
|
+
- Celestino Gomes
|
9
|
+
- Andre Kupkosvki
|
10
|
+
- "Vin\xC3\xADcius Teles"
|
8
11
|
autorequire:
|
9
12
|
bindir: bin
|
10
13
|
cert_chain: []
|
11
14
|
|
12
|
-
date: 2008-
|
15
|
+
date: 2008-08-31 00:00:00 -03:00
|
13
16
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
name: actionpack
|
17
|
-
type: :runtime
|
18
|
-
version_requirement:
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 1.4.2
|
24
|
-
version:
|
17
|
+
dependencies: []
|
18
|
+
|
25
19
|
description: "brcep \xC3\xA9 uma das gems que compoem o Brazilian Rails"
|
26
20
|
email: tapajos@gmail.com
|
27
21
|
executables: []
|
@@ -34,14 +28,11 @@ files:
|
|
34
28
|
- Rakefile
|
35
29
|
- README
|
36
30
|
- CHANGELOG
|
37
|
-
- TODO
|
38
31
|
- MIT-LICENSE
|
39
32
|
- lib/brcep
|
40
|
-
- lib/brcep/br_form_options_helper.rb
|
41
33
|
- lib/brcep/busca_endereco.rb
|
42
34
|
- lib/brcep/version.rb
|
43
35
|
- lib/brcep.rb
|
44
|
-
- test/br_form_helper_test.rb
|
45
36
|
- test/busca_endereco_test.rb
|
46
37
|
- test/mocks
|
47
38
|
- test/mocks/zip_22640100.xml
|
data/TODO
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
module ActionView::Helpers::FormOptionsHelper
|
2
|
-
ESTADOS_BRASILEIROS = [["Acre", "AC"],
|
3
|
-
["Alagoas", "AL"],
|
4
|
-
["Amapá", "AP"],
|
5
|
-
["Amazonas", "AM"],
|
6
|
-
["Bahia", "BA"],
|
7
|
-
["Ceará", "CE"],
|
8
|
-
["Distrito Federal", "DF"],
|
9
|
-
["Espírito Santos", "ES"],
|
10
|
-
["Goiás", "GO"],
|
11
|
-
["Maranhão", "MA"],
|
12
|
-
["Mato Grosso", "MT"],
|
13
|
-
["Mato Grosso do Sul", "MS"],
|
14
|
-
["Minas Gerais", "MG"],
|
15
|
-
["Pará", "PA"],
|
16
|
-
["Paraíba", "PB"],
|
17
|
-
["Paraná", "PR"],
|
18
|
-
["Pernambuco", "PE"],
|
19
|
-
["Piauí", "PI"],
|
20
|
-
["Rio de Janeiro", "RJ"],
|
21
|
-
["Rio Grande do Norte", "RN"],
|
22
|
-
["Rio Grande do Sul", "RS"],
|
23
|
-
["Rondônia", "RO"],
|
24
|
-
["Roraima", "RR"],
|
25
|
-
["Santa Catarina", "SC"],
|
26
|
-
["São Paulo", "SP"],
|
27
|
-
["Sergipe", "SE"],
|
28
|
-
["Tocantins", "TO"]
|
29
|
-
] unless const_defined?("ESTADOS_BRASILEIROS")
|
30
|
-
|
31
|
-
# Helper para montar um select para seleção de estados brasileiros, usando
|
32
|
-
# option_estados_for_select para gerar a lista de opções.
|
33
|
-
def select_estado(object, method, options = {}, html_options = {})
|
34
|
-
select object, method, ESTADOS_BRASILEIROS, options, html_options
|
35
|
-
end
|
36
|
-
|
37
|
-
# Helper para montar um select para seleção de estados brasileiros, usando
|
38
|
-
# option_uf_for_select para gerar a lista de opções.
|
39
|
-
def select_uf(object, method, options = {}, html_options = {})
|
40
|
-
select object, method, ESTADOS_BRASILEIROS.collect {|estado, sigla| sigla}, options, html_options
|
41
|
-
end
|
42
|
-
|
43
|
-
# Retorna uma string com a lista de estados brasileiros para usar em uma tag select,
|
44
|
-
# com exibição do nome do estado, mas armazenando a sigla.
|
45
|
-
def option_estados_for_select
|
46
|
-
html = ""
|
47
|
-
html += options_for_select ESTADOS_BRASILEIROS
|
48
|
-
html
|
49
|
-
end
|
50
|
-
|
51
|
-
# Retorna uma string com a lista de estados brasileiros para usar em uma tag select,
|
52
|
-
# com exibição e armazenamento a sigla.
|
53
|
-
def option_uf_for_select
|
54
|
-
html = ""
|
55
|
-
html += options_for_select ESTADOS_BRASILEIROS.collect {|nome,sigla| sigla}
|
56
|
-
html
|
57
|
-
end
|
58
|
-
end
|
data/test/br_form_helper_test.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/test_helper'
|
2
|
-
require 'rubygems'
|
3
|
-
require 'net/http'
|
4
|
-
require 'mocha'
|
5
|
-
|
6
|
-
class BrFormHelperTest < Test::Unit::TestCase
|
7
|
-
|
8
|
-
include ActionView::Helpers::FormOptionsHelper
|
9
|
-
|
10
|
-
def test_option_estados_for_select
|
11
|
-
assert_equal %(<option value=\"AC\">Acre</option>\n<option value=\"AL\">Alagoas</option>\n<option value=\"AP\">Amapá</option>\n<option value=\"AM\">Amazonas</option>\n<option value=\"BA\">Bahia</option>\n<option value=\"CE\">Ceará</option>\n<option value=\"DF\">Distrito Federal</option>\n<option value=\"ES\">Espírito Santos</option>\n<option value=\"GO\">Goiás</option>\n<option value=\"MA\">Maranhão</option>\n<option value=\"MT\">Mato Grosso</option>\n<option value=\"MS\">Mato Grosso do Sul</option>\n<option value=\"MG\">Minas Gerais</option>\n<option value=\"PA\">Pará</option>\n<option value=\"PB\">Paraíba</option>\n<option value=\"PR\">Paraná</option>\n<option value=\"PE\">Pernambuco</option>\n<option value=\"PI\">Piauí</option>\n<option value=\"RJ\">Rio de Janeiro</option>\n<option value=\"RN\">Rio Grande do Norte</option>\n<option value=\"RS\">Rio Grande do Sul</option>\n<option value=\"RO\">Rondônia</option>\n<option value=\"RR\">Roraima</option>\n<option value=\"SC\">Santa Catarina</option>\n<option value=\"SP\">São Paulo</option>\n<option value=\"SE\">Sergipe</option>\n<option value=\"TO\">Tocantins</option>), option_estados_for_select
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_option_uf_for_select
|
15
|
-
assert_equal %(<option value=\"AC\">AC</option>\n<option value=\"AL\">AL</option>\n<option value=\"AP\">AP</option>\n<option value=\"AM\">AM</option>\n<option value=\"BA\">BA</option>\n<option value=\"CE\">CE</option>\n<option value=\"DF\">DF</option>\n<option value=\"ES\">ES</option>\n<option value=\"GO\">GO</option>\n<option value=\"MA\">MA</option>\n<option value=\"MT\">MT</option>\n<option value=\"MS\">MS</option>\n<option value=\"MG\">MG</option>\n<option value=\"PA\">PA</option>\n<option value=\"PB\">PB</option>\n<option value=\"PR\">PR</option>\n<option value=\"PE\">PE</option>\n<option value=\"PI\">PI</option>\n<option value=\"RJ\">RJ</option>\n<option value=\"RN\">RN</option>\n<option value=\"RS\">RS</option>\n<option value=\"RO\">RO</option>\n<option value=\"RR\">RR</option>\n<option value=\"SC\">SC</option>\n<option value=\"SP\">SP</option>\n<option value=\"SE\">SE</option>\n<option value=\"TO\">TO</option>), option_uf_for_select
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_select_estado
|
19
|
-
assert_equal %(<select id=\"lancamento_estado\" name=\"lancamento[estado]\"><option value=\"AC\">Acre</option>\n<option value=\"AL\">Alagoas</option>\n<option value=\"AP\">Amapá</option>\n<option value=\"AM\">Amazonas</option>\n<option value=\"BA\">Bahia</option>\n<option value=\"CE\">Ceará</option>\n<option value=\"DF\">Distrito Federal</option>\n<option value=\"ES\">Espírito Santos</option>\n<option value=\"GO\">Goiás</option>\n<option value=\"MA\">Maranhão</option>\n<option value=\"MT\">Mato Grosso</option>\n<option value=\"MS\">Mato Grosso do Sul</option>\n<option value=\"MG\">Minas Gerais</option>\n<option value=\"PA\">Pará</option>\n<option value=\"PB\">Paraíba</option>\n<option value=\"PR\">Paraná</option>\n<option value=\"PE\">Pernambuco</option>\n<option value=\"PI\">Piauí</option>\n<option value=\"RJ\">Rio de Janeiro</option>\n<option value=\"RN\">Rio Grande do Norte</option>\n<option value=\"RS\">Rio Grande do Sul</option>\n<option value=\"RO\">Rondônia</option>\n<option value=\"RR\">Roraima</option>\n<option value=\"SC\">Santa Catarina</option>\n<option value=\"SP\">São Paulo</option>\n<option value=\"SE\">Sergipe</option>\n<option value=\"TO\">Tocantins</option></select>), select_estado(:lancamento, :estado)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_select_uf
|
23
|
-
options = {:options1 => "1"}
|
24
|
-
html_options = {:name => "name"}
|
25
|
-
expects(:select).with(:lancamento, :estado, ['AC', 'AL', 'AP', 'AM', 'BA', 'CE', 'DF', 'ES', 'GO', 'MA', 'MT', 'MS', 'MG', 'PA', 'PB', 'PR', 'PE', 'PI', 'RJ', 'RN', 'RS', 'RO', 'RR', 'SC', 'SP', 'SE', 'TO'], {:options1 => '1'}, {:name => 'name'}).returns("select")
|
26
|
-
assert_equal "select", select_uf(:lancamento, :estado, options, html_options)
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|