fontlike 0.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7e8e113bcb40ed1f4065678df40ade434e0afd78
4
+ data.tar.gz: e02db3e7031ca358c21d62740ea8a0a1c4887115
5
+ SHA512:
6
+ metadata.gz: 8db82af1bc229f290c81731870d24175fe501b86f1fc229b6fa28619c9f745de979bccca1c5932cf464d904782bfeafab7c417024841169a7c56665b13f75e49
7
+ data.tar.gz: bb5bcb9014cabe244c0823d9d51c834945bb19be429e1699c8a5405e3edb6a36a86ae4f6ad8058873fbb9910843aa86b9cf1d2481ddf74332993aba9132ad460
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :test do
4
+ gem 'rspec'
5
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,26 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.2.5)
5
+ rspec (3.3.0)
6
+ rspec-core (~> 3.3.0)
7
+ rspec-expectations (~> 3.3.0)
8
+ rspec-mocks (~> 3.3.0)
9
+ rspec-core (3.3.2)
10
+ rspec-support (~> 3.3.0)
11
+ rspec-expectations (3.3.1)
12
+ diff-lcs (>= 1.2.0, < 2.0)
13
+ rspec-support (~> 3.3.0)
14
+ rspec-mocks (3.3.2)
15
+ diff-lcs (>= 1.2.0, < 2.0)
16
+ rspec-support (~> 3.3.0)
17
+ rspec-support (3.3.0)
18
+
19
+ PLATFORMS
20
+ ruby
21
+
22
+ DEPENDENCIES
23
+ rspec
24
+
25
+ BUNDLED WITH
26
+ 1.10.5
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ ### fontlike
2
+
3
+ bloat your ascii - fun with extended character sets. text your friends things that look like fonts.
4
+
5
+ #### requirements
6
+
7
+ - os x (uses OS X `pbcopy`)
8
+ - ruby
9
+
10
+ #### installation
11
+
12
+ $ gem install fontlike
13
+
14
+ #### usage
15
+
16
+ $ fontlike -ds What do you think, mr fancy pants?
17
+ --> Copied "π•Žπ•™π•’π•₯ 𝕕𝕠 π•ͺ𝕠𝕦 π•₯π•™π•šπ•Ÿπ•œ, π•žπ•£ π•—π•’π•Ÿπ•”π•ͺ π•‘π•’π•Ÿπ•₯𝕀?" to clipboard
18
+
19
+ $ fontlike -f What do you think, mr fancy pants?
20
+ --> Copied "𝓦𝓱π“ͺ𝓽 𝓭𝓸 𝔂𝓸𝓾 𝓽𝓱𝓲𝓷𝓴, 𝓢𝓻 𝓯π“ͺ𝓷𝓬𝔂 𝓹π“ͺ𝓷𝓽𝓼?" to clipboard
21
+
22
+ $ fontlike -s What do you think, mr fancy pants?
23
+ --> Copied "π–½π—ˆ π—’π—ˆπ—Ž 𝗍𝗁𝗂𝗇𝗄, 𝗆𝗋 𝖿𝖺𝗇𝖼𝗒 π—‰π–Ίπ—‡π—π—Œ?" to clipboard
24
+
25
+ $ fontlike -a What do you think, mr fancy pants?
26
+ --> Copied "WHAT DO YOU THINK, MR FANCY PANTS?" to clipboard
27
+
28
+ $ fontlike -m What do you think, mr fancy pants?
29
+ --> Copied "πš†πš‘πšŠπš 𝚍𝚘 𝚒𝚘𝚞 πšπš‘πš’πš—πš”, πš–πš› πšπšŠπš—πšŒπš’ πš™πšŠπš—πšπšœ?" to clipboard
30
+
31
+ #### license
32
+
33
+ MIT
data/bin/fontlike ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require './lib/fontlike'
5
+
6
+ options = {}
7
+ OptionParser.new do |opts|
8
+ opts.banner = "Usage: circle [options]"
9
+
10
+ opts.on("-f", "--fancy", "Get fancy") do |f|
11
+ options[:fancy] = f
12
+ end
13
+
14
+ opts.on("-a", "--angry", "Get angry") do |s|
15
+ options[:shout] = s
16
+ end
17
+
18
+ opts.on("-m", "--mono", "Get oldschool") do |m|
19
+ options[:mono] = m
20
+ end
21
+
22
+ opts.on("-c", "--circle", "Get circled?") do |c|
23
+ options[:circle] = c
24
+ end
25
+
26
+ opts.on("-s", "--sans-serif", "Get attractive") do |ss|
27
+ options[:sans_serif] = ss
28
+ end
29
+
30
+ opts.on("-ds", "--double-struck", "Get struck") do |ds|
31
+ options[:double_struck] = ds
32
+ end
33
+ end.parse!
34
+
35
+ transmuter = Fontlike::Transmuter.new(options)
36
+
37
+ copy = transmuter.transmute(ARGV.join(" "))
38
+ puts "--> Copied \"#{copy}\" to clipboard"
39
+
40
+ %x(echo #{copy} | pbcopy)
data/fontlike.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fontlike/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "fontlike"
8
+ gem.version = Fontlike::VERSION
9
+ gem.authors = ["Max Lahey"]
10
+ gem.email = ["maxwellslahey@gmail.com"]
11
+ gem.description = %q{Fontlike bloats your ascii}
12
+ gem.summary = %q{Fontlike bloats your ascii}
13
+ gem.homepage = "https://github.com/maxwells/fontlike"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = ['fontlike']
17
+ gem.test_files = gem.files.grep(%r{^(spec)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.licenses = ['MIT']
21
+
22
+ gem.required_ruby_version = '>= 1.9.3'
23
+ end
@@ -0,0 +1,43 @@
1
+ module Fontlike
2
+ class Transmuter
3
+ attr_accessor :upper_base, :lower_base
4
+
5
+ def initialize(options)
6
+ if options[:fancy]
7
+ self.upper_base = [0x1D4D0]
8
+ self.lower_base = [0x1D4EA]
9
+ elsif options[:shout]
10
+ self.upper_base = ['A'.ord]
11
+ self.lower_base = ['A'.ord]
12
+ elsif options[:mono]
13
+ self.upper_base = [120432]
14
+ self.lower_base = [120458]
15
+ elsif options[:sans_serif]
16
+ self.upper_base = [120224]
17
+ self.lower_base = [120250]
18
+ elsif options[:circle]
19
+ self.upper_base = [0xFEFF, 0x24B6]
20
+ self.lower_base = [0xFEFF, 0x24D0]
21
+ else
22
+ self.upper_base = [120120]
23
+ self.lower_base = [120146]
24
+ end
25
+ end
26
+
27
+ def transmute(str)
28
+ str.split("").map do |char|
29
+ if char.match(/[A-Z]/)
30
+ *prefix, suffix = upper_base
31
+ last = suffix + char.ord - 'A'.ord
32
+ [*prefix, last].pack('U*')
33
+ elsif char.match(/[a-z]/)
34
+ *prefix, suffix = lower_base
35
+ last = suffix + char.ord - 'a'.ord
36
+ [*prefix, last].pack('U*')
37
+ else
38
+ char
39
+ end
40
+ end.join("")
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,3 @@
1
+ module Fontlike
2
+ VERSION = '0.0.1'
3
+ end
data/lib/fontlike.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'fontlike/version'
2
+ require 'fontlike/transmuter'
3
+
4
+ module Fontlike
5
+ end
@@ -0,0 +1,55 @@
1
+ require 'fontlike'
2
+
3
+ INPUT = "What do you think, mr fancy pants?"
4
+
5
+ describe Fontlike::Transmuter do
6
+ let(:transmuter) { Fontlike::Transmuter.new(opts) }
7
+ let(:opts) { {} }
8
+ let(:output) { transmuter.transmute(INPUT) }
9
+
10
+ describe 'with fancy flag' do
11
+ let(:opts) { { fancy: true } }
12
+
13
+ it 'outputs some fancy text' do
14
+ expect(output).to eq("𝓦𝓱π“ͺ𝓽 𝓭𝓸 𝔂𝓸𝓾 𝓽𝓱𝓲𝓷𝓴, 𝓢𝓻 𝓯π“ͺ𝓷𝓬𝔂 𝓹π“ͺ𝓷𝓽𝓼?")
15
+ end
16
+ end
17
+
18
+ describe 'with shout flag' do
19
+ let(:opts) { { shout: true } }
20
+
21
+ it 'outputs some shout text' do
22
+ expect(output).to eq("WHAT DO YOU THINK, MR FANCY PANTS?")
23
+ end
24
+ end
25
+
26
+ describe 'with mono flag' do
27
+ let(:opts) { { mono: true } }
28
+
29
+ it 'outputs some mono text' do
30
+ expect(output).to eq("πš†πš‘πšŠπš 𝚍𝚘 𝚒𝚘𝚞 πšπš‘πš’πš—πš”, πš–πš› πšπšŠπš—πšŒπš’ πš™πšŠπš—πšπšœ?")
31
+ end
32
+ end
33
+
34
+ describe 'with sans_serif flag' do
35
+ let(:opts) { { sans_serif: true } }
36
+
37
+ it 'outputs some sans_serif text' do
38
+ expect(output).to eq("𝖢𝗁𝖺𝗍 π–½π—ˆ π—’π—ˆπ—Ž 𝗍𝗁𝗂𝗇𝗄, 𝗆𝗋 𝖿𝖺𝗇𝖼𝗒 π—‰π–Ίπ—‡π—π—Œ?")
39
+ end
40
+ end
41
+
42
+ describe 'with double_struck flag' do
43
+ let(:opts) { { double_struck: true } }
44
+
45
+ it 'outputs some double_struck text' do
46
+ expect(output).to eq("π•Žπ•™π•’π•₯ 𝕕𝕠 π•ͺ𝕠𝕦 π•₯π•™π•šπ•Ÿπ•œ, π•žπ•£ π•—π•’π•Ÿπ•”π•ͺ π•‘π•’π•Ÿπ•₯𝕀?")
47
+ end
48
+ end
49
+
50
+ describe 'with no flag' do
51
+ it 'outputs some double_struck text' do
52
+ expect(output).to eq("π•Žπ•™π•’π•₯ 𝕕𝕠 π•ͺ𝕠𝕦 π•₯π•™π•šπ•Ÿπ•œ, π•žπ•£ π•—π•’π•Ÿπ•”π•ͺ π•‘π•’π•Ÿπ•₯𝕀?")
53
+ end
54
+ end
55
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fontlike
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Max Lahey
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-24 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Fontlike bloats your ascii
14
+ email:
15
+ - maxwellslahey@gmail.com
16
+ executables:
17
+ - fontlike
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - Gemfile
22
+ - Gemfile.lock
23
+ - README.md
24
+ - bin/fontlike
25
+ - fontlike.gemspec
26
+ - lib/fontlike.rb
27
+ - lib/fontlike/transmuter.rb
28
+ - lib/fontlike/version.rb
29
+ - spec/fontlike_spec.rb
30
+ homepage: https://github.com/maxwells/fontlike
31
+ licenses:
32
+ - MIT
33
+ metadata: {}
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.9.3
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubyforge_project:
50
+ rubygems_version: 2.4.8
51
+ signing_key:
52
+ specification_version: 4
53
+ summary: Fontlike bloats your ascii
54
+ test_files:
55
+ - spec/fontlike_spec.rb