bubs 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. data/LICENSE.md +20 -0
  2. data/README.md +20 -0
  3. data/Rakefile +150 -0
  4. data/bin/bubs +5 -0
  5. data/bubs.gemspec +61 -0
  6. data/lib/bubs.rb +71 -0
  7. metadata +54 -0
data/LICENSE.md ADDED
@@ -0,0 +1,20 @@
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.
data/README.md ADDED
@@ -0,0 +1,20 @@
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
+ It also copies it to your clipboard for easy pasting. That's it.
12
+
13
+ ## ⒾⓃⓈⓉⒶⓁⓁ
14
+
15
+ $ gem install bubs
16
+
17
+
18
+ ## ✪
19
+
20
+ [ⒽⓄⓁⓂⒶⓃ](https://twitter.com/holman)
data/Rakefile ADDED
@@ -0,0 +1,150 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'date'
4
+
5
+ #############################################################################
6
+ #
7
+ # Helper functions
8
+ #
9
+ #############################################################################
10
+
11
+ def name
12
+ @name ||= Dir['*.gemspec'].first.split('.').first
13
+ end
14
+
15
+ def version
16
+ line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
17
+ line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
18
+ end
19
+
20
+ def date
21
+ Date.today.to_s
22
+ end
23
+
24
+ def rubyforge_project
25
+ name
26
+ end
27
+
28
+ def gemspec_file
29
+ "#{name}.gemspec"
30
+ end
31
+
32
+ def gem_file
33
+ "#{name}-#{version}.gem"
34
+ end
35
+
36
+ def replace_header(head, header_name)
37
+ head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
38
+ end
39
+
40
+ #############################################################################
41
+ #
42
+ # Standard tasks
43
+ #
44
+ #############################################################################
45
+
46
+ task :default => :test
47
+
48
+ require 'rake/testtask'
49
+ Rake::TestTask.new(:test) do |test|
50
+ test.libs << 'lib' << 'test'
51
+ test.pattern = 'test/**/test_*.rb'
52
+ test.verbose = true
53
+ end
54
+
55
+ desc "Generate RCov test coverage and open in your browser"
56
+ task :coverage do
57
+ require 'rcov'
58
+ sh "rm -fr coverage"
59
+ sh "rcov test/test_*.rb"
60
+ sh "open coverage/index.html"
61
+ end
62
+
63
+ require 'rdoc/task'
64
+ Rake::RDocTask.new do |rdoc|
65
+ rdoc.rdoc_dir = 'rdoc'
66
+ rdoc.title = "#{name} #{version}"
67
+ rdoc.rdoc_files.include('README*')
68
+ rdoc.rdoc_files.include('lib/**/*.rb')
69
+ end
70
+
71
+ desc "Open an irb session preloaded with this library"
72
+ task :console do
73
+ sh "irb -rubygems -r ./lib/#{name}.rb"
74
+ end
75
+
76
+ #############################################################################
77
+ #
78
+ # Custom tasks (add your own tasks here)
79
+ #
80
+ #############################################################################
81
+
82
+
83
+
84
+ #############################################################################
85
+ #
86
+ # Packaging tasks
87
+ #
88
+ #############################################################################
89
+
90
+ desc "Create tag v#{version} and build and push #{gem_file} to Rubygems"
91
+ task :release => :build do
92
+ unless `git branch` =~ /^\* master$/
93
+ puts "You must be on the master branch to release!"
94
+ exit!
95
+ end
96
+ sh "git commit --allow-empty -a -m 'Release #{version}'"
97
+ sh "git tag v#{version}"
98
+ sh "git push origin master"
99
+ sh "git push origin v#{version}"
100
+ sh "gem push pkg/#{name}-#{version}.gem"
101
+ end
102
+
103
+ desc "Build #{gem_file} into the pkg directory"
104
+ task :build => :gemspec do
105
+ sh "mkdir -p pkg"
106
+ sh "gem build #{gemspec_file}"
107
+ sh "mv #{gem_file} pkg"
108
+ end
109
+
110
+ desc "Generate #{gemspec_file}"
111
+ task :gemspec => :validate do
112
+ # read spec file and split out manifest section
113
+ spec = File.read(gemspec_file)
114
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
115
+
116
+ # replace name version and date
117
+ replace_header(head, :name)
118
+ replace_header(head, :version)
119
+ replace_header(head, :date)
120
+ #comment this out if your rubyforge_project has a different name
121
+ replace_header(head, :rubyforge_project)
122
+
123
+ # determine file list from git ls-files
124
+ files = `git ls-files`.
125
+ split("\n").
126
+ sort.
127
+ reject { |file| file =~ /^\./ }.
128
+ reject { |file| file =~ /^(rdoc|pkg)/ }.
129
+ map { |file| " #{file}" }.
130
+ join("\n")
131
+
132
+ # piece file back together and write
133
+ manifest = " s.files = %w[\n#{files}\n ]\n"
134
+ spec = [head, manifest, tail].join(" # = MANIFEST =\n")
135
+ File.open(gemspec_file, 'w') { |io| io.write(spec) }
136
+ puts "Updated #{gemspec_file}"
137
+ end
138
+
139
+ desc "Validate #{gemspec_file}"
140
+ task :validate do
141
+ libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
142
+ unless libfiles.empty?
143
+ puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
144
+ exit!
145
+ end
146
+ unless Dir['VERSION*'].empty?
147
+ puts "A `VERSION` file at root level violates Gem best practices."
148
+ exit!
149
+ end
150
+ end
data/bin/bubs ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
3
+ require 'bubs'
4
+
5
+ Bubs.convert(ARGV.join(' '))
data/bubs.gemspec ADDED
@@ -0,0 +1,61 @@
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.1'
17
+ s.date = '2013-06-19'
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
data/lib/bubs.rb ADDED
@@ -0,0 +1,71 @@
1
+ # encoding: utf-8
2
+ class Bubs
3
+ VERSION = '0.0.1'
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
+ bubs = {
10
+ :A => :Ⓐ,
11
+ :B => :Ⓑ,
12
+ :C => :Ⓒ,
13
+ :D => :Ⓓ,
14
+ :E => :Ⓔ,
15
+ :F => :Ⓕ,
16
+ :G => :Ⓖ,
17
+ :H => :Ⓗ,
18
+ :I => :Ⓘ,
19
+ :J => :Ⓙ,
20
+ :K => :Ⓚ,
21
+ :L => :Ⓛ,
22
+ :M => :Ⓜ,
23
+ :N => :Ⓝ,
24
+ :O => :Ⓞ,
25
+ :P => :Ⓟ,
26
+ :Q => :Ⓠ,
27
+ :R => :Ⓡ,
28
+ :S => :Ⓢ,
29
+ :T => :Ⓣ,
30
+ :U => :Ⓤ,
31
+ :V => :Ⓥ,
32
+ :W => :Ⓦ,
33
+ :X => :Ⓧ,
34
+ :Y => :Ⓨ,
35
+ :Z => :Ⓩ,
36
+ :a => :ⓐ,
37
+ :b => :ⓑ,
38
+ :c => :ⓒ,
39
+ :d => :ⓓ,
40
+ :e => :ⓔ,
41
+ :f => :ⓕ,
42
+ :g => :ⓖ,
43
+ :h => :ⓗ,
44
+ :i => :ⓘ,
45
+ :j => :ⓙ,
46
+ :k => :ⓚ,
47
+ :l => :ⓛ,
48
+ :m => :ⓜ,
49
+ :n => :ⓝ,
50
+ :o => :ⓞ,
51
+ :p => :ⓟ,
52
+ :q => :ⓠ,
53
+ :r => :ⓡ,
54
+ :s => :ⓢ,
55
+ :t => :ⓣ,
56
+ :u => :ⓤ,
57
+ :v => :ⓥ,
58
+ :w => :ⓦ,
59
+ :x => :ⓧ,
60
+ :y => :ⓨ,
61
+ :z => :ⓩ
62
+ }
63
+
64
+ bubbled = text.split(//).map do |letter|
65
+ bubs[letter.to_sym] || letter
66
+ end.join('')
67
+
68
+ `echo "#{bubbled}" | pbcopy` if RUBY_PLATFORM =~ /darwin/
69
+ puts bubbled
70
+ end
71
+ end
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bubs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Zach Holman
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-06-19 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Ⓐ ⓁⓄⓉ ⓄⒻ ⒷⓊⒷⒷⓁⒺⓈ
15
+ email: zach@zachholman.com
16
+ executables:
17
+ - bubs
18
+ extensions: []
19
+ extra_rdoc_files:
20
+ - README.md
21
+ - LICENSE.md
22
+ files:
23
+ - LICENSE.md
24
+ - README.md
25
+ - Rakefile
26
+ - bin/bubs
27
+ - bubs.gemspec
28
+ - lib/bubs.rb
29
+ homepage: https://github.com/holman/bubs
30
+ licenses: []
31
+ post_install_message:
32
+ rdoc_options:
33
+ - --charset=UTF-8
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubyforge_project: bubs
50
+ rubygems_version: 1.8.23
51
+ signing_key:
52
+ specification_version: 2
53
+ summary: ⒷⓊⒷⒷⓁⒺⓈ
54
+ test_files: []