spongebobify 0.1.0 → 0.1.2

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
2
  SHA256:
3
- metadata.gz: 5c2def4e295a78acc3fa25e95a918da0535419a23806fe8e225032012f9f4142
4
- data.tar.gz: e6cfc30814d7a0dfe5d3a8e94add6aa5e94592227e7900c5a0188c00114c1edd
3
+ metadata.gz: '0339accdcc932191c228abb667d0e0ee7e0f1a306c0c4556ed2af43ca141bbe2'
4
+ data.tar.gz: 9805a57e78bfbbf9fa0baf02d2ec30adf43a1e54a8ae8c8df7e6d1bc3f6631bc
5
5
  SHA512:
6
- metadata.gz: 0a36faf0c7825ac6203ab543c339adc8cf014bf69c36faaba62dd0bc9096709cbd7c1ce117fcd827f7ba4b096047d9ff787480610fa04381f8b9e01f05a8764a
7
- data.tar.gz: e63f6f5b83ac39542f330b33358b449cdd73e3d52432644f095d0a786939f088dd4bc6e9aa3bbfba52b39112af98de3dec831753eeb1ee6595ac092aab203c78
6
+ metadata.gz: a4e0d965a280ee417a1916ba9f9b4ecbb5fee7152037822770da8e05daf877fb02898b1b5deacc10ab980528a1b2aac3a74519d5d43ba707a39b00ebb1db6a12
7
+ data.tar.gz: 69ed1cf7f0f907b222d7e50c29f297bbafe8a59040e1e4e5d74f4fa56cf30468fd5111e702f5dd26173dc0e7361c9d417ca2bde929e79f2fbb65d4d94d2a9b08
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
@@ -1,19 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spongebobify (0.1.0)
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
@@ -1,40 +1,35 @@
1
- # Spongebobify
1
+ # sPoNgEbObIfY
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/spongebobify`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ cOnVeRt nOrMaL PaRlAnCe iNtO WaY MoRe sArCaStIc sPoNgEbOb cLuCkInG ChIcKeN StYlE.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ## iNsTaLlAtIoN
6
6
 
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
7
+ aDd tHiS LiNe tO YoUr aPpLiCaTiOn's gEmFiLe:
10
8
 
11
9
  ```ruby
12
10
  gem 'spongebobify'
13
11
  ```
14
12
 
15
- And then execute:
13
+ aNd tHeN ExEcUtE:
16
14
 
17
15
  $ bundle install
18
16
 
19
- Or install it yourself as:
17
+ oR InStAlL It yOuRsElF As:
20
18
 
21
19
  $ gem install spongebobify
22
20
 
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
21
+ ## uSaGe
32
22
 
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/spongebobify.
23
+ ```
24
+ $ bin/spongebobify boring text lacking in sarcasm
25
+ => bOrInG TeXt lAcKiNg iN SaRcAsM
26
+ ```
36
27
 
28
+ ```
29
+ $ bin/spongebobify < input.txt
30
+ => bOrInG TeXt lAcKiNg iN SaRcAsM
31
+ ```
37
32
 
38
- ## License
33
+ ## lIcEnSe
39
34
 
40
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
35
+ tHe gEm iS AvAiLaBlE As oPeN SoUrCe uNdEr tHe tErMs oF ThE [MiT LiCeNsE](https://opensource.org/licenses/MIT).
data/bin/spongebobify CHANGED
@@ -5,7 +5,7 @@ require 'spongebobify'
5
5
 
6
6
  if ARGV.length > 0
7
7
  puts Spongebobify.process(ARGV.join(" "))
8
- else
8
+ elsif !STDIN.tty?
9
9
  STDIN.each_line do |line|
10
10
  puts Spongebobify.process(line || [])
11
11
  end
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.0'
4
+ VERSION = '0.1.2'
5
5
  end
data/lib/spongebobify.rb CHANGED
@@ -1,15 +1,28 @@
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
+ new_string = String.new
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
+ new_string << (is_uppercase(byte) ? (byte ^ 32).chr : byte.chr)
22
+ else
23
+ new_string << (is_lowercase(byte) ? (byte ^ 32).chr : byte.chr)
24
+ end
25
+ index += 1
13
26
  end
14
27
 
15
28
  new_string
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.0
4
+ version: 0.1.2
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: []