chord_diagrams 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd5808f4c95547936f46bd3c6e6012f5d6fcfea5940c9b4674c2ed5caab6d1c8
4
- data.tar.gz: d7307034e5ccd952930e2bb5a0e25722096d4ffa969ed8ddce1fe1d4ec522def
3
+ metadata.gz: a16a88b747ac512e5fc309130f6cd953228ac284fe4ffdef1aba5022e31fd059
4
+ data.tar.gz: ab2db5f28c06082ae209bd575420d3f98c5cdca1167f7a6e4b1f7b0d4f4ecdeb
5
5
  SHA512:
6
- metadata.gz: b812b32121a8647a0b6e5dafe3547742be2d8c6c2202ca534a424b2dfae768e4bf60637feddf2e6922c9034a37292cbb072620374b74a557befe8199111d6031
7
- data.tar.gz: dcc129ecd9af3344a04552be7a0878996d47fdad743077519b7633c64272dbc5b2a99ac4427441c79f32eaa9fff4fb01d6c0cec1558919389185e728d3efdbde
6
+ metadata.gz: c23e1acd4a41acd93365ebf96e96ca680ef13cb841e6a8ddf3df0398d7d4c65ff2ad14f491055fbc316815b53334b58f49200e9ad83312781aaf33418f112c7b
7
+ data.tar.gz: 28e712bd7a6ebdacbccaa6b85f5e7df6e0fb01ff1cc0b8bc693b6de073a0d779673c5b788fca390b787b6f9e862181fb96a8498907a65fed87b55c7c8ff0d5e4
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in chord_diagrams.gemspec
4
4
  gemspec
data/Rakefile CHANGED
@@ -1,29 +1,30 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
- require 'chord_diagrams'
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require "chord_diagrams"
4
+ require "standard/rake"
4
5
 
5
6
  RSpec::Core::RakeTask.new(:spec)
6
7
 
7
- task default: :spec
8
+ task default: [:spec, :standard]
8
9
 
9
10
  task sheets: %i[guitar ukulele]
10
11
 
11
12
  task :guitar do
12
- html = ''
13
+ html = ""
13
14
 
14
15
  ChordDiagrams::GUITAR_FINGERINGS.keys.each do |name|
15
16
  html << ChordDiagrams.guitar_svg(name)
16
17
  end
17
18
 
18
- File.open('guitar.html', 'w') { |file| file.write(html) }
19
+ File.open("guitar.html", "w") { |file| file.write(html) }
19
20
  end
20
21
 
21
22
  task :ukulele do
22
- html = ''
23
+ html = ""
23
24
 
24
25
  ChordDiagrams::UKULELE_FINGERINGS.keys.each do |name|
25
26
  html << ChordDiagrams.ukulele_svg(name)
26
27
  end
27
28
 
28
- File.open('ukulele.html', 'w') { |file| file.write(html) }
29
+ File.open("ukulele.html", "w") { |file| file.write(html) }
29
30
  end
