coffee 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0aa1241ef6c53a116b7606b02f7596aa852be3b1
4
+ data.tar.gz: d6d318b48aa10795d05dedb05ed6361a270f7980
5
+ SHA512:
6
+ metadata.gz: c9db3d5ec7c58e49bb4157be86cbd85dbc18ee5581e7946be7090e2248c2c31ebe7fa320c70fe7429d255c46115bf3633bb3da4b1653c81aa840cb94a052d8d6
7
+ data.tar.gz: c6c3823365791472529e5ff96f4be929891534eea9907f44326a568ce420058b42aab3da08a9637aa3ea9944887016f6fbca593270c1f5de50cadccce1ee4137
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in coffee.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Arkadiusz Buras
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Coffee
2
+
3
+ Super simple arduino remote coffee controller
4
+
5
+ ## Installation
6
+
7
+ Install it yourself as:
8
+
9
+ $ gem install coffee
10
+
11
+ ## Usage
12
+
13
+ First you need to configure your coffee maker
14
+
15
+ coffee config http://url-to-your-coffee-maker.com/coffee/terminal
16
+
17
+ Now you can make coffee using coffee command
18
+
19
+ coffee on
20
+
21
+ If you want to stop coffee maker enter command
22
+
23
+ coffee off
24
+
25
+ To check if coffee maker status enter
26
+
27
+ coffee status
28
+
29
+ To set message on lcd on coffee maker type:
30
+
31
+ coffee message "Hello world"
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it ( http://github.com/<my-github-username>/coffee/fork )
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/coffee ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
4
+ $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
5
+
6
+ require "coffee"
7
+
8
+ Coffee::Cli.start(ARGV)
data/coffee.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'coffee/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "coffee"
8
+ spec.version = Coffee::VERSION
9
+ spec.authors = ["Arkadiusz Buras"]
10
+ spec.email = ["macbury@gmail.com"]
11
+ spec.summary = %q{Simple remote coffee maker controller}
12
+ spec.description = %q{Simple remote coffee maker controller}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "thor"
24
+ spec.add_development_dependency "httparty"
25
+ end
data/lib/coffee/cli.rb ADDED
@@ -0,0 +1,40 @@
1
+
2
+ module Coffee
3
+
4
+ class Cli < Thor
5
+ desc "on", "start coffee maker"
6
+ def on
7
+ Coffee::Remote.on
8
+ Coffee::Remote.print_status
9
+ end
10
+
11
+ desc "off", "stop coffee maker"
12
+ def off
13
+ Coffee::Remote.off
14
+ Coffee::Remote.print_status
15
+ end
16
+
17
+ desc "status", "show info about coffee maker"
18
+ def status
19
+ Coffee::Remote.print_status
20
+ end
21
+
22
+ desc "message", "show message on coffee maker lcd"
23
+ def message(content)
24
+ Coffee::Remote.message(content)
25
+ end
26
+
27
+ desc "config", "config coffee maker for specified url ex. coffee config http://coffee.com"
28
+ def config(url)
29
+ puts "Configuring..."
30
+ config = JSON.parse(HTTParty.get(File.join(url, "/coffee/config")).parsed_response)
31
+ if ["login", "password", "host"].any? {|k| config.key?(k)}
32
+ File.open(Coffee::Config.path, 'w') {|f| f.write config.to_yaml }
33
+ puts "Success! Saving config in #{Coffee::Config.path.inspect}"
34
+ else
35
+ puts "Invalid response"
36
+ end
37
+ end
38
+ end
39
+
40
+ end
@@ -0,0 +1,24 @@
1
+ module Coffee
2
+ class Config
3
+
4
+ def self.get(key)
5
+ self.shared[key]
6
+ end
7
+
8
+ def self.basic
9
+ {:username => get("login"), :password => get("password") }
10
+ end
11
+
12
+ def self.url(path)
13
+ File.join(get("host"), path)
14
+ end
15
+
16
+ def self.shared
17
+ @shared ||= YAML::load(File.open(self.path))
18
+ end
19
+
20
+ def self.path
21
+ File.join(File.expand_path(Dir.home), ".coffee")
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,28 @@
1
+ module Coffee
2
+ class Remote
3
+ include HTTParty
4
+
5
+ def self.message(content)
6
+ get(Coffee::Config.url("/coffee/message"), basic_auth: Coffee::Config.basic, body: { message: content })
7
+ end
8
+
9
+ def self.on
10
+ get(Coffee::Config.url("/coffee/on"), basic_auth: Coffee::Config.basic)
11
+ end
12
+
13
+ def self.off
14
+ get(Coffee::Config.url("/coffee/off"), basic_auth: Coffee::Config.basic)
15
+ end
16
+
17
+ def self.status
18
+ JSON.parse(get(Coffee::Config.url("/coffee/about"), basic_auth: Coffee::Config.basic).parsed_response)
19
+ end
20
+
21
+ def self.print_status
22
+ stats = self.status
23
+ puts "Running: #{stats["running"].inspect}"
24
+ puts "Seconds: #{stats["uptime"].inspect}"
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,3 @@
1
+ module Coffee
2
+ VERSION = "0.0.1"
3
+ end
data/lib/coffee.rb ADDED
@@ -0,0 +1,11 @@
1
+ require "coffee/version"
2
+ require "thor"
3
+ require "httparty"
4
+ require "yaml"
5
+ module Coffee
6
+ # Your code goes here...
7
+ end
8
+
9
+ require "coffee/config"
10
+ require "coffee/remote"
11
+ require "coffee/cli"
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: coffee
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Arkadiusz Buras
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: httparty
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Simple remote coffee maker controller
70
+ email:
71
+ - macbury@gmail.com
72
+ executables:
73
+ - coffee
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/coffee
83
+ - coffee.gemspec
84
+ - lib/coffee.rb
85
+ - lib/coffee/cli.rb
86
+ - lib/coffee/config.rb
87
+ - lib/coffee/remote.rb
88
+ - lib/coffee/version.rb
89
+ homepage: ''
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.2.0
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: Simple remote coffee maker controller
113
+ test_files: []