rage_flip 1.1.0 → 1.2.0
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 +4 -4
- data/Gemfile +2 -1
- data/README.md +593 -131
- data/Rakefile +23 -23
- data/exe/chaos +4 -5
- data/exe/chaos_level +4 -4
- data/exe/disapproval +17 -0
- data/exe/doubleunderline +4 -5
- data/exe/emote +4 -5
- data/exe/flip +17 -0
- data/exe/flip_text +4 -5
- data/exe/rage_flip +4 -5
- data/exe/sarcasm +4 -5
- data/exe/strikethrough +4 -5
- data/exe/table_flip +4 -5
- data/exe/underline +4 -5
- data/lib/rage_flip/chaos.rb +13 -13
- data/lib/rage_flip/clipboard.rb +1 -1
- data/lib/rage_flip/emote.rb +47 -17
- data/lib/rage_flip/flipper.rb +11 -11
- data/lib/rage_flip/sarcasm.rb +1 -1
- data/lib/rage_flip/strikethrough.rb +3 -3
- data/lib/rage_flip/text_substitution.rb +61 -0
- data/lib/rage_flip/underline.rb +5 -5
- data/lib/rage_flip/version.rb +2 -2
- data/lib/rage_flip.rb +3 -2
- data/spec/rage_flip_spec.rb +99 -99
- data/spec/spec_helper.rb +3 -3
- metadata +6 -1
@@ -0,0 +1,61 @@
|
|
1
|
+
module RageFlip
|
2
|
+
class TextSubstitution
|
3
|
+
SUBSTITUTIONS = {
|
4
|
+
"bugeyes" => "(⊙_◎)",
|
5
|
+
"cmd-" => "⌘-",
|
6
|
+
"cmd" => "⌘",
|
7
|
+
"cntl" => "⌃",
|
8
|
+
"disapproval" => "ಠ_ಠ",
|
9
|
+
"dogshrug" => '¯\_🐶_/¯',
|
10
|
+
"duck-flip" => "(╯°□°)╯︵ ┻(duckflip)┻",
|
11
|
+
"facepalm" => "(-‸ლ)",
|
12
|
+
"flip" => "(╯°□°)╯︵ ┻━┻",
|
13
|
+
"fu" => "t(-__-t)",
|
14
|
+
"heresatable" => "┬─┬ ノ( ゜-゜ノ)",
|
15
|
+
"javaflip" => "(╯°□°)╯︵ ┻ɐʌɐɾ┻",
|
16
|
+
"kungfuhamster" => ' ()__()
|
17
|
+
/ o o\ ;
|
18
|
+
|\'=Y=\';-/
|
19
|
+
{ \ / }
|
20
|
+
mmm mmm ',
|
21
|
+
"noevil" => "🙈🙉🙊",
|
22
|
+
"omw" => "On my way!",
|
23
|
+
"optn" => "⌥",
|
24
|
+
"rage" => "ಠ益ಠ",
|
25
|
+
"rageflip" => "(ノಠ益ಠ)ノ彡┻━┻",
|
26
|
+
"rock" => '\m/ (>_<) \m/',
|
27
|
+
"shft" => "⇧",
|
28
|
+
"shift" => "⇧",
|
29
|
+
"shrug" => '¯\_(ツ)_/¯',
|
30
|
+
"shrugtable" => '┻━┻ ︵ ¯\(ツ)/¯ ︵ ┻━┻',
|
31
|
+
"unsee" => "♨_♨",
|
32
|
+
"yuno" => "ლ(ಠ益ಠლ)"
|
33
|
+
}.freeze
|
34
|
+
|
35
|
+
def self.process(substitution_name)
|
36
|
+
substitution_name = substitution_name.downcase
|
37
|
+
|
38
|
+
if SUBSTITUTIONS.key?(substitution_name)
|
39
|
+
SUBSTITUTIONS[substitution_name]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.list_substitutions
|
44
|
+
output = ["Available text substitutions:"]
|
45
|
+
SUBSTITUTIONS.each do |name, text|
|
46
|
+
# Truncate long substitutions for display
|
47
|
+
display_text = (text.length > 50) ? "#{text[0..47]}..." : text
|
48
|
+
output << " #{name.ljust(15)} - #{display_text}"
|
49
|
+
end
|
50
|
+
output.join("\n")
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.substitution_exists?(name)
|
54
|
+
SUBSTITUTIONS.key?(name.downcase)
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.substitution_names
|
58
|
+
SUBSTITUTIONS.keys
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/rage_flip/underline.rb
CHANGED
@@ -2,18 +2,18 @@ module RageFlip
|
|
2
2
|
class Underline
|
3
3
|
UNDERLINE_CHAR = "\u0332"
|
4
4
|
DOUBLE_UNDERLINE_CHAR = "\u0333"
|
5
|
-
|
5
|
+
|
6
6
|
def self.process(text, double: false)
|
7
7
|
underline_char = double ? DOUBLE_UNDERLINE_CHAR : UNDERLINE_CHAR
|
8
|
-
text.each_char.map { |c| [c, underline_char] }.
|
8
|
+
text.each_char.map { |c| [c, underline_char] }.join
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def self.single_underline(text)
|
12
12
|
process(text, double: false)
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def self.double_underline(text)
|
16
16
|
process(text, double: true)
|
17
17
|
end
|
18
18
|
end
|
19
|
-
end
|
19
|
+
end
|
data/lib/rage_flip/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module RageFlip
|
2
|
-
VERSION = "1.
|
3
|
-
end
|
2
|
+
VERSION = "1.2.0"
|
3
|
+
end
|
data/lib/rage_flip.rb
CHANGED
@@ -6,8 +6,9 @@ require_relative "rage_flip/underline"
|
|
6
6
|
require_relative "rage_flip/chaos"
|
7
7
|
require_relative "rage_flip/clipboard"
|
8
8
|
require_relative "rage_flip/emote"
|
9
|
-
|
9
|
+
require_relative "rage_flip/text_substitution"
|
10
|
+
require "shellwords"
|
10
11
|
|
11
12
|
module RageFlip
|
12
13
|
class Error < StandardError; end
|
13
|
-
end
|
14
|
+
end
|
data/spec/rage_flip_spec.rb
CHANGED
@@ -1,70 +1,70 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe RageFlip do
|
4
4
|
describe RageFlip::Flipper do
|
5
|
-
describe
|
6
|
-
it
|
7
|
-
result = RageFlip::Flipper.flip(
|
8
|
-
expect(result).to eq(
|
5
|
+
describe ".flip" do
|
6
|
+
it "flips text upside down" do
|
7
|
+
result = RageFlip::Flipper.flip("Hello")
|
8
|
+
expect(result).to eq("oʅʅǝH")
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
describe
|
13
|
-
it
|
14
|
-
result = RageFlip::Flipper.rage_flip(
|
15
|
-
expect(result).to include(
|
16
|
-
expect(result).to include(
|
12
|
+
describe ".rage_flip" do
|
13
|
+
it "adds rage emoticons to flipped text" do
|
14
|
+
result = RageFlip::Flipper.rage_flip("test")
|
15
|
+
expect(result).to include("(ノಠ益ಠ)ノ彡┻")
|
16
|
+
expect(result).to include("┻")
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
describe
|
21
|
-
it
|
22
|
-
result = RageFlip::Flipper.table_flip(
|
23
|
-
expect(result).to include(
|
24
|
-
expect(result).to include(
|
25
|
-
expect(result).to include(
|
20
|
+
describe ".table_flip" do
|
21
|
+
it "adds table flip emoticons to flipped text" do
|
22
|
+
result = RageFlip::Flipper.table_flip("test")
|
23
|
+
expect(result).to include("(╯°□°)╯︵")
|
24
|
+
expect(result).to include("┻━┻")
|
25
|
+
expect(result).to include("ʇsǝʇ") # flipped version of 'test'
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
describe
|
30
|
-
it
|
31
|
-
result = RageFlip::Flipper.flip_text(
|
32
|
-
expect(result).to eq(
|
33
|
-
expect(result).not_to include(
|
34
|
-
expect(result).not_to include(
|
29
|
+
describe ".flip_text" do
|
30
|
+
it "flips text without any emoticons" do
|
31
|
+
result = RageFlip::Flipper.flip_text("test")
|
32
|
+
expect(result).to eq("ʇsǝʇ")
|
33
|
+
expect(result).not_to include("(")
|
34
|
+
expect(result).not_to include("┻")
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
describe RageFlip::Sarcasm do
|
40
|
-
describe
|
41
|
-
it
|
42
|
-
result = RageFlip::Sarcasm.process(
|
43
|
-
expect(result).to eq(
|
40
|
+
describe ".process" do
|
41
|
+
it "alternates case of characters" do
|
42
|
+
result = RageFlip::Sarcasm.process("hello")
|
43
|
+
expect(result).to eq("HeLlO")
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
describe RageFlip::Strikethrough do
|
49
|
-
describe
|
50
|
-
it
|
51
|
-
result = RageFlip::Strikethrough.process(
|
49
|
+
describe ".process" do
|
50
|
+
it "adds strikethrough characters" do
|
51
|
+
result = RageFlip::Strikethrough.process("test")
|
52
52
|
expect(result).to include("\u0336")
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
describe RageFlip::Underline do
|
58
|
-
describe
|
59
|
-
it
|
60
|
-
result = RageFlip::Underline.single_underline(
|
58
|
+
describe ".single_underline" do
|
59
|
+
it "adds single underline characters" do
|
60
|
+
result = RageFlip::Underline.single_underline("test")
|
61
61
|
expect(result).to include("\u0332")
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
describe
|
66
|
-
it
|
67
|
-
result = RageFlip::Underline.double_underline(
|
65
|
+
describe ".double_underline" do
|
66
|
+
it "adds double underline characters" do
|
67
|
+
result = RageFlip::Underline.double_underline("test")
|
68
68
|
expect(result).to include("\u0333")
|
69
69
|
end
|
70
70
|
end
|
@@ -72,117 +72,117 @@ RSpec.describe RageFlip do
|
|
72
72
|
|
73
73
|
describe RageFlip::Chaos do
|
74
74
|
let(:chaos_file) { File.expand_path("~/.chaos_level.txt") }
|
75
|
-
|
75
|
+
|
76
76
|
before do
|
77
77
|
# Clean up chaos file before each test
|
78
78
|
File.delete(chaos_file) if File.exist?(chaos_file)
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
81
|
after do
|
82
82
|
# Clean up chaos file after each test
|
83
83
|
File.delete(chaos_file) if File.exist?(chaos_file)
|
84
84
|
end
|
85
85
|
|
86
|
-
describe
|
87
|
-
it
|
88
|
-
result = RageFlip::Chaos.process(
|
86
|
+
describe ".process" do
|
87
|
+
it "adds combining characters for chaos effect" do
|
88
|
+
result = RageFlip::Chaos.process("test", 5)
|
89
89
|
expect(result.length).to be > 4 # Should be longer than original
|
90
90
|
end
|
91
|
-
|
92
|
-
it
|
93
|
-
result = RageFlip::Chaos.process(
|
91
|
+
|
92
|
+
it "uses default chaos level when no file exists" do
|
93
|
+
result = RageFlip::Chaos.process("test")
|
94
94
|
expect(result.length).to be > 4 # Should be longer than original
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
-
describe
|
99
|
-
it
|
100
|
-
result = RageFlip::Chaos.set_chaos_level(
|
101
|
-
expect(File.read(chaos_file).strip).to eq(
|
102
|
-
expect(result).to eq(
|
98
|
+
describe ".set_chaos_level" do
|
99
|
+
it "sets chaos level to specific number" do
|
100
|
+
result = RageFlip::Chaos.set_chaos_level("15")
|
101
|
+
expect(File.read(chaos_file).strip).to eq("15")
|
102
|
+
expect(result).to eq("chaos level is now 15")
|
103
103
|
end
|
104
|
-
|
105
|
-
it
|
106
|
-
RageFlip::Chaos.set_chaos_level(
|
107
|
-
result = RageFlip::Chaos.set_chaos_level(
|
108
|
-
expect(File.read(chaos_file).strip).to eq(
|
109
|
-
expect(result).to eq(
|
104
|
+
|
105
|
+
it "increases chaos level with more" do
|
106
|
+
RageFlip::Chaos.set_chaos_level("10")
|
107
|
+
result = RageFlip::Chaos.set_chaos_level("more")
|
108
|
+
expect(File.read(chaos_file).strip).to eq("11")
|
109
|
+
expect(result).to eq("chaos level is now 11")
|
110
110
|
end
|
111
|
-
|
112
|
-
it
|
113
|
-
RageFlip::Chaos.set_chaos_level(
|
114
|
-
result = RageFlip::Chaos.set_chaos_level(
|
115
|
-
expect(File.read(chaos_file).strip).to eq(
|
116
|
-
expect(result).to eq(
|
111
|
+
|
112
|
+
it "decreases chaos level with less" do
|
113
|
+
RageFlip::Chaos.set_chaos_level("10")
|
114
|
+
result = RageFlip::Chaos.set_chaos_level("less")
|
115
|
+
expect(File.read(chaos_file).strip).to eq("9")
|
116
|
+
expect(result).to eq("chaos level is now 9")
|
117
117
|
end
|
118
|
-
|
119
|
-
it
|
120
|
-
RageFlip::Chaos.set_chaos_level(
|
121
|
-
result = RageFlip::Chaos.set_chaos_level(
|
122
|
-
expect(File.read(chaos_file).strip).to eq(
|
123
|
-
expect(result).to eq(
|
118
|
+
|
119
|
+
it "does not go below 1" do
|
120
|
+
RageFlip::Chaos.set_chaos_level("1")
|
121
|
+
result = RageFlip::Chaos.set_chaos_level("less")
|
122
|
+
expect(File.read(chaos_file).strip).to eq("1")
|
123
|
+
expect(result).to eq("chaos level is now 1")
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
-
describe
|
128
|
-
it
|
127
|
+
describe ".read_chaos_level" do
|
128
|
+
it "returns default when file does not exist" do
|
129
129
|
expect(RageFlip::Chaos.read_chaos_level).to eq(10)
|
130
130
|
end
|
131
|
-
|
132
|
-
it
|
133
|
-
File.write(chaos_file,
|
131
|
+
|
132
|
+
it "reads level from file when it exists" do
|
133
|
+
File.write(chaos_file, "25")
|
134
134
|
expect(RageFlip::Chaos.read_chaos_level).to eq(25)
|
135
135
|
end
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
139
|
describe RageFlip::Emote do
|
140
|
-
describe
|
141
|
-
it
|
142
|
-
result = RageFlip::Emote.process(
|
143
|
-
expect(result).to eq(
|
140
|
+
describe ".process" do
|
141
|
+
it "returns correct emote for disapproval" do
|
142
|
+
result = RageFlip::Emote.process("disapproval")
|
143
|
+
expect(result).to eq("(ಠ_ಠ)")
|
144
144
|
end
|
145
145
|
|
146
|
-
it
|
147
|
-
result = RageFlip::Emote.process(
|
148
|
-
expect(result).to eq(
|
146
|
+
it "returns correct emote for bullshit" do
|
147
|
+
result = RageFlip::Emote.process("bullshit")
|
148
|
+
expect(result).to eq("🐄💩")
|
149
149
|
end
|
150
150
|
|
151
|
-
it
|
152
|
-
result = RageFlip::Emote.process(
|
153
|
-
expect(result).to eq(
|
151
|
+
it "returns correct emote for dogshit" do
|
152
|
+
result = RageFlip::Emote.process("dogshit")
|
153
|
+
expect(result).to eq("🐶💩")
|
154
154
|
end
|
155
155
|
|
156
|
-
it
|
157
|
-
result = RageFlip::Emote.process(
|
158
|
-
expect(result).to eq(
|
156
|
+
it "handles case insensitive input" do
|
157
|
+
result = RageFlip::Emote.process("DISAPPROVAL")
|
158
|
+
expect(result).to eq("(ಠ_ಠ)")
|
159
159
|
end
|
160
160
|
|
161
|
-
it
|
162
|
-
result = RageFlip::Emote.process(
|
161
|
+
it "returns nil for unknown emote" do
|
162
|
+
result = RageFlip::Emote.process("unknown")
|
163
163
|
expect(result).to be_nil
|
164
164
|
end
|
165
165
|
end
|
166
166
|
|
167
|
-
describe
|
168
|
-
it
|
167
|
+
describe ".list_emotes" do
|
168
|
+
it "returns formatted list of all emotes" do
|
169
169
|
result = RageFlip::Emote.list_emotes
|
170
|
-
expect(result).to include(
|
171
|
-
expect(result).to include(
|
172
|
-
expect(result).to include(
|
173
|
-
expect(result).to include(
|
174
|
-
expect(result).to include(
|
170
|
+
expect(result).to include("Available emotes:")
|
171
|
+
expect(result).to include("disapproval")
|
172
|
+
expect(result).to include("(ಠ_ಠ)")
|
173
|
+
expect(result).to include("bullshit")
|
174
|
+
expect(result).to include("🐄💩")
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
178
|
-
describe
|
179
|
-
it
|
180
|
-
expect(RageFlip::Emote.emote_exists?(
|
178
|
+
describe ".emote_exists?" do
|
179
|
+
it "returns true for existing emote" do
|
180
|
+
expect(RageFlip::Emote.emote_exists?("disapproval")).to be true
|
181
181
|
end
|
182
182
|
|
183
|
-
it
|
184
|
-
expect(RageFlip::Emote.emote_exists?(
|
183
|
+
it "returns false for non-existing emote" do
|
184
|
+
expect(RageFlip::Emote.emote_exists?("nonexistent")).to be false
|
185
185
|
end
|
186
186
|
end
|
187
187
|
end
|
188
|
-
end
|
188
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require_relative
|
1
|
+
require "rspec"
|
2
|
+
require_relative "../lib/rage_flip"
|
3
3
|
|
4
4
|
RSpec.configure do |config|
|
5
5
|
config.expect_with :rspec do |c|
|
@@ -13,4 +13,4 @@ RSpec.configure do |config|
|
|
13
13
|
config.disable_monkey_patching!
|
14
14
|
config.order = :random
|
15
15
|
Kernel.srand config.seed
|
16
|
-
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rage_flip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Powell
|
@@ -45,8 +45,10 @@ email:
|
|
45
45
|
executables:
|
46
46
|
- chaos
|
47
47
|
- chaos_level
|
48
|
+
- disapproval
|
48
49
|
- doubleunderline
|
49
50
|
- emote
|
51
|
+
- flip
|
50
52
|
- flip_text
|
51
53
|
- rage_flip
|
52
54
|
- sarcasm
|
@@ -65,8 +67,10 @@ files:
|
|
65
67
|
- bin/version
|
66
68
|
- exe/chaos
|
67
69
|
- exe/chaos_level
|
70
|
+
- exe/disapproval
|
68
71
|
- exe/doubleunderline
|
69
72
|
- exe/emote
|
73
|
+
- exe/flip
|
70
74
|
- exe/flip_text
|
71
75
|
- exe/rage_flip
|
72
76
|
- exe/sarcasm
|
@@ -80,6 +84,7 @@ files:
|
|
80
84
|
- lib/rage_flip/flipper.rb
|
81
85
|
- lib/rage_flip/sarcasm.rb
|
82
86
|
- lib/rage_flip/strikethrough.rb
|
87
|
+
- lib/rage_flip/text_substitution.rb
|
83
88
|
- lib/rage_flip/underline.rb
|
84
89
|
- lib/rage_flip/version.rb
|
85
90
|
- spec/rage_flip_spec.rb
|