sundial 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock ADDED
@@ -0,0 +1,23 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sundial (1.0.0)
5
+ activesupport
6
+ geokit
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ activesupport (3.2.3)
12
+ i18n (~> 0.6)
13
+ multi_json (~> 1.0)
14
+ geokit (1.6.5)
15
+ multi_json
16
+ i18n (0.6.0)
17
+ multi_json (1.3.4)
18
+
19
+ PLATFORMS
20
+ ruby
21
+
22
+ DEPENDENCIES
23
+ sundial!
data/README ADDED
@@ -0,0 +1,23 @@
1
+ sun = Sundial.new
2
+
3
+ # We use your address to find the latitude and longitude, which are necessary to make an accurate forecast for your location. (or whatever location).
4
+
5
+ sun.address = YOUR ADDRESS HERE
6
+
7
+ sun.address = 127.0.0.1 # Since we pass the address to Geokit, it can be any fragment of an address, or an IP.
8
+
9
+ sun.get_timezone_offset # This will call out to the internet to get your offset from GMT
10
+ # or set it by hand.
11
+ # Again, it's necessary to know the time offset for your coordinates in order to make a accurate forecast.
12
+ sun.offset = -5 # hours off GMT.
13
+
14
+ puts "Sunrise", sun.sunrise_f
15
+ puts "Sunset", sun.sunset_f
16
+
17
+
18
+
19
+
20
+ TODO
21
+
22
+ Get everything under test, and remove dependency on Activesupport. (It's just there to add and subtract hours from dates.)
23
+
data/examples/driver.rb CHANGED
@@ -11,7 +11,8 @@ end
11
11
  #
12
12
  #@s.address = "201 West Broad Street, Richmond, VA"
13
13
  #@s.address = "6526 Stuart Ave, Richmond, VA, 23226"
14
- #@s.date = (Date.today + 110.days + 1.year).jd
14
+ #@s.date = (Date.today + 200.days).jd
15
+ #@s.date = (Date.today - 55.days).jd
15
16
 
16
17
  #@s.address = "Amsterdam, Netherlands"
17
18
  @s.address = @s.external_ip
@@ -68,8 +69,8 @@ def format_datetime(dt)
68
69
  dt.strftime("%B %e %Y %T")
69
70
  end
70
71
 
71
- puts "the equivalent of 9 AM on the solstice on this day would be", format_datetime(@s.nine)
72
- puts "the equivalent of 5 pm on the solstice on this day would be", format_datetime(@s.five)
72
+ puts "the equivalent of 9 AM on the equinox on this day would be", format_datetime(@s.nine)
73
+ puts "the equivalent of 5 pm on the equinox on this day would be", format_datetime(@s.five)
73
74
 
74
75
 
75
76
 
data/lib/sundial.rb CHANGED
@@ -21,7 +21,7 @@ class Sundial
21
21
  end
22
22
 
23
23
  def whatismyip
24
- "http://www.whatismyip.org/"
24
+ "http://checkip.dyndns.org"
25
25
  end
26
26
 
27
27
  def current_julian_date
@@ -30,7 +30,7 @@ class Sundial
30
30
  end
31
31
 
32
32
  def external_ip
33
- @ip ||= open(whatismyip).read
33
+ @ip ||= open(whatismyip).read[/[\d\.]+/]
34
34
  @ip
35
35
  # '75.75.82.80'
36
36
  end
@@ -1,3 +1,3 @@
1
1
  module Sundial
2
- VERSION = "0.0.1"
2
+ VERSION = "1.0.0"
3
3
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sundial
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
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-04-05 00:00:00.000000000 Z
12
+ date: 2012-05-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70204155777920 !ruby/object:Gem::Requirement
16
+ requirement: &70181759576780 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70204155777920
24
+ version_requirements: *70181759576780
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: geokit
27
- requirement: &70204155777420 !ruby/object:Gem::Requirement
27
+ requirement: &70181759576060 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70204155777420
35
+ version_requirements: *70181759576060
36
36
  description: This gem calculates the sunrise and sunset at your current location.
37
37
  email:
38
38
  - larrick@gmail.com
@@ -42,11 +42,14 @@ extra_rdoc_files: []
42
42
  files:
43
43
  - .rvmrc
44
44
  - Gemfile
45
+ - Gemfile.lock
46
+ - README
45
47
  - Rakefile
46
48
  - examples/driver.rb
47
49
  - lib/numeric_extensions.rb
48
50
  - lib/sundial.rb
49
51
  - lib/sundial/version.rb
52
+ - pkg/sundial-0.0.1.gem
50
53
  - sundial.gemspec
51
54
  - test/sun_calculator_test.rb
52
55
  homepage: https://github.com/deathbob/Sundial
@@ -75,3 +78,4 @@ specification_version: 3
75
78
  summary: Gem to calculate the sunrise and sunset at your location
76
79
  test_files:
77
80
  - test/sun_calculator_test.rb
81
+ has_rdoc: