lunar_phase 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +35 -0
- data/Rakefile +2 -0
- data/bin/lunarp +47 -0
- data/lib/lunar_phase/moon.rb +38 -0
- data/lib/lunar_phase/version.rb +3 -0
- data/lib/lunar_phase.rb +7 -0
- data/lunar_phase.gemspec +23 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 34b73cc53e22c9c74d6c9a3d1498ed85d6282f21
|
4
|
+
data.tar.gz: d9ac2f74755038a8fce1b07c5de91444d90104c8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c73a5c5432cba772cc53a7f0156e2047f0dd4d7b5b279e4e7392e67097d6408cddf1b04f09efb6695b6da2974e248c24b374b36d188a3c6dcd32bb4bc521fcb2
|
7
|
+
data.tar.gz: 4adcdb7dc887e2a647c9597cdf814950808a0128be59e65e3b9dd16179fe1a69375ef0df2ee7871f7b7297b723ddacada9ec0052ddab139cad7652651b4e4f02
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Harper Essenfeld
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# LunarPhase
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'lunar_phase'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install lunar_phase
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
lunarp
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
Credits:
|
28
|
+
Thank you, "novatech"!
|
29
|
+
http://programmingpraxis.com/2010/01/22/phases-of-the-moon/
|
30
|
+
|
31
|
+
1. Fork it ( https://github.com/[my-github-username]/lunar_phase/fork )
|
32
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
33
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
34
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
35
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/lunarp
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# require_relative "../lib/lunar_phase/moon"
|
4
|
+
# moon = LunarPhase::Moon.new
|
5
|
+
# moon.get_info
|
6
|
+
|
7
|
+
puts "Enter the date according to the following format: 2014,7,31"
|
8
|
+
date = gets.chomp
|
9
|
+
|
10
|
+
date = date.split(",")
|
11
|
+
year = date[0].to_i
|
12
|
+
month = date[1].to_i
|
13
|
+
day = date[2].to_i
|
14
|
+
|
15
|
+
|
16
|
+
def julian(year, month, day)
|
17
|
+
a = (14-month)/12
|
18
|
+
y = year+4800-a
|
19
|
+
m = (12*a)-3+month
|
20
|
+
return day + (153*m+2)/5 + (365*y) + y/4 - y/100 + y/400 - 32045
|
21
|
+
end
|
22
|
+
|
23
|
+
def phase(year,month,day)
|
24
|
+
p=(julian(year,month,day)-julian(2000,1,6))%29.530588853
|
25
|
+
if p<1.84566
|
26
|
+
return "New"
|
27
|
+
elsif p<5.53699
|
28
|
+
return "Waxing Crescent"
|
29
|
+
elsif p<9.22831
|
30
|
+
return "First Quarter"
|
31
|
+
elsif p<12.91963
|
32
|
+
return "Waxing Gibbous"
|
33
|
+
elsif p<16.61096
|
34
|
+
return "Full"
|
35
|
+
elsif p<20.30228
|
36
|
+
return "Waning Gibbous"
|
37
|
+
elsif p<23.99361
|
38
|
+
return "Last Quarter"
|
39
|
+
elsif p<27.68493
|
40
|
+
return "Waning Crescent"
|
41
|
+
else
|
42
|
+
return "New"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
puts phase(year, month, day)
|
47
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# module LunarPhase
|
2
|
+
# class Moon
|
3
|
+
|
4
|
+
# def julian (year, month, day)
|
5
|
+
# a = (14-month)/12
|
6
|
+
# y = year+4800-a
|
7
|
+
# m = (12*a)-3+month
|
8
|
+
# return day + (153*m+2)/5 + (365*y) + y/4 - y/100 + y/400 - 32045
|
9
|
+
# end
|
10
|
+
|
11
|
+
# def phase (year,month,day)
|
12
|
+
# p=(julian(year,month,day)-julian(2000,1,6))%29.530588853
|
13
|
+
# if p<1.84566: return "New"
|
14
|
+
# elsif p<5.53699: return "Waxing crescent"
|
15
|
+
# elsif p<9.22831: return "First quarter"
|
16
|
+
# elsif p<12.91963: return "Waxing gibbous"
|
17
|
+
# elsif p<16.61096: return "Full"
|
18
|
+
# elsif p<20.30228: return "Waning gibbous"
|
19
|
+
# elsif p<23.99361: return "Last quarter"
|
20
|
+
# elsif p<27.68493: return "Waning crescent"
|
21
|
+
# else return "New"
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
|
26
|
+
# print "#{phase(2020,1,23)}\n"
|
27
|
+
# print "#{phase(1999,1,6)}\n"
|
28
|
+
# print "#{phase(2010,2,10)}\n"
|
29
|
+
# print "#{phase(1987,5,10)}\n"
|
30
|
+
|
31
|
+
|
32
|
+
# module LunarPhase
|
33
|
+
# class Moon
|
34
|
+
# def get_info
|
35
|
+
# puts "full moon"
|
36
|
+
# end
|
37
|
+
# end
|
38
|
+
# end
|
data/lib/lunar_phase.rb
ADDED
data/lunar_phase.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'lunar_phase/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "lunar_phase"
|
8
|
+
spec.version = LunarPhase::VERSION
|
9
|
+
spec.authors = ["Harper Essenfeld"]
|
10
|
+
spec.email = ["harper.essenfeld@gmail.com"]
|
11
|
+
spec.summary = %q{Enter any date in terminal and receive the lunar phase for that date.}
|
12
|
+
spec.description = %q{}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lunar_phase
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Harper Essenfeld
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: ''
|
42
|
+
email:
|
43
|
+
- harper.essenfeld@gmail.com
|
44
|
+
executables:
|
45
|
+
- lunarp
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bin/lunarp
|
55
|
+
- lib/lunar_phase.rb
|
56
|
+
- lib/lunar_phase/moon.rb
|
57
|
+
- lib/lunar_phase/version.rb
|
58
|
+
- lunar_phase.gemspec
|
59
|
+
homepage: ''
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.2.2
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: Enter any date in terminal and receive the lunar phase for that date.
|
83
|
+
test_files: []
|