regentanz 0.3.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +268 -0
  3. data/bin/regentanz +16 -0
  4. data/lib/regentanz.rb +10 -11
  5. data/lib/regentanz/cli/common.rb +35 -0
  6. data/lib/regentanz/cli/compare.rb +85 -0
  7. data/lib/regentanz/cli/compile.rb +27 -0
  8. data/lib/regentanz/template_compiler.rb +263 -0
  9. data/lib/regentanz/version.rb +1 -2
  10. data/lib/regentanz/yaml-ext.rb +18 -0
  11. data/spec/regentanz/resources/test/unloaded.rb +11 -0
  12. data/spec/regentanz/template_compiler_spec.rb +692 -0
  13. data/spec/spec_helper.rb +2 -0
  14. metadata +45 -152
  15. data/.gitignore +0 -5
  16. data/.rvmrc +0 -4
  17. data/CHANGELOG.rdoc +0 -26
  18. data/Gemfile +0 -4
  19. data/LICENSE +0 -24
  20. data/README.rdoc +0 -54
  21. data/Rakefile +0 -23
  22. data/lib/regentanz/astronomy.rb +0 -69
  23. data/lib/regentanz/cache.rb +0 -2
  24. data/lib/regentanz/cache/base.rb +0 -51
  25. data/lib/regentanz/cache/file.rb +0 -86
  26. data/lib/regentanz/callbacks.rb +0 -18
  27. data/lib/regentanz/conditions.rb +0 -3
  28. data/lib/regentanz/conditions/base.rb +0 -16
  29. data/lib/regentanz/conditions/current.rb +0 -14
  30. data/lib/regentanz/conditions/forecast.rb +0 -14
  31. data/lib/regentanz/configuration.rb +0 -55
  32. data/lib/regentanz/configurator.rb +0 -22
  33. data/lib/regentanz/google_weather.rb +0 -151
  34. data/lib/regentanz/parser.rb +0 -1
  35. data/lib/regentanz/parser/google_weather.rb +0 -100
  36. data/lib/regentanz/test_helper.rb +0 -52
  37. data/regentanz.gemspec +0 -30
  38. data/test/factories.rb +0 -6
  39. data/test/support/tmp/.gitignore +0 -1
  40. data/test/support/valid_response.xml.erb +0 -26
  41. data/test/test_helper.rb +0 -14
  42. data/test/unit/astronomy_test.rb +0 -26
  43. data/test/unit/cache/base_test.rb +0 -53
  44. data/test/unit/cache/file_test.rb +0 -141
  45. data/test/unit/callbacks_test.rb +0 -27
  46. data/test/unit/configuration_test.rb +0 -57
  47. data/test/unit/current_condition_test.rb +0 -33
  48. data/test/unit/forecast_condition_test.rb +0 -35
  49. data/test/unit/google_weather_test.rb +0 -125
  50. data/test/unit/parser/google_weather_parser_test.rb +0 -71
@@ -0,0 +1,2 @@
1
+ require 'regentanz'
2
+ require 'regentanz/yaml-ext'
metadata CHANGED
@@ -1,198 +1,91 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: regentanz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
- - Carsten Zimmermann
7
+ - Burt Platform Team
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-09 00:00:00.000000000 Z
11
+ date: 2018-03-20 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: activesupport
14
+ name: aws-sdk-s3
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '3.0'
19
+ version: '1'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '3.0'
26
+ version: '1'
30
27
  - !ruby/object:Gem::Dependency
31
- name: rake
28
+ name: aws-sdk-cloudformation
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: mocha
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: bundler
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- - !ruby/object:Gem::Dependency
79
- name: factory_girl
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ~>
84
- - !ruby/object:Gem::Version
85
- version: '2.0'
86
- type: :development
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ~>
92
- - !ruby/object:Gem::Version
93
- version: '2.0'
94
- - !ruby/object:Gem::Dependency
95
- name: rdoc
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ~>
100
- - !ruby/object:Gem::Version
101
- version: '2.4'
102
- type: :development
33
+ version: '1'
34
+ type: :runtime
103
35
  prerelease: false
104
36
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
37
  requirements:
107
- - - ~>
38
+ - - "~>"
108
39
  - !ruby/object:Gem::Version
109
- version: '2.4'
110
- description: Library to access the Google Weather API
40
+ version: '1'
41
+ description: Regentanz is a template preprocessor and compiler that makes it easier
42
+ to work with CloudFormation
111
43
  email:
