brdata 2.1.8 → 2.1.9
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/Rakefile +3 -10
- data/lib/brdata.rb +2 -1
- data/lib/brdata/br_date_helper.rb +2 -1
- data/lib/brdata/date_portuguese.rb +2 -2
- data/lib/brdata/excecoes.rb +1 -0
- data/lib/brdata/version.rb +1 -1
- data/test/br_date_helper_test.rb +1 -0
- data/test/date_test.rb +8 -3
- data/test/feriado_parser_test.rb +1 -1
- data/test/feriado_test.rb +1 -0
- data/test/time_test.rb +7 -2
- metadata +6 -6
data/Rakefile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
require 'rubygems'
|
2
3
|
require 'rake'
|
3
4
|
require 'rake/testtask'
|
@@ -85,15 +86,7 @@ end
|
|
85
86
|
# end
|
86
87
|
#
|
87
88
|
|
88
|
-
desc "Publish the release
|
89
|
+
desc "Publish the new release"
|
89
90
|
task :release => [ :package ] do
|
90
|
-
|
91
|
-
require 'rake/contrib/rubyforgepublisher'
|
92
|
-
|
93
|
-
packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" }
|
94
|
-
|
95
|
-
rubyforge = RubyForge.new
|
96
|
-
rubyforge.configure
|
97
|
-
rubyforge.login
|
98
|
-
rubyforge.add_release("brazilian-rails", PKG_NAME, "REL #{PKG_VERSION}", *packages)
|
91
|
+
system("cd pkg/ && gem push #{PKG_NAME}-#{PKG_VERSION}.gem")
|
99
92
|
end
|
data/lib/brdata.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
$:.unshift(File.dirname(__FILE__)) unless
|
2
3
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
4
|
|
@@ -40,4 +41,4 @@ feriados, metodos = FeriadoParser.parser(File.dirname(__FILE__) + "/brdata/confi
|
|
40
41
|
Date::FERIADOS.clear
|
41
42
|
Date::FERIADOS_METODOS.clear
|
42
43
|
feriados.each { |f| Date::FERIADOS << f }
|
43
|
-
metodos.each { |m| Date::FERIADOS_METODOS << m }
|
44
|
+
metodos.each { |m| Date::FERIADOS_METODOS << m }
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
module ActionView::Helpers::DateHelper
|
2
3
|
# Traduz o método distance_of_time_in_words para retornar esse valor em português
|
3
4
|
#
|
@@ -30,4 +31,4 @@ module ActionView::Helpers::DateHelper
|
|
30
31
|
else "mais de #{(distance_in_minutes / 525960).round} anos"
|
31
32
|
end
|
32
33
|
end
|
33
|
-
end
|
34
|
+
end
|
@@ -7,7 +7,7 @@ module ActiveSupport::CoreExtensions::String::Conversions
|
|
7
7
|
if /(\d{1,2})\W(\d{1,2})\W(\d{4})/ =~ self
|
8
8
|
::Date.new($3.to_i, $2.to_i, $1.to_i)
|
9
9
|
else
|
10
|
-
::Date.new(
|
10
|
+
::Date.new(*::Date._parse(self, false).values_at(:year, :mon, :mday))
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -44,4 +44,4 @@ class NilClass
|
|
44
44
|
def to_s_br
|
45
45
|
""
|
46
46
|
end
|
47
|
-
end
|
47
|
+
end
|
data/lib/brdata/excecoes.rb
CHANGED
data/lib/brdata/version.rb
CHANGED
data/test/br_date_helper_test.rb
CHANGED
data/test/date_test.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
require File.dirname(__FILE__) + '/test_helper'
|
2
3
|
|
3
4
|
class DateTest < Test::Unit::TestCase
|
@@ -40,8 +41,12 @@ class DateTest < Test::Unit::TestCase
|
|
40
41
|
assert Date.valid?("13/12/2007"), "Should be a valid date"
|
41
42
|
end
|
42
43
|
|
43
|
-
|
44
|
-
|
44
|
+
if RUBY_VERSION < '1.9'
|
45
|
+
# IMPORTANTE: Date#parse se comporta de forma diferente no ruby 1.9,
|
46
|
+
# por isso esse teste não é executado no 1.9, ate que haja uma solução melhor
|
47
|
+
def test_valid_when_date_format_is_invalid
|
48
|
+
assert !Date.valid?("13/12/200A"), "Should be a invalid date"
|
49
|
+
end
|
45
50
|
end
|
46
51
|
|
47
52
|
def test_valid_when_date_format_is_brazilian_and_valid_format_and_invalid_civil
|
@@ -98,7 +103,7 @@ class DateTest < Test::Unit::TestCase
|
|
98
103
|
end
|
99
104
|
|
100
105
|
def test_date_translation_with_strftime
|
101
|
-
assert_equal "Dezembro Dez Sexta-Feira Sex", Date.parse("12
|
106
|
+
assert_equal "Dezembro Dez Sexta-Feira Sex", Date.parse("2008-12-05").strftime("%B %b %A %a")
|
102
107
|
end
|
103
108
|
|
104
109
|
end
|
data/test/feriado_parser_test.rb
CHANGED
@@ -9,7 +9,7 @@ class FeriadoParserTest < Test::Unit::TestCase
|
|
9
9
|
def test_feriados
|
10
10
|
feriados, metodos = FeriadoParser.parser(FERIADO_YML_PATH)
|
11
11
|
feriados.each {|feriado| assert_kind_of Feriado, feriado}
|
12
|
-
assert_equal NATAL, feriados.
|
12
|
+
assert_equal NATAL, feriados.find {|f| f.nome == "natal"}
|
13
13
|
assert metodos.include?( "pascoa")
|
14
14
|
assert metodos.include?( "corpus_christi")
|
15
15
|
end
|
data/test/feriado_test.rb
CHANGED
data/test/time_test.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
require File.dirname(__FILE__) + '/test_helper'
|
2
3
|
|
3
4
|
class TimeTest < Test::Unit::TestCase
|
4
5
|
|
5
6
|
#to_s
|
6
7
|
def test_time_to_s_with_traditional_format
|
7
|
-
|
8
|
+
if RUBY_VERSION < '1.9'
|
9
|
+
assert_equal "Mon Sep 24 16:03:05 UTC 2007", "Mon Sep 24 16:03:05 UTC 2007".to_time.to_s
|
10
|
+
else
|
11
|
+
assert_equal "2007-09-24 16:03:05 UTC", "2007-09-24 16:03:05 UTC".to_time.to_s
|
12
|
+
end
|
8
13
|
end
|
9
14
|
|
10
15
|
#to_s_br
|
@@ -62,7 +67,7 @@ class TimeTest < Test::Unit::TestCase
|
|
62
67
|
end
|
63
68
|
|
64
69
|
def test_time_translation_with_strftime
|
65
|
-
assert_equal "Dezembro Dez Sexta-Feira Sex", Time.parse("12
|
70
|
+
assert_equal "Dezembro Dez Sexta-Feira Sex", Time.parse("2008-12-05").strftime("%B %b %A %a")
|
66
71
|
end
|
67
72
|
|
68
73
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brdata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Marcos Tapaj\xC3\xB3s"
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2009-04
|
15
|
+
date: 2009-12-04 00:00:00 -02:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -48,9 +48,7 @@ files:
|
|
48
48
|
- README
|
49
49
|
- CHANGELOG
|
50
50
|
- MIT-LICENSE
|
51
|
-
- lib/brdata
|
52
51
|
- lib/brdata/br_date_helper.rb
|
53
|
-
- lib/brdata/config
|
54
52
|
- lib/brdata/config/nacionais_fixos.yml
|
55
53
|
- lib/brdata/config/nacionais_moveis.yml
|
56
54
|
- lib/brdata/date_portuguese.rb
|
@@ -68,6 +66,8 @@ files:
|
|
68
66
|
- test/time_test.rb
|
69
67
|
has_rdoc: true
|
70
68
|
homepage: http://www.improveit.com.br/software_livre/brazilian_rails
|
69
|
+
licenses: []
|
70
|
+
|
71
71
|
post_install_message:
|
72
72
|
rdoc_options: []
|
73
73
|
|
@@ -88,9 +88,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
requirements:
|
89
89
|
- none
|
90
90
|
rubyforge_project: brdata
|
91
|
-
rubygems_version: 1.3.
|
91
|
+
rubygems_version: 1.3.5
|
92
92
|
signing_key:
|
93
|
-
specification_version:
|
93
|
+
specification_version: 3
|
94
94
|
summary: "brdata \xC3\xA9 uma das gems que compoem o Brazilian Rails"
|
95
95
|
test_files: []
|
96
96
|
|