tweeting_cake 0.0.1
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/.gitignore +35 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +46 -0
- data/LICENSE +22 -0
- data/README.md +28 -0
- data/Rakefile +1 -0
- data/bin/supervise_cutting_of_tweeting_cake +5 -0
- data/lib/tweeting_cake.rb +7 -0
- data/lib/tweeting_cake/cake_slicer.rb +13 -0
- data/lib/tweeting_cake/cake_supervisor.rb +44 -0
- data/lib/tweeting_cake/tweeting_cake.rb +23 -0
- data/lib/tweeting_cake/twitter_client.rb +21 -0
- data/lib/tweeting_cake/version.rb +3 -0
- data/start.rb +4 -0
- data/tweeting_cake.gemspec +26 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2353e95dd1e578dd1cf003ec018cef2181669621
|
4
|
+
data.tar.gz: 71d8f2b5f885f5f5c85f42aefa0907787ce5529a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 44503060dc5454169c80334d84e838a0ac307e035129d297a4e7352fef4667c79def7bcacfdc3f6acf46d3d4b56e99f6543a928cd4298a6ab1ec3423c7ec2657
|
7
|
+
data.tar.gz: 373ae532064e76f8c031d8233c4e01de8441ee05c2083b7207a465ddc149f607858524b9e1489778cbeda2b37b7da7ef9ad1c5161c772cdf0276507324c0b0d2
|
data/.gitignore
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/.env
|
5
|
+
/coverage/
|
6
|
+
/InstalledFiles
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
## Specific to RubyMotion:
|
14
|
+
.dat*
|
15
|
+
.repl_history
|
16
|
+
build/
|
17
|
+
|
18
|
+
## Documentation cache and generated files:
|
19
|
+
/.yardoc/
|
20
|
+
/_yardoc/
|
21
|
+
/doc/
|
22
|
+
/rdoc/
|
23
|
+
|
24
|
+
## Environment normalisation:
|
25
|
+
/.bundle/
|
26
|
+
/lib/bundler/man/
|
27
|
+
|
28
|
+
# for a library or gem, you might want to ignore these files since the code is
|
29
|
+
# intended to run in multiple environments; otherwise, check them in:
|
30
|
+
# Gemfile.lock
|
31
|
+
# .ruby-version
|
32
|
+
# .ruby-gemset
|
33
|
+
|
34
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
35
|
+
.rvmrc
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
tweeting_cake (0.0.1)
|
5
|
+
dotenv (~> 2.0)
|
6
|
+
twitter (~> 5.14)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.3.7)
|
12
|
+
buftok (0.2.0)
|
13
|
+
dotenv (2.0.0)
|
14
|
+
equalizer (0.0.11)
|
15
|
+
faraday (0.9.1)
|
16
|
+
multipart-post (>= 1.2, < 3)
|
17
|
+
http (0.6.3)
|
18
|
+
http_parser.rb (~> 0.6.0)
|
19
|
+
http_parser.rb (0.6.0)
|
20
|
+
json (1.8.2)
|
21
|
+
memoizable (0.4.2)
|
22
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
23
|
+
multipart-post (2.0.0)
|
24
|
+
naught (1.0.0)
|
25
|
+
rake (10.4.2)
|
26
|
+
simple_oauth (0.3.1)
|
27
|
+
thread_safe (0.3.5)
|
28
|
+
twitter (5.14.0)
|
29
|
+
addressable (~> 2.3)
|
30
|
+
buftok (~> 0.2.0)
|
31
|
+
equalizer (~> 0.0.9)
|
32
|
+
faraday (~> 0.9.0)
|
33
|
+
http (~> 0.6.0)
|
34
|
+
http_parser.rb (~> 0.6.0)
|
35
|
+
json (~> 1.8)
|
36
|
+
memoizable (~> 0.4.0)
|
37
|
+
naught (~> 1.0)
|
38
|
+
simple_oauth (~> 0.3.0)
|
39
|
+
|
40
|
+
PLATFORMS
|
41
|
+
ruby
|
42
|
+
|
43
|
+
DEPENDENCIES
|
44
|
+
bundler (~> 1.5)
|
45
|
+
rake
|
46
|
+
tweeting_cake!
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Tobias Talltorp
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# A cake that can tweet
|
2
|
+
|
3
|
+
This is part of the "Internet of ordinary things" movement:
|
4
|
+
We take ordinary things and ask kids what they would do if it was connected to a computer and/or the internet.
|
5
|
+
|
6
|
+
It is a creative that brings value to both parties
|
7
|
+
* __Kids__ learn to code while thinking witout bounderies
|
8
|
+
* __Brands__ get a glimpse of what is possible if they think outside their product development processes
|
9
|
+
|
10
|
+
## Prerequisits
|
11
|
+
This is what you need to make a tweeting cake
|
12
|
+
* [Makey Makey](http://makeymakey.com/)
|
13
|
+
* A cake that is not too dry
|
14
|
+
|
15
|
+
## We officially support
|
16
|
+
* [Brownies](http://www.bbcgoodfood.com/recipes/1223/bestever-brownies)
|
17
|
+
* [Delicato french chocolate cake](http://www.delicato.se/48/74/Fransk-Chokladtarta.html)
|
18
|
+
* [Angry Bird Cupcakes](http://thecraftingchicks.com/2011/03/angry-birds-cupcakes.html)
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
```gem install tweeting_cake```
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
Once installed, run this command to post a tweet when cake is cut and served
|
25
|
+
```bash
|
26
|
+
supervise_cutting_of_tweeting_cake
|
27
|
+
```
|
28
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require_relative "./twitter_client"
|
2
|
+
require_relative "./tweeting_cake"
|
3
|
+
require_relative "./cake_slicer"
|
4
|
+
require 'io/console'
|
5
|
+
|
6
|
+
module TweetingCake
|
7
|
+
class CakeSupervisor
|
8
|
+
def supervise_cake_cutting
|
9
|
+
twitter_handle = ask_for_twitter_handle
|
10
|
+
tweeting_cake = TweetingCake.new(
|
11
|
+
name_on_cake: twitter_handle
|
12
|
+
)
|
13
|
+
cake_slicer = CakeSlicer.new(TwitterClient.new)
|
14
|
+
|
15
|
+
give_cake_slicing_instructions
|
16
|
+
wait_for_cake_to_get_sliced
|
17
|
+
|
18
|
+
cake_slicer.serve_a_slice_from(tweeting_cake)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def give_cake_slicing_instructions
|
24
|
+
puts "Now cut the cake with the cake slicer!"
|
25
|
+
STDOUT.flush
|
26
|
+
end
|
27
|
+
|
28
|
+
def ask_for_twitter_handle
|
29
|
+
puts "what is your twitter handle?"
|
30
|
+
STDOUT.flush
|
31
|
+
gets.chomp
|
32
|
+
end
|
33
|
+
|
34
|
+
def wait_for_cake_to_get_sliced
|
35
|
+
loop do
|
36
|
+
system("stty raw -echo")
|
37
|
+
char = STDIN.read_nonblock(1) rescue nil
|
38
|
+
system("stty -raw echo")
|
39
|
+
break if / /i =~ char
|
40
|
+
exit if /x/i =~ char
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module TweetingCake
|
2
|
+
class TweetingCake
|
3
|
+
attr_reader :name_on_cake
|
4
|
+
|
5
|
+
def initialize(args = {})
|
6
|
+
@name_on_cake = args[:name_on_cake]
|
7
|
+
end
|
8
|
+
|
9
|
+
def tweetable_description
|
10
|
+
"#tweeting_cake is served! #{twitter_handle} must be celebrating something #awesome!"
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def twitter_handle
|
16
|
+
if name_on_cake.start_with?("@")
|
17
|
+
name_on_cake
|
18
|
+
else
|
19
|
+
"@#{name_on_cake}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'twitter'
|
2
|
+
|
3
|
+
module TweetingCake
|
4
|
+
class TwitterClient
|
5
|
+
def tweet(message)
|
6
|
+
#puts message
|
7
|
+
client.update(message)
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def client
|
13
|
+
@client ||= Twitter::REST::Client.new do |config|
|
14
|
+
config.consumer_key = ENV["TWITTER_CONSUMER_KEY"]
|
15
|
+
config.consumer_secret = ENV["TWITTER_CONSUMER_SECRET"]
|
16
|
+
config.access_token = ENV["TWITTER_ACCESS_TOKEN"]
|
17
|
+
config.access_token_secret = ENV["TWITTER_ACCESS_SECRET"]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/start.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'tweeting_cake/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "tweeting_cake"
|
8
|
+
spec.version = TweetingCake::VERSION
|
9
|
+
spec.authors = ["Tobias Talltorp"]
|
10
|
+
spec.email = ["tobias@talltorp.se"]
|
11
|
+
spec.summary = "Make a cake tweet with a Makey Makey"
|
12
|
+
spec.description = "Make a cake tweet witha Makey Makey"
|
13
|
+
spec.homepage = "https://github.com/talltorp/tweeting_cake"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
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_dependency 'twitter', "~> 5.14"
|
22
|
+
spec.add_dependency 'dotenv', "~> 2.0"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tweeting_cake
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tobias Talltorp
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: twitter
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.14'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dotenv
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
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: Make a cake tweet witha Makey Makey
|
70
|
+
email:
|
71
|
+
- tobias@talltorp.se
|
72
|
+
executables:
|
73
|
+
- supervise_cutting_of_tweeting_cake
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- Gemfile
|
79
|
+
- Gemfile.lock
|
80
|
+
- LICENSE
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/supervise_cutting_of_tweeting_cake
|
84
|
+
- lib/tweeting_cake.rb
|
85
|
+
- lib/tweeting_cake/cake_slicer.rb
|
86
|
+
- lib/tweeting_cake/cake_supervisor.rb
|
87
|
+
- lib/tweeting_cake/tweeting_cake.rb
|
88
|
+
- lib/tweeting_cake/twitter_client.rb
|
89
|
+
- lib/tweeting_cake/version.rb
|
90
|
+
- start.rb
|
91
|
+
- tweeting_cake.gemspec
|
92
|
+
homepage: https://github.com/talltorp/tweeting_cake
|
93
|
+
licenses:
|
94
|
+
- MIT
|
95
|
+
metadata: {}
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
requirements: []
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 2.2.0
|
113
|
+
signing_key:
|
114
|
+
specification_version: 4
|
115
|
+
summary: Make a cake tweet with a Makey Makey
|
116
|
+
test_files: []
|