huebot 0.2.0 → 0.3.0

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: ec0452c2e2f31fbbf2fac6b5bfe817f19f9f312ed85eca34c5dcbf47d4280b58
4
- data.tar.gz: a5412c05d81ba53ca81a2461d19d408e025c78298237459746c6ede4f376614b
3
+ metadata.gz: 7d761b227b5739c696762eb62db2e1e1d4592978133cf66ff2cd6d929bb83a95
4
+ data.tar.gz: 9451071e823fbda241f5bba7b9095d29d2dff1b82a8004fdd8fca8a673f47082
5
5
  SHA512:
6
- metadata.gz: 58124a0670d16dd043a050a044f6f5e378a29ec5b95d28919e7bfafdc953f9bbcaf7c469bbe318a5710fecd4e6cfcfd07bd0366ee9fcbf63774841a0a2c022b1
7
- data.tar.gz: 6fd6d42ee5c40e64a47a4b82916e980a828f0152ea8b541d95ec7a29a35f9222114e9fc2e9fb9ee7c810f0860be26878d886525dd46cf096820ae65e3de598b4
6
+ metadata.gz: d64695ec9ceb5813563974d0dd0c9dd4c3b7c18e29cee89482badec64cfc39bafc9db1dfdf87ecf8a54e8fcc090a51099645cf211d3314d2bf9b28f568a4982b
7
+ data.tar.gz: 6ce32ed34982a8d1e6478d4a305176c8bf5afa707033cde9f754d1a264383b169bddc4d5171fc97f139b8f012a85b463aca7abf231b544a16aef7938a5374692
@@ -12,7 +12,7 @@ module Huebot
12
12
  #
13
13
  # @attr inputs [Array<String>]
14
14
  #
15
- Options = Struct.new(:inputs)
15
+ Options = Struct.new(:inputs, :read_stdin)
16
16
 
17
17
  #
18
18
  # Returns the command given to huebot.
@@ -34,16 +34,18 @@ module Huebot
34
34
  parser.parse!
35
35
 
36
36
  files = ARGV[1..-1]
37
- if files.empty?
37
+ if files.empty? and !options.read_stdin
38
38
  puts parser.help
39
39
  exit 1
40
40
  elsif (bad_paths = files.select { |p| !File.exists? p }).any?
41
41
  $stderr.puts "Cannot find #{bad_paths.join ', '}"
42
42
  exit 1
43
43
  else
44
- return options, files.map { |path|
44
+ sources = files.map { |path|
45
45
  ProgramSrc.new(YAML.load_file(path), path)
46
46
  }
47
+ sources << ProgramSrc.new(YAML.load($stdin.read), "STDIN") if options.read_stdin
48
+ return options, sources
47
49
  end
48
50
  end
49
51
 
@@ -93,7 +95,7 @@ module Huebot
93
95
  end
94
96
 
95
97
  def self.option_parser
96
- options = Options.new([])
98
+ options = Options.new([], false)
97
99
  parser = OptionParser.new { |opts|
98
100
  opts.banner = %(
99
101
  List all lights and groups:
@@ -110,6 +112,7 @@ Options:
110
112
  opts.on("-lLIGHT", "--light=LIGHT", "Light ID or name") { |l| options.inputs << LightInput.new(l) }
111
113
  opts.on("-gGROUP", "--group=GROUP", "Group ID or name") { |g| options.inputs << GroupInput.new(g) }
112
114
  opts.on("--all", "All lights and groups TODO") { $stderr.puts "Not Implemented"; exit 1 }
115
+ opts.on("-i", "Read program from STDIN") { options.read_stdin = true }
113
116
  opts.on("-h", "--help", "Prints this help") { puts opts; exit }
114
117
  }
115
118
  return options, parser
@@ -1,4 +1,4 @@
1
1
  module Huebot
2
2
  # Gem version
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: huebot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Hollinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-19 00:00:00.000000000 Z
11
+ date: 2019-07-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Declare and run YAML programs for Philips Hue devices
14
14
  email: jordan.hollinger@gmail.com
@@ -57,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
57
  version: '0'
58
58
  requirements: []
59
59
  rubyforge_project:
60
- rubygems_version: 2.7.6
60
+ rubygems_version: 2.7.6.2
61
61
  signing_key:
62
62
  specification_version: 4
63
63
  summary: Orchestration for Hue devices