bubs 0.0.1 → 0.0.2

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.
Files changed (5) hide show
  1. data/Rakefile +2 -1
  2. data/bin/bubs +4 -2
  3. data/bubs.gemspec +2 -2
  4. data/lib/bubs.rb +79 -60
  5. metadata +2 -2
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'rubygems'
2
3
  require 'rake'
3
4
  require 'date'
@@ -93,7 +94,7 @@ task :release => :build do
93
94
  puts "You must be on the master branch to release!"
94
95
  exit!
95
96
  end
96
- sh "git commit --allow-empty -a -m 'Release #{version}'"
97
+ sh "git commit --allow-empty -a -m 'ⓇⒺⓁⒺⒶⓈⒺ #{version}'"
97
98
  sh "git tag v#{version}"
98
99
  sh "git push origin master"
99
100
  sh "git push origin v#{version}"
data/bin/bubs CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
2
+ $:.unshift File.expand_path('../../lib', __FILE__)
3
3
  require 'bubs'
4
4
 
5
- Bubs.convert(ARGV.join(' '))
5
+ text = Bubs.convert(ARGV.join(' '))
6
+ Bubs.copy(text)
7
+ puts text
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'bubs'
16
- s.version = '0.0.1'
17
- s.date = '2013-06-19'
16
+ s.version = '0.0.2'
17
+ s.date = '2013-06-20'
18
18
  s.rubyforge_project = 'bubs'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -1,71 +1,90 @@
1
1
  # encoding: utf-8
2
2
  class Bubs
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
+
5
+ CONVERT_MAP = {
6
+ 'A' => 'Ⓐ',
7
+ 'B' => 'Ⓑ',
8
+ 'C' => 'Ⓒ',
9
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+ '0' => '⓪'
68
+ }
4
69
 
5
70
  # Convert words to ⓌⓄⓇⒹⓈ.
6
71
  #
7
72
  # Returns a String, but a much cooler string than what you had initially.
8
73
  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
- }
74
+ text.gsub(/[a-z0-9]/i, CONVERT_MAP)
75
+ end
63
76
 
64
- bubbled = text.split(//).map do |letter|
65
- bubs[letter.to_sym] || letter
66
- end.join('')
77
+ # Copies the text to clipboard
78
+ #
79
+ # ... not in windows, tho
80
+ def self.copy(text)
81
+ copycmd = case RUBY_PLATFORM
82
+ when /darwin/
83
+ 'pbcopy'
84
+ when /linux/
85
+ 'xclip'
86
+ end
67
87
 
68
- `echo "#{bubbled}" | pbcopy` if RUBY_PLATFORM =~ /darwin/
69
- puts bubbled
88
+ copycmd && `printf "#{text}" | #{copycmd}`
70
89
  end
71
90
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bubs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-19 00:00:00.000000000 Z
12
+ date: 2013-06-20 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Ⓐ ⓁⓄⓉ ⓄⒻ ⒷⓊⒷⒷⓁⒺⓈ
15
15
  email: zach@zachholman.com