trollme 0.1.1 → 0.2.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
- SHA1:
3
- metadata.gz: 2dd32004cb23304eb848a4ac76fdc0ca3590bff2
4
- data.tar.gz: 0b8f00a7c7ef344fc8a06abfc66c4ae4004d9942
2
+ SHA256:
3
+ metadata.gz: 5329206b3096207e316d73941f1fe9ec8af6d87b17f2ab06cbe0245223ebe7f2
4
+ data.tar.gz: f956932b644d3f32bbba9cea73a4cb410d335dde14054a6959f050ca3c636ab1
5
5
  SHA512:
6
- metadata.gz: 0a93d4dd6dbac7747e84b800d133ac1037b297c77ef57d0fda094f07597ec988da1a5af3c6a8545c4c253d5eb91d1b42a9366d367904b41e51a70daca3388f10
7
- data.tar.gz: 8bce602c45b8a9d491e2c444c8ee8d04cc1f7758b7517422f55cfcce16705e6a95f2b27ce13195047273fe1ac130062cb91dc1a245bc02000b3d79e35505e673
6
+ metadata.gz: 4ec1592ef1649171ee9f5003868875bd4b67db68dfcd638fe6135a75b7967d76a67f46e79387a9ae944ff377cdb90371ed5905d193ab3ab0501ebd089ab2eedf
7
+ data.tar.gz: 4eb7f001519a476d6c95e5c76ad95b1e4203d48f28a811e05d4a87b68b6740abfc7838d49d721110ad77bfffaed4d7eff7b1b422d968dc85b0530488076c0636
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trollme (0.1.0)
4
+ trollme (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -33,8 +33,8 @@ PLATFORMS
33
33
 
34
34
  DEPENDENCIES
35
35
  bundler (~> 1.16)
36
- fakefs
37
- pry
36
+ fakefs (~> 0.13)
37
+ pry (~> 0.11)
38
38
  rake (~> 10.0)
39
39
  rspec (~> 3.0)
40
40
  trollme!
data/README.md CHANGED
@@ -1,18 +1,53 @@
1
1
  # Trollme
2
- TO WRITE
2
+ How many of us we work in an office, and spend 8 daily hours with our colleagues? How many time did we see their screens unlocked, tempted to apply some changes on their laptops?
3
+
4
+ That's the purpose of **Trollme**. Basically is a gem to prank people changing their Desktop Background. You can choose among 6 topics, or just make it random if you prefer.
5
+
6
+ As well is important to say that right now it just works with Mac. I know it's not 100% fair that it's just supported by one OS. But 90% of my colleagues are working with Mac and the idea of this gem is to prank them... In the future, I can try to arrange it.
7
+ **Why do I want to do that?**
8
+
9
+ Just looking to prank some people in a funny and inoffensive way. At the end we teach them to lock their screens and help the enterprise to apply the ISO Quality Management, don't we?
10
+
11
+ ![time to troll!](https://media.giphy.com/media/q8pghZNgAQ0rm/giphy.gif)
3
12
  ## Installation
13
+ Is quite easy:
14
+
4
15
  ` gem install trollme`
5
16
 
6
- Then in your command line terminal you just have to invoke it
17
+ Then in your command line terminal, you just have to invoke it
7
18
  `$ trollme`
8
19
 
9
- ## Usage
20
+ In case you want to select one topic, here is the list you can use:
21
+ ```sh
22
+ - dogs
23
+ - horror
24
+ - memes
25
+ - nerds
26
+ - cats
27
+ - sweet
28
+ ```
29
+
30
+ To make it work you just have to specify the topic. Example:
31
+ `$ trollme cats`
32
+ In case you insert a wrong topic or one is not in the list, automatically will fall into random.
10
33
 
11
- TODO: Write usage instructions here
34
+ Or if you are a Rails developer and you want to super troll them, just hide it in your gemfile
35
+ `gem 'trollme'`
36
+ now just wait until they leave the screen unlocked and just run the command line statement. Cool :)
37
+
38
+ ### Other uses
39
+ Another use for this gem, is to fork the project, change the YAML file ( just need to respec the format ), and sync with a cronjob. You can have an automated background changer for everyday with the images you want.
12
40
 
13
41
  ## Contributing
14
42
 
15
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/trollme.
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ruffeng/trollme.
44
+
45
+ ## TODO
46
+ - [x] Create categories in a YAML file
47
+ - [x] Upload pictures in Cloudinary
48
+ - [x] Let the user choose a category
49
+ [ ] Generate meme text if a text is sent
50
+ [ ] Change Background depending on their OS
16
51
 
17
52
  ## License
18
53
 
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'trollme'
4
4
 
5
- Trollme.run
5
+ Trollme.run(topic: ARGV[0])
@@ -0,0 +1,185 @@
1
+ dogs:
2
+ -
3
+ file: dog_biscuit.jpg
4
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566893/dogs/DOG-TROLL-BISCUIT.jpg
5
+ -
6
+ file: dog_tongue.jpg
7
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566892/dogs/DOG-TROLL-CUTE.jpg
8
+ -
9
+ file: dog_ears.jpg
10
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566890/dogs/DOG-TROLL-HEAR.jpg
11
+ -
12
+ file: dog_look.jpg
13
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566890/dogs/DOG-TROLL-LOOK.jpg
14
+ -
15
+ file: dog_date.jpb
16
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566890/dogs/DOG-TROLL-DATE.jpg
17
+ -
18
+ file: dog_happy.jpg
19
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566889/dogs/DOG-TROLL-HEY.jpg
20
+ -
21
+ file: dog_snob.jpg
22
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566889/dogs/DOG-TROLL-SNOB.jpg
23
+ -
24
+ file: dog_trex.jpg
25
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566889/dogs/DOG-TROLL-TREX.jpg
26
+ -
27
+ file: dog_laugh.jpg
28
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566889/dogs/DOG-TROLL-LAUGH.jpg
29
+ -
30
+ file: dog_style.jpg
31
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566888/dogs/DOG-TROLL-STYLE.jpg
32
+ -
33
+ file: dog_smile.jpg
34
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566888/dogs/DOG-TROLL-TROLLED.jpg
35
+ -
36
+ file: dog_lick.jpg
37
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566888/dogs/DOG-TROLL-SCREEN.jpg
38
+ -
39
+ file: dog_pirate.jpg
40
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566888/dogs/DOG-TROLL-PIRATE.jpg
41
+
42
+ horror:
43
+ -
44
+ file: exorcist.jpg
45
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566993/horror/SCARY-TROLL-EXORCIST.jpg
46
+ -
47
+ file: zombie_girl.jpg
48
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566992/horror/SCARY-TROLL-CUTTER.jpg
49
+ -
50
+ file: it.jpg
51
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566992/horror/SCARY-TROLL-CLOWN.jpg
52
+ -
53
+ file: michael_myers.jpb
54
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566991/horror/SCARY-TROLL-HALLOWEEN.jpg
55
+ -
56
+ file: zombie.jpg
57
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566991/horror/SCARY-TROLL-BRAINS.jpg
58
+ -
59
+ file: chainsaw.jpg
60
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566991/horror/SCARY-TROLL-LOCK.jpg
61
+ -
62
+ file: jason_voorhees.jpg
63
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566990/horror/SCARY-TROLL-WAITING.jpg
64
+ -
65
+ file: beetlejuice.jpg
66
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566990/horror/SCARY-TROLL-TROLLERJUICE.jpg
67
+ -
68
+ file: prayer.jpg
69
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529566989/horror/SCARY-TROLL-PRAY.jpg
70
+
71
+ memes:
72
+ -
73
+ file: troller.jpg
74
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567163/memes/TROLL-MEMES-TROLL.jpg
75
+ -
76
+ file: angry_kid.jpg
77
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567163/memes/TROLL-MEME-BABY.jpg
78
+ -
79
+ file: no_please_no.jpg
80
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567162/memes/TROLL-MEMES-NOOO.jpg
81
+ -
82
+ file: wat_sense.jpg
83
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567162/memes/TROLL-MEMES-BORING.jpg
84
+ -
85
+ file: wonka.jpg
86
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567162/memes/TROLL-MEMES-FEEL.jpg
87
+ -
88
+ file: trump_trolled.jpg
89
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567162/memes/TROLL-MEMES-TRUMP.jpg
90
+ -
91
+ file: kid_skeptical.jpg
92
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567161/memes/TROLL-MEMES-TELLING.jpg
93
+
94
+ nerds:
95
+ -
96
+ file: magnum.jpg
97
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567055/nerds/FAMOUS-TROLL-ZOOLANDER.jpg
98
+ -
99
+ file: office_guy.jpg
100
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567055/nerds/FAMOUS-TROLL-OFFICE2.jpg
101
+ -
102
+ file: bruno_sacha.jpg
103
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567054/nerds/FAMOUS-TROLL-BRUNO.jpg
104
+ -
105
+ file: borat_sacha.jpg
106
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567054/nerds/FAMOUS-TROLL-BORAT.jpg
107
+ -
108
+ file: dwight_office.jpg
109
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567054/nerds/FAMOUS-TROLL-OFFICE.jpg
110
+ -
111
+ file: bean_bored.jpg
112
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567054/nerds/FAMOUS-TROLL-BEAN.jpg
113
+ -
114
+ file: ali_g_sacha.jpg
115
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567053/nerds/FAMOUS-TROLL-ALIG.jpg
116
+ -
117
+ file: dumber_carrey.jpg
118
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567052/nerds/FAMOUS-TROLL-JIM.jpg
119
+ -
120
+ file: mairena.jpg
121
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567052/nerds/FAMOUS-TROLL-MAIRENA.jpg
122
+ -
123
+ file: austin_powers.jpg
124
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567051/nerds/FAMOUS-TROLL-AUSTIN.jpg
125
+
126
+ cats:
127
+ -
128
+ file: cat_squad.jpb
129
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567322/pussycat/CAT-TROLL-SQUAD.jpg
130
+ -
131
+ file: cat_tongue.jpg
132
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567321/pussycat/CAT-TROLL-LOCK.jpg
133
+ -
134
+ file: cat_surrender.jpg
135
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567321/pussycat/CAT-TROLL-SURRENDER.jpg
136
+ -
137
+ file: reservoir_cat.jpg
138
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567321/pussycat/CAT-TROLL-RESERVOIR.jpg
139
+ -
140
+ file: cat_warm.jpg
141
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567321/pussycat/CAT-TROLL-HAT.jpg
142
+ -
143
+ file: cat_look.jpg
144
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567320/pussycat/CAT-TROLL-TELL.jpg
145
+ -
146
+ file: cat_up.jpg
147
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567319/pussycat/CAT-TROLL-ON.jpg
148
+ -
149
+ file: please_cat.jpg
150
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567319/pussycat/CAT-TROLL-PLEASE.jpg
151
+ -
152
+ file: cat_tongue.jpg
153
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567318/pussycat/CAT-TROLL-GOT.jpg
154
+ -
155
+ file: cat_oh_no.jpg
156
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567318/pussycat/CAT-TROLL-OHNO.jpg
157
+ -
158
+ file: grumpy_trolled.jpg
159
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567317/pussycat/CAT-TROLL-GRUMPY.jpg
160
+ -
161
+ file: batcat.jpg
162
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567317/pussycat/CAT-TROLL-BATCAT.jpg
163
+ -
164
+ file: grumpy_no.jpg
165
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567317/pussycat/CAT-TROLL-GRUMPY2.jpg
166
+
167
+ sweet:
168
+ -
169
+ file: baby_sweet.jpg
170
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567588/sweet/SWEET_TROLL-WHAT.jpg
171
+ -
172
+ file: guinea_blonde.jpg
173
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567587/sweet/SWEET_TROLL-DIVA.jpg
174
+ -
175
+ file: guinea_sweet.jpg
176
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567586/sweet/SWEET_TROLL-FRIEND.jpg
177
+ -
178
+ file: teddy_sweet.jpg
179
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567586/sweet/SWEET_TROLL-LOVE.jpg
180
+ -
181
+ file: guinea_unicorn.jpg
182
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567585/sweet/SWEET_TROLL-UNICORNPIG.jpg
183
+ -
184
+ file: amazon_wishlist.jpg
185
+ url: https://res.cloudinary.com/dhorp8suj/image/upload/v1529567585/sweet/SWEET_TROLL-AMAZON.jpg
@@ -1,12 +1,14 @@
1
1
  require 'trollme/version'
2
2
  require 'trollme/downloader'
3
3
  require 'trollme/change_background'
4
+ require 'trollme/topic'
4
5
 
5
6
  module Trollme
6
7
  module_function
7
8
 
8
- def run
9
- path = Downloader.call
9
+ def run(topic: nil)
10
+ topic = Topic.call(topic)
11
+ path = Downloader.call(topic)
10
12
  ChangeBackground.call(path)
11
13
  end
12
14
  end
@@ -1,4 +1,3 @@
1
- require 'pry'
2
1
  require 'open-uri'
3
2
  module Trollme
4
3
  module Downloader
@@ -8,13 +7,12 @@ module Trollme
8
7
  OpenFile = Class.new(RuntimeError)
9
8
  SaveFile = Class.new(RuntimeError)
10
9
 
11
- PICTURE = 'mairena.jpg'.freeze
12
- URL = 'https://ep00.epimg.net/elpais/imagenes/2017/06/14/fotorrelato/1497431610_448226_1497432498_album_normal.jpg'.freeze
13
10
 
14
- def call
11
+ def call(topic)
12
+ set_defaults(topic)
15
13
  set_folder
16
- if File.exist?(PICTURE)
17
- get_existing_file(PICTURE)
14
+ if File.exist?(@file)
15
+ get_existing_file(@file)
18
16
  else
19
17
  download_image_and_return_path
20
18
  end
@@ -29,6 +27,11 @@ module Trollme
29
27
  class << self
30
28
  private
31
29
 
30
+ def set_defaults(topic)
31
+ @file = topic['file']
32
+ @url = topic['url']
33
+ end
34
+
32
35
  def set_folder
33
36
  Dir.chdir(File.expand_path('~/Downloads'))
34
37
  rescue Errno::ENOENT
@@ -40,15 +43,15 @@ module Trollme
40
43
  end
41
44
 
42
45
  def download_image_and_return_path
43
- file = File.open(PICTURE, 'wb') { |new_file| write_image(new_file) }
44
- get_existing_file(file.path)
46
+ new_file = File.open(file, 'wb') { |new_file| write_image(new_file) }
47
+ get_existing_file(new_file.path)
45
48
  rescue Errno::ENOENT
46
49
  rollback
47
50
  raise SaveFile
48
51
  end
49
52
 
50
53
  def write_image(file)
51
- file << open(URL).read
54
+ file << open(url).read
52
55
  rescue Errno::ENOENT
53
56
  rollback
54
57
  raise OpenFile
@@ -58,8 +61,10 @@ module Trollme
58
61
  end
59
62
 
60
63
  def rollback
61
- File.delete(PICTURE)
64
+ File.delete(file)
62
65
  end
66
+
67
+ attr_reader :file, :url
63
68
  end
64
69
  end
65
70
  end
@@ -0,0 +1,44 @@
1
+ require 'yaml'
2
+
3
+ module Trollme
4
+ module Topic
5
+ module_function
6
+
7
+ def call(topic)
8
+ defaults(topic)
9
+ return random_topic unless topic_is_in_list_and_present(topic)
10
+ picture_from_topic(topic)
11
+ end
12
+
13
+ class << self
14
+ private
15
+
16
+ def defaults(topic)
17
+ @yaml = YAML.load_file(topics_path)
18
+ @topic = downcase_topic(topic)
19
+ end
20
+
21
+ def downcase_topic(topic)
22
+ topic.downcase if topic
23
+ end
24
+
25
+ def topics_path
26
+ File.expand_path(File.join(__dir__, '..', 'external', 'topics.yml'))
27
+ end
28
+
29
+ def topic_is_in_list_and_present(topic)
30
+ topic && yaml.key?(topic)
31
+ end
32
+
33
+ def random_topic
34
+ picture_from_topic(yaml.keys.sample)
35
+ end
36
+
37
+ def picture_from_topic(topic)
38
+ yaml[topic].sample
39
+ end
40
+
41
+ attr_reader :yaml, :topic
42
+ end
43
+ end
44
+ end
@@ -1,3 +1,3 @@
1
1
  module Trollme
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trollme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruffeng
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-25 00:00:00.000000000 Z
11
+ date: 2018-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -101,9 +101,11 @@ files:
101
101
  - bin/console
102
102
  - bin/setup
103
103
  - exe/trollme
104
+ - lib/external/topics.yml
104
105
  - lib/trollme.rb
105
106
  - lib/trollme/change_background.rb
106
107
  - lib/trollme/downloader.rb
108
+ - lib/trollme/topic.rb
107
109
  - lib/trollme/version.rb
108
110
  - trollme.gemspec
109
111
  homepage: https://github.com/Ruffeng/trollme/tree/master
@@ -126,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
128
  version: '0'
127
129
  requirements: []
128
130
  rubyforge_project:
129
- rubygems_version: 2.6.11
131
+ rubygems_version: 2.7.3
130
132
  signing_key:
131
133
  specification_version: 4
132
134
  summary: Gem to troll your colleagues from the office.