@@ -1,29 +1,29 @@
1
- lib = File.expand_path('lib', __dir__)
1
+ lib = File.expand_path("lib", __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'chord_diagrams/version'
3
+ require "chord_diagrams/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = 'chord_diagrams'
7
- spec.version = ChordDiagrams::VERSION
8
- spec.authors = ['Brian Kelly']
9
- spec.email = ['bkelly@carbonfive.com']
6
+ spec.name = "chord_diagrams"
7
+ spec.version = ChordDiagrams::VERSION
8
+ spec.authors = ["Brian Kelly"]
9
+ spec.email = ["bkelly@carbonfive.com"]
10
10
 
11
- spec.summary = 'Generate Chord Diagrams for Guitar and Ukulele'
12
- spec.description = 'Generate Chord Diagrams for Guitar and Ukulele'
13
- spec.homepage = 'https://github.com/spilth/chord_diagrams'
14
- spec.license = 'MIT'
11
+ spec.summary = "Generate Chord Diagrams for Guitar and Ukulele"
12
+ spec.description = "Generate Chord Diagrams for Guitar and Ukulele"
13
+ spec.homepage = "https://github.com/spilth/chord_diagrams"
14
+ spec.license = "MIT"
15
15
 
16
16
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
17
  # to allow pushing to a single host or delete this section to allow pushing to any host.
18
18
  if spec.respond_to?(:metadata)
19
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
19
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
20
20
 
21
- spec.metadata['homepage_uri'] = spec.homepage
22
- spec.metadata['source_code_uri'] = 'https://github.com/spilth/chord_diagrams'
21
+ spec.metadata["homepage_uri"] = spec.homepage
22
+ spec.metadata["source_code_uri"] = "https://github.com/spilth/chord_diagrams"
23
23
  # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
24
24
  else
25
- raise 'RubyGems 2.0 or newer is required to protect against ' \
26
- 'public gem pushes.'
25
+ raise "RubyGems 2.0 or newer is required to protect against " \
26
+ "public gem pushes."
27
27
  end
28
28
 
29
29
  # Specify which files should be added to the gem when it is released.
@@ -31,13 +31,14 @@ Gem::Specification.new do |spec|
31
31
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
32
32
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
33
33
  end
34
- spec.bindir = 'exe'
35
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
- spec.require_paths = ['lib']
34
+ spec.bindir = "exe"
35
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
+ spec.require_paths = ["lib"]
37
37
 
38
- spec.add_dependency 'victor', '0.3.2'
39
- spec.add_development_dependency 'bundler', '~> 2.2'
40
- spec.add_development_dependency 'rake', '~> 13.0'
41
- spec.add_development_dependency 'rspec', '~> 3.8'
42
- spec.add_development_dependency 'nokogiri', '~> 1.11'
38
+ spec.add_dependency "victor", "0.3.2"
39
+ spec.add_development_dependency "bundler", "~> 2.2"
40
+ spec.add_development_dependency "rake", "~> 13.0"
41
+ spec.add_development_dependency "rspec", "~> 3.8"
42
+ spec.add_development_dependency "nokogiri", "~> 1.11"
43
+ spec.add_development_dependency "standardrb"
43
44
  end
@@ -89,6 +89,7 @@ Dm/F,10323x,2210
89
89
  Gm/Bb,x10333,0231
90
90
  A7/G,302020,0100
91
91
  G#dim,4564xx,1202
92
+ Adim,x01212,23x3
92
93
  D#dim7,xx1212,2323
93
94
  G#dim7,456464,1212
94
95
  Daug,xx0332,3221
@@ -1,10 +1,10 @@
1
- require 'csv'
1
+ require "csv"
2
2
 
3
3
  module ChordDiagrams
4
4
  guitar_fingerings = {}
5
5
  ukulele_fingerings = {}
6
6
 
7
- fingerings_file = File.join(File.expand_path(File.dirname(__FILE__)), 'fingerings.csv')
7
+ fingerings_file = File.join(__dir__, "fingerings.csv")
8
8
 
9
9
  CSV.foreach(fingerings_file, headers: true) do |row|
10
10
  guitar_fingerings[row[0]] = row[1] unless row[1].nil?
@@ -1,3 +1,3 @@
1
1
  module ChordDiagrams
2
- VERSION = '0.0.11'.freeze
2
+ VERSION = "0.0.12".freeze
3
3
  end
@@ -1,6 +1,6 @@
1
- require 'chord_diagrams/version'
2
- require 'chord_diagrams/fingerings'
3
- require 'victor'
1
+ require "chord_diagrams/version"
2
+ require "chord_diagrams/fingerings"
3
+ require "victor"
4
4
 
5
5
  module ChordDiagrams
6
6
  LINE_STYLE = {
@@ -10,8 +10,8 @@ module ChordDiagrams
10
10
  }.freeze
11
11
 
12
12
  class << self
13
- def ukulele_svg(name, _fingering = nil)
14
- svg = Victor::SVG.new template: :minimal, width: 80, height: 100, viewBox: '0 0 160 200'
13
+ def ukulele_svg(name, fingering = nil)
14
+ svg = Victor::SVG.new template: :minimal, width: 80, height: 100, viewBox: "0 0 160 200"
15
15
 
16
16
  ChordDiagrams.draw_ukulele_name(name, svg)
17
17
  ChordDiagrams.draw_ukulele_frets(svg)
@@ -29,7 +29,7 @@ module ChordDiagrams
29
29
  end
30
30
 
31
31
  def guitar_svg(name, fingering = nil)
32
- svg = Victor::SVG.new template: :minimal, width: 100, height: 100, viewBox: '0 0 200 200'
32
+ svg = Victor::SVG.new template: :minimal, width: 100, height: 100, viewBox: "0 0 200 200"
33
33
 
34
34
  ChordDiagrams.draw_guitar_name(name, svg)
35
35
  ChordDiagrams.draw_guitar_frets(svg)
@@ -47,14 +47,14 @@ module ChordDiagrams
47
47
  end
48
48
 
49
49
  def draw_ukulele_name(name, svg)
50
- svg.text name, id: 'chordName', x: 80, y: 40, text_anchor: :middle, style: {
50
+ svg.text name, id: "chordName", x: 80, y: 40, text_anchor: :middle, style: {
51
51
  font_size: 36,
52
52
  font_weight: :bold
53
53
  }
54
54
  end
55
55
 
56
56
  def draw_guitar_name(name, svg)
57
- svg.text name, id: 'chordName', x: 100, y: 40, text_anchor: :middle, style: {
57
+ svg.text name, id: "chordName", x: 100, y: 40, text_anchor: :middle, style: {
58
58
  font_size: 36,
59
59
  font_weight: :bold
60
60
  }
@@ -87,7 +87,7 @@ module ChordDiagrams
87
87
  def draw_guitar_missing_chord_diagram(name, svg)
88
88
  puts "Could't find fingerings for the Guitar chord '#{name}'"
89
89
 
90
- svg.text '?', x: 102, y: 155, text_anchor: :middle, style: {
90
+ svg.text "?", x: 102, y: 155, text_anchor: :middle, style: {
91
91
  font_size: 96,
92
92
  font_weight: :bold,
93
93
  fill: :gray
@@ -95,9 +95,9 @@ module ChordDiagrams
95
95
  end
96
96
 
97
97
  def draw_ukulele_missing_chord_diagram(name, svg)
98
- puts "Could't find fingerings for the Ukulele chord '#{name}'"
98
+ puts "Couldn't find fingerings for the Ukulele chord '#{name}'"
99
99
 
100
- svg.text '?', x: 81, y: 155, text_anchor: :middle, style: {
100
+ svg.text "?", x: 81, y: 155, text_anchor: :middle, style: {
101
101
  font_size: 96,
102
102
  font_weight: :bold,
103
103
  fill: :gray
@@ -105,7 +105,7 @@ module ChordDiagrams
105
105
  end
106
106
 
107
107
  def draw_chord_diagram(fingerings, svg)
108
- fingerings = fingerings.split('')
108
+ fingerings = fingerings.chars
109
109
 
110
110
  lowest_fret = fingerings.reject { |fret| fret.to_i < 1 }.min
111
111
  highest_fret = fingerings.reject { |fret| fret.to_i < 1 }.max
@@ -114,20 +114,18 @@ module ChordDiagrams
114
114
  draw_fret_number(lowest_fret, svg)
115
115
 
116
116
  fingerings = shift_guitar_fingerings(fingerings, lowest_fret)
117
+ elsif fingerings.size == 6
118
+ draw_guitar_nut(svg)
117
119
  else
118
- if fingerings.size == 6
119
- draw_guitar_nut(svg)
120
- else
121
- draw_ukulele_nut(svg)
122
- end
120
+ draw_ukulele_nut(svg)
123
121
  end
124
122
 
125
123
  fingerings.each_with_index do |fingering, index|
126
124
  offset = 50 + (20 * index)
127
125
 
128
- if fingering == 'x'
126
+ if fingering == "x"
129
127
  draw_muted_string(offset, svg)
130
- elsif fingering == '0'
128
+ elsif fingering == "0"
131
129
  draw_open_string(offset, svg)
132
130
  else
133
131
  draw_fingered_string(fingering, offset, svg)
@@ -136,14 +134,14 @@ module ChordDiagrams
136
134
  end
137
135
 
138
136
  def draw_guitar_nut(svg)
139
- svg.line id: 'nut', x1: 49, y1: 77, x2: 151, y2: 77, style: {
137
+ svg.line id: "nut", x1: 49, y1: 77, x2: 151, y2: 77, style: {
140
138
  stroke: :black,
141
139
  stroke_width: 8
142
140
  }
143
141
  end
144
142
 
145
143
  def draw_ukulele_nut(svg)
146
- svg.line id: 'nut', x1: 49, y1: 77, x2: 111, y2: 77, style: {
144
+ svg.line id: "nut", x1: 49, y1: 77, x2: 111, y2: 77, style: {
147
145
  stroke: :black,
148
146
  stroke_width: 8
149
147
  }
@@ -169,12 +167,12 @@ module ChordDiagrams
169
167
  private
170
168
 
171
169
  def draw_fret_number(number, svg)
172
- svg.text number, id: 'fretNumber', x: 37, y: 98, text_anchor: :end, style: {font_size: 24}
170
+ svg.text number, id: "fretNumber", x: 37, y: 98, text_anchor: :end, style: {font_size: 24}
173
171
  end
174
172
 
175
173
  def shift_guitar_fingerings(fingerings, lowest_fret)
176
174
  fingerings.map do |fingering|
177
- if fingering != 'x' && fingering != '0'
175
+ if fingering != "x" && fingering != "0"
178
176
  fingering.to_i - lowest_fret.to_i + 1
179
177
  else
180
178
  fingering
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chord_diagrams
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Kelly
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-04 00:00:00.000000000 Z
11
+ date: 2021-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: victor
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.11'
83
+ - !ruby/object:Gem::Dependency
84
+ name: standardrb
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  description: Generate Chord Diagrams for Guitar and Ukulele
84
98
  email:
85
99
  - bkelly@carbonfive.com