112
- - cz@aegisnet.de
113
- executables: []
44
+ - theo@burtcorp.com
45
+ - munkby@burtcorp.com
46
+ - david@burtcorp.com
47
+ executables:
48
+ - regentanz
114
49
  extensions: []
115
50
  extra_rdoc_files: []
116
51
  files:
117
- - .gitignore
118
- - .rvmrc
119
- - CHANGELOG.rdoc
120
- - Gemfile
121
- - LICENSE
122
- - README.rdoc
123
- - Rakefile
52
+ - README.md
53
+ - bin/regentanz
124
54
  - lib/regentanz.rb
125
- - lib/regentanz/astronomy.rb
126
- - lib/regentanz/cache.rb
127
- - lib/regentanz/cache/base.rb
128
- - lib/regentanz/cache/file.rb
129
- - lib/regentanz/callbacks.rb
130
- - lib/regentanz/conditions.rb
131
- - lib/regentanz/conditions/base.rb
132
- - lib/regentanz/conditions/current.rb
133
- - lib/regentanz/conditions/forecast.rb
134
- - lib/regentanz/configuration.rb
135
- - lib/regentanz/configurator.rb
136
- - lib/regentanz/google_weather.rb
137
- - lib/regentanz/parser.rb
138
- - lib/regentanz/parser/google_weather.rb
139
- - lib/regentanz/test_helper.rb
55
+ - lib/regentanz/cli/common.rb
56
+ - lib/regentanz/cli/compare.rb
57
+ - lib/regentanz/cli/compile.rb
58
+ - lib/regentanz/template_compiler.rb
140
59
  - lib/regentanz/version.rb
141
- - regentanz.gemspec
142
- - test/factories.rb
143
- - test/support/tmp/.gitignore
144
- - test/support/valid_response.xml.erb
145
- - test/test_helper.rb
146
- - test/unit/astronomy_test.rb
147
- - test/unit/cache/base_test.rb
148
- - test/unit/cache/file_test.rb
149
- - test/unit/callbacks_test.rb
150
- - test/unit/configuration_test.rb
151
- - test/unit/current_condition_test.rb
152
- - test/unit/forecast_condition_test.rb
153
- - test/unit/google_weather_test.rb
154
- - test/unit/parser/google_weather_parser_test.rb
155
- homepage: ''
156
- licenses: []
60
+ - lib/regentanz/yaml-ext.rb
61
+ - spec/regentanz/resources/test/unloaded.rb
62
+ - spec/regentanz/template_compiler_spec.rb
63
+ - spec/spec_helper.rb
64
+ homepage: http://github.com/burtcorp/regentanz
65
+ licenses:
66
+ - BSD 3-Clause
67
+ metadata: {}
157
68
  post_install_message:
158
69
  rdoc_options: []
159
70
  require_paths:
160
71
  - lib
161
72
  required_ruby_version: !ruby/object:Gem::Requirement
162
- none: false
163
73
  requirements:
164
- - - ! '>='
74
+ - - ">="
165
75
  - !ruby/object:Gem::Version
166
- version: '0'
167
- segments:
168
- - 0
169
- hash: -3677000706019098419
76
+ version: 2.0.0
170
77
  required_rubygems_version: !ruby/object:Gem::Requirement
171
- none: false
172
78
  requirements:
173
- - - ! '>='
79
+ - - ">="
174
80
  - !ruby/object:Gem::Version
175
81
  version: '0'
176
- segments:
177
- - 0
178
- hash: -3677000706019098419
179
82
  requirements: []
180
- rubyforge_project: regentanz
181
- rubygems_version: 1.8.25
83
+ rubyforge_project:
84
+ rubygems_version: 2.6.14
182
85
  signing_key:
183
- specification_version: 3
184
- summary: Library to access the Google Weather API
86
+ specification_version: 4
87
+ summary: Template preprocessor and compiler for CloudFormation
185
88
  test_files:
186
- - test/factories.rb
187
- - test/support/tmp/.gitignore
188
- - test/support/valid_response.xml.erb
189
- - test/test_helper.rb
190
- - test/unit/astronomy_test.rb
191
- - test/unit/cache/base_test.rb
192
- - test/unit/cache/file_test.rb
193
- - test/unit/callbacks_test.rb
194
- - test/unit/configuration_test.rb
195
- - test/unit/current_condition_test.rb
196
- - test/unit/forecast_condition_test.rb
197
- - test/unit/google_weather_test.rb
198
- - test/unit/parser/google_weather_parser_test.rb
89
+ - spec/spec_helper.rb
90
+ - spec/regentanz/template_compiler_spec.rb
91
+ - spec/regentanz/resources/test/unloaded.rb
data/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- .DS_Store
2
- pkg
3
- *~
4
- *.swp
5
- Gemfile.lock
data/.rvmrc DELETED
@@ -1,4 +0,0 @@
1
- # vim: ft=bash
2
- # rvm use 1.9.3-p374
3
- rvm use 1.8.7-p249
4
- rvm --create gemset use $(basename $(pwd))
@@ -1,26 +0,0 @@
1
- == CHANGELOG
2
-
3
- === v0.3.3 // 2013-06-09
4
- * Remove ActionMailer dependency
5
- * Gem functionality is defunct as Google shut down their API
6
-
7
- === v0.1.4 // 2011-10-14
8
- * Fixed bug that caused forecast to have the current day only
9
- * present? now properly returns its true state (as opposed to always false)
10
- * Known issue: {current_date_time node always returns the beginning of The Epoch}[https://github.com/carpodaster/regentanz/issues/1] (API problem)
11
-
12
- === v0.1.2 // 2011-04-19
13
- * Retry state is tracked by cache backend
14
- * Removed OpenStruct by adding Conditions::Forecast and Conditions::Current
15
- * XML-Parsing is down in parser class
16
-
17
- === v0.1.0 // 2011-04-16
18
- * Moved caching into separate module
19
-
20
- === v0.0.5 // 2011-04-15
21
- * Removed RAILS_ROOT
22
- * Moved constants into class-wide configuration
23
- * Callback-stubs
24
-
25
- === v0.0.1 // 2011-04-13
26
- * Initially packaged model as a gem
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in regentanz.gemspec
4
- gemspec
data/LICENSE DELETED
@@ -1,24 +0,0 @@
1
- Copyright (c) 2011, Carsten Zimmermann
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without
5
- modification, are permitted provided that the following conditions are met:
6
- * Redistributions of source code must retain the above copyright
7
- notice, this list of conditions and the following disclaimer.
8
- * Redistributions in binary form must reproduce the above copyright
9
- notice, this list of conditions and the following disclaimer in the
10
- documentation and/or other materials provided with the distribution.
11
- * Neither the name of the original author / copyright holder nor the
12
- names of its contributors may be used to endorse or promote products
13
- derived from this software without specific prior written permission.
14
-
15
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
19
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,54 +0,0 @@
1
- == Regentanz
2
- *Regentanz* (German: <i>rain dance</i>) is a Ruby library to connect to Google's
3
- innofficial (ie. undocumented and unsupported) weather API.
4
-
5
-
6
- === Discontinued Weather API
7
- *Notice*: Google has discontinued their weather service.
8
- The Gem is currently *not* able to return weather data.
9
-
10
- === Installation
11
- The gem is available from rubygems, so using bundler "installation" would be:
12
- # Gemfile
13
- gem 'regentanz'
14
-
15
- === Usage
16
- Supply a location and a language to retrieve weather:
17
- weather = Regentanz::GoogleWeather.new(:location => "Berlin, Germany", :lang => :en)
18
- weather.current # current condition
19
- weather.forecast # array with forecast conditions
20
-
21
- It uses <b>file-based caching</b> by default, other cache backends will follow.
22
- See {Regentanz::Cache::Base}[https://github.com/carpodaster/regentanz/blob/master/lib/regentanz/cache/base.rb]
23
- for details (and if you want to create your own backend).
24
-
25
- === Handling API-Errors
26
-
27
- *TODO* wainting for callbacks
28
-
29
- === Configuration
30
- *Regentanz* can either be configured through a configure block or directly via
31
- its configuration object. It uses sane defaults so there should be no need for
32
- configuration to start right off. If you're using *Regentanz* with Rails,
33
- a file in <tt>config/initializers</tt> is your friend.
34
-
35
- Configure block:
36
- Regentanz.configure do |config|
37
- config.cache_backend Regentanz::Cache::File
38
- config.cache_dir "/path/to/cache_file"
39
- end
40
-
41
- Direct configuration:
42
- Regentanz.configuration.cache_dir = "/some/other/path"
43
-
44
- See {Regentanz::Configuration}[https://github.com/carpodaster/regentanz/blob/master/lib/regentanz/configuration.rb]
45
- for a full list of configurable options.
46
-
47
- === TODO
48
- * Implement OpenWeatherMap as new backend
49
- * Finalise callback hooks
50
- * Make tests pass on Ruby 1.9
51
-
52
- === Credits
53
- *Regentanz* is based upon and extracted from a standalone Ruby class made for
54
- {berlin.kauperts.de}[http://berlin.kauperts.de] by {kaupert media gmbh}[http://kaupertmedia.de].
data/Rakefile DELETED
@@ -1,23 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- Bundler::GemHelper.install_tasks
4
- require 'rake/testtask'
5
- require 'rdoc/task'
6
-
7
- desc 'Default: run unit tests.'
8
- task :default => :test
9
-
10
- Rake::TestTask.new(:test) do |t|
11
- t.libs << 'lib'
12
- t.libs << 'test'
13
- t.pattern = 'test/**/*_test.rb'
14
- t.verbose = true
15
- end
16
-
17
- Rake::RDocTask.new(:rdoc) do |rdoc|
18
- rdoc.rdoc_dir = 'rdoc'
19
- rdoc.title = 'Regentanz'
20
- rdoc.options << '--line-numbers' << '--inline-source'
21
- rdoc.rdoc_files.include('README*')
22
- rdoc.rdoc_files.include('lib/**/*.rb')
23
- end
@@ -1,69 +0,0 @@
1
- module Regentanz
2
- # :nodoc:
3
- # Code taken from http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/264573
4
- module Astronomy
5
- include Math
6
-
7
- private
8
- # :doc:
9
-
10
- def sun_rise_set(mode, lat, lng, zenith = 90.8333)
11
- #step 1: first calculate the day of the year
12
- mode = mode.to_sym
13
- date = Date.today
14
- n=date.yday
15
-
16
- #step 2: convert the longitude to hour value and calculate an approximate time
17
- lng_hour=lng/15
18
- t = n+ ((6-lng_hour)/24) if mode==:sunrise
19
- t = n+ ((18-lng_hour)/24) if mode==:sunset
20
-
21
- #step 3: calculate the sun's mean anomaly
22
- m = (0.9856 * t) - 3.289
23
-
24
- #step 4: calculate the sun's true longitude
25
- l = (m+(1.1916 * sin(deg_to_rad(m))) + (0.020 * sin(deg_to_rad(2*m))) + 282.634) % 360
26
-
27
- #step 5a: calculate the sun's right ascension
28
- ra = rad_to_deg(atan(0.91764 * tan(deg_to_rad(l)))) % 360
29
-
30
- #step 5b: right ascension value needs to be in the same quadrant as L
31
- lquadrant = (l/90).floor*90
32
- raquadrant = (ra/90).floor*90
33
- ra = ra+(lquadrant-raquadrant)
34
-
35
- #step 5c: right ascension value needs to be converted into hours
36
- ra/=15
37
-
38
- #step 6: calculate the sun's declination
39
- sin_dec = 0.39782 * sin(deg_to_rad(l))
40
- cos_dec = cos(asin(sin_dec))
41
- #step 7a: calculate the sun's local hour angle
42
- cos_h = (cos(deg_to_rad(zenith)) - (sin_dec * sin(deg_to_rad(lat)))) / (cos_dec * cos(deg_to_rad(lat)))
43
-
44
- return nil if (not (-1..1).include? cos_h)
45
-
46
- #step 7b: finish calculating H and convert into hours
47
- h = (360 - rad_to_deg(acos(cos_h)))/15 if mode==:sunrise
48
- h = (rad_to_deg(acos(cos_h)))/15 if mode==:sunset
49
-
50
- #step 8: calculate local mean time
51
- t = h + ra - (0.06571 * t) - 6.622
52
- t %=24
53
-
54
- #step 9: convert to UTC
55
- return (date.to_datetime+(t - lng_hour)/24).to_time.getlocal
56
- end
57
-
58
- # Convenience helper
59
- def deg_to_rad(degrees)
60
- degrees*PI/180
61
- end
62
-
63
- # Convenience helper
64
- def rad_to_deg(radians)
65
- radians*180/PI
66
- end
67
-
68
- end
69
- end