uke 1.0.0
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 +7 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +5 -0
- data/MIT-LICENSE.txt +20 -0
- data/README.md +76 -0
- data/Rakefile +30 -0
- data/bin/uke-chords +39 -0
- data/lib/uke.rb +39 -0
- data/lib/uke/chords.rb +195 -0
- data/lib/uke/fretboard.rb +57 -0
- data/lib/uke/version.rb +4 -0
- data/uke.gemspec +23 -0
- metadata +87 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 8871351a22290ca9b4d067e90e823ccb1e47854b
|
|
4
|
+
data.tar.gz: 41d03d9d191759de0aba43e6b504538f94d4a242
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 46a8e567cb15b1753306e90d8ec8e7df2355f3750a77e4655fa3b607702a52aed908382f8df04f181b627295be5490cf40fc75d24ab4a15a92b07e5237048919
|
|
7
|
+
data.tar.gz: 50b6816c7eeff4e7e0d83c5e7b6e27b60d9ddb54eac2ff469baf742d0b00bb11b1e97d591936984083706847f6645719b6509d5e4585a342db3d1ee789ab0923
|
data/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Gemfile.lock
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/MIT-LICENSE.txt
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2015 Jan Lelis, mail@janlelis.de
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# uke gem [![[version]](https://badge.fury.io/rb/uke.svg)](http://badge.fury.io/rb/uke)
|
|
2
|
+
|
|
3
|
+
Displays popular ukulele chords for the popular `GCEA` tuning like this:
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
$ uke-chords G B7 C Cm
|
|
7
|
+
|
|
8
|
+
⚪
|
|
9
|
+
╒══╤══╤══╕ ╒══╤══╤══╕
|
|
10
|
+
_____ │ │ │ │ │ │ │ │
|
|
11
|
+
/ ____| ├──┼──┼──┤ ├──┼──┼──┤
|
|
12
|
+
| | __ │ ● │ ● │ ● │ ●
|
|
13
|
+
| | |_ | ├──┼──┼──┤ ├──┼──┼──┤
|
|
14
|
+
| |__| | │ │ ● │ │ │ ● │
|
|
15
|
+
\_____| ├──┼──┼──┤ ├──┼──┼──┤
|
|
16
|
+
│ │ │ │ ● │ │ │
|
|
17
|
+
└──┴──┴──┘ └──┴──┴──┘
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
⚪
|
|
21
|
+
╒══╤══╤══╕ ╒══╤══╤══╕
|
|
22
|
+
____ ______ │ │ │ │ │ │ │ │
|
|
23
|
+
| _ \____ | ├──┼──┼──┤ ├──┼──┼──┤
|
|
24
|
+
| |_) | / / ● │ ● ● │ │ ● │
|
|
25
|
+
| _ < / / ├──┼──┼──┤ ├──┼──┼──┤
|
|
26
|
+
| |_) |/ / │ ● │ │ │ ● │ │
|
|
27
|
+
|____//_/ ├──┼──┼──┤ ├──┼──┼──┤
|
|
28
|
+
│ │ │ │ ● │ │ │
|
|
29
|
+
└──┴──┴──┘ └──┴──┴──┘
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
⚪ ⚪ ⚪ ⚪ ⚪ ⚪
|
|
33
|
+
╒══╤══╤══╕ ╒══╤══╤══╕ ╒══╤══╤══╕
|
|
34
|
+
_____ │ │ │ │ │ │ │ │ │ │ │ │
|
|
35
|
+
/ ____| ├──┼──┼──┤ ├──┼──┼──┤ ├──┼──┼──┤
|
|
36
|
+
| | │ │ │ │ │ │ │ │ │ │ │ │
|
|
37
|
+
| | ├──┼──┼──┤ ├──┼──┼──┤ ├──┼──┼──┤
|
|
38
|
+
| |____ │ │ │ ● │ │ │ ● │ │ ● ●
|
|
39
|
+
\_____| ├──┼──┼──┤ ├──┼──┼──┤ ├──┼──┼──┤
|
|
40
|
+
│ │ │ │ │ ● │ │ │ ● │ │
|
|
41
|
+
└──┴──┴──┘ └──┴──┴──┘ └──┴──┴──┘
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
⚪
|
|
45
|
+
╒══╤══╤══╕
|
|
46
|
+
_____ │ │ │ │
|
|
47
|
+
/ ____| ├──┼──┼──┤
|
|
48
|
+
| | _ __ ___ │ │ │ │
|
|
49
|
+
| | | '_ ` _ \ ├──┼──┼──┤
|
|
50
|
+
| |____| | | | | | │ ● ● ●
|
|
51
|
+
\_____|_| |_| |_| ├──┼──┼──┤
|
|
52
|
+
│ │ │ │
|
|
53
|
+
└──┴──┴──┘
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Setup
|
|
58
|
+
|
|
59
|
+
Make sure that your computer has [Ruby 2.0 or higher installed](http://ruby.about.com/od/tutorials/a/installruby.htm).
|
|
60
|
+
|
|
61
|
+
Then run
|
|
62
|
+
|
|
63
|
+
```ruby
|
|
64
|
+
gem install uke
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Usage
|
|
68
|
+
|
|
69
|
+
On the command-line, run `uke-chords`, followed by the chords you want to display (see the example at top).
|
|
70
|
+
|
|
71
|
+
Run `uke-chords` without any parameters for a list of included chords.
|
|
72
|
+
|
|
73
|
+
## MIT License
|
|
74
|
+
|
|
75
|
+
Except for the chords, copyright (C) 2015 Jan Lelis <http://janlelis.com>. Released under the MIT license.
|
|
76
|
+
|
data/Rakefile
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# # #
|
|
2
|
+
# Get gemspec info
|
|
3
|
+
|
|
4
|
+
gemspec_file = Dir['*.gemspec'].first
|
|
5
|
+
gemspec = eval File.read(gemspec_file), binding, gemspec_file
|
|
6
|
+
info = "#{gemspec.name} | #{gemspec.version} | " \
|
|
7
|
+
"#{gemspec.runtime_dependencies.size} dependencies | " \
|
|
8
|
+
"#{gemspec.files.size} files"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# # #
|
|
12
|
+
# Gem build and install task
|
|
13
|
+
|
|
14
|
+
desc info
|
|
15
|
+
task :gem do
|
|
16
|
+
puts info + "\n\n"
|
|
17
|
+
print " "; sh "gem build #{gemspec_file}"
|
|
18
|
+
FileUtils.mkdir_p 'pkg'
|
|
19
|
+
FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", 'pkg'
|
|
20
|
+
puts; sh %{gem install --no-document pkg/#{gemspec.name}-#{gemspec.version}.gem}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# # #
|
|
25
|
+
# Start an IRB session with the gem loaded
|
|
26
|
+
|
|
27
|
+
desc "#{gemspec.name} | IRB"
|
|
28
|
+
task :irb do
|
|
29
|
+
sh "irb -I ./lib -r #{gemspec.name.gsub '-','/'}"
|
|
30
|
+
end
|
data/bin/uke-chords
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
#require 'uke'
|
|
4
|
+
require_relative '../lib/uke'
|
|
5
|
+
require 'rationalist'
|
|
6
|
+
|
|
7
|
+
args = Rationalist.parse(
|
|
8
|
+
boolean: [:help, :version],
|
|
9
|
+
string: [:style],
|
|
10
|
+
default: { style: :small },
|
|
11
|
+
alias: { s: :style, v: :version }
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
case
|
|
15
|
+
when args[:v]
|
|
16
|
+
$stderr.puts Uke::VERSION
|
|
17
|
+
when args[:help]
|
|
18
|
+
puts <<BANNER
|
|
19
|
+
|
|
20
|
+
DESCRIPTION
|
|
21
|
+
|
|
22
|
+
Displays popular ukulele chords
|
|
23
|
+
|
|
24
|
+
USAGE
|
|
25
|
+
|
|
26
|
+
Pass the chords to display as arguments
|
|
27
|
+
|
|
28
|
+
Run without arguments for a list of included chords
|
|
29
|
+
|
|
30
|
+
EXAMPLE
|
|
31
|
+
|
|
32
|
+
uke-chords G B7 C Cm
|
|
33
|
+
|
|
34
|
+
BANNER
|
|
35
|
+
when args[:_].empty?
|
|
36
|
+
Uke.new.print_chord_list
|
|
37
|
+
else
|
|
38
|
+
Uke.new.print_chords args[:_], args[:style]
|
|
39
|
+
end
|
data/lib/uke.rb
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'artii'
|
|
2
|
+
|
|
3
|
+
require_relative "uke/version"
|
|
4
|
+
require_relative "uke/chords"
|
|
5
|
+
require_relative "uke/fretboard"
|
|
6
|
+
|
|
7
|
+
class Uke
|
|
8
|
+
def print_chord_list
|
|
9
|
+
puts Uke::CHORDS.keys.join " "
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def print_chords(which, style = nil)
|
|
13
|
+
Array(which).each{ |chord_name|
|
|
14
|
+
chords = CHORDS[chord_name]
|
|
15
|
+
if !chords.empty?
|
|
16
|
+
puts chords.reduce(
|
|
17
|
+
chord_name_to_ascii_lines(chord_name)
|
|
18
|
+
){ |old_lines, chord|
|
|
19
|
+
old_lines.zip(Fretboard.new(chord, style).lines).map(&:join)
|
|
20
|
+
}.join($/)
|
|
21
|
+
else
|
|
22
|
+
$stderr.puts "\n #{chord_name} not found"
|
|
23
|
+
end
|
|
24
|
+
}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def chord_name_to_ascii_lines(chord)
|
|
30
|
+
a = Artii::Base.new# font: 'roman'
|
|
31
|
+
res = [" ", " ", " "]
|
|
32
|
+
res += a.asciify(chord).split($/)
|
|
33
|
+
res += [" "]
|
|
34
|
+
|
|
35
|
+
max = res.max_by(&:size).size
|
|
36
|
+
|
|
37
|
+
res.map{ |l| " " + l.ljust(max) }
|
|
38
|
+
end
|
|
39
|
+
end
|
data/lib/uke/chords.rb
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
class Uke
|
|
2
|
+
CHORDS_RAW = <<CHORDS_RAW # stolen from https://github.com/zimolzak/ukulele/blob/master/lotsachords.txt
|
|
3
|
+
A 2,1,0,0
|
|
4
|
+
A 2,1,0,4
|
|
5
|
+
A 2,4,0,4
|
|
6
|
+
A# 3,2,1,1
|
|
7
|
+
A 5 2,4,0,0
|
|
8
|
+
A 7 0,1,0,0
|
|
9
|
+
A# 7 1,2,1,1
|
|
10
|
+
A 7 2,4,3,4
|
|
11
|
+
A 7sus 0,2,0,0
|
|
12
|
+
A# 7sus 1,3,1,1
|
|
13
|
+
A 9 2,1,0,2
|
|
14
|
+
A# 9 3,2,1,3
|
|
15
|
+
A 9 4,1,0,0
|
|
16
|
+
A aug 2,1,1,0
|
|
17
|
+
A aug 2,1,1,4
|
|
18
|
+
A#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|
109
|
+
D# m7b5 2,3,2,4
|
|
110
|
+
D maj7 2,2,2,4
|
|
111
|
+
D sus 0,2,3,0
|
|
112
|
+
D# sus 1,3,4,1
|
|
113
|
+
D sus 2,2,3,0
|
|
114
|
+
D# sus 3,3,4,1
|
|
115
|
+
E 1,4,0,2
|
|
116
|
+
E 1,4,4,2
|
|
117
|
+
E 4,4,4,2
|
|
118
|
+
E 5 4,4,0,2
|
|
119
|
+
E 7 1,2,0,2
|
|
120
|
+
E 7sus 2,2,0,2
|
|
121
|
+
E 7sus 4,2,0,0
|
|
122
|
+
E 9 1,4,2,2
|
|
123
|
+
E dim 0,4,0,1
|
|
124
|
+
E dim 0,4,3,1
|
|
125
|
+
E dim 3,4,3,1
|
|
126
|
+
E m 0,4,0,2
|
|
127
|
+
E m 0,4,3,2
|
|
128
|
+
E m 4,4,3,2
|
|
129
|
+
E m7 0,2,0,2
|
|
130
|
+
E m7b5 0,2,0,1
|
|
131
|
+
E maj7 1,3,0,2
|
|
132
|
+
E sus 2,4,0,2
|
|
133
|
+
E sus 4,4,0,0
|
|
134
|
+
F 2,0,1,0
|
|
135
|
+
F 2,0,1,3
|
|
136
|
+
F# 3,1,2,1
|
|
137
|
+
F# 3,1,2,4
|
|
138
|
+
F 7 2,3,1,3
|
|
139
|
+
F# 7 3,4,2,4
|
|
140
|
+
F 7sus 3,3,1,3
|
|
141
|
+
F# 7sus 4,4,2,4
|
|
142
|
+
F 9 0,0,1,0
|
|
143
|
+
F# 9 1,1,2,1
|
|
144
|
+
F# dim 2,0,2,0
|
|
145
|
+
F# dim 2,0,2,3
|
|
146
|
+
F m 1,0,1,3
|
|
147
|
+
F# m 2,1,2,0
|
|
148
|
+
F# m 2,1,2,4
|
|
149
|
+
F m7 1,3,1,3
|
|
150
|
+
F# m7 2,4,2,4
|
|
151
|
+
F m7b5 1,3,1,2
|
|
152
|
+
F# m7b5 2,4,2,3
|
|
153
|
+
F maj7 2,4,1,3
|
|
154
|
+
F sus 3,0,1,1
|
|
155
|
+
F sus 3,0,1,3
|
|
156
|
+
F# sus 4,1,2,2
|
|
157
|
+
F# sus 4,1,2,4
|
|
158
|
+
G 0,2,3,2
|
|
159
|
+
G# 1,3,4,3
|
|
160
|
+
G 4,2,3,2
|
|
161
|
+
G 7 0,2,1,2
|
|
162
|
+
G# 7 1,3,2,3
|
|
163
|
+
G 7sus 0,2,1,3
|
|
164
|
+
G# 7sus 1,3,2,4
|
|
165
|
+
G 9 2,2,3,2
|
|
166
|
+
G# 9 3,3,4,3
|
|
167
|
+
G 9 4,2,3,0
|
|
168
|
+
G dim 0,1,3,1
|
|
169
|
+
G# dim 1,2,4,2
|
|
170
|
+
G dim 3,1,3,1
|
|
171
|
+
G dim 3,1,3,4
|
|
172
|
+
G# dim 4,2,4,2
|
|
173
|
+
G m 0,2,3,1
|
|
174
|
+
G# m 1,3,4,2
|
|
175
|
+
G m 3,2,3,1
|
|
176
|
+
G# m 4,3,4,2
|
|
177
|
+
G m7 0,2,1,1
|
|
178
|
+
G# m7 1,3,2,2
|
|
179
|
+
G m7b5 0,1,1,1
|
|
180
|
+
G# m7b5 1,2,2,2
|
|
181
|
+
G maj7 0,2,2,2
|
|
182
|
+
G# maj7 0,3,4,3
|
|
183
|
+
G# maj7 1,3,3,3
|
|
184
|
+
G sus 0,2,3,3
|
|
185
|
+
G# sus 1,3,4,4
|
|
186
|
+
CHORDS_RAW
|
|
187
|
+
|
|
188
|
+
CHORDS = Hash.new{ |h, k| h[k] = [] }
|
|
189
|
+
|
|
190
|
+
CHORDS_RAW.split($/).each{ |line|
|
|
191
|
+
fingers = line[/\d,\d,\d,\d$/].split(',').map(&:to_i)
|
|
192
|
+
chord = $`.tr ' ', ''
|
|
193
|
+
CHORDS[chord] << fingers
|
|
194
|
+
}
|
|
195
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
class Uke
|
|
2
|
+
class Fretboard
|
|
3
|
+
STYLES = {
|
|
4
|
+
small: { open: " ⚪", finger: " ●" },
|
|
5
|
+
large: { open: " ○", finger: "⬤ " },
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
def initialize(chord, style = nil)
|
|
9
|
+
@chord = chord
|
|
10
|
+
@style = style.to_sym
|
|
11
|
+
raise ArgumentError, 'Unknown style' unless STYLES[@style]
|
|
12
|
+
@config = chord_to_config(@chord)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def lines
|
|
16
|
+
(TEMPLATE % @config).split($/)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def chord_to_config(chord)
|
|
22
|
+
config = DEFAULT_CONFIG.dup
|
|
23
|
+
chord.each_with_index{ |n, i|
|
|
24
|
+
if n == 0
|
|
25
|
+
config[i] = STYLES[@style][:open]
|
|
26
|
+
else
|
|
27
|
+
config[n*4+i] = STYLES[@style][:finger]
|
|
28
|
+
end
|
|
29
|
+
}
|
|
30
|
+
config
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
DEFAULT_CONFIG = [
|
|
34
|
+
" ", " ", " ", " ",
|
|
35
|
+
" │", " │", " │", " │",
|
|
36
|
+
" │", " │", " │", " │",
|
|
37
|
+
" │", " │", " │", " │",
|
|
38
|
+
" │", " │", " │", " │",
|
|
39
|
+
" │", " │", " │", " │",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
TEMPLATE = <<TEMPLATE
|
|
43
|
+
|
|
44
|
+
\t%s %s %s %s
|
|
45
|
+
\t ╒══╤══╤══╕
|
|
46
|
+
\t%s %s %s %s
|
|
47
|
+
\t ├──┼──┼──┤
|
|
48
|
+
\t%s %s %s %s
|
|
49
|
+
\t ├──┼──┼──┤
|
|
50
|
+
\t%s %s %s %s
|
|
51
|
+
\t ├──┼──┼──┤
|
|
52
|
+
\t%s %s %s %s
|
|
53
|
+
\t └──┴──┴──┘
|
|
54
|
+
|
|
55
|
+
TEMPLATE
|
|
56
|
+
end
|
|
57
|
+
end
|
data/lib/uke/version.rb
ADDED
data/uke.gemspec
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
require File.dirname(__FILE__) + "/lib/uke/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |gem|
|
|
6
|
+
gem.name = "uke"
|
|
7
|
+
gem.version = Uke::VERSION
|
|
8
|
+
gem.summary = "Displays popular ukulele chords"
|
|
9
|
+
gem.description = "Displays popular ukulele chords for the popular `GCEA` tuning"
|
|
10
|
+
gem.authors = ["Jan Lelis"]
|
|
11
|
+
gem.email = ["mail@janlelis.de"]
|
|
12
|
+
gem.homepage = "https://github.com/janlelis/uke"
|
|
13
|
+
gem.license = "MIT"
|
|
14
|
+
|
|
15
|
+
gem.files = Dir["{**/}{.*,*}"].select{ |path| File.file?(path) && path !~ /^pkg/ }
|
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
18
|
+
gem.require_paths = ["lib"]
|
|
19
|
+
|
|
20
|
+
gem.required_ruby_version = "~> 2.0"
|
|
21
|
+
gem.add_dependency 'rationalist', '~> 2.0'
|
|
22
|
+
gem.add_dependency 'artii', '~> 2.1'
|
|
23
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: uke
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Jan Lelis
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-07-02 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rationalist
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2.0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: artii
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '2.1'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '2.1'
|
|
41
|
+
description: Displays popular ukulele chords for the popular `GCEA` tuning
|
|
42
|
+
email:
|
|
43
|
+
- mail@janlelis.de
|
|
44
|
+
executables:
|
|
45
|
+
- uke-chords
|
|
46
|
+
extensions: []
|
|
47
|
+
extra_rdoc_files: []
|
|
48
|
+
files:
|
|
49
|
+
- ".gitignore"
|
|
50
|
+
- CHANGELOG.md
|
|
51
|
+
- Gemfile
|
|
52
|
+
- Gemfile.lock
|
|
53
|
+
- MIT-LICENSE.txt
|
|
54
|
+
- README.md
|
|
55
|
+
- Rakefile
|
|
56
|
+
- bin/uke-chords
|
|
57
|
+
- lib/uke.rb
|
|
58
|
+
- lib/uke/chords.rb
|
|
59
|
+
- lib/uke/fretboard.rb
|
|
60
|
+
- lib/uke/version.rb
|
|
61
|
+
- uke.gemspec
|
|
62
|
+
homepage: https://github.com/janlelis/uke
|
|
63
|
+
licenses:
|
|
64
|
+
- MIT
|
|
65
|
+
metadata: {}
|
|
66
|
+
post_install_message:
|
|
67
|
+
rdoc_options: []
|
|
68
|
+
require_paths:
|
|
69
|
+
- lib
|
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '2.0'
|
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
|
+
requirements:
|
|
77
|
+
- - ">="
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
version: '0'
|
|
80
|
+
requirements: []
|
|
81
|
+
rubyforge_project:
|
|
82
|
+
rubygems_version: 2.4.6
|
|
83
|
+
signing_key:
|
|
84
|
+
specification_version: 4
|
|
85
|
+
summary: Displays popular ukulele chords
|
|
86
|
+
test_files: []
|
|
87
|
+
has_rdoc:
|