temperature_converter_DaLe 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/temp-conv +72 -0
- data/lib/temperature_converter_DaLe.rb +22 -0
- metadata +46 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: b6080e06624f4633ff4dab056605cebd39b12ebf
|
|
4
|
+
data.tar.gz: dcaa8adda243ae58e356cb3f16344682deae5cac
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: fc367932ab180eb95260107ac6ae51d7b26b7523544dd4bf7b23e6d55c20080adab3536aeb396b1e87390a2ce6ddc7d1ef39ae38e5229dc92170c31fc403b195
|
|
7
|
+
data.tar.gz: ff074907b8787204d18b97cce13e8cd735df928d1120c5c4bfdc31139a49ba6ceb6152b80faf043c012d7aec35ce26a1166aa013830ade10794a5cad2af5050d
|
data/bin/temp-conv
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'temperature_converter_DaLe'
|
|
3
|
+
require 'colorize'
|
|
4
|
+
require 'optparse'
|
|
5
|
+
|
|
6
|
+
cmdl_input = ARGV[0]
|
|
7
|
+
file_path = "data.txt"
|
|
8
|
+
url_path = "http://labict.be/software-engineering/temperature/api/temperature/fake"
|
|
9
|
+
|
|
10
|
+
OptionParser.new do |opts|
|
|
11
|
+
opts.banner = "Usage: ruby app.rb [options]"
|
|
12
|
+
|
|
13
|
+
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
|
14
|
+
puts v.inspect
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
opts.on("-c MYCOMMAND", "--command MYCOMMAND", Float , "Commandline temperature") do |mycommand|
|
|
19
|
+
puts "output : read from commandline".white
|
|
20
|
+
puts "==============================\n\n".white
|
|
21
|
+
@conversion = TemperatureConverterCommandline.commandline_temperature mycommand
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
opts.on("-f [MYFILE]", "--file [MYFILE]", String , "File path , null = default file") do |myfile|
|
|
26
|
+
if (myfile.nil?)
|
|
27
|
+
myfile = file_path
|
|
28
|
+
end
|
|
29
|
+
puts "output : read from file".white
|
|
30
|
+
puts "=======================\n\n".white
|
|
31
|
+
@conversion = TemperatureConverterFile.file_temperature myfile
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
opts.on("-u [MYURL]", "--url [MYURL]", String , "Url path , null = default Url") do |myurl|
|
|
35
|
+
if (myurl.nil?)
|
|
36
|
+
myurl = url_path
|
|
37
|
+
end
|
|
38
|
+
puts "output : read from url".white
|
|
39
|
+
puts "======================\n\n".white
|
|
40
|
+
@conversion = TemperatureConverterUrl.url_temperature myurl
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
opts.on("-m", "--mqtt" , "MQTT yes or no") do |mymqtt|
|
|
44
|
+
puts "output : read from ttn".white
|
|
45
|
+
puts "======================\n\n".white
|
|
46
|
+
# Thread.new do
|
|
47
|
+
@conversion = TemperatureConverterTtl.ttl_temperature
|
|
48
|
+
# end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
opts.on("-t", "--text", Float , "Show text only") do |t|
|
|
52
|
+
@show_all=false
|
|
53
|
+
TemperatureOutput.show_to_text(@conversion)
|
|
54
|
+
puts '------------------------------------------------------------------'.yellow
|
|
55
|
+
end
|
|
56
|
+
opts.on("-w", "--web", Float , "Show html only") do |t|
|
|
57
|
+
@show_all=false
|
|
58
|
+
TemperatureOutput.show_to_html(@conversion)
|
|
59
|
+
puts '------------------------------------------------------------------'.yellow
|
|
60
|
+
end
|
|
61
|
+
opts.on("-j", "--json", Float , "Show json only") do |t|
|
|
62
|
+
@show_all=false
|
|
63
|
+
TemperatureOutput.show_to_json(@conversion)
|
|
64
|
+
puts '------------------------------------------------------------------'.yellow
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
opts.on("-a", "--all", Float , "Show all output formats") do |t|
|
|
68
|
+
TemperatureOutput.show_output(@conversion)
|
|
69
|
+
puts '------------------------------------------------------------------'.yellow
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
end.parse!
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
require './lib/temperature_read_file.rb'
|
|
3
|
+
require './lib/temperature_read_ttl.rb'
|
|
4
|
+
require './lib/temperature_read_url.rb'
|
|
5
|
+
require './lib/temperature_read_commandline.rb'
|
|
6
|
+
|
|
7
|
+
require './lib/temperature_converter_commandline.rb'
|
|
8
|
+
require './lib/temperature_converter_file.rb'
|
|
9
|
+
require './lib/temperature_converter_url.rb'
|
|
10
|
+
require './lib/temperature_converter_ttl.rb'
|
|
11
|
+
require './lib/temperature_converter.rb'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
require './lib/temperature_output.rb'
|
|
15
|
+
require './lib/temperature_output_to_html.rb'
|
|
16
|
+
require './lib/temperature_output_to_json.rb'
|
|
17
|
+
require './lib/temperature_output_to_text.rb'
|
|
18
|
+
|
|
19
|
+
require './lib/temperature_convert.rb'
|
|
20
|
+
require './lib/temperature_convert_to_celcius.rb'
|
|
21
|
+
require './lib/temperature_convert_to_fahrenheit.rb'
|
|
22
|
+
require './lib/temperature_convert_to_kelvin.rb'
|
metadata
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: temperature_converter_DaLe
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.2
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- David Lejeune
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-11-29 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Converter cecius to fahrenheit and kelvin
|
|
14
|
+
email: dof.dly@gmail.com
|
|
15
|
+
executables:
|
|
16
|
+
- temp-conv
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- bin/temp-conv
|
|
21
|
+
- lib/temperature_converter_DaLe.rb
|
|
22
|
+
homepage: https://github.com/DavidLejeune/01-temperature-converter
|
|
23
|
+
licenses:
|
|
24
|
+
- MIT
|
|
25
|
+
metadata: {}
|
|
26
|
+
post_install_message:
|
|
27
|
+
rdoc_options: []
|
|
28
|
+
require_paths:
|
|
29
|
+
- lib
|
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
31
|
+
requirements:
|
|
32
|
+
- - ">="
|
|
33
|
+
- !ruby/object:Gem::Version
|
|
34
|
+
version: '0'
|
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
requirements: []
|
|
41
|
+
rubyforge_project:
|
|
42
|
+
rubygems_version: 2.4.5.1
|
|
43
|
+
signing_key:
|
|
44
|
+
specification_version: 4
|
|
45
|
+
summary: Temp converter
|
|
46
|
+
test_files: []
|