spongebobify 0.1.1 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c8d9ac362561187e6379f332314cbad22e4edd4e15cd1aaaa7292a3fb664ea0
4
- data.tar.gz: f5d97a575abeb5988cc1c3b2d69c09dcbab6c71b63ac84148aa539600ddc0a96
3
+ metadata.gz: 5b1931bc50366b8e1d60e15578ace8336cc8c0ae93c717581cf50e6b935242ed
4
+ data.tar.gz: 6b0417c2598e78e25bea579115bd523962117cbff774739810102d50df48479c
5
5
  SHA512:
6
- metadata.gz: 21a22c0b5c8edd8c01596e34b66bfd2368aab6c405d14b19806ab61c0c9cad366df1aab68a4ffd960dead1b49d8a2fb3ebc8b25cc1d079a8e6bfae30d4576937
7
- data.tar.gz: a704dbb2632328ac67cdc0e4e5a3d1325c19f196d2212b51641526d422c429c5ada43aaeb42c3d5987fdabaedcd3aa1ca5a6ac0dfcd07a0dbf2e24334d6b5c73
6
+ metadata.gz: 4d8caf6abd577efdef86a2048b79e109874b106e2ffa08cd5f643057705e83df433909f17d955010ebd5a11dfc32e92ae8225ebad712aaad1954cf72df425f9b
7
+ data.tar.gz: e8889b9a06540c5dc40f9e6bec070f6d919889e9b02f136204a5e8da99f2a98a75ab5486b00e0d646c619af5b732e59c97720b486c1a878e7e48023994e4b8ed
data/Gemfile CHANGED
@@ -6,3 +6,4 @@ source 'https://rubygems.org'
6
6
  gemspec
7
7
 
8
8
  gem 'rake', '~> 12.0'
9
+ gem 'thor'
data/Gemfile.lock CHANGED
@@ -2,18 +2,22 @@ PATH
2
2
  remote: .
3
3
  specs:
4
4
  spongebobify (0.1.1)
5
+ thor (~> 1.0)
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
8
9
  specs:
9
10
  rake (12.3.3)
11
+ thor (1.3.1)
10
12
 
11
13
  PLATFORMS
14
+ arm64-darwin-22
12
15
  ruby
13
16
 
14
17
  DEPENDENCIES
15
18
  rake (~> 12.0)
16
19
  spongebobify!
20
+ thor
17
21
 
18
22
  BUNDLED WITH
19
- 1.17.2
23
+ 2.5.11
data/README.md CHANGED
@@ -4,30 +4,34 @@ cOnVeRt nOrMaL PaRlAnCe iNtO WaY MoRe sArCaStIc sPoNgEbOb cLuCkInG ChIcKeN StYlE
4
4
 
5
5
  ## iNsTaLlAtIoN
6
6
 
7
- aDd tHiS LiNe tO YoUr aPpLiCaTiOn's gEmFiLe:
7
+
8
+ iNsTaLl tHe gEm:
8
9
 
9
10
  ```ruby
10
- gem 'spongebobify'
11
+ gem install spongebobify
11
12
  ```
12
13
 
13
- aNd tHeN ExEcUtE:
14
-
15
- $ bundle install
14
+ aNd tHeN AdD SoMeThInG LiKe tHiS To yOuR .zShRc oR EqUiVaLeNt:
16
15
 
17
- oR InStAlL It yOuRsElF As:
18
-
19
- $ gem install spongebobify
16
+ ```
17
+ export PATH=$(ruby -e 'puts Gem.user_dir')/bin:$PATH
18
+ ```
20
19
 
21
20
  ## uSaGe
22
21
 
23
22
  ```
24
- $ bin/spongebobify boring text lacking in sarcasm
23
+ $ spongebobify "boring text lacking in sarcasm"
25
24
  => bOrInG TeXt lAcKiNg iN SaRcAsM
26
25
  ```
27
26
 
28
27
  ```
29
- $ bin/spongebobify < input.txt
30
- => bOrInG TeXt lAcKiNg iN SaRcAsM
28
+ $ spongebobify ./war-and-peace.txt
29
+ => cHaPtEr i
30
+
31
+ "wElL, pRiNcE, sO GeNoA AnD LuCcA ArE NoW JuSt fAmIlY EsTaTeS Of tHe
32
+ bUoNaPaRtEs. BuT I WaRn yOu, If yOu dOn't tElL Me tHaT ThIs mEaNs wAr,
33
+ If yOu sTiLl tRy tO DeFeNd tHe iNfAmIeS AnD HoRrOrS PeRpEtRaTeD By tHaT
34
+ AnTiChRiSt--I ReAlLy bElIeVe hE Is aNtIcHrIsT...
31
35
  ```
32
36
 
33
37
  ## lIcEnSe
data/exe/spongebobify ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
5
+
6
+ require 'spongebobify/cli'
7
+
8
+ Spongebobify::CLI.start(ARGV.dup.unshift("spongebobify"))
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'thor'
4
+ require 'spongebobify'
5
+
6
+ module Spongebobify
7
+ class CLI < Thor
8
+ desc "spongebobify [TEXT|FILE]", "Converts TEXT or contents of FILE to spongebob case"
9
+ def spongebobify(input = nil)
10
+ if input.nil? && $stdin.tty?
11
+ puts "No input provided. Use 'spongebobify \"some text\"' or 'spongebobify ./path_to_file.txt'"
12
+ exit 1
13
+ end
14
+
15
+ if File.exist?(input)
16
+ text = File.read(input)
17
+ else
18
+ text = input
19
+ end
20
+
21
+ puts Spongebobify.process(text)
22
+ end
23
+
24
+ default_task :spongebobify
25
+ end
26
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spongebobify
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.3'
5
5
  end
data/lib/spongebobify.rb CHANGED
@@ -1,18 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spongebobify/version'
4
+ require 'spongebobify/cli'
4
5
 
5
- module Spongebobify
6
- def self.process(string)
7
- new_string = string.downcase
6
+ def is_lowercase(byte)
7
+ byte >= 97 && byte <= 122
8
+ end
8
9
 
9
- (1...new_string.length).step(2).each do |index|
10
- next unless new_string[index].ord.between?(97, 122)
10
+ def is_uppercase(byte)
11
+ byte >= 65 && byte <= 90
12
+ end
13
+
14
+ module Spongebobify
15
+ def self.process(input_string)
16
+ index = 0
17
+ byte_array = []
11
18
 
12
- new_string[index] = (new_string[index].ord ^ 32).chr
19
+ input_string.each_byte do |byte|
20
+ if index % 2 == 0
21
+ byte_array << (is_uppercase(byte) ? (byte ^ 32) : byte)
22
+ else
23
+ byte_array << (is_lowercase(byte) ? (byte ^ 32) : byte)
24
+ end
25
+ index += 1
13
26
  end
14
27
 
15
- new_string
28
+ byte_array.pack('C*')
16
29
  end
17
30
  end
18
31
 
data/spongebobify.gemspec CHANGED
@@ -23,7 +23,10 @@ Gem::Specification.new do |spec|
23
23
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
24
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
25
  end
26
+
26
27
  spec.bindir = 'exe'
27
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
29
  spec.require_paths = ['lib']
30
+
31
+ spec.add_runtime_dependency 'thor', '~> 1.0'
29
32
  end
metadata CHANGED
@@ -1,20 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spongebobify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - OneNeptune
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-11 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2024-05-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
13
27
  description: Convert normal parlance into way more sarcastic SpongeBob clucking chicken
14
28
  style.
15
29
  email:
16
30
  - michael@michaelbennett.nyc
17
- executables: []
31
+ executables:
32
+ - spongebobify
18
33
  extensions: []
19
34
  extra_rdoc_files: []
20
35
  files:
@@ -27,7 +42,9 @@ files:
27
42
  - bin/console
28
43
  - bin/setup
29
44
  - bin/spongebobify
45
+ - exe/spongebobify
30
46
  - lib/spongebobify.rb
47
+ - lib/spongebobify/cli.rb
31
48
  - lib/spongebobify/version.rb
32
49
  - spongebobify.gemspec
33
50
  homepage: https://www.github.com/OneNeptune/spongebobify
@@ -36,7 +53,7 @@ licenses:
36
53
  metadata:
37
54
  homepage_uri: https://www.github.com/OneNeptune/spongebobify
38
55
  source_code_uri: https://www.github.com/OneNeptune/spongebobify
39
- post_install_message:
56
+ post_install_message:
40
57
  rdoc_options: []
41
58
  require_paths:
42
59
  - lib
@@ -51,8 +68,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
68
  - !ruby/object:Gem::Version
52
69
  version: '0'
53
70
  requirements: []
54
- rubygems_version: 3.0.3
55
- signing_key:
71
+ rubygems_version: 3.4.10
72
+ signing_key:
56
73
  specification_version: 4
57
74
  summary: Transform input text to sPoNgEbOb cAsE
58
75
  test_files: []