darian 0.0.2 → 0.0.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/.travis.yml +1 -0
- data/.yardopts +1 -0
- data/ChangeLog +4 -0
- data/Gemfile +5 -2
- data/Gemfile.lock +8 -8
- data/README.md +7 -4
- data/Rakefile +7 -4
- data/darian.gemspec +4 -3
- data/lib/darian.rb +7 -1
- data/lib/darian/date.rb +7 -3
- data/lib/darian/date_methods.rb +22 -0
- data/lib/darian/time.rb +3 -2
- data/lib/darian/version.rb +1 -1
- data/spec/darian_spec.rb +4 -2
- metadata +44 -19
data/.travis.yml
CHANGED
data/.yardopts
CHANGED
data/ChangeLog
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -4,15 +4,15 @@ GEM
|
|
4
4
|
diff-lcs (1.1.3)
|
5
5
|
rake (0.9.2.2)
|
6
6
|
redcarpet (2.1.1)
|
7
|
-
rspec (2.
|
8
|
-
rspec-core (~> 2.
|
9
|
-
rspec-expectations (~> 2.
|
10
|
-
rspec-mocks (~> 2.
|
11
|
-
rspec-core (2.
|
12
|
-
rspec-expectations (2.
|
7
|
+
rspec (2.11.0)
|
8
|
+
rspec-core (~> 2.11.0)
|
9
|
+
rspec-expectations (~> 2.11.0)
|
10
|
+
rspec-mocks (~> 2.11.0)
|
11
|
+
rspec-core (2.11.1)
|
12
|
+
rspec-expectations (2.11.2)
|
13
13
|
diff-lcs (~> 1.1.3)
|
14
|
-
rspec-mocks (2.
|
15
|
-
yard (0.8.1)
|
14
|
+
rspec-mocks (2.11.1)
|
15
|
+
yard (0.8.2.1)
|
16
16
|
|
17
17
|
PLATFORMS
|
18
18
|
ruby
|
data/README.md
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
# Darian Mars Calendar Converter
|
2
2
|
|
3
|
+
This is Ruby library to convert Earth time to Mars time in Darian calendar.
|
4
|
+
|
3
5
|
The [Darian calendar] is a proposed system of time-keeping on the planet Mars.
|
4
6
|
It was created by aerospace engineer and political scientist Thomas Gangale
|
5
|
-
in 1985. This library use
|
7
|
+
in 1985. This library use 2002 version of calendar with Telescopic Epoch
|
6
8
|
(1609 instead of 1975 year in original calendar propose).
|
7
9
|
|
8
|
-
This Ruby library convert Earth time to Mars time in Darian calendar.
|
9
|
-
|
10
10
|
Based on [JS converter] by Thomas Gangale.
|
11
11
|
|
12
|
+
Sponsored by [Evil Martians].
|
13
|
+
|
12
14
|
[Darian calendar]: http://en.wikipedia.org/wiki/Darian_calendar
|
13
15
|
[JS converter]: http://pweb.jps.net/~tgangale/mars/converter/calendar_clock.htm
|
16
|
+
[Evil Martians]: http://evilmartians.com/
|
14
17
|
|
15
18
|
## Usage
|
16
19
|
|
@@ -36,7 +39,7 @@ mars_date = Darian.from_earth(earth_date)
|
|
36
39
|
|
37
40
|
## License
|
38
41
|
|
39
|
-
|
42
|
+
Library is licensed under the GNU Lesser General Public License version 3.
|
40
43
|
See the LICENSE file or http://www.gnu.org/licenses/lgpl.html.
|
41
44
|
|
42
45
|
## Author
|
data/Rakefile
CHANGED
@@ -15,10 +15,13 @@ require 'rspec/core/rake_task'
|
|
15
15
|
|
16
16
|
RSpec::Core::RakeTask.new
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
begin
|
19
|
+
require 'yard'
|
20
|
+
YARD::Rake::YardocTask.new do |yard|
|
21
|
+
v = Darian::VERSION
|
22
|
+
yard.options << "--title='Darian Mars Calendar Converter #{v}'"
|
23
|
+
end
|
24
|
+
rescue LoadError; end
|
22
25
|
|
23
26
|
task :clobber_doc do
|
24
27
|
rm_r 'doc' rescue nil
|
data/darian.gemspec
CHANGED
@@ -5,14 +5,15 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.name = 'darian'
|
6
6
|
s.version = Darian::VERSION.dup
|
7
7
|
s.date = Time.now.strftime('%Y-%m-%d')
|
8
|
-
s.summary = 'Darian Mars
|
8
|
+
s.summary = 'Darian Mars calendar converter.'
|
9
9
|
s.description = <<-EOF
|
10
|
-
|
10
|
+
This is Ruby library to convert Earth time to Mars time in Darian calendar.
|
11
|
+
It use 2002 version of calendar with Telescopic Epoch.
|
11
12
|
EOF
|
12
13
|
|
13
14
|
s.files = `git ls-files`.split("\n")
|
14
15
|
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
15
|
-
s.extra_rdoc_files = ['README.md', 'LICENSE']
|
16
|
+
s.extra_rdoc_files = ['README.md', 'LICENSE', 'ChangeLog']
|
16
17
|
s.require_path = 'lib'
|
17
18
|
|
18
19
|
s.author = 'Andrey "A.I." Sitnik'
|
data/lib/darian.rb
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
=begin
|
3
3
|
Main file to load all neccessary classes for Darian Mars calendar.
|
4
4
|
|
5
|
-
Copyright (C) 2012 Andrey “A.I.” Sitnik <andrey@sitnik.ru
|
5
|
+
Copyright (C) 2012 Andrey “A.I.” Sitnik <andrey@sitnik.ru>,
|
6
|
+
sponsored by Evil Martians.
|
6
7
|
|
7
8
|
This program is free software: you can redistribute it and/or modify
|
8
9
|
it under the terms of the GNU Lesser General Public License as published by
|
@@ -24,6 +25,9 @@ require File.join(dir, 'date_methods')
|
|
24
25
|
require File.join(dir, 'time')
|
25
26
|
require File.join(dir, 'date')
|
26
27
|
|
28
|
+
# Darian Mars calendar.
|
29
|
+
#
|
30
|
+
# mars_time = Darian.from_earth(earth_time)
|
27
31
|
module Darian
|
28
32
|
class << self
|
29
33
|
|
@@ -31,6 +35,8 @@ module Darian
|
|
31
35
|
def from_earth(arg)
|
32
36
|
if arg.is_a? ::Time
|
33
37
|
Darian::Time.from_earth(arg)
|
38
|
+
elsif arg.is_a? ::DateTime
|
39
|
+
Darian::Time.from_earth(::Time.parse(arg.to_s))
|
34
40
|
elsif arg.is_a? ::Date
|
35
41
|
Darian::Date.from_earth(arg)
|
36
42
|
else
|
data/lib/darian/date.rb
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
=begin
|
3
3
|
Darian Mars calendar date converter.
|
4
4
|
|
5
|
-
Copyright (C) 2012 Andrey “A.I.” Sitnik <andrey@sitnik.ru
|
5
|
+
Copyright (C) 2012 Andrey “A.I.” Sitnik <andrey@sitnik.ru>,
|
6
|
+
sponsored by Evil Martians.
|
6
7
|
|
7
8
|
This program is free software: you can redistribute it and/or modify
|
8
9
|
it under the terms of the GNU Lesser General Public License as published by
|
@@ -27,12 +28,15 @@ module Darian
|
|
27
28
|
class Date
|
28
29
|
include DateMethods
|
29
30
|
|
31
|
+
# Return Mars date converted from Earth date.
|
32
|
+
#
|
33
|
+
# Darian.from_earth(Date.today)
|
30
34
|
def self.from_earth(date)
|
31
35
|
time = ::Time.parse(date.to_s + " 00:00:00")
|
32
|
-
|
36
|
+
Darian::Time.from_earth(time).to_date
|
33
37
|
end
|
34
38
|
|
35
|
-
# Create martian date by time.
|
39
|
+
# Create martian date by martian time.
|
36
40
|
def initialize(time)
|
37
41
|
@year = time.year
|
38
42
|
@month = time.month
|
data/lib/darian/date_methods.rb
CHANGED
@@ -1,4 +1,26 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
=begin
|
3
|
+
Common date methods for Time and Date classes.
|
4
|
+
|
5
|
+
Copyright (C) 2012 Andrey “A.I.” Sitnik <andrey@sitnik.ru>,
|
6
|
+
sponsored by Evil Martians.
|
7
|
+
|
8
|
+
This program is free software: you can redistribute it and/or modify
|
9
|
+
it under the terms of the GNU Lesser General Public License as published by
|
10
|
+
the Free Software Foundation, either version 3 of the License, or
|
11
|
+
(at your option) any later version.
|
12
|
+
|
13
|
+
This program is distributed in the hope that it will be useful,
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
GNU Lesser General Public License for more details.
|
17
|
+
|
18
|
+
You should have received a copy of the GNU Lesser General Public License
|
19
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20
|
+
=end
|
21
|
+
|
1
22
|
module Darian
|
23
|
+
# Common date methods for Time and Date classes.
|
2
24
|
module DateMethods
|
3
25
|
attr_reader :year
|
4
26
|
attr_reader :month
|
data/lib/darian/time.rb
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
=begin
|
3
3
|
Darian Mars calendar time converter.
|
4
4
|
|
5
|
-
Copyright (C) 2012 Andrey “A.I.” Sitnik <andrey@sitnik.ru
|
5
|
+
Copyright (C) 2012 Andrey “A.I.” Sitnik <andrey@sitnik.ru>,
|
6
|
+
sponsored by Evil Martians.
|
6
7
|
|
7
8
|
This program is free software: you can redistribute it and/or modify
|
8
9
|
it under the terms of the GNU Lesser General Public License as published by
|
@@ -121,7 +122,7 @@ module Darian
|
|
121
122
|
|
122
123
|
# Return martian date.
|
123
124
|
def to_date
|
124
|
-
|
125
|
+
Darian::Date.new(self)
|
125
126
|
end
|
126
127
|
end
|
127
128
|
end
|
data/lib/darian/version.rb
CHANGED
data/spec/darian_spec.rb
CHANGED
@@ -8,8 +8,10 @@ describe Darian do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should convert by argument class" do
|
11
|
-
Darian.from_earth(Time.now).should
|
12
|
-
Darian.from_earth(
|
11
|
+
Darian.from_earth(Time.now).should be_a(Darian::Time)
|
12
|
+
Darian.from_earth(DateTime.now).should be_a(Darian::Time)
|
13
|
+
Darian.from_earth(Date.today).should be_a(Darian::Date)
|
14
|
+
lambda { Darian.from_earth(1) }.should raise_error(ArgumentError)
|
13
15
|
end
|
14
16
|
|
15
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: darian
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 1.0.10
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.10
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: yard
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rake
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: rspec
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '0'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: redcarpet
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,16 +85,21 @@ dependencies:
|
|
65
85
|
version: '0'
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
69
|
-
|
70
|
-
|
71
|
-
'
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: ! " This is Ruby library to convert Earth time to Mars time in Darian
|
95
|
+
calendar.\n It use 2002 version of calendar with Telescopic Epoch.\n"
|
72
96
|
email: andrey@sitnik.ru
|
73
97
|
executables: []
|
74
98
|
extensions: []
|
75
99
|
extra_rdoc_files:
|
76
100
|
- README.md
|
77
101
|
- LICENSE
|
102
|
+
- ChangeLog
|
78
103
|
files:
|
79
104
|
- .gitignore
|
80
105
|
- .rspec
|
@@ -110,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
135
|
version: '0'
|
111
136
|
segments:
|
112
137
|
- 0
|
113
|
-
hash:
|
138
|
+
hash: 856161155010593318
|
114
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
140
|
none: false
|
116
141
|
requirements:
|
@@ -119,12 +144,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
144
|
version: '0'
|
120
145
|
segments:
|
121
146
|
- 0
|
122
|
-
hash:
|
147
|
+
hash: 856161155010593318
|
123
148
|
requirements: []
|
124
149
|
rubyforge_project:
|
125
|
-
rubygems_version: 1.8.
|
150
|
+
rubygems_version: 1.8.23
|
126
151
|
signing_key:
|
127
152
|
specification_version: 3
|
128
|
-
summary: Darian Mars
|
153
|
+
summary: Darian Mars calendar converter.
|
129
154
|
test_files: []
|
130
155
|
has_rdoc:
|