spongebobify 0.1.1 → 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: 3c8d9ac362561187e6379f332314cbad22e4edd4e15cd1aaaa7292a3fb664ea0
4
- data.tar.gz: f5d97a575abeb5988cc1c3b2d69c09dcbab6c71b63ac84148aa539600ddc0a96
3
+ metadata.gz: '0339accdcc932191c228abb667d0e0ee7e0f1a306c0c4556ed2af43ca141bbe2'
4
+ data.tar.gz: 9805a57e78bfbbf9fa0baf02d2ec30adf43a1e54a8ae8c8df7e6d1bc3f6631bc
5
5
  SHA512:
6
- metadata.gz: 21a22c0b5c8edd8c01596e34b66bfd2368aab6c405d14b19806ab61c0c9cad366df1aab68a4ffd960dead1b49d8a2fb3ebc8b25cc1d079a8e6bfae30d4576937
7
- data.tar.gz: a704dbb2632328ac67cdc0e4e5a3d1325c19f196d2212b51641526d422c429c5ada43aaeb42c3d5987fdabaedcd3aa1ca5a6ac0dfcd07a0dbf2e24334d6b5c73
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
@@ -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/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.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.1
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: []