chord_diagrams 0.0.11 → 0.0.13

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: 7e2ac822f1ea38010bcf65ba0dc0415f13632e8659bfc31682b635d95a7a25e5
4
+ data.tar.gz: 44764d69a88c4a22882fc5bcb886f82c3dd05a4d7b45edecd5ffb1d92df10ce7
5
5
  SHA512:
6
- metadata.gz: b812b32121a8647a0b6e5dafe3547742be2d8c6c2202ca534a424b2dfae768e4bf60637feddf2e6922c9034a37292cbb072620374b74a557befe8199111d6031
7
- data.tar.gz: dcc129ecd9af3344a04552be7a0878996d47fdad743077519b7633c64272dbc5b2a99ac4427441c79f32eaa9fff4fb01d6c0cec1558919389185e728d3efdbde
6
+ metadata.gz: 735fb4df05dd7b428da25f1d5c6aba8f966901cc13151dba0e5410ec0d2bf8c71d98842e9321c22de1b2be6a0193c7c8c9e839631e235e1fa0fddaf31510010d
7
+ data.tar.gz: 555afb42e5da751cfd45b36bc79c6323372b7ea39ebc22050f8c3ed46c695dfa3c264de6d5ace7589da3bb7fb0c031f51a80f431cb7c71bb0307819d495a4f86
@@ -0,0 +1,22 @@
1
+ name: Build
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+
9
+ strategy:
10
+ matrix:
11
+ ruby-version: [3.0, 3.1, 3.2, head]
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby ${{ matrix.ruby-version }}
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby-version }}
19
+ - name: Install dependencies
20
+ run: bundle install
21
+ - name: Run tests
22
+ run: bundle exec rake
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.3
1
+ 3.2.0
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.2.0
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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ChordDiagrams [![Build Status](https://www.travis-ci.com/spilth/chord_diagrams.svg?branch=master)](https://www.travis-ci.com/spilth/chord_diagrams)
1
+ # ChordDiagrams [![Build Status](https://www.travis-ci.com/spilth/chord_diagrams.svg?branch=main)](https://www.travis-ci.com/spilth/chord_diagrams)
2
2
 
3
3
  Generate SVGs for Guitar and Ukulele Chord Diagrams
4
4
 
data/Rakefile CHANGED
@@ -1,29 +1,33 @@
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
 
10
+ desc "Generate all diagrams"
9
11
  task sheets: %i[guitar ukulele]
10
12
 
13
+ desc "Generate guitar diagrams"
11
14
  task :guitar do
12
- html = ''
15
+ html = ""
13
16
 
14
17
  ChordDiagrams::GUITAR_FINGERINGS.keys.each do |name|
15
18
  html << ChordDiagrams.guitar_svg(name)
16
19
  end
17
20
 
18
- File.open('guitar.html', 'w') { |file| file.write(html) }
21
+ File.write("guitar.html", html)
19
22
  end
20
23
 
24
+ desc "Generate ukulele diagrams"
21
25
  task :ukulele do
22
- html = ''
26
+ html = ""
23
27
 
24
28
  ChordDiagrams::UKULELE_FINGERINGS.keys.each do |name|
25
29
  html << ChordDiagrams.ukulele_svg(name)
26
30
  end
27
31
 
28
- File.open('ukulele.html', 'w') { |file| file.write(html) }
32
+ File.write("ukulele.html", html)
29
33
  end
@@ -1,29 +1,31 @@
1
- lib = File.expand_path('lib', __dir__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("lib", __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'chord_diagrams/version'
5
+ require "chord_diagrams/version"
4
6
 
5
7
  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']
8
+ spec.name = "chord_diagrams"
9
+ spec.version = ChordDiagrams::VERSION
10
+ spec.authors = ["Brian Kelly"]
11
+ spec.email = ["bkelly@carbonfive.com"]
10
12
 
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'
13
+ spec.summary = "Generate Chord Diagrams for Guitar and Ukulele"
14
+ spec.description = "Generate Chord Diagrams for Guitar and Ukulele"
15
+ spec.homepage = "https://github.com/spilth/chord_diagrams"
16
+ spec.license = "MIT"
15
17
 
16
18
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
19
  # to allow pushing to a single host or delete this section to allow pushing to any host.
18
20
  if spec.respond_to?(:metadata)
19
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
21
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
20
22
 
21
- spec.metadata['homepage_uri'] = spec.homepage
22
- spec.metadata['source_code_uri'] = 'https://github.com/spilth/chord_diagrams'
23
+ spec.metadata["homepage_uri"] = spec.homepage
24
+ spec.metadata["source_code_uri"] = "https://github.com/spilth/chord_diagrams"
23
25
  # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
24
26
  else
25
- raise 'RubyGems 2.0 or newer is required to protect against ' \
26
- 'public gem pushes.'
27
+ raise "RubyGems 2.0 or newer is required to protect against " \
28
+ "public gem pushes."
27
29
  end
28
30
 
29
31
  # Specify which files should be added to the gem when it is released.
@@ -31,13 +33,14 @@ Gem::Specification.new do |spec|
31
33
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
32
34
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
33
35
  end
34
- spec.bindir = 'exe'
35
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
- spec.require_paths = ['lib']
36
+ spec.bindir = "exe"
37
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
+ spec.require_paths = ["lib"]
37
39
 
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'
40
+ spec.add_dependency "victor", "0.3.4"
41
+ spec.add_development_dependency "bundler"
42
+ spec.add_development_dependency "rake"
43
+ spec.add_development_dependency "rspec"
44
+ spec.add_development_dependency "nokogiri"
45
+ spec.add_development_dependency "standardrb"
43
46
  end
@@ -89,7 +89,9 @@ 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
95
96
  Aaug,x03221,2114
97
+ Dadd11,xx0032,0220
@@ -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.13".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.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Kelly
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-04 00:00:00.000000000 Z
11
+ date: 2023-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: victor
@@ -16,70 +16,84 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.3.2
19
+ version: 0.3.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.3.2
26
+ version: 0.3.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.2'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '2.2'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '13.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '13.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '3.8'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '3.8'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: nokogiri
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '1.11'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '1.11'
82
+ version: '0'
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
@@ -87,10 +101,11 @@ executables: []
87
101
  extensions: []
88
102
  extra_rdoc_files: []
89
103
  files:
104
+ - ".github/workflows/build.yml"
90
105
  - ".gitignore"
91
106
  - ".rspec"
92
107
  - ".ruby-version"
93
- - ".travis.yml"
108
+ - ".tool-versions"
94
109
  - Gemfile
95
110
  - LICENSE.txt
96
111
  - README.md
@@ -109,7 +124,7 @@ metadata:
109
124
  allowed_push_host: https://rubygems.org
110
125
  homepage_uri: https://github.com/spilth/chord_diagrams
111
126
  source_code_uri: https://github.com/spilth/chord_diagrams
112
- post_install_message:
127
+ post_install_message:
113
128
  rdoc_options: []
114
129
  require_paths:
115
130
  - lib
@@ -124,8 +139,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
139
  - !ruby/object:Gem::Version
125
140
  version: '0'
126
141
  requirements: []
127
- rubygems_version: 3.1.6
128
- signing_key:
142
+ rubygems_version: 3.4.7
143
+ signing_key:
129
144
  specification_version: 4
130
145
  summary: Generate Chord Diagrams for Guitar and Ukulele
131
146
  test_files: []
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.7.2
7
- before_install: gem install bundler -v 2.2