rage_flip 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f4b780908672f74c2712af5e8181f0d9cb4dbd16762c7f6cfeed78d1919de117
4
+ data.tar.gz: 9195ac9f1f12a2158851f4ff8e14888a55bb967800a04496ade227ab16887e60
5
+ SHA512:
6
+ metadata.gz: 01ab12c8e8b0d5a211d00a0debaf91084b4581812810f9681c874fc8bdeeaed913d3351779b0d17df5c2ce2ebae45fae2f647df525c478b1114e47d1523194e7
7
+ data.tar.gz: fb9930f012419ba490887f7b292c85e2b6cbce3cf6837fd417f4c25f80d3af010fd09a945ffa4c043d062b760f3b0625ddbac8ad94aa7e9e44111b3c69369a68
data/CHANGELOG.md ADDED
@@ -0,0 +1,32 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+ - Version management and release automation
12
+
13
+ ## [1.0.0] - 2025-10-03
14
+
15
+ ### Added
16
+ - Initial release of RageFlip gem
17
+ - `rage_flip` command for upside-down text with rage emoticons
18
+ - `sarcasm` command for alternating case text
19
+ - `strikethrough` command for strikethrough formatting
20
+ - `underline` command for single underline formatting
21
+ - `doubleunderline` command for double underline formatting
22
+ - `chaos` command for chaotic text with combining characters
23
+ - `chaos_level` command for controlling chaos intensity
24
+ - Cross-platform clipboard support (macOS, Linux, Windows)
25
+ - Comprehensive test suite
26
+ - Complete Ruby API for programmatic usage
27
+
28
+ ### Features
29
+ - Unicode character mapping for upside-down text transformation
30
+ - Environment variable support for chaos level configuration
31
+ - Automatic clipboard copying for all commands
32
+ - Platform detection and appropriate clipboard tool usage
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem "rspec"
7
+ gem "rake"
8
+ end
data/README.md ADDED
@@ -0,0 +1,233 @@
1
+ # RageFlip
2
+
3
+ `rage_flip` is a Ruby gem that provides text manipulation utilities with clipboard integration. It flips text upside down with rage table flip emoticons and includes several other text formatting tools.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rage_flip'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ ```bash
16
+ bundle install
17
+ ```
18
+
19
+ Or install it yourself as:
20
+
21
+ ```bash
22
+ gem install rage_flip
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ The gem provides several command-line utilities for text manipulation:
28
+
29
+ ### rage_flip
30
+
31
+ The main command flips text upside down and adds rage table flip emoticons:
32
+
33
+ ```bash
34
+ rage_flip "Hello World"
35
+ # Output: (ノಠ益ಠ)ノ彡┻plɹoM ollǝH┻
36
+ # Result is automatically copied to clipboard
37
+ ```
38
+
39
+ The flip transformation:
40
+ - Reverses the text order
41
+ - Maps characters to their upside-down equivalents
42
+ - Wraps the result with `(ノಠ益ಠ)ノ彡┻` and `┻`
43
+
44
+ ### sarcasm
45
+
46
+ Alternates between uppercase and lowercase characters:
47
+
48
+ ```bash
49
+ sarcasm "this is sarcastic"
50
+ # Output: ThIs Is SaRcAsTiC
51
+ ```
52
+
53
+ ### strikethrough
54
+
55
+ Adds strikethrough formatting to text using Unicode combining characters:
56
+
57
+ ```bash
58
+ strikethrough "crossed out text"
59
+ # Output: c̶r̶o̶s̶s̶e̶d̶ ̶o̶u̶t̶ ̶t̶e̶x̶t̶
60
+ ```
61
+
62
+ ### underline
63
+
64
+ Adds single underline formatting:
65
+
66
+ ```bash
67
+ underline "underlined text"
68
+ # Output: u̲n̲d̲e̲r̲l̲i̲n̲e̲d̲ ̲t̲e̲x̲t̲
69
+ ```
70
+
71
+ ### doubleunderline
72
+
73
+ Adds double underline formatting:
74
+
75
+ ```bash
76
+ doubleunderline "double underlined"
77
+ # Output: d̳o̳u̳b̳l̳e̳ ̳u̳n̳d̳e̳r̳l̳i̳n̳e̳d̳
78
+ ```
79
+
80
+ ### chaos
81
+
82
+ Adds random Unicode combining characters for a chaotic effect:
83
+
84
+ ```bash
85
+ chaos "chaotic text"
86
+ # Output: c̸̰̈h̴̲̆a̷̰̋ò̶̰ẗ̸̲ḭ̷̋c̶̰̈ ̸̰̈t̷̰̋ĕ̴̲ẍ̸̰t̷̰̋
87
+ ```
88
+
89
+ The chaos level can be controlled with the `CHAOS_LEVEL` environment variable or the `chaos_level` command.
90
+
91
+ ### chaos_level
92
+
93
+ Controls the chaos level for the chaos command:
94
+
95
+ ```bash
96
+ chaos_level more # Increase chaos level by 1
97
+ chaos_level less # Decrease chaos level by 1
98
+ chaos_level 15 # Set chaos level to 15
99
+ ```
100
+
101
+ The default chaos level is 10. Higher numbers create more chaotic effects.
102
+
103
+ ## Platform-Specific Clipboard Support
104
+
105
+ The gem automatically detects your platform and uses the appropriate clipboard command:
106
+
107
+ - **macOS**: Uses `pbcopy`
108
+ - **Linux**: Uses `xclip` or `xsel` (install one of these first)
109
+ - **Windows**: Uses `clip`
110
+
111
+ All commands automatically copy their output to the clipboard and display the result.
112
+
113
+ ## Character Mappings
114
+
115
+ The flip functionality uses comprehensive character mappings including:
116
+
117
+ - Regular alphabet (A-Z, a-z)
118
+ - Numbers (0-9)
119
+ - Common punctuation and symbols
120
+ - Special Unicode characters for upside-down equivalents
121
+
122
+ ## Environment Variables
123
+
124
+ - `CHAOS_LEVEL`: Controls the intensity of the chaos effect (default: 10)
125
+
126
+ ## Library Usage
127
+
128
+ You can also use the gem programmatically:
129
+
130
+ ```ruby
131
+ require 'rage_flip'
132
+
133
+ # Flip text with rage emoticons
134
+ RageFlip::Flipper.rage_flip("Hello World")
135
+ # => "(ノಠ益ಠ)ノ彡┻plɹoM ollǝH┻"
136
+
137
+ # Just flip without emoticons
138
+ RageFlip::Flipper.flip("Hello")
139
+ # => "ollǝH"
140
+
141
+ # Sarcastic text
142
+ RageFlip::Sarcasm.process("hello world")
143
+ # => "HeLlO WoRlD"
144
+
145
+ # Strikethrough
146
+ RageFlip::Strikethrough.process("text")
147
+ # => "t̶e̶x̶t̶"
148
+
149
+ # Underline (single or double)
150
+ RageFlip::Underline.single_underline("text")
151
+ # => "t̲e̲x̲t̲"
152
+
153
+ RageFlip::Underline.double_underline("text")
154
+ # => "t̳e̳x̳t̳"
155
+
156
+ # Chaos
157
+ RageFlip::Chaos.process("text", 5)
158
+ # => "t̸e̷x̸t̷"
159
+
160
+ # Copy to clipboard
161
+ RageFlip::Clipboard.copy("text to copy")
162
+ ```
163
+
164
+ ## Development
165
+
166
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
167
+
168
+ ### Version Management
169
+
170
+ The gem includes comprehensive version management tools:
171
+
172
+ #### Rake Tasks
173
+
174
+ ```bash
175
+ # Show current version
176
+ rake version:show
177
+
178
+ # Bump patch version (1.0.0 -> 1.0.1)
179
+ rake version:bump:patch
180
+
181
+ # Bump minor version (1.0.0 -> 1.1.0)
182
+ rake version:bump:minor
183
+
184
+ # Bump major version (1.0.0 -> 2.0.0)
185
+ rake version:bump:major
186
+
187
+ # Set specific version
188
+ rake version:set[1.2.3]
189
+ ```
190
+
191
+ #### Version Script
192
+
193
+ ```bash
194
+ # Show current version
195
+ ./bin/version show
196
+
197
+ # Bump versions
198
+ ./bin/version patch
199
+ ./bin/version minor
200
+ ./bin/version major
201
+
202
+ # Set specific version
203
+ ./bin/version set 1.2.3
204
+ ```
205
+
206
+ #### Release Process
207
+
208
+ ```bash
209
+ # Complete release workflow
210
+ rake release
211
+ # This will: run tests, build gem, create git tag
212
+ ```
213
+
214
+ ### Automated CI/CD
215
+
216
+ The project includes GitHub Actions workflows for:
217
+ - **Continuous Integration**: Runs tests on Ruby 3.0, 3.1, and 3.2
218
+ - **Automated Releases**: Creates GitHub releases when commits start with "Release v"
219
+
220
+ To create a release:
221
+ 1. Bump the version: `./bin/version minor`
222
+ 2. Update CHANGELOG.md with changes
223
+ 3. Commit: `git commit -am "Release v1.1.0"`
224
+ 4. Push: `git push origin main`
225
+ 5. The CI will automatically create a GitHub release with the built gem
226
+
227
+ ## Contributing
228
+
229
+ Bug reports and pull requests are welcome on GitHub at https://github.com/stringsn88keys/rage_flip_gem.
230
+
231
+ ## License
232
+
233
+ The gem is available as open source under the terms of the MIT License.
data/Rakefile ADDED
@@ -0,0 +1,141 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rspec/core/rake_task'
4
+ require_relative 'lib/rage_flip/version'
5
+
6
+ # Define the default task
7
+ task :default => :test
8
+
9
+ # Define a task for running tests with RSpec
10
+ RSpec::Core::RakeTask.new(:test) do |t|
11
+ t.pattern = 'spec/**/*_spec.rb'
12
+ end
13
+
14
+ # Alias for backwards compatibility
15
+ task :spec => :test
16
+
17
+ # Define a task for building the gem
18
+ task :build do
19
+ sh 'gem build rage_flip.gemspec'
20
+ end
21
+
22
+ # Define a task for installing the gem
23
+ task :install do
24
+ sh 'gem install rage_flip-*.gem'
25
+ end
26
+
27
+ # Define a task for cleaning up generated files
28
+ task :clean do
29
+ rm_rf Dir['*.gem']
30
+ end
31
+
32
+ # Define a task for running all tasks
33
+ task :all => [:build, :install, :test]
34
+
35
+ # Version management tasks
36
+ namespace :version do
37
+ desc "Show current version"
38
+ task :show do
39
+ puts "Current version: #{RageFlip::VERSION}"
40
+ end
41
+
42
+ desc "Bump patch version (0.1.0 -> 0.1.1)"
43
+ task "bump:patch" do
44
+ bump_version(:patch)
45
+ end
46
+
47
+ desc "Bump minor version (0.1.0 -> 0.2.0)"
48
+ task "bump:minor" do
49
+ bump_version(:minor)
50
+ end
51
+
52
+ desc "Bump major version (0.1.0 -> 1.0.0)"
53
+ task "bump:major" do
54
+ bump_version(:major)
55
+ end
56
+
57
+ desc "Set specific version"
58
+ task :set, [:version] do |t, args|
59
+ if args[:version].nil?
60
+ puts "Usage: rake version:set[1.2.3]"
61
+ exit 1
62
+ end
63
+
64
+ unless args[:version].match?(/^\d+\.\d+\.\d+$/)
65
+ puts "Error: Version must be in format X.Y.Z (e.g., 1.2.3)"
66
+ exit 1
67
+ end
68
+
69
+ update_version_file(args[:version])
70
+ puts "Version set to #{args[:version]}"
71
+ end
72
+ end
73
+
74
+ # Release task
75
+ desc "Build gem, run tests, and create git tag"
76
+ task :release do
77
+ # Ensure working directory is clean
78
+ unless `git status --porcelain`.strip.empty?
79
+ puts "Error: Working directory is not clean. Commit or stash changes first."
80
+ exit 1
81
+ end
82
+
83
+ # Run tests
84
+ Rake::Task[:test].invoke
85
+ puts "✓ Tests passed"
86
+
87
+ # Build gem
88
+ Rake::Task[:build].invoke
89
+ puts "✓ Gem built"
90
+
91
+ # Create git tag
92
+ version = RageFlip::VERSION
93
+ `git tag -a v#{version} -m "Release v#{version}"`
94
+ puts "✓ Git tag v#{version} created"
95
+
96
+ puts "\nRelease v#{version} ready!"
97
+ puts "To push: git push origin main --tags"
98
+ puts "To publish: gem push rage_flip-#{version}.gem"
99
+ end
100
+
101
+ # Helper method to bump version
102
+ def bump_version(type)
103
+ current_version = read_current_version
104
+ current = current_version.split('.').map(&:to_i)
105
+
106
+ case type
107
+ when :patch
108
+ current[2] += 1
109
+ when :minor
110
+ current[1] += 1
111
+ current[2] = 0
112
+ when :major
113
+ current[0] += 1
114
+ current[1] = 0
115
+ current[2] = 0
116
+ end
117
+
118
+ new_version = current.join('.')
119
+ update_version_file(new_version)
120
+ puts "Version bumped from #{current_version} to #{new_version}"
121
+ end
122
+
123
+ # Helper method to read current version from file
124
+ def read_current_version
125
+ version_file = 'lib/rage_flip/version.rb'
126
+ content = File.read(version_file)
127
+ content.match(/VERSION = "([^"]+)"/)[1]
128
+ end
129
+
130
+ # Helper method to update version file
131
+ def update_version_file(new_version)
132
+ version_file = 'lib/rage_flip/version.rb'
133
+ content = File.read(version_file)
134
+
135
+ updated_content = content.gsub(
136
+ /VERSION = "[^"]+"/,
137
+ "VERSION = \"#{new_version}\""
138
+ )
139
+
140
+ File.write(version_file, updated_content)
141
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rage_flip"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/bin/version ADDED
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Version bump script for rage_flip gem
4
+ # Usage: ./bin/version [major|minor|patch|show|set X.Y.Z]
5
+
6
+ require_relative '../lib/rage_flip/version'
7
+
8
+ def bump_version(type)
9
+ current = RageFlip::VERSION.split('.').map(&:to_i)
10
+
11
+ case type
12
+ when 'patch'
13
+ current[2] += 1
14
+ when 'minor'
15
+ current[1] += 1
16
+ current[2] = 0
17
+ when 'major'
18
+ current[0] += 1
19
+ current[1] = 0
20
+ current[2] = 0
21
+ else
22
+ puts "Error: Invalid bump type '#{type}'. Use: major, minor, or patch"
23
+ exit 1
24
+ end
25
+
26
+ new_version = current.join('.')
27
+ update_version_file(new_version)
28
+
29
+ puts "Version bumped from #{RageFlip::VERSION} to #{new_version}"
30
+ puts ""
31
+ puts "Next steps:"
32
+ puts " git add lib/rage_flip/version.rb"
33
+ puts " git commit -m 'Bump version to v#{new_version}'"
34
+ puts " git tag v#{new_version}"
35
+ puts " git push origin main --tags"
36
+ end
37
+
38
+ def update_version_file(new_version)
39
+ version_file = File.expand_path('../lib/rage_flip/version.rb', __dir__)
40
+ content = File.read(version_file)
41
+
42
+ updated_content = content.gsub(
43
+ /VERSION = "[^"]+"/,
44
+ "VERSION = \"#{new_version}\""
45
+ )
46
+
47
+ File.write(version_file, updated_content)
48
+ end
49
+
50
+ def show_version
51
+ puts "Current version: #{RageFlip::VERSION}"
52
+ end
53
+
54
+ def set_version(version)
55
+ unless version.match?(/^\d+\.\d+\.\d+$/)
56
+ puts "Error: Version must be in format X.Y.Z (e.g., 1.2.3)"
57
+ exit 1
58
+ end
59
+
60
+ old_version = RageFlip::VERSION
61
+ update_version_file(version)
62
+ puts "Version changed from #{old_version} to #{version}"
63
+ end
64
+
65
+ # Main script
66
+ case ARGV[0]
67
+ when 'major', 'minor', 'patch'
68
+ bump_version(ARGV[0])
69
+ when 'show', nil
70
+ show_version
71
+ when 'set'
72
+ if ARGV[1].nil?
73
+ puts "Error: Please specify version number"
74
+ puts "Usage: #{$0} set X.Y.Z"
75
+ exit 1
76
+ end
77
+ set_version(ARGV[1])
78
+ else
79
+ puts "Usage: #{$0} [major|minor|patch|show|set X.Y.Z]"
80
+ puts ""
81
+ puts "Commands:"
82
+ puts " major - Bump major version (1.0.0 -> 2.0.0)"
83
+ puts " minor - Bump minor version (1.0.0 -> 1.1.0)"
84
+ puts " patch - Bump patch version (1.0.0 -> 1.0.1)"
85
+ puts " show - Show current version"
86
+ puts " set - Set specific version (e.g., set 1.2.3)"
87
+ exit 1
88
+ end
data/exe/chaos ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/rage_flip'
4
+
5
+ text = ARGV.join(' ')
6
+
7
+ if text.empty?
8
+ puts "Usage: chaos <text_to_chaos>"
9
+ exit 1
10
+ end
11
+
12
+ chaos_level = ENV['CHAOS_LEVEL']&.to_i || 10
13
+ result = RageFlip::Chaos.process(text, chaos_level)
14
+
15
+ if RageFlip::Clipboard.copy(result)
16
+ puts result
17
+ else
18
+ puts "Failed to copy to clipboard, but here's your chaotic text:"
19
+ puts result
20
+ end
data/exe/chaos_level ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/rage_flip'
4
+
5
+ if ARGV.length != 1
6
+ puts "Usage: chaos_level <more|less|number>"
7
+ puts " more - Increase chaos level by 1"
8
+ puts " less - Decrease chaos level by 1"
9
+ puts " number - Set chaos level to specific number"
10
+ exit 1
11
+ end
12
+
13
+ instruction = ARGV[0]
14
+ result = RageFlip::Chaos.set_chaos_level(instruction)
15
+ puts result
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/rage_flip'
4
+
5
+ text = ARGV.join(' ')
6
+
7
+ if text.empty?
8
+ puts "Usage: doubleunderline <text_to_double_underline>"
9
+ exit 1
10
+ end
11
+
12
+ result = RageFlip::Underline.double_underline(text)
13
+
14
+ if RageFlip::Clipboard.copy(result)
15
+ puts result
16
+ else
17
+ puts "Failed to copy to clipboard, but here's your double underlined text:"
18
+ puts result
19
+ end
data/exe/rage_flip ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/rage_flip'
4
+
5
+ # Get the arguments passed to the script
6
+ text = ARGV.join(' ')
7
+
8
+ if text.empty?
9
+ puts "Usage: rage_flip <text_to_flip>"
10
+ exit 1
11
+ end
12
+
13
+ # Create the rage flip with table flip emoticons
14
+ result = RageFlip::Flipper.rage_flip(text)
15
+
16
+ # Copy to clipboard
17
+ if RageFlip::Clipboard.copy(result)
18
+ puts result
19
+ else
20
+ puts "Failed to copy to clipboard, but here's your flipped text:"
21
+ puts result
22
+ end
data/exe/sarcasm ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/rage_flip'
4
+
5
+ text = ARGV.join(' ')
6
+
7
+ if text.empty?
8
+ puts "Usage: sarcasm <text_to_sarcasm>"
9
+ exit 1
10
+ end
11
+
12
+ result = RageFlip::Sarcasm.process(text)
13
+
14
+ if RageFlip::Clipboard.copy(result)
15
+ puts result
16
+ else
17
+ puts "Failed to copy to clipboard, but here's your sarcastic text:"
18
+ puts result
19
+ end
data/exe/strikethrough ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/rage_flip'
4
+
5
+ text = ARGV.join(' ')
6
+
7
+ if text.empty?
8
+ puts "Usage: strikethrough <text_to_strikethrough>"
9
+ exit 1
10
+ end
11
+
12
+ result = RageFlip::Strikethrough.process(text)
13
+
14
+ if RageFlip::Clipboard.copy(result)
15
+ puts result
16
+ else
17
+ puts "Failed to copy to clipboard, but here's your strikethrough text:"
18
+ puts result
19
+ end
data/exe/underline ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/rage_flip'
4
+
5
+ text = ARGV.join(' ')
6
+
7
+ if text.empty?
8
+ puts "Usage: underline <text_to_underline>"
9
+ exit 1
10
+ end
11
+
12
+ result = RageFlip::Underline.single_underline(text)
13
+
14
+ if RageFlip::Clipboard.copy(result)
15
+ puts result
16
+ else
17
+ puts "Failed to copy to clipboard, but here's your underlined text:"
18
+ puts result
19
+ end
@@ -0,0 +1,31 @@
1
+ module RageFlip
2
+ class Chaos
3
+ DEFAULT_CHAOS_LEVEL = 10
4
+
5
+ def self.process(text, chaos_level = nil)
6
+ chaos_level ||= ENV['CHAOS_LEVEL']&.to_i || DEFAULT_CHAOS_LEVEL
7
+
8
+ text.each_char.map do |c|
9
+ combining_chars = rand(1..chaos_level).times.map do
10
+ "%c" % rand(0x300..0x36f)
11
+ end
12
+ [c, combining_chars]
13
+ end.flatten.join
14
+ end
15
+
16
+ def self.set_chaos_level(instruction)
17
+ current_level = ENV['CHAOS_LEVEL']&.to_i || DEFAULT_CHAOS_LEVEL
18
+
19
+ case instruction
20
+ when 'more'
21
+ ENV['CHAOS_LEVEL'] = (current_level + 1).to_s
22
+ when 'less'
23
+ ENV['CHAOS_LEVEL'] = (current_level - 1).to_s
24
+ else
25
+ ENV['CHAOS_LEVEL'] = instruction.to_s
26
+ end
27
+
28
+ "chaos level is now #{ENV['CHAOS_LEVEL']}"
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,25 @@
1
+ module RageFlip
2
+ class Clipboard
3
+ def self.copy(text)
4
+ case RUBY_PLATFORM
5
+ when /darwin/
6
+ system("echo #{text.shellescape} | pbcopy")
7
+ when /linux/
8
+ if system("which xclip > /dev/null 2>&1")
9
+ system("echo #{text.shellescape} | xclip -selection clipboard")
10
+ elsif system("which xsel > /dev/null 2>&1")
11
+ system("echo #{text.shellescape} | xsel --clipboard --input")
12
+ else
13
+ puts "Error: No clipboard utility found. Please install xclip or xsel."
14
+ return false
15
+ end
16
+ when /mswin|mingw|cygwin/
17
+ system("echo #{text.shellescape} | clip")
18
+ else
19
+ puts "Error: Unsupported platform for clipboard operations."
20
+ return false
21
+ end
22
+ true
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,33 @@
1
+ module RageFlip
2
+ class Flipper
3
+ FORWARD = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-=!@#$%^&*()_+ "
4
+ BACKSIDEDOWN = " +‾()*⅋^%$#@¡=-068𝘓95ߤ↋↊⇂zʎxʍʌnʇsɹbdouɯʅʞɾᴉɥƃⅎǝpɔqɐZ⅄XϺɅՈꓕSꓤꝹԀONꟽ⅂ꓘᒋIH⅁ᖵƎᗡϽꓭ∀"
5
+
6
+ def self.flip(word)
7
+ # Create the upside down map by reversing the backsidedown string
8
+ upsidedown = BACKSIDEDOWN.reverse
9
+
10
+ # Create mapping from forward to upsidedown characters
11
+ upsidedownmap = {}
12
+ FORWARD.each_char.with_index do |char, index|
13
+ upsidedownmap[char] = upsidedown[index] if upsidedown[index]
14
+ end
15
+
16
+ # Flip the word: reverse the string and map each character
17
+ flipped = ""
18
+ word.each_char do |char|
19
+ mapped_char = upsidedownmap[char] || char
20
+ flipped = mapped_char + flipped
21
+ end
22
+
23
+ flipped
24
+ end
25
+
26
+ def self.rage_flip(text)
27
+ rageflip_front = "(ノಠ益ಠ)ノ彡┻"
28
+ rageflip_back = "┻"
29
+
30
+ "#{rageflip_front}#{flip(text)}#{rageflip_back}"
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,8 @@
1
+ module RageFlip
2
+ class Sarcasm
3
+ def self.process(text)
4
+ cycle_enum = [:upcase, :downcase].cycle
5
+ text.each_char.map { |c| c.send(cycle_enum.next) }.join
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ module RageFlip
2
+ class Strikethrough
3
+ STRIKETHROUGH_CHAR = "\u0336"
4
+
5
+ def self.process(text)
6
+ text.each_char.map { |c| [c, STRIKETHROUGH_CHAR] }.flatten.join
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,19 @@
1
+ module RageFlip
2
+ class Underline
3
+ UNDERLINE_CHAR = "\u0332"
4
+ DOUBLE_UNDERLINE_CHAR = "\u0333"
5
+
6
+ def self.process(text, double: false)
7
+ underline_char = double ? DOUBLE_UNDERLINE_CHAR : UNDERLINE_CHAR
8
+ text.each_char.map { |c| [c, underline_char] }.flatten.join
9
+ end
10
+
11
+ def self.single_underline(text)
12
+ process(text, double: false)
13
+ end
14
+
15
+ def self.double_underline(text)
16
+ process(text, double: true)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ module RageFlip
2
+ VERSION = "1.0.0"
3
+ end
data/lib/rage_flip.rb ADDED
@@ -0,0 +1,12 @@
1
+ require_relative "rage_flip/version"
2
+ require_relative "rage_flip/flipper"
3
+ require_relative "rage_flip/sarcasm"
4
+ require_relative "rage_flip/strikethrough"
5
+ require_relative "rage_flip/underline"
6
+ require_relative "rage_flip/chaos"
7
+ require_relative "rage_flip/clipboard"
8
+ require 'shellwords'
9
+
10
+ module RageFlip
11
+ class Error < StandardError; end
12
+ end
@@ -0,0 +1,71 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe RageFlip do
4
+ describe RageFlip::Flipper do
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
+ end
10
+ end
11
+
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
+ end
18
+ end
19
+ end
20
+
21
+ describe RageFlip::Sarcasm do
22
+ describe '.process' do
23
+ it 'alternates case of characters' do
24
+ result = RageFlip::Sarcasm.process('hello')
25
+ expect(result).to eq('HeLlO')
26
+ end
27
+ end
28
+ end
29
+
30
+ describe RageFlip::Strikethrough do
31
+ describe '.process' do
32
+ it 'adds strikethrough characters' do
33
+ result = RageFlip::Strikethrough.process('test')
34
+ expect(result).to include("\u0336")
35
+ end
36
+ end
37
+ end
38
+
39
+ describe RageFlip::Underline do
40
+ describe '.single_underline' do
41
+ it 'adds single underline characters' do
42
+ result = RageFlip::Underline.single_underline('test')
43
+ expect(result).to include("\u0332")
44
+ end
45
+ end
46
+
47
+ describe '.double_underline' do
48
+ it 'adds double underline characters' do
49
+ result = RageFlip::Underline.double_underline('test')
50
+ expect(result).to include("\u0333")
51
+ end
52
+ end
53
+ end
54
+
55
+ describe RageFlip::Chaos do
56
+ describe '.process' do
57
+ it 'adds combining characters for chaos effect' do
58
+ result = RageFlip::Chaos.process('test', 5)
59
+ expect(result.length).to be > 4 # Should be longer than original
60
+ end
61
+ end
62
+
63
+ describe '.set_chaos_level' do
64
+ it 'sets chaos level to specific number' do
65
+ result = RageFlip::Chaos.set_chaos_level('15')
66
+ expect(ENV['CHAOS_LEVEL']).to eq('15')
67
+ expect(result).to eq('chaos level is now 15')
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,16 @@
1
+ require 'rspec'
2
+ require_relative '../lib/rage_flip'
3
+
4
+ RSpec.configure do |config|
5
+ config.expect_with :rspec do |c|
6
+ c.syntax = :expect
7
+ end
8
+
9
+ config.mock_with :rspec do |mocks|
10
+ mocks.verify_partial_doubles = true
11
+ end
12
+
13
+ config.disable_monkey_patching!
14
+ config.order = :random
15
+ Kernel.srand config.seed
16
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rage_flip
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Thomas Powell
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2025-10-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '13.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '13.0'
41
+ description: The rage_flip gem provides various text manipulation utilities with clipboard
42
+ integration.
43
+ email:
44
+ - twilliampowell@gmail.com
45
+ executables:
46
+ - chaos
47
+ - chaos_level
48
+ - doubleunderline
49
+ - rage_flip
50
+ - sarcasm
51
+ - strikethrough
52
+ - underline
53
+ extensions: []
54
+ extra_rdoc_files: []
55
+ files:
56
+ - CHANGELOG.md
57
+ - Gemfile
58
+ - README.md
59
+ - Rakefile
60
+ - bin/console
61
+ - bin/setup
62
+ - bin/version
63
+ - exe/chaos
64
+ - exe/chaos_level
65
+ - exe/doubleunderline
66
+ - exe/rage_flip
67
+ - exe/sarcasm
68
+ - exe/strikethrough
69
+ - exe/underline
70
+ - lib/rage_flip.rb
71
+ - lib/rage_flip/chaos.rb
72
+ - lib/rage_flip/clipboard.rb
73
+ - lib/rage_flip/flipper.rb
74
+ - lib/rage_flip/sarcasm.rb
75
+ - lib/rage_flip/strikethrough.rb
76
+ - lib/rage_flip/underline.rb
77
+ - lib/rage_flip/version.rb
78
+ - spec/rage_flip_spec.rb
79
+ - spec/spec_helper.rb
80
+ homepage: https://github.com/stringsn88keys/rage_flip_gem
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubygems_version: 3.4.10
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: A gem that manipulates text in various fun ways.
103
+ test_files: []