internal_tide_wrapper 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +135 -0
- data/LICENSE.txt +20 -0
- data/README.md +18 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/world_tides +18 -0
- data/lib/world_tides.rb +4 -0
- data/lib/world_tides/api_wrapper.rb +81 -0
- data/lib/world_tides/cli.rb +33 -0
- data/lib/world_tides/command.rb +121 -0
- data/lib/world_tides/commands/.gitkeep +1 -0
- data/lib/world_tides/commands/fetch.rb +22 -0
- data/lib/world_tides/templates/.gitkeep +1 -0
- data/lib/world_tides/templates/fetch/.gitkeep +1 -0
- data/lib/world_tides/version.rb +3 -0
- data/world_tides.gemspec +47 -0
- metadata +389 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6c080ec9e5862e192283e736d41f6288c37b5bcefa20db8b3083db6bd38fc6c1
|
4
|
+
data.tar.gz: 3a9b4dcd5143ac07e30331aafe17716e47763303f216d54d1afc4d10b50a53ae
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e8d87dc9182ad6356910c21177a6baff3268e16f5f9c6807f7bd63633e3efe8cffd955b0a9a633256e8850e3af22bd1d25a7b2d3d0ed484adea8d0de08896843
|
7
|
+
data.tar.gz: 6f73fd33d1ad49348319e9df693053ac420a7460d007498748691ad074bb4c3c77336bdcb59c57c1dea84f2b935321ba2ff17c0c1f4001fabae92bf032bb87fa
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at danielsteele@hotmail.co.uk. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
world_tides (0.1.0)
|
5
|
+
activesupport (~> 5.1)
|
6
|
+
httparty (~> 0.16)
|
7
|
+
pastel (~> 0.7.2)
|
8
|
+
thor (~> 0.19.4)
|
9
|
+
tty-color (~> 0.4.2)
|
10
|
+
tty-command (~> 0.7.0)
|
11
|
+
tty-cursor (~> 0.5.0)
|
12
|
+
tty-editor (~> 0.3.0)
|
13
|
+
tty-file (~> 0.5.0)
|
14
|
+
tty-font (~> 0.2.0)
|
15
|
+
tty-markdown (~> 0.3.0)
|
16
|
+
tty-pager (~> 0.11.0)
|
17
|
+
tty-platform (~> 0.1.0)
|
18
|
+
tty-progressbar (~> 0.13.0)
|
19
|
+
tty-prompt (~> 0.14.0)
|
20
|
+
tty-screen (~> 0.6.4)
|
21
|
+
tty-spinner (~> 0.8.0)
|
22
|
+
tty-table (~> 0.10.0)
|
23
|
+
tty-tree (~> 0.1.0)
|
24
|
+
tty-which (~> 0.3.0)
|
25
|
+
|
26
|
+
GEM
|
27
|
+
remote: https://rubygems.org/
|
28
|
+
specs:
|
29
|
+
activesupport (5.2.0)
|
30
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
31
|
+
i18n (>= 0.7, < 2)
|
32
|
+
minitest (~> 5.1)
|
33
|
+
tzinfo (~> 1.1)
|
34
|
+
concurrent-ruby (1.0.5)
|
35
|
+
diff-lcs (1.3)
|
36
|
+
equatable (0.5.0)
|
37
|
+
hitimes (1.2.6)
|
38
|
+
httparty (0.16.2)
|
39
|
+
multi_xml (>= 0.5.2)
|
40
|
+
i18n (1.0.0)
|
41
|
+
concurrent-ruby (~> 1.0)
|
42
|
+
kramdown (1.16.2)
|
43
|
+
minitest (5.11.3)
|
44
|
+
multi_xml (0.6.0)
|
45
|
+
necromancer (0.4.0)
|
46
|
+
pastel (0.7.2)
|
47
|
+
equatable (~> 0.5.0)
|
48
|
+
tty-color (~> 0.4.0)
|
49
|
+
rake (10.5.0)
|
50
|
+
rouge (3.1.1)
|
51
|
+
rspec (3.7.0)
|
52
|
+
rspec-core (~> 3.7.0)
|
53
|
+
rspec-expectations (~> 3.7.0)
|
54
|
+
rspec-mocks (~> 3.7.0)
|
55
|
+
rspec-core (3.7.1)
|
56
|
+
rspec-support (~> 3.7.0)
|
57
|
+
rspec-expectations (3.7.0)
|
58
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
59
|
+
rspec-support (~> 3.7.0)
|
60
|
+
rspec-mocks (3.7.0)
|
61
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
62
|
+
rspec-support (~> 3.7.0)
|
63
|
+
rspec-support (3.7.1)
|
64
|
+
strings (0.1.1)
|
65
|
+
unicode-display_width (~> 1.3.0)
|
66
|
+
unicode_utils (~> 1.4.0)
|
67
|
+
thor (0.19.4)
|
68
|
+
thread_safe (0.3.6)
|
69
|
+
timers (4.1.2)
|
70
|
+
hitimes
|
71
|
+
tty-color (0.4.2)
|
72
|
+
tty-command (0.7.0)
|
73
|
+
pastel (~> 0.7.0)
|
74
|
+
tty-cursor (0.5.0)
|
75
|
+
tty-editor (0.3.0)
|
76
|
+
tty-prompt (~> 0.14.0)
|
77
|
+
tty-which (~> 0.3.0)
|
78
|
+
tty-file (0.5.0)
|
79
|
+
diff-lcs (~> 1.3.0)
|
80
|
+
pastel (~> 0.7.2)
|
81
|
+
tty-prompt (~> 0.14.0)
|
82
|
+
tty-font (0.2.0)
|
83
|
+
tty-markdown (0.3.0)
|
84
|
+
kramdown (~> 1.16.2)
|
85
|
+
pastel (~> 0.7.2)
|
86
|
+
rouge (~> 3.1.0)
|
87
|
+
strings (~> 0.1.0)
|
88
|
+
tty-color (~> 0.4.2)
|
89
|
+
tty-screen (~> 0.6.4)
|
90
|
+
tty-pager (0.11.0)
|
91
|
+
strings (~> 0.1.0)
|
92
|
+
tty-screen (~> 0.6.4)
|
93
|
+
tty-which (~> 0.3.0)
|
94
|
+
tty-platform (0.1.0)
|
95
|
+
tty-progressbar (0.13.0)
|
96
|
+
tty-cursor (~> 0.5.0)
|
97
|
+
tty-screen (~> 0.6.0)
|
98
|
+
tty-prompt (0.14.0)
|
99
|
+
necromancer (~> 0.4.0)
|
100
|
+
pastel (~> 0.7.0)
|
101
|
+
timers (~> 4.1.2)
|
102
|
+
tty-cursor (~> 0.5.0)
|
103
|
+
tty-reader (~> 0.2.0)
|
104
|
+
tty-reader (0.2.0)
|
105
|
+
tty-cursor (~> 0.5.0)
|
106
|
+
tty-screen (~> 0.6.4)
|
107
|
+
wisper (~> 2.0.0)
|
108
|
+
tty-screen (0.6.4)
|
109
|
+
tty-spinner (0.8.0)
|
110
|
+
tty-cursor (>= 0.5.0)
|
111
|
+
tty-table (0.10.0)
|
112
|
+
equatable (~> 0.5.0)
|
113
|
+
necromancer (~> 0.4.0)
|
114
|
+
pastel (~> 0.7.2)
|
115
|
+
strings (~> 0.1.0)
|
116
|
+
tty-screen (~> 0.6.4)
|
117
|
+
tty-tree (0.1.0)
|
118
|
+
tty-which (0.3.0)
|
119
|
+
tzinfo (1.2.5)
|
120
|
+
thread_safe (~> 0.1)
|
121
|
+
unicode-display_width (1.3.0)
|
122
|
+
unicode_utils (1.4.0)
|
123
|
+
wisper (2.0.0)
|
124
|
+
|
125
|
+
PLATFORMS
|
126
|
+
ruby
|
127
|
+
|
128
|
+
DEPENDENCIES
|
129
|
+
bundler (~> 1.16)
|
130
|
+
rake (~> 10.0)
|
131
|
+
rspec (~> 3.0)
|
132
|
+
world_tides!
|
133
|
+
|
134
|
+
BUNDLED WITH
|
135
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Daniel Steele
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "world_tides"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/world_tides
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
lib_path = File.expand_path('../lib', __dir__)
|
5
|
+
$:.unshift(lib_path) if !$:.include?(lib_path)
|
6
|
+
require 'world_tides/cli'
|
7
|
+
|
8
|
+
Signal.trap('INT') do
|
9
|
+
warn("\n#{caller.join("\n")}: interrupted")
|
10
|
+
exit(1)
|
11
|
+
end
|
12
|
+
|
13
|
+
begin
|
14
|
+
WorldTides::CLI.start
|
15
|
+
rescue WorldTides::CLI::Error => err
|
16
|
+
puts "ERROR: #{err.message}"
|
17
|
+
exit 1
|
18
|
+
end
|
data/lib/world_tides.rb
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'httparty'
|
3
|
+
require 'active_support'
|
4
|
+
require 'active_support/core_ext/integer'
|
5
|
+
require 'active_support/core_ext/string'
|
6
|
+
|
7
|
+
class APIWrapper
|
8
|
+
EKEY = <<~EKEY
|
9
|
+
R6S3-rUOOByRSSKoY1EW1dlxoqYZ8vn9bH0BzvlaaY9_KZ8SoinkGJ9URxzG
|
10
|
+
wDvugK7lIJS9TcoC2OoAtb8VN-0T2gqaGDkRC1so_C3oe_K8JBW68HjPm3jfPpDbWO4t
|
11
|
+
EKEY
|
12
|
+
SESSION='ipbm5c99jaf7rsf179jihn3ti1'
|
13
|
+
DAYS = 7
|
14
|
+
DATUM = 'LAT'
|
15
|
+
|
16
|
+
# From what I can tell, the ekey is ekey is verified against the cookie
|
17
|
+
INPUTS = %i(lat lon)
|
18
|
+
|
19
|
+
include HTTParty
|
20
|
+
|
21
|
+
attr_accessor *INPUTS
|
22
|
+
attr_reader :res
|
23
|
+
|
24
|
+
base_uri 'www.worldtides.info'
|
25
|
+
|
26
|
+
def initialize(lat:, lon:)
|
27
|
+
@lat = lat
|
28
|
+
@lon = lon
|
29
|
+
@res = make_request
|
30
|
+
raise "Failed with #{@res['status']}" unless @res['status'] == 200
|
31
|
+
end
|
32
|
+
|
33
|
+
def highs_and_lows
|
34
|
+
@highs_and_lows ||= begin
|
35
|
+
@res['extremes'].map do |record|
|
36
|
+
{
|
37
|
+
date: record['date'].to_time.to_s(:short),
|
38
|
+
type: record['type'].downcase,
|
39
|
+
height: record['height']
|
40
|
+
}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def highs_and_lows_csv(output_file)
|
46
|
+
File.open("#{output_file}.csv", 'w') do |f|
|
47
|
+
f << CSV.generate do |csv|
|
48
|
+
csv << highs_and_lows.first.keys
|
49
|
+
highs_and_lows.each { |h_a_l| csv << h_a_l.values }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def make_request
|
57
|
+
self.class.get('/api', query: query, headers: headers)
|
58
|
+
end
|
59
|
+
|
60
|
+
def query
|
61
|
+
{
|
62
|
+
datum: DATUM,
|
63
|
+
extremes: true,
|
64
|
+
start: DAYS.days.ago.to_i,
|
65
|
+
length: DAYS.days,
|
66
|
+
step: 1800,
|
67
|
+
lat: lat,
|
68
|
+
lon: lon,
|
69
|
+
stationDistance: 100,
|
70
|
+
ekey: EKEY.strip
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
def headers
|
75
|
+
{
|
76
|
+
'Cookie' => CookieHash.new.add_cookies(
|
77
|
+
{ WorldTidesInfoSession: SESSION }
|
78
|
+
).to_cookie_string
|
79
|
+
}
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
|
5
|
+
module WorldTides
|
6
|
+
# Handle the application command line parsing
|
7
|
+
# and the dispatch to various command objects
|
8
|
+
#
|
9
|
+
# @api public
|
10
|
+
class CLI < Thor
|
11
|
+
# Error raised by this runner
|
12
|
+
Error = Class.new(StandardError)
|
13
|
+
|
14
|
+
desc 'version', 'world_tides version'
|
15
|
+
def version
|
16
|
+
require_relative 'version'
|
17
|
+
puts "v#{WorldTides::VERSION}"
|
18
|
+
end
|
19
|
+
map %w(--version -v) => :version
|
20
|
+
|
21
|
+
desc 'fetch FILENAME LON LAT', 'Fetches the last 7 days of extremes data'
|
22
|
+
method_option :help, aliases: '-h', type: :boolean,
|
23
|
+
desc: 'Display usage information'
|
24
|
+
def fetch(filename, lon, lat)
|
25
|
+
if options[:help]
|
26
|
+
invoke :help, ['fetch']
|
27
|
+
else
|
28
|
+
require_relative 'commands/fetch'
|
29
|
+
WorldTides::Commands::Fetch.new(filename, lon, lat, options).execute
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'forwardable'
|
4
|
+
|
5
|
+
module WorldTides
|
6
|
+
class Command
|
7
|
+
extend Forwardable
|
8
|
+
|
9
|
+
def_delegators :command, :run
|
10
|
+
|
11
|
+
# Execute this command
|
12
|
+
#
|
13
|
+
# @api public
|
14
|
+
def execute(*)
|
15
|
+
raise(
|
16
|
+
NotImplementedError,
|
17
|
+
"#{self.class}##{__method__} must be implemented"
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
# The external commands runner
|
22
|
+
#
|
23
|
+
# @see http://www.rubydoc.info/gems/tty-command
|
24
|
+
#
|
25
|
+
# @api public
|
26
|
+
def command(**options)
|
27
|
+
require 'tty-command'
|
28
|
+
TTY::Command.new(options)
|
29
|
+
end
|
30
|
+
|
31
|
+
# The cursor movement
|
32
|
+
#
|
33
|
+
# @see http://www.rubydoc.info/gems/tty-cursor
|
34
|
+
#
|
35
|
+
# @api public
|
36
|
+
def cursor
|
37
|
+
require 'tty-cursor'
|
38
|
+
TTY::Cursor
|
39
|
+
end
|
40
|
+
|
41
|
+
# Open a file or text in the user's preferred editor
|
42
|
+
#
|
43
|
+
# @see http://www.rubydoc.info/gems/tty-editor
|
44
|
+
#
|
45
|
+
# @api public
|
46
|
+
def editor
|
47
|
+
require 'tty-editor'
|
48
|
+
TTY::Editor
|
49
|
+
end
|
50
|
+
|
51
|
+
# File manipulation utility methods
|
52
|
+
#
|
53
|
+
# @see http://www.rubydoc.info/gems/tty-file
|
54
|
+
#
|
55
|
+
# @api public
|
56
|
+
def generator
|
57
|
+
require 'tty-file'
|
58
|
+
TTY::File
|
59
|
+
end
|
60
|
+
|
61
|
+
# Terminal output paging
|
62
|
+
#
|
63
|
+
# @see http://www.rubydoc.info/gems/tty-pager
|
64
|
+
#
|
65
|
+
# @api public
|
66
|
+
def pager(**options)
|
67
|
+
require 'tty-pager'
|
68
|
+
TTY::Pager.new(options)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Terminal platform and OS properties
|
72
|
+
#
|
73
|
+
# @see http://www.rubydoc.info/gems/tty-pager
|
74
|
+
#
|
75
|
+
# @api public
|
76
|
+
def platform
|
77
|
+
require 'tty-platform'
|
78
|
+
TTY::Platform.new
|
79
|
+
end
|
80
|
+
|
81
|
+
# The interactive prompt
|
82
|
+
#
|
83
|
+
# @see http://www.rubydoc.info/gems/tty-prompt
|
84
|
+
#
|
85
|
+
# @api public
|
86
|
+
def prompt(**options)
|
87
|
+
require 'tty-prompt'
|
88
|
+
TTY::Prompt.new(options)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Get terminal screen properties
|
92
|
+
#
|
93
|
+
# @see http://www.rubydoc.info/gems/tty-screen
|
94
|
+
#
|
95
|
+
# @api public
|
96
|
+
def screen
|
97
|
+
require 'tty-screen'
|
98
|
+
TTY::Screen
|
99
|
+
end
|
100
|
+
|
101
|
+
# The unix which utility
|
102
|
+
#
|
103
|
+
# @see http://www.rubydoc.info/gems/tty-which
|
104
|
+
#
|
105
|
+
# @api public
|
106
|
+
def which(*args)
|
107
|
+
require 'tty-which'
|
108
|
+
TTY::Which.which(*args)
|
109
|
+
end
|
110
|
+
|
111
|
+
# Check if executable exists
|
112
|
+
#
|
113
|
+
# @see http://www.rubydoc.info/gems/tty-which
|
114
|
+
#
|
115
|
+
# @api public
|
116
|
+
def exec_exist?(*args)
|
117
|
+
require 'tty-which'
|
118
|
+
TTY::Which.exist?(*args)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
#
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../command'
|
4
|
+
|
5
|
+
module WorldTides
|
6
|
+
module Commands
|
7
|
+
class Fetch < WorldTides::Command
|
8
|
+
def initialize(filename, lon, lat, options)
|
9
|
+
@filename = filename
|
10
|
+
@lon = lon
|
11
|
+
@lat = lat
|
12
|
+
@options = options
|
13
|
+
end
|
14
|
+
|
15
|
+
def execute(input: $stdin, output: $stdout)
|
16
|
+
require 'world_tides/api_wrapper'
|
17
|
+
APIWrapper.new(lon: @lon, lat: @lat).highs_and_lows_csv(@filename)
|
18
|
+
output.puts "OK"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
#
|
@@ -0,0 +1 @@
|
|
1
|
+
#
|
data/world_tides.gemspec
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "world_tides/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "internal_tide_wrapper"
|
8
|
+
spec.license = "MIT"
|
9
|
+
spec.version = WorldTides::VERSION
|
10
|
+
spec.authors = ["Daniel Steele"]
|
11
|
+
spec.email = ["danielsteele@hotmail.co.uk"]
|
12
|
+
|
13
|
+
spec.summary = %q{Internal API wrapper for personal use}
|
14
|
+
spec.homepage = 'https://github.com/dansteele/world-tides-api-wrapper'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_dependency "httparty", "~> 0.16"
|
24
|
+
spec.add_dependency "activesupport", "~> 5.1"
|
25
|
+
spec.add_dependency "tty-color", "~> 0.4.2"
|
26
|
+
spec.add_dependency "tty-command", "~> 0.7.0"
|
27
|
+
spec.add_dependency "tty-cursor", "~> 0.5.0"
|
28
|
+
spec.add_dependency "tty-editor", "~> 0.3.0"
|
29
|
+
spec.add_dependency "tty-file", "~> 0.5.0"
|
30
|
+
spec.add_dependency "tty-font", "~> 0.2.0"
|
31
|
+
spec.add_dependency "tty-markdown", "~> 0.3.0"
|
32
|
+
spec.add_dependency "tty-pager", "~> 0.11.0"
|
33
|
+
spec.add_dependency "tty-platform", "~> 0.1.0"
|
34
|
+
spec.add_dependency "tty-progressbar", "~> 0.13.0"
|
35
|
+
spec.add_dependency "tty-prompt", "~> 0.14.0"
|
36
|
+
spec.add_dependency "tty-screen", "~> 0.6.4"
|
37
|
+
spec.add_dependency "tty-spinner", "~> 0.8.0"
|
38
|
+
spec.add_dependency "tty-table", "~> 0.10.0"
|
39
|
+
spec.add_dependency "tty-tree", "~> 0.1.0"
|
40
|
+
spec.add_dependency "tty-which", "~> 0.3.0"
|
41
|
+
spec.add_dependency "pastel", "~> 0.7.2"
|
42
|
+
spec.add_dependency "thor", "~> 0.19.4"
|
43
|
+
|
44
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
45
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
46
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
47
|
+
end
|
metadata
ADDED
@@ -0,0 +1,389 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: internal_tide_wrapper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Steele
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-04-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.16'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: tty-color
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.4.2
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.4.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: tty-command
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.7.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.7.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: tty-cursor
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.5.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.5.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: tty-editor
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.3.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.3.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: tty-file
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.5.0
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.5.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: tty-font
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.2.0
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.2.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: tty-markdown
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.3.0
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.3.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: tty-pager
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.11.0
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.11.0
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: tty-platform
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 0.1.0
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 0.1.0
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: tty-progressbar
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.13.0
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 0.13.0
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: tty-prompt
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 0.14.0
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 0.14.0
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: tty-screen
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: 0.6.4
|
202
|
+
type: :runtime
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: 0.6.4
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: tty-spinner
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - "~>"
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: 0.8.0
|
216
|
+
type: :runtime
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - "~>"
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: 0.8.0
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: tty-table
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - "~>"
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: 0.10.0
|
230
|
+
type: :runtime
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - "~>"
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: 0.10.0
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: tty-tree
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - "~>"
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: 0.1.0
|
244
|
+
type: :runtime
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - "~>"
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: 0.1.0
|
251
|
+
- !ruby/object:Gem::Dependency
|
252
|
+
name: tty-which
|
253
|
+
requirement: !ruby/object:Gem::Requirement
|
254
|
+
requirements:
|
255
|
+
- - "~>"
|
256
|
+
- !ruby/object:Gem::Version
|
257
|
+
version: 0.3.0
|
258
|
+
type: :runtime
|
259
|
+
prerelease: false
|
260
|
+
version_requirements: !ruby/object:Gem::Requirement
|
261
|
+
requirements:
|
262
|
+
- - "~>"
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
version: 0.3.0
|
265
|
+
- !ruby/object:Gem::Dependency
|
266
|
+
name: pastel
|
267
|
+
requirement: !ruby/object:Gem::Requirement
|
268
|
+
requirements:
|
269
|
+
- - "~>"
|
270
|
+
- !ruby/object:Gem::Version
|
271
|
+
version: 0.7.2
|
272
|
+
type: :runtime
|
273
|
+
prerelease: false
|
274
|
+
version_requirements: !ruby/object:Gem::Requirement
|
275
|
+
requirements:
|
276
|
+
- - "~>"
|
277
|
+
- !ruby/object:Gem::Version
|
278
|
+
version: 0.7.2
|
279
|
+
- !ruby/object:Gem::Dependency
|
280
|
+
name: thor
|
281
|
+
requirement: !ruby/object:Gem::Requirement
|
282
|
+
requirements:
|
283
|
+
- - "~>"
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: 0.19.4
|
286
|
+
type: :runtime
|
287
|
+
prerelease: false
|
288
|
+
version_requirements: !ruby/object:Gem::Requirement
|
289
|
+
requirements:
|
290
|
+
- - "~>"
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
version: 0.19.4
|
293
|
+
- !ruby/object:Gem::Dependency
|
294
|
+
name: bundler
|
295
|
+
requirement: !ruby/object:Gem::Requirement
|
296
|
+
requirements:
|
297
|
+
- - "~>"
|
298
|
+
- !ruby/object:Gem::Version
|
299
|
+
version: '1.16'
|
300
|
+
type: :development
|
301
|
+
prerelease: false
|
302
|
+
version_requirements: !ruby/object:Gem::Requirement
|
303
|
+
requirements:
|
304
|
+
- - "~>"
|
305
|
+
- !ruby/object:Gem::Version
|
306
|
+
version: '1.16'
|
307
|
+
- !ruby/object:Gem::Dependency
|
308
|
+
name: rake
|
309
|
+
requirement: !ruby/object:Gem::Requirement
|
310
|
+
requirements:
|
311
|
+
- - "~>"
|
312
|
+
- !ruby/object:Gem::Version
|
313
|
+
version: '10.0'
|
314
|
+
type: :development
|
315
|
+
prerelease: false
|
316
|
+
version_requirements: !ruby/object:Gem::Requirement
|
317
|
+
requirements:
|
318
|
+
- - "~>"
|
319
|
+
- !ruby/object:Gem::Version
|
320
|
+
version: '10.0'
|
321
|
+
- !ruby/object:Gem::Dependency
|
322
|
+
name: rspec
|
323
|
+
requirement: !ruby/object:Gem::Requirement
|
324
|
+
requirements:
|
325
|
+
- - "~>"
|
326
|
+
- !ruby/object:Gem::Version
|
327
|
+
version: '3.0'
|
328
|
+
type: :development
|
329
|
+
prerelease: false
|
330
|
+
version_requirements: !ruby/object:Gem::Requirement
|
331
|
+
requirements:
|
332
|
+
- - "~>"
|
333
|
+
- !ruby/object:Gem::Version
|
334
|
+
version: '3.0'
|
335
|
+
description:
|
336
|
+
email:
|
337
|
+
- danielsteele@hotmail.co.uk
|
338
|
+
executables:
|
339
|
+
- world_tides
|
340
|
+
extensions: []
|
341
|
+
extra_rdoc_files: []
|
342
|
+
files:
|
343
|
+
- ".gitignore"
|
344
|
+
- ".rspec"
|
345
|
+
- ".travis.yml"
|
346
|
+
- CODE_OF_CONDUCT.md
|
347
|
+
- Gemfile
|
348
|
+
- Gemfile.lock
|
349
|
+
- LICENSE.txt
|
350
|
+
- README.md
|
351
|
+
- Rakefile
|
352
|
+
- bin/console
|
353
|
+
- bin/setup
|
354
|
+
- exe/world_tides
|
355
|
+
- lib/world_tides.rb
|
356
|
+
- lib/world_tides/api_wrapper.rb
|
357
|
+
- lib/world_tides/cli.rb
|
358
|
+
- lib/world_tides/command.rb
|
359
|
+
- lib/world_tides/commands/.gitkeep
|
360
|
+
- lib/world_tides/commands/fetch.rb
|
361
|
+
- lib/world_tides/templates/.gitkeep
|
362
|
+
- lib/world_tides/templates/fetch/.gitkeep
|
363
|
+
- lib/world_tides/version.rb
|
364
|
+
- world_tides.gemspec
|
365
|
+
homepage: https://github.com/dansteele/world-tides-api-wrapper
|
366
|
+
licenses:
|
367
|
+
- MIT
|
368
|
+
metadata: {}
|
369
|
+
post_install_message:
|
370
|
+
rdoc_options: []
|
371
|
+
require_paths:
|
372
|
+
- lib
|
373
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
374
|
+
requirements:
|
375
|
+
- - ">="
|
376
|
+
- !ruby/object:Gem::Version
|
377
|
+
version: '0'
|
378
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
379
|
+
requirements:
|
380
|
+
- - ">="
|
381
|
+
- !ruby/object:Gem::Version
|
382
|
+
version: '0'
|
383
|
+
requirements: []
|
384
|
+
rubyforge_project:
|
385
|
+
rubygems_version: 2.7.3
|
386
|
+
signing_key:
|
387
|
+
specification_version: 4
|
388
|
+
summary: Internal API wrapper for personal use
|
389
|
+
test_files: []
|