fuelcli 0.1.4 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2fdd63c8d38924a8e4049443b67a5e0a75a7e8a3d53c558ca6abc7628e71a903
4
- data.tar.gz: 4b479f4bda3e8b3ee143e2bc940a8ff0e2f3364b5ef1c83bdf6a50452c6383d9
3
+ metadata.gz: 9d051e9fc2e19484588492615524630b101735a1aebb7de66a06dc0704971938
4
+ data.tar.gz: 23cb204a0b96c8978fd6cdd32fc6a158b73ecba01519257acf5418fca407993b
5
5
  SHA512:
6
- metadata.gz: ca5d3a840735ff5f6b738b6da9aaf50b43a7c8e31acf07786a1f173744e37798b86197562009ae6e57400b7b7286487cd2e1bc83ca72a06557ae592e414cb5fb
7
- data.tar.gz: 58b040003ef4a8e3e1ab83af3b265938ea7cea3ff6ac4c158bc07c9d8712cd61f13c1ee2d03c36be3606d26f552ced2576b23cf71a08243df90543863f30d446
6
+ metadata.gz: 4672640b2dbeb34cbdd45f460586c53aad5e0379343f562f25e2ac3505297a0ea7ca604185c0686ec555732fcb632ec57aac3e50a58a2e9976d1fdfd719083fd
7
+ data.tar.gz: 3fe15ec3ddc7058addc9a54a982b1811c68aef0b59cae4a457bca6e1313e9b87b7d1d2d5b48bff106252170de726adc1c80fafbf42a2647ac7ea766961a7dd22
data/.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Datasource local storage ignored files
5
+ /dataSources/
6
+ /dataSources.local.xml
7
+ # Editor-based HTTP Client requests
8
+ /httpRequests/
data/.idea/fuel.iml ADDED
@@ -0,0 +1,54 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="jdk" jdkName="chruby: ruby-2.7.2" jdkType="RUBY_SDK" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, chruby: ruby-2.7.2) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.4.4, chruby: ruby-2.7.2) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="notifier (v0.5.2, chruby: ruby-2.7.2) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="rake (v12.3.3, chruby: ruby-2.7.2) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.10.0, chruby: ruby-2.7.2) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.10.0, chruby: ruby-2.7.2) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.10.0, chruby: ruby-2.7.2) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.10.0, chruby: ruby-2.7.2) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.10.0, chruby: ruby-2.7.2) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, chruby: ruby-2.7.2) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="terminal-notifier (v2.0.0, chruby: ruby-2.7.2) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="thor (v1.1.0, chruby: ruby-2.7.2) [gem]" level="application" />
26
+ </component>
27
+ <component name="RakeTasksCache">
28
+ <option name="myRootTask">
29
+ <RakeTaskImpl id="rake">
30
+ <subtasks>
31
+ <RakeTaskImpl description="Build fuelcli-0.1.8.gem into the pkg directory" fullCommand="build" id="build" />
32
+ <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
33
+ <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
34
+ <RakeTaskImpl description="Build and install fuelcli-0.1.8.gem into system gems" fullCommand="install" id="install" />
35
+ <RakeTaskImpl id="install">
36
+ <subtasks>
37
+ <RakeTaskImpl description="Build and install fuelcli-0.1.8.gem into system gems without network access" fullCommand="install:local" id="local" />
38
+ </subtasks>
39
+ </RakeTaskImpl>
40
+ <RakeTaskImpl description="Create tag v0.1.8 and build and push fuelcli-0.1.8.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
41
+ <RakeTaskImpl description="" fullCommand="default" id="default" />
42
+ <RakeTaskImpl description="" fullCommand="release" id="release" />
43
+ <RakeTaskImpl id="release">
44
+ <subtasks>
45
+ <RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
46
+ <RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
47
+ <RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
48
+ </subtasks>
49
+ </RakeTaskImpl>
50
+ </subtasks>
51
+ </RakeTaskImpl>
52
+ </option>
53
+ </component>
54
+ </module>
data/.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="chruby: ruby-2.7.1" project-jdk-type="RUBY_SDK" />
4
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/fuel.iml" filepath="$PROJECT_DIR$/.idea/fuel.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
data/Gemfile.lock CHANGED
@@ -1,13 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fuel (0.1.2)
4
+ fuelcli (0.2.1)
5
+ notifier (~> 0.5.2)
6
+ ruby-progressbar (~> 1.11)
7
+ terminal-notifier (~> 2.0)
5
8
  thor (~> 1.0)
6
9
 
7
10
  GEM
8
11
  remote: https://rubygems.org/
9
12
  specs:
10
13
  diff-lcs (1.4.4)
14
+ notifier (0.5.2)
11
15
  rake (12.3.3)
12
16
  rspec (3.10.0)
13
17
  rspec-core (~> 3.10.0)
@@ -22,13 +26,15 @@ GEM
22
26
  diff-lcs (>= 1.2.0, < 2.0)
23
27
  rspec-support (~> 3.10.0)
24
28
  rspec-support (3.10.0)
25
- thor (1.0.1)
29
+ ruby-progressbar (1.11.0)
30
+ terminal-notifier (2.0.0)
31
+ thor (1.1.0)
26
32
 
27
33
  PLATFORMS
28
34
  ruby
29
35
 
30
36
  DEPENDENCIES
31
- fuel!
37
+ fuelcli!
32
38
  rake (~> 12.0)
33
39
  rspec
34
40
 
data/exe/fuel CHANGED
@@ -4,6 +4,7 @@ require 'uri'
4
4
  require 'fuel'
5
5
  require 'thor'
6
6
  require 'json'
7
+ require 'notifier'
7
8
  require 'net/http'
8
9
 
9
10
 
@@ -16,34 +17,35 @@ module Fuel
16
17
 
17
18
  def burn(leg)
18
19
  begin
19
- say ""
20
20
  say "#{get_name(leg)}"
21
- say ""
21
+ say "#{get_note_url(leg)}"
22
22
  burn_fuel
23
+ send_notification "fuel burned"
23
24
  if( yes? "leg #{get_name(leg)} flown?")
24
25
  update_flight_plan(leg,true)
25
26
  else
26
27
  update_flight_plan(leg,false)
27
- refuel
28
+ refuel
29
+ send_notification "refueled"
28
30
  burn leg if yes? "burn more fuel on #{get_name(leg)}?"
29
31
  end
32
+ rescue JSON::ParserError => e
33
+ say "#{leg} is not a valid uid"
30
34
  rescue Interrupt => e
31
35
  begin
32
- say ""
33
36
  if @progressbar.title == "Fuel - burning"
34
37
  if yes?("Flown leg?")
35
38
  update_flight_plan(leg,true)
39
+ send_notification "fuel burned"
36
40
  end
37
41
  end
38
42
  if @progressbar.title == "Fuel - refueling"
39
43
  burn leg if yes? "burn more fuel on #{get_name(leg)}?"
40
44
  end
41
-
42
- rescue Interrupt => exception
45
+ rescue Interrupt
43
46
 
44
47
  end
45
48
 
46
-
47
49
  end
48
50
 
49
51
  end
@@ -51,15 +53,23 @@ module Fuel
51
53
  private
52
54
 
53
55
  def get_name(leg)
54
- url = URI("http://flightplanapp.herokuapp.com/api/fuel/#{leg}")
56
+ url = URI("http://#{ENV.fetch("FUEL_HOST","www.flightplanapp.com")}/api/fuel/#{leg}")
55
57
  http = Net::HTTP.new(url.host, url.port)
56
58
  request = Net::HTTP::Get.new(url)
57
59
  response = http.request(request)
58
60
  waypoint = JSON.parse(response.read_body)
59
61
  waypoint["description"]
60
62
  end
63
+ def get_note_url(leg)
64
+ url = URI("http://#{ENV.fetch("FUEL_HOST","www.flightplanapp.com")}/api/fuel/#{leg}")
65
+ http = Net::HTTP.new(url.host, url.port)
66
+ request = Net::HTTP::Get.new(url)
67
+ response = http.request(request)
68
+ waypoint = JSON.parse(response.read_body)
69
+ waypoint["note_url"]
70
+ end
61
71
  def update_flight_plan(leg,flown)
62
- url = URI("http://flightplanapp.herokuapp.com/api/fuel")
72
+ url = URI("http://#{ENV.fetch("FUEL_HOST","www.flightplanapp.com")}/api/fuel")
63
73
  http = Net::HTTP.new(url.host, url.port)
64
74
  request = Net::HTTP::Post.new(url)
65
75
  request["Content-Type"] = 'multipart/form-data'
@@ -71,7 +81,15 @@ module Fuel
71
81
  def burn_fuel
72
82
  invoke_progress title: "Fuel - burning", total: Fuel.configuration.burn_time
73
83
  end
74
-
84
+
85
+ def send_notification msg
86
+ Notifier.notify(
87
+ image: "../gauge.png",
88
+ title: "Fuel Gauge",
89
+ message: msg
90
+ )
91
+ end
92
+
75
93
  def refuel
76
94
  invoke_progress title: "Fuel - refueling", total: Fuel.configuration.refuel_time
77
95
  end
@@ -84,9 +102,7 @@ module Fuel
84
102
  sleep 1
85
103
  end
86
104
  end
87
-
88
-
89
- end
105
+ end
90
106
  end
91
107
 
92
- Fuel::Cli.start(ARGV)
108
+ Fuel::Cli.start(ARGV)
data/fuelcli.gemspec CHANGED
@@ -16,5 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.require_paths = ["lib"]
17
17
 
18
18
  spec.add_dependency 'thor', '~> 1.0'
19
-
20
- end
19
+ spec.add_dependency 'ruby-progressbar', '~> 1.11'
20
+ spec.add_dependency 'notifier', '~> 0.5.2'
21
+ spec.add_dependency 'terminal-notifier', '~> 2.0'
22
+ end
data/gauge.png ADDED
Binary file
data/lib/fuel.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'ostruct'
3
+ require 'ruby-progressbar'
3
4
 
4
5
  module Fuel
5
6
  BURN_TIME=480
data/lib/fuel/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Fuel
2
- VERSION = "0.1.4"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuelcli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dsofadog
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-11 00:00:00.000000000 Z
11
+ date: 2021-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -24,6 +24,48 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: ruby-progressbar
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.11'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.11'
41
+ - !ruby/object:Gem::Dependency
42
+ name: notifier
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.5.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.5.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: terminal-notifier
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
27
69
  description:
28
70
  email:
29
71
  - delaney@so.fa.dog
@@ -33,6 +75,11 @@ extensions: []
33
75
  extra_rdoc_files: []
34
76
  files:
35
77
  - ".gitignore"
78
+ - ".idea/.gitignore"
79
+ - ".idea/fuel.iml"
80
+ - ".idea/misc.xml"
81
+ - ".idea/modules.xml"
82
+ - ".idea/vcs.xml"
36
83
  - Gemfile
37
84
  - Gemfile.lock
38
85
  - README.md
@@ -41,6 +88,7 @@ files:
41
88
  - bin/setup
42
89
  - exe/fuel
43
90
  - fuelcli.gemspec
91
+ - gauge.png
44
92
  - lib/fuel.rb
45
93
  - lib/fuel/version.rb
46
94
  homepage: