make-sandwich 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.md +58 -0
- data/Rakefile +1 -0
- data/bin/make_sandwich +46 -0
- data/make-sandwich.gemspec +21 -0
- metadata +89 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 General Things Inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# Make Sandwich
|
2
|
+
|
3
|
+
Sometimes you just need a sandwich on the command line.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```bash
|
8
|
+
$ gem i make_sandwich
|
9
|
+
```
|
10
|
+
|
11
|
+
## Configuration
|
12
|
+
|
13
|
+
Create your ~/.sandwich file
|
14
|
+
|
15
|
+
```bash
|
16
|
+
$ vim ~/.sandwich
|
17
|
+
```
|
18
|
+
|
19
|
+
and add the sandwich makers email, your gmail email, and your gmail password all on separate lines like so
|
20
|
+
|
21
|
+
```markdown
|
22
|
+
sandwicher@generalthings.com
|
23
|
+
youremail@generalthings.com
|
24
|
+
password
|
25
|
+
```
|
26
|
+
|
27
|
+
|
28
|
+
### Making Tender juicy sandwiches on the commandline.
|
29
|
+
|
30
|
+
Runnitttt!
|
31
|
+
|
32
|
+
```bash
|
33
|
+
make_sandwich
|
34
|
+
```
|
35
|
+
|
36
|
+
# YUMMM!!!!!!!!!
|
37
|
+
|
38
|
+
|
39
|
+
### Coming soon...
|
40
|
+
|
41
|
+
* Connecting to Karotz
|
42
|
+
* nom nom on sandwiches.
|
43
|
+
|
44
|
+
|
45
|
+
## Note on Patches/Pull Requests
|
46
|
+
|
47
|
+
* Fork the project.
|
48
|
+
* Make your feature addition or bug fix.
|
49
|
+
* Add tests for it. This is important so I don't break it in a
|
50
|
+
future version unintentionally.
|
51
|
+
* Commit, do not mess with rakefile, version, or history.
|
52
|
+
(if you want to have your own version, that is fine but
|
53
|
+
bump version in a commit by itself I can ignore when I pull)
|
54
|
+
* Send me a pull request. Bonus points for topic branches.
|
55
|
+
|
56
|
+
## Copyright
|
57
|
+
|
58
|
+
Copyright (c) 2012 General Things Inc. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/make_sandwich
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "gmail"
|
4
|
+
require "ruby-gmail"
|
5
|
+
require "typhoeus"
|
6
|
+
|
7
|
+
# check for the config file
|
8
|
+
config_file = "#{ENV['HOME']}/.sandwich"
|
9
|
+
unless File.exist?(config_file)
|
10
|
+
puts "You need to type the sandwich makers email, your email and password (one per line) into `~/.sandwich`"
|
11
|
+
puts "Example:"
|
12
|
+
puts "sandwicher@generalthings.com"
|
13
|
+
puts "youremail@generalthings.com"
|
14
|
+
puts "password"
|
15
|
+
exit!(1)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Establish all the params
|
19
|
+
sandwich_maker,email,password = File.read(config_file).split("\n")
|
20
|
+
|
21
|
+
# Inspirational quotes are very important
|
22
|
+
#
|
23
|
+
# you need to soothe the your sandwich maker first.
|
24
|
+
#
|
25
|
+
# http://www.iheartquotes.com/api/v1/random
|
26
|
+
quote = Typhoeus::Request.get("http://www.iheartquotes.com/api/v1/random")
|
27
|
+
msg = quote.body.split("\n")
|
28
|
+
msg.pop
|
29
|
+
|
30
|
+
# Building the Gmail connection
|
31
|
+
gmail = Gmail.new(email, password)
|
32
|
+
|
33
|
+
# Creating and sending the email
|
34
|
+
gmail.deliver do
|
35
|
+
to "#{sandwich_maker}"
|
36
|
+
subject "Favor pleaseeee! :)"
|
37
|
+
text_part do
|
38
|
+
body "Please sir,\n
|
39
|
+
Could you make me a sandwich?\n
|
40
|
+
#{msg.join("\n")}
|
41
|
+
\nThank you!"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Close the connection.
|
46
|
+
gmail.logout
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "make-sandwich"
|
3
|
+
s.version = "0.0.1"
|
4
|
+
s.authors = ["Christopher Hein"]
|
5
|
+
s.email = ["chris@generalthings.com"]
|
6
|
+
s.homepage = "https://github.com/generalthings/make_sandwich"
|
7
|
+
s.summary = %q{Delicious, juicy, tender sandwiches on the command line.}
|
8
|
+
s.description = %q{Have an employee that loves making sandwiches... we do, but we're all too lazy to take our headphones off to ask him wipe one up. In an effort to solve this I wrote make_sandwich.}
|
9
|
+
|
10
|
+
s.rubyforge_project = "make-sandwich"
|
11
|
+
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
15
|
+
s.require_paths = ["lib"]
|
16
|
+
|
17
|
+
# specify any dependencies here; for example:
|
18
|
+
s.add_development_dependency "gmail"
|
19
|
+
s.add_development_dependency "ruby-gmail"
|
20
|
+
s.add_development_dependency "typhoeus"
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: make-sandwich
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Christopher Hein
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-02-16 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: gmail
|
16
|
+
requirement: &70101543528140 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70101543528140
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: ruby-gmail
|
27
|
+
requirement: &70101543527700 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70101543527700
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: typhoeus
|
38
|
+
requirement: &70101543527280 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70101543527280
|
47
|
+
description: Have an employee that loves making sandwiches... we do, but we're all
|
48
|
+
too lazy to take our headphones off to ask him wipe one up. In an effort to solve
|
49
|
+
this I wrote make_sandwich.
|
50
|
+
email:
|
51
|
+
- chris@generalthings.com
|
52
|
+
executables:
|
53
|
+
- make_sandwich
|
54
|
+
extensions: []
|
55
|
+
extra_rdoc_files: []
|
56
|
+
files:
|
57
|
+
- .gitignore
|
58
|
+
- Gemfile
|
59
|
+
- LICENSE
|
60
|
+
- README.md
|
61
|
+
- Rakefile
|
62
|
+
- bin/make_sandwich
|
63
|
+
- make-sandwich.gemspec
|
64
|
+
homepage: https://github.com/generalthings/make_sandwich
|
65
|
+
licenses: []
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubyforge_project: make-sandwich
|
84
|
+
rubygems_version: 1.8.10
|
85
|
+
signing_key:
|
86
|
+
specification_version: 3
|
87
|
+
summary: Delicious, juicy, tender sandwiches on the command line.
|
88
|
+
test_files: []
|
89
|
+
has_rdoc:
|