fiscali 1.2.5 → 2.0.0
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 +15 -3
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/README.markdown +7 -3
- data/Rakefile +5 -55
- data/fiscali.gemspec +17 -45
- data/lib/fiscali.rb +3 -0
- data/lib/rising_sun/fiscali.rb +80 -85
- data/lib/rising_sun/version.rb +5 -0
- data/spec/fiscali_spec.rb +90 -0
- data/spec/spec_helper.rb +5 -0
- metadata +69 -23
- data/VERSION +0 -1
- data/test/fiscali_test.rb +0 -62
- data/test/test_helper.rb +0 -3
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.markdown
CHANGED
@@ -13,14 +13,18 @@ Fiscali provides ONE thing:
|
|
13
13
|
|
14
14
|
## Installing
|
15
15
|
|
16
|
-
# Install the gem:
|
17
|
-
sudo gem install
|
16
|
+
# Install the gem (from gemcutter.org):
|
17
|
+
sudo gem install fiscali
|
18
18
|
|
19
19
|
## Using in your Rails project
|
20
20
|
|
21
21
|
It's easy to get up and running. Update your config/environment.rb file with this gem
|
22
22
|
|
23
|
-
config.gem "
|
23
|
+
config.gem "fiscali"
|
24
|
+
|
25
|
+
In newer Rails projects, include the gem in the Gemfile and run "bundle install" to install the gem.
|
26
|
+
|
27
|
+
gem "fiscali"
|
24
28
|
|
25
29
|
Next step is to provide your Date/Time class your start zone. Stick this in an initializer file. (If you didnt understand that, put it in $ENV[RAILS_ROOT]/config/initializers/fiscali.rb)
|
26
30
|
|
data/Rakefile
CHANGED
@@ -1,57 +1,7 @@
|
|
1
|
-
|
2
|
-
require
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
require 'rspec/core/rake_task'
|
3
4
|
|
4
|
-
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "fiscali"
|
8
|
-
gem.summary = %Q{Fiscal Year Date Functions}
|
9
|
-
gem.email = "aditya.sanghi@risingsunbilling.com"
|
10
|
-
gem.homepage = "http://asanghi.github.com/fiscali"
|
11
|
-
gem.authors = ["Aditya Sanghi"]
|
12
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
13
|
-
gem.add_dependency('activesupport')
|
14
|
-
end
|
15
|
-
|
16
|
-
rescue LoadError
|
17
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
18
|
-
end
|
19
|
-
|
20
|
-
require 'rake/testtask'
|
21
|
-
Rake::TestTask.new(:test) do |test|
|
22
|
-
test.libs << 'lib' << 'test'
|
23
|
-
test.pattern = 'test/**/*_test.rb'
|
24
|
-
test.verbose = true
|
25
|
-
end
|
26
|
-
|
27
|
-
begin
|
28
|
-
require 'rcov/rcovtask'
|
29
|
-
Rcov::RcovTask.new do |test|
|
30
|
-
test.libs << 'test'
|
31
|
-
test.pattern = 'test/**/*_test.rb'
|
32
|
-
test.verbose = true
|
33
|
-
end
|
34
|
-
rescue LoadError
|
35
|
-
task :rcov do
|
36
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
|
41
|
-
task :default => :test
|
42
|
-
|
43
|
-
require 'rake/rdoctask'
|
44
|
-
Rake::RDocTask.new do |rdoc|
|
45
|
-
if File.exist?('VERSION.yml')
|
46
|
-
config = YAML.load(File.read('VERSION.yml'))
|
47
|
-
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
48
|
-
else
|
49
|
-
version = ""
|
50
|
-
end
|
51
|
-
|
52
|
-
rdoc.rdoc_dir = 'rdoc'
|
53
|
-
rdoc.title = "fiscali #{version}"
|
54
|
-
rdoc.rdoc_files.include('README*')
|
55
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
56
|
-
end
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
57
6
|
|
7
|
+
task :default => :spec
|
data/fiscali.gemspec
CHANGED
@@ -1,51 +1,23 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/rising_sun/version', __FILE__)
|
2
3
|
|
3
|
-
Gem::Specification.new do |
|
4
|
-
|
5
|
-
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = "fiscali"
|
6
|
+
gem.version = RisingSun::Fiscali::VERSION
|
7
|
+
gem.authors = ["Aditya Sanghi"]
|
8
|
+
gem.email = ["asanghi@me.com"]
|
9
|
+
gem.description = %q{Fiscal Year Date Functions}
|
10
|
+
gem.summary = %q{Fiscal Year Date Functions}
|
11
|
+
gem.homepage = "https://github.com/asanghi/fiscali"
|
6
12
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
s.extra_rdoc_files = [
|
12
|
-
"LICENSE",
|
13
|
-
"README.markdown"
|
14
|
-
]
|
15
|
-
s.files = [
|
16
|
-
".document",
|
17
|
-
".gitignore",
|
18
|
-
"LICENSE",
|
19
|
-
"README.markdown",
|
20
|
-
"Rakefile",
|
21
|
-
"VERSION",
|
22
|
-
"fiscali.gemspec",
|
23
|
-
"install.rb",
|
24
|
-
"lib/fiscali.rb",
|
25
|
-
"lib/rising_sun/fiscali.rb",
|
26
|
-
"test/fiscali_test.rb",
|
27
|
-
"test/test_helper.rb"
|
28
|
-
]
|
29
|
-
s.homepage = %q{http://asanghi.github.com/fiscali}
|
30
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
31
|
-
s.require_paths = ["lib"]
|
32
|
-
s.rubygems_version = %q{1.3.5}
|
33
|
-
s.summary = %q{Fiscal Year Date Functions}
|
34
|
-
s.test_files = [
|
35
|
-
"test/fiscali_test.rb",
|
36
|
-
"test/test_helper.rb"
|
37
|
-
]
|
13
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
14
|
+
gem.files = `git ls-files`.split("\n")
|
15
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
gem.require_paths = ["lib"]
|
38
17
|
|
39
|
-
|
40
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
41
|
-
s.specification_version = 3
|
18
|
+
gem.add_dependency 'activesupport'
|
42
19
|
|
43
|
-
|
44
|
-
|
45
|
-
else
|
46
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
47
|
-
end
|
48
|
-
else
|
49
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
50
|
-
end
|
20
|
+
gem.add_development_dependency 'rake'
|
21
|
+
gem.add_development_dependency 'rspec', '~> 2.8'
|
51
22
|
end
|
23
|
+
|
data/lib/fiscali.rb
CHANGED
data/lib/rising_sun/fiscali.rb
CHANGED
@@ -2,36 +2,34 @@ module RisingSun
|
|
2
2
|
module Fiscali
|
3
3
|
def self.included(base)
|
4
4
|
base.extend ClassMethods
|
5
|
-
unless included_modules.include? InstanceMethods
|
6
|
-
base.send(:include, InstanceMethods)
|
7
|
-
end
|
8
5
|
end
|
9
|
-
|
6
|
+
|
10
7
|
FISCAL_ZONE = {:india => 4, :uk => 4, :us => 10, :pakistan => 7,
|
11
8
|
:australia => 7, :ireland => 1, :nz => 7, :japan => 4}
|
12
9
|
FY_START_MONTH = 1
|
13
|
-
|
10
|
+
|
14
11
|
module ClassMethods
|
12
|
+
|
15
13
|
def fiscal_zone=(zone)
|
16
|
-
|
17
|
-
|
14
|
+
Thread.current[:fiscali_start_month] = FISCAL_ZONE[zone] || FY_START_MONTH
|
15
|
+
Thread.current[:fiscali_zone] = zone
|
18
16
|
end
|
19
17
|
|
20
18
|
def fy_start_month
|
21
|
-
|
19
|
+
Thread.current[:fiscali_start_month] || FY_START_MONTH
|
22
20
|
end
|
23
21
|
|
24
22
|
def fiscal_zone
|
25
|
-
|
23
|
+
Thread.current[:fiscali_zone]
|
26
24
|
end
|
27
25
|
|
28
26
|
def fy_start_month=(month)
|
29
|
-
|
30
|
-
|
27
|
+
Thread.current[:fiscali_zone] = nil
|
28
|
+
Thread.current[:fiscali_start_month] = month
|
31
29
|
end
|
32
30
|
|
33
31
|
def financial_year_start(year=Date.today.year)
|
34
|
-
|
32
|
+
new(year,fy_start_month,1)
|
35
33
|
end
|
36
34
|
|
37
35
|
def financial_months
|
@@ -40,102 +38,99 @@ module RisingSun
|
|
40
38
|
|
41
39
|
end
|
42
40
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
41
|
+
def financial_year
|
42
|
+
self.month < start_month ? self.year - 1 : self.year
|
43
|
+
end
|
47
44
|
|
48
|
-
|
49
|
-
|
50
|
-
|
45
|
+
def beginning_of_financial_year
|
46
|
+
change(:year => financial_year, :month => start_month, :day => 1)
|
47
|
+
end
|
51
48
|
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
def end_of_financial_year
|
50
|
+
(beginning_of_financial_year + 1.year - 1.month).end_of_month
|
51
|
+
end
|
55
52
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
53
|
+
alias :beginning_of_financial_q1 :beginning_of_financial_year
|
54
|
+
def end_of_financial_q1
|
55
|
+
end_of_financial_year - 9.months
|
56
|
+
end
|
60
57
|
|
61
|
-
|
62
|
-
|
63
|
-
|
58
|
+
def beginning_of_financial_q2
|
59
|
+
beginning_of_financial_year + 3.months
|
60
|
+
end
|
64
61
|
|
65
|
-
|
66
|
-
|
67
|
-
|
62
|
+
def end_of_financial_q2
|
63
|
+
end_of_financial_year - 6.months
|
64
|
+
end
|
68
65
|
|
69
|
-
|
70
|
-
|
71
|
-
|
66
|
+
def beginning_of_financial_q3
|
67
|
+
beginning_of_financial_year + 6.months
|
68
|
+
end
|
72
69
|
|
73
|
-
|
74
|
-
|
75
|
-
|
70
|
+
def end_of_financial_q3
|
71
|
+
end_of_financial_year - 3.months
|
72
|
+
end
|
76
73
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
74
|
+
def beginning_of_financial_q4
|
75
|
+
beginning_of_financial_year + 9.months
|
76
|
+
end
|
77
|
+
alias :end_of_financial_q4 :end_of_financial_year
|
81
78
|
|
82
|
-
|
83
|
-
|
79
|
+
alias :beginning_of_financial_h1 :beginning_of_financial_year
|
80
|
+
alias :end_of_financial_h1 :end_of_financial_q2
|
84
81
|
|
85
|
-
|
86
|
-
|
82
|
+
alias :beginning_of_financial_h2 :beginning_of_financial_q3
|
83
|
+
alias :end_of_financial_h2 :end_of_financial_year
|
87
84
|
|
88
|
-
|
89
|
-
|
90
|
-
|
85
|
+
def financial_quarter
|
86
|
+
"Q#{( months_between / 3 ).floor + 1} #{financial_year}"
|
87
|
+
end
|
91
88
|
|
92
|
-
|
93
|
-
|
94
|
-
|
89
|
+
def financial_half
|
90
|
+
"H#{( months_between / 6 ).floor + 1} #{financial_year}"
|
91
|
+
end
|
95
92
|
|
96
|
-
|
97
|
-
|
98
|
-
|
93
|
+
def next_financial_quarter
|
94
|
+
beginning_of_financial_year.months_since(((months_between / 3).floor + 1 ) * 3)
|
95
|
+
end
|
99
96
|
|
100
|
-
|
101
|
-
|
102
|
-
|
97
|
+
def next_financial_half
|
98
|
+
beginning_of_financial_year.months_since(((months_between / 6).floor + 1) * 6)
|
99
|
+
end
|
103
100
|
|
104
|
-
|
105
|
-
|
106
|
-
|
101
|
+
def beginning_of_financial_quarter
|
102
|
+
beginning_of_financial_year.months_since(((months_between / 3).floor) * 3)
|
103
|
+
end
|
107
104
|
|
108
|
-
|
109
|
-
|
110
|
-
|
105
|
+
def beginning_of_financial_half
|
106
|
+
beginning_of_financial_year.months_since(((months_between / 6).floor) * 6)
|
107
|
+
end
|
111
108
|
|
112
|
-
|
113
|
-
|
114
|
-
|
109
|
+
def previous_financial_quarter
|
110
|
+
beginning_of_financial_quarter.months_ago(3)
|
111
|
+
end
|
115
112
|
|
116
|
-
|
117
|
-
|
118
|
-
|
113
|
+
def previous_financial_half
|
114
|
+
beginning_of_financial_half.months_ago(6)
|
115
|
+
end
|
119
116
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
end
|
117
|
+
def financial_month_of(month)
|
118
|
+
if month < start_month
|
119
|
+
Date.new(year+1,month,1)
|
120
|
+
else
|
121
|
+
Date.new(year,month,1)
|
126
122
|
end
|
123
|
+
end
|
127
124
|
|
128
|
-
|
129
|
-
|
130
|
-
def months_between
|
131
|
-
soy = self.beginning_of_financial_year
|
132
|
-
(self.month - soy.month) + 12 * (self.year - soy.year)
|
133
|
-
end
|
125
|
+
private
|
134
126
|
|
135
|
-
|
136
|
-
|
137
|
-
|
127
|
+
def months_between
|
128
|
+
soy = self.beginning_of_financial_year
|
129
|
+
(self.month - soy.month) + 12 * (self.year - soy.year)
|
130
|
+
end
|
138
131
|
|
132
|
+
def start_month
|
133
|
+
self.class.fy_start_month || FY_START_MONTH
|
139
134
|
end
|
140
135
|
|
141
136
|
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "fiscali" do
|
4
|
+
it "should be possible to read fiscal zone" do
|
5
|
+
Date.fiscal_zone.should be_nil
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should be possible to write fiscal zone" do
|
9
|
+
Date.fiscal_zone = :india
|
10
|
+
Date.fiscal_zone.should eql(:india)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should be possible to read fiscal start month" do
|
14
|
+
Date.fy_start_month = 2
|
15
|
+
Date.fy_start_month.should eql(2)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should report financial year start" do
|
19
|
+
Date.fiscal_zone = :india
|
20
|
+
this_year = Date.today.year
|
21
|
+
Date.financial_year_start.should eql(Date.new(this_year,4,1))
|
22
|
+
|
23
|
+
Date.financial_year_start(2009).should eql(Date.new(2009,4,1))
|
24
|
+
end
|
25
|
+
|
26
|
+
context "should report correct date field" do
|
27
|
+
before(:each) do
|
28
|
+
@d = Date.new(2009,1,1)
|
29
|
+
end
|
30
|
+
it "should report correct financial year" do
|
31
|
+
@d.financial_year.should eql(2008)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should report correct beginning and of financial year" do
|
35
|
+
@d.beginning_of_financial_year.should eql(Date.new(2008,4,1))
|
36
|
+
@d.end_of_financial_year.should eql(Date.new(2009,3,31))
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should report correct beginning of financial halves and quarters" do
|
40
|
+
@d.beginning_of_financial_h1.should eql(Date.new(2008,4,1))
|
41
|
+
@d.beginning_of_financial_h2.should eql(Date.new(2008,10,1))
|
42
|
+
@d.beginning_of_financial_q1.should eql(Date.new(2008,4,1))
|
43
|
+
@d.beginning_of_financial_q2.should eql(Date.new(2008,7,1))
|
44
|
+
@d.beginning_of_financial_q3.should eql(Date.new(2008,10,1))
|
45
|
+
@d.beginning_of_financial_q4.should eql(Date.new(2009,1,1))
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should report correct end of financial halves and quarters" do
|
49
|
+
@d.end_of_financial_h1.should eql(Date.new(2008,9,30))
|
50
|
+
@d.end_of_financial_h2.should eql(Date.new(2009,3,31))
|
51
|
+
@d.end_of_financial_q1.should eql(Date.new(2008,6,30))
|
52
|
+
@d.end_of_financial_q2.should eql(Date.new(2008,9,30))
|
53
|
+
@d.end_of_financial_q3.should eql(Date.new(2008,12,31))
|
54
|
+
@d.end_of_financial_q4.should eql(Date.new(2009,3,31))
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should report financial quarters" do
|
58
|
+
@d.financial_quarter.should eql('Q4 2008')
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should report financial half" do
|
62
|
+
@d.financial_half.should eql('H2 2008')
|
63
|
+
Date.new(2009,11,30).financial_half.should eql("H2 2009")
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should report next half and quarter" do
|
67
|
+
@d.next_financial_half.should eql(Date.new(2009,4,1))
|
68
|
+
Date.new(2009,6,1).next_financial_half.should eql(Date.new(2009,10,1))
|
69
|
+
|
70
|
+
@d.next_financial_quarter.should eql(Date.new(2009,4,1))
|
71
|
+
Date.new(2009,10,30).next_financial_quarter.should eql(Date.new(2010,1,1))
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should report beginning of financial half and quarter" do
|
75
|
+
@d.beginning_of_financial_half.should eql(Date.new(2008,10,1))
|
76
|
+
@d.beginning_of_financial_quarter.should eql(Date.new(2009,1,1))
|
77
|
+
Date.new(2009,6,1).beginning_of_financial_half.should eql(Date.new(2009,4,1))
|
78
|
+
Date.new(2009,10,30).beginning_of_financial_quarter.should eql(Date.new(2009,10,1))
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should report previous financial half and quarter" do
|
82
|
+
@d.previous_financial_half.should eql(Date.new(2008,4,1))
|
83
|
+
@d.previous_financial_quarter.should eql(Date.new(2008,10,1))
|
84
|
+
Date.new(2009,6,1).previous_financial_half.should eql(Date.new(2008,10,1))
|
85
|
+
Date.new(2009,10,30).previous_financial_quarter.should eql(Date.new(2009,7,1))
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fiscali
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 15
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 2.0.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Aditya Sanghi
|
@@ -9,69 +15,109 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
13
|
-
default_executable:
|
18
|
+
date: 2012-02-15 00:00:00 Z
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: activesupport
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
17
32
|
type: :runtime
|
18
|
-
|
19
|
-
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: rake
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
20
39
|
requirements:
|
21
40
|
- - ">="
|
22
41
|
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
23
45
|
version: "0"
|
24
|
-
|
25
|
-
|
26
|
-
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rspec
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 19
|
57
|
+
segments:
|
58
|
+
- 2
|
59
|
+
- 8
|
60
|
+
version: "2.8"
|
61
|
+
type: :development
|
62
|
+
version_requirements: *id003
|
63
|
+
description: Fiscal Year Date Functions
|
64
|
+
email:
|
65
|
+
- asanghi@me.com
|
27
66
|
executables: []
|
28
67
|
|
29
68
|
extensions: []
|
30
69
|
|
31
|
-
extra_rdoc_files:
|
32
|
-
|
33
|
-
- README.markdown
|
70
|
+
extra_rdoc_files: []
|
71
|
+
|
34
72
|
files:
|
35
73
|
- .document
|
36
74
|
- .gitignore
|
75
|
+
- .travis.yml
|
76
|
+
- Gemfile
|
37
77
|
- LICENSE
|
38
78
|
- README.markdown
|
39
79
|
- Rakefile
|
40
|
-
- VERSION
|
41
80
|
- fiscali.gemspec
|
42
81
|
- install.rb
|
43
82
|
- lib/fiscali.rb
|
44
83
|
- lib/rising_sun/fiscali.rb
|
45
|
-
-
|
46
|
-
-
|
47
|
-
|
48
|
-
homepage:
|
84
|
+
- lib/rising_sun/version.rb
|
85
|
+
- spec/fiscali_spec.rb
|
86
|
+
- spec/spec_helper.rb
|
87
|
+
homepage: https://github.com/asanghi/fiscali
|
49
88
|
licenses: []
|
50
89
|
|
51
90
|
post_install_message:
|
52
|
-
rdoc_options:
|
53
|
-
|
91
|
+
rdoc_options: []
|
92
|
+
|
54
93
|
require_paths:
|
55
94
|
- lib
|
56
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
57
97
|
requirements:
|
58
98
|
- - ">="
|
59
99
|
- !ruby/object:Gem::Version
|
100
|
+
hash: 3
|
101
|
+
segments:
|
102
|
+
- 0
|
60
103
|
version: "0"
|
61
|
-
version:
|
62
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
63
106
|
requirements:
|
64
107
|
- - ">="
|
65
108
|
- !ruby/object:Gem::Version
|
109
|
+
hash: 3
|
110
|
+
segments:
|
111
|
+
- 0
|
66
112
|
version: "0"
|
67
|
-
version:
|
68
113
|
requirements: []
|
69
114
|
|
70
115
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.
|
116
|
+
rubygems_version: 1.8.11
|
72
117
|
signing_key:
|
73
118
|
specification_version: 3
|
74
119
|
summary: Fiscal Year Date Functions
|
75
120
|
test_files:
|
76
|
-
-
|
77
|
-
-
|
121
|
+
- spec/fiscali_spec.rb
|
122
|
+
- spec/spec_helper.rb
|
123
|
+
has_rdoc:
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.2.5
|
data/test/fiscali_test.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class FiscaliTest < ActiveSupport::TestCase
|
4
|
-
test "date test" do
|
5
|
-
Date.fiscal_zone = :india
|
6
|
-
assert_equal(Date.fiscal_zone,:india)
|
7
|
-
assert_equal(Date.fy_start_month,4)
|
8
|
-
Date.fy_start_month = 2
|
9
|
-
assert_equal(Date.fy_start_month,2)
|
10
|
-
|
11
|
-
Date.fiscal_zone = :india
|
12
|
-
|
13
|
-
d = Date.financial_year_start(2009)
|
14
|
-
assert_equal(d,Date.new(2009,4,1),'Financial Year start not correct')
|
15
|
-
|
16
|
-
d = Date.new(2009,1,1)
|
17
|
-
assert_equal(d.financial_year,2008,'Financial Year is not correct')
|
18
|
-
assert_equal(d.beginning_of_financial_year,Date.new(2008,4,1),'Beginning of FY is not correct')
|
19
|
-
assert_equal(d.beginning_of_financial_h1,Date.new(2008,4,1),'Beginning of h1 is not correct')
|
20
|
-
assert_equal(d.beginning_of_financial_h2,Date.new(2008,10,1),'Beginning of h2 is not correct')
|
21
|
-
assert_equal(d.beginning_of_financial_q1,Date.new(2008,4,1),'Beginning of q1 is not correct')
|
22
|
-
assert_equal(d.beginning_of_financial_q2,Date.new(2008,7,1),'Beginning of q2 is not correct')
|
23
|
-
assert_equal(d.beginning_of_financial_q3,Date.new(2008,10,1),'Beginning of q3 is not correct')
|
24
|
-
assert_equal(d.beginning_of_financial_q4,Date.new(2009,1,1),'Beginning of q4 is not correct')
|
25
|
-
|
26
|
-
assert_equal(d.end_of_financial_year,Date.new(2009,3,31),'End of FY is not correct')
|
27
|
-
assert_equal(d.end_of_financial_h1,Date.new(2008,9,30),'End of h1 is not correct')
|
28
|
-
assert_equal(d.end_of_financial_h2,Date.new(2009,3,31),'End of h2 is not correct')
|
29
|
-
assert_equal(d.end_of_financial_q1,Date.new(2008,6,30),'End of q1 is not correct')
|
30
|
-
assert_equal(d.end_of_financial_q2,Date.new(2008,9,30),'End of q2 is not correct')
|
31
|
-
assert_equal(d.end_of_financial_q3,Date.new(2008,12,31),'End of q3 is not correct')
|
32
|
-
assert_equal(d.end_of_financial_q4,Date.new(2009,3,31),'End of q4 is not correct')
|
33
|
-
|
34
|
-
assert_equal(d.financial_quarter,'Q4 2008','Financial Quarter is not correct')
|
35
|
-
assert_equal(Date.new(2008,4,1).financial_quarter,'Q1 2008','Financial Quarter is not correct')
|
36
|
-
assert_equal(d.financial_half,'H2 2008','Financial Half is not correct')
|
37
|
-
assert_equal(Date.new(2009,11,30).financial_half,'H2 2009','Financial Half is not correct')
|
38
|
-
|
39
|
-
assert_equal(d.next_financial_half,Date.new(2009,4,1),'Next Financial Half is not correct')
|
40
|
-
assert_equal(d.next_financial_quarter,Date.new(2009,4,1),'Next Financial Quarter is not correct')
|
41
|
-
assert_equal(Date.new(2009,6,1).next_financial_half,Date.new(2009,10,1), 'Next Financial Half is not correct')
|
42
|
-
assert_equal(Date.new(2009,10,30).next_financial_quarter,Date.new(2010,1,1),'Next Financial Quarter is not correct')
|
43
|
-
|
44
|
-
assert_equal(d.beginning_of_financial_half,
|
45
|
-
Date.new(2008,10,1),'Beginning of Financial Half is not correct')
|
46
|
-
assert_equal(d.beginning_of_financial_quarter,
|
47
|
-
Date.new(2009,1,1),'Beginning of Financial Quarter is not correct')
|
48
|
-
assert_equal(Date.new(2009,6,1).beginning_of_financial_half,
|
49
|
-
Date.new(2009,4,1), 'Beginning of Financial Half is not correct')
|
50
|
-
assert_equal(Date.new(2009,10,30).beginning_of_financial_quarter,
|
51
|
-
Date.new(2009,10,1),'Beginning of Financial Quarter is not correct')
|
52
|
-
|
53
|
-
assert_equal(d.previous_financial_half,
|
54
|
-
Date.new(2008,4,1),'Previous Financial Half is not correct')
|
55
|
-
assert_equal(d.previous_financial_quarter,
|
56
|
-
Date.new(2008,10,1),'Previous Financial Quarter is not correct')
|
57
|
-
assert_equal(Date.new(2009,6,1).previous_financial_half,
|
58
|
-
Date.new(2008,10,1), 'Previous Financial Half is not correct')
|
59
|
-
assert_equal(Date.new(2009,10,30).previous_financial_quarter,
|
60
|
-
Date.new(2009,7,1),'Previous Financial Quarter is not correct')
|
61
|
-
end
|
62
|
-
end
|
data/test/test_helper.rb
DELETED