├── .gitignore ├── bin └── bubs ├── README.md ├── lib └── bubs.rb ├── LICENSE.md ├── bubs.gemspec └── Rakefile /.gitignore: -------------------------------------------------------------------------------- 1 | pkg 2 | -------------------------------------------------------------------------------- /bin/bubs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift File.expand_path('../../lib', __FILE__) 3 | require 'bubs' 4 | 5 | if $stdin.stat.size > 0 6 | args = $stdin.read 7 | else 8 | if ARGV.delete("--loud") || ARGV.delete("-l") 9 | args = ARGV.join(' ').upcase 10 | else 11 | args = ARGV.join(' ') 12 | end 13 | end 14 | 15 | abort(Bubs.convert(Bubs::VERSION)) if args == "--version" || args == "-v" 16 | 17 | text = Bubs.convert(args) 18 | Bubs.copy(text) 19 | puts text 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![ⒷⓊⒷⓈ](http://cl.ly/image/0J2U1x1d1o0a/content) 2 | 3 | ⒷⓊⒷⓈ helps you write really obnoxious text from your command line. Try it in 4 | your commit messages- your coworkers will love you. 5 | 6 | ## ⓊⓈⒶⒼⒺ 7 | 8 | $ bubs BUBS IS THE BEST 9 | ⒷⓊⒷⓈ ⒾⓈ ⓉⒽⒺ ⒷⒺⓈⓉ 10 | 11 | $ bubs --loud bubs gets shouty 12 | ⒷⓊⒷⓈ ⒼⒺⓉⓈ ⓈⒽⓄⓊⓉⓎ 13 | 14 | It also copies it to your clipboard for easy pasting. That's it. 15 | 16 | ## ⒾⓃⓈⓉⒶⓁⓁ 17 | 18 | $ gem install bubs 19 | 20 | 21 | ## ✪ 22 | 23 | [ⒽⓄⓁⓂⒶⓃ](https://twitter.com/holman) 24 | -------------------------------------------------------------------------------- /lib/bubs.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | class Bubs 3 | VERSION = '0.0.6' 4 | 5 | # Convert words to ⓌⓄⓇⒹⓈ. 6 | # 7 | # Returns a String, but a much cooler string than what you had initially. 8 | def self.convert(text) 9 | text.tr('A-Za-z1-90', 'Ⓐ-Ⓩⓐ-ⓩ①-⑨⓪') 10 | end 11 | 12 | # Copies the text to clipboard 13 | # 14 | # ... not in windows xp, tho 15 | def self.copy(text) 16 | copycmd = case RUBY_PLATFORM 17 | when /darwin/ 18 | 'pbcopy' 19 | when /linux/ 20 | 'xclip' 21 | end 22 | 23 | system("powershell -Command '\"#{text}\"' | clip") if RUBY_PLATFORM =~ /mswin/ 24 | 25 | copycmd && system("printf \"#{text}\" | #{copycmd}") 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) Zach Holman, http://zachholman.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /bubs.gemspec: -------------------------------------------------------------------------------- 1 | ## This is the rakegem gemspec template. Make sure you read and understand 2 | ## all of the comments. Some sections require modification, and others can 3 | ## be deleted if you don't need them. Once you understand the contents of 4 | ## this file, feel free to delete any comments that begin with two hash marks. 5 | ## You can find comprehensive Gem::Specification documentation, at 6 | ## http://docs.rubygems.org/read/chapter/20 7 | Gem::Specification.new do |s| 8 | s.specification_version = 2 if s.respond_to? :specification_version= 9 | s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= 10 | s.rubygems_version = '1.3.5' 11 | 12 | ## Leave these as is they will be modified for you by the rake gemspec task. 13 | ## If your rubyforge_project name is different, then edit it and comment out 14 | ## the sub! line in the Rakefile 15 | s.name = 'bubs' 16 | s.version = '0.0.6' 17 | s.date = '2015-06-05' 18 | s.rubyforge_project = 'bubs' 19 | 20 | ## Make sure your summary is short. The description may be as long 21 | ## as you like. 22 | s.summary = "ⒷⓊⒷⒷⓁⒺⓈ" 23 | s.description = "Ⓐ ⓁⓄⓉ ⓄⒻ ⒷⓊⒷⒷⓁⒺⓈ" 24 | 25 | ## List the primary authors. If there are a bunch of authors, it's probably 26 | ## better to set the email to an email list or something. If you don't have 27 | ## a custom homepage, consider using your GitHub URL or the like. 28 | s.authors = ["Zach Holman"] 29 | s.email = 'zach@zachholman.com' 30 | s.homepage = 'https://github.com/holman/bubs' 31 | 32 | ## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as 33 | ## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb' 34 | s.require_paths = %w[lib] 35 | 36 | ## If your gem includes any executables, list them here. 37 | s.executables = ["bubs"] 38 | 39 | ## Specify any RDoc options here. You'll want to add your README and 40 | ## LICENSE files to the extra_rdoc_files list. 41 | s.rdoc_options = ["--charset=UTF-8"] 42 | s.extra_rdoc_files = %w[README.md LICENSE.md] 43 | 44 | ## Leave this section as-is. It will be automatically generated from the 45 | ## contents of your Git repository via the gemspec task. DO NOT REMOVE 46 | ## THE MANIFEST COMMENTS, they are used as delimiters by the task. 47 | # = MANIFEST = 48 | s.files = %w[ 49 | LICENSE.md 50 | README.md 51 | Rakefile 52 | bin/bubs 53 | bubs.gemspec 54 | lib/bubs.rb 55 | ] 56 | # = MANIFEST = 57 | 58 | ## Test files will be grabbed from the file list. Make sure the path glob 59 | ## matches what you actually use. 60 | s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ } 61 | end 62 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | require 'rubygems' 3 | require 'rake' 4 | require 'date' 5 | 6 | ############################################################################# 7 | # 8 | # Helper functions 9 | # 10 | ############################################################################# 11 | 12 | def name 13 | @name ||= Dir['*.gemspec'].first.split('.').first 14 | end 15 | 16 | def version 17 | line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/] 18 | line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1] 19 | end 20 | 21 | def date 22 | Date.today.to_s 23 | end 24 | 25 | def rubyforge_project 26 | name 27 | end 28 | 29 | def gemspec_file 30 | "#{name}.gemspec" 31 | end 32 | 33 | def gem_file 34 | "#{name}-#{version}.gem" 35 | end 36 | 37 | def replace_header(head, header_name) 38 | head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"} 39 | end 40 | 41 | ############################################################################# 42 | # 43 | # Standard tasks 44 | # 45 | ############################################################################# 46 | 47 | task :default => :test 48 | 49 | require 'rake/testtask' 50 | Rake::TestTask.new(:test) do |test| 51 | test.libs << 'lib' << 'test' 52 | test.pattern = 'test/**/test_*.rb' 53 | test.verbose = true 54 | end 55 | 56 | desc "Generate RCov test coverage and open in your browser" 57 | task :coverage do 58 | require 'rcov' 59 | sh "rm -fr coverage" 60 | sh "rcov test/test_*.rb" 61 | sh "open coverage/index.html" 62 | end 63 | 64 | require 'rdoc/task' 65 | Rake::RDocTask.new do |rdoc| 66 | rdoc.rdoc_dir = 'rdoc' 67 | rdoc.title = "#{name} #{version}" 68 | rdoc.rdoc_files.include('README*') 69 | rdoc.rdoc_files.include('lib/**/*.rb') 70 | end 71 | 72 | desc "Open an irb session preloaded with this library" 73 | task :console do 74 | sh "irb -rubygems -r ./lib/#{name}.rb" 75 | end 76 | 77 | ############################################################################# 78 | # 79 | # Custom tasks (add your own tasks here) 80 | # 81 | ############################################################################# 82 | 83 | 84 | 85 | ############################################################################# 86 | # 87 | # Packaging tasks 88 | # 89 | ############################################################################# 90 | 91 | desc "Create tag v#{version} and build and push #{gem_file} to Rubygems" 92 | task :release => :build do 93 | unless `git branch` =~ /^\* master$/ 94 | puts "You must be on the master branch to release!" 95 | exit! 96 | end 97 | sh "git commit --allow-empty -a -m 'ⓇⒺⓁⒺⒶⓈⒺ #{version}'" 98 | sh "git tag v#{version}" 99 | sh "git push origin master" 100 | sh "git push origin v#{version}" 101 | sh "gem push pkg/#{name}-#{version}.gem" 102 | end 103 | 104 | desc "Build #{gem_file} into the pkg directory" 105 | task :build => :gemspec do 106 | sh "mkdir -p pkg" 107 | sh "gem build #{gemspec_file}" 108 | sh "mv #{gem_file} pkg" 109 | end 110 | 111 | desc "Generate #{gemspec_file}" 112 | task :gemspec => :validate do 113 | # read spec file and split out manifest section 114 | spec = File.read(gemspec_file) 115 | head, manifest, tail = spec.split(" # = MANIFEST =\n") 116 | 117 | # replace name version and date 118 | replace_header(head, :name) 119 | replace_header(head, :version) 120 | replace_header(head, :date) 121 | #comment this out if your rubyforge_project has a different name 122 | replace_header(head, :rubyforge_project) 123 | 124 | # determine file list from git ls-files 125 | files = `git ls-files`. 126 | split("\n"). 127 | sort. 128 | reject { |file| file =~ /^\./ }. 129 | reject { |file| file =~ /^(rdoc|pkg)/ }. 130 | map { |file| " #{file}" }. 131 | join("\n") 132 | 133 | # piece file back together and write 134 | manifest = " s.files = %w[\n#{files}\n ]\n" 135 | spec = [head, manifest, tail].join(" # = MANIFEST =\n") 136 | File.open(gemspec_file, 'w') { |io| io.write(spec) } 137 | puts "Updated #{gemspec_file}" 138 | end 139 | 140 | desc "Validate #{gemspec_file}" 141 | task :validate do 142 | libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"] 143 | unless libfiles.empty? 144 | puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir." 145 | exit! 146 | end 147 | unless Dir['VERSION*'].empty? 148 | puts "A `VERSION` file at root level violates Gem best practices." 149 | exit! 150 | end 151 | end 152 | --------------------------------------------------------------------------------