fretboards 0.0.5 → 0.1.0

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: 2f74b94171d59d8205ea78288d485e0456c0cec05235384b1467031d55f8e16e
4
- data.tar.gz: 77b288c138152851fb1c9ec3b3d888f78ce9a1cd81b9361e2128031f74b03b6d
3
+ metadata.gz: e8f38b4dde148fa6891ffe83e6013de5f53a405a5107bac0b0ede0c20fd4bc0d
4
+ data.tar.gz: 319ff9148fa863aeb67adceae38bc76287098919c85566e3b1e51276f5b2d7cf
5
5
  SHA512:
6
- metadata.gz: 2b193399564a8ed351a954ee6198b493846cd89f3671da04fa84d992934b9f65fc767f3e0b0cab0a818f14c4eaf02accbcd1e317b1ac8c9cb82620677680f433
7
- data.tar.gz: a64774090babf06d96e2811f33600488a0d61739bc868645a3ef2a145aae18ce4145198c3e160cdb29b6c45bb210822db35abe700dd22611ae1015101b63de0c
6
+ metadata.gz: 87ac886d83ec05402278f8377751e127d3c25948ae388131dac81e42664061e30a646a83cb80290c6c78179743f217a68393aaaf38425ca0eb257cc082ab22f7
7
+ data.tar.gz: 6d4b57ea5aceb769ef23a878818f89966ba03aa8ff0aa5352c9d62970321286c127b9cae9869b40934517e75ddb5fb125d9e70ad7a7c392bfbb16bec7ca3523e
@@ -2,12 +2,87 @@
2
2
 
3
3
  require "fretboards"
4
4
  require "fretboards/renderer/svg"
5
+ require "docopt"
5
6
 
6
- # TODO make something useful
7
- terse = ARGV
8
- # puts terse.inspect
7
+ doc = <<DOCOPT
8
+ Output a SVG fretboard.
9
9
 
10
- fb = Fretboards::Fretboard.new(:tuning => %w{g' c' e' a'})
11
- fb.terse(ARGV)
12
- renderer = Fretboards::Renderer::Svg.new()
13
- puts renderer.render(fb)
10
+ Usage:
11
+ #{__FILE__} [options] [<dots>...]
12
+ #{__FILE__} (--tuning=<tuning> | --guitar | --ukulele) [options] [<dots>...]
13
+ #{__FILE__} -h | --help
14
+ #{__FILE__} --version
15
+
16
+ Options:
17
+ --tuning=<tuning> Tuning of the instrument [default: g' c' e' a'].
18
+ --width=<width> Width of the fretboard [default: 108].
19
+ --height=<height> Height of the fretboard [default: 180].
20
+ --fret-count=<fret-count> Number of frets [default: 4].
21
+ --title=<title> Title of the fretboard [default: ].
22
+ -h --help Show this screen.
23
+ --version Show version.
24
+
25
+ Arguments:
26
+ <dots> Dots to be drawn on the fretboard. Defaults to 4 strings and ukulele tuning. Actual tuning pitches are only considered when passing the dot marks as pitches.
27
+
28
+ Dots are specified as a sequence of numbers, one per string, starting from 0. Use x for a muted string.
29
+
30
+ #{__FILE__} 0 2 1 2
31
+
32
+ You can also specify dots as pitches, a to g.
33
+
34
+ - Use `is` suffix for sharp, `es` for flat.
35
+ - Use `'` or `,` for octaves up or down. `c'` is middle C.
36
+
37
+ #{__FILE__} aes\\' d\\' f\\' b\\'
38
+
39
+ Draw guitar fretboard passing `--guitar` or `--guitar-7`:
40
+
41
+ #{__FILE__} --guitar x 3 2 0 1 0
42
+
43
+ Use `[` and `]` to indicate barres:
44
+
45
+ #{__FILE__} --guitar 1\\[ 3 3 2 1 1\\]
46
+
47
+ Mark a dot as root with `!`:
48
+
49
+ #{__FILE__} --guitar 3! 2 0 0 3 3
50
+
51
+ Annotate fingerings with `-`:
52
+
53
+ #{__FILE__} --guitar 3-2 2-1 0 0 3-3 3-4
54
+
55
+ To place multiple dots on the same string, use `/`:
56
+
57
+ #{__FILE__} --guitar 5/6 8/6 5/5 7/5 5/4 7/4 5/3 7/3 5/2 8/2 5/1 8/1
58
+
59
+ Report bugs at https://github.com/choan/fretboards/issues
60
+ DOCOPT
61
+
62
+ begin
63
+ arguments = Docopt::docopt(doc, version: ::Fretboards::VERSION)
64
+ rescue Docopt::Exit => e
65
+ puts e.message
66
+ exit
67
+ end
68
+
69
+ if arguments['--guitar']
70
+ arguments['--tuning'] = "e, a, d g b e'"
71
+ elsif arguments['--guitar-7']
72
+ arguments['--tuning'] = "b,, e, a, d g b e'"
73
+ elsif arguments['--ukulele']
74
+ arguments['--tuning'] = "g' c' e' a'"
75
+ end
76
+
77
+ terse = arguments['<dots>']
78
+ tuning = arguments['--tuning'].split(' ')
79
+ title = arguments['--title']
80
+ width = arguments['--width'].to_i
81
+ height = arguments['--height'].to_i
82
+ fret_count = arguments['--fret-count'].to_i
83
+
84
+ fb = Fretboards::Fretboard.new(:tuning => tuning)
85
+ fb.title = title unless title.empty?
86
+ fb.terse(terse)
87
+ renderer = Fretboards::Renderer::Svg.new(width: width, height: height, fret_count: fret_count)
88
+ puts renderer.render(fb)
data/fretboards.gemspec CHANGED
@@ -22,4 +22,5 @@ Gem::Specification.new do |s|
22
22
  # specify any dependencies here; for example:
23
23
  # s.add_development_dependency "rspec"
24
24
  s.add_runtime_dependency "builder"
25
+ s.add_runtime_dependency "docopt", "~> 0.6.0"
25
26
  end
@@ -1,3 +1,3 @@
1
1
  module Fretboards
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fretboards
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Choan Galvez
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-18 00:00:00.000000000 Z
11
+ date: 2023-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: docopt
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.6.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.6.0
27
41
  description: Allows defining instrument fretboard structures and representing them
28
42
  as highly customizable SVG graphics.
29
43
  email:
@@ -57,7 +71,7 @@ homepage: ''
57
71
  licenses:
58
72
  - MIT
59
73
  metadata: {}
60
- post_install_message:
74
+ post_install_message:
61
75
  rdoc_options: []
62
76
  require_paths:
63
77
  - lib
@@ -72,8 +86,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
86
  - !ruby/object:Gem::Version
73
87
  version: '0'
74
88
  requirements: []
75
- rubygems_version: 3.0.4
76
- signing_key:
89
+ rubygems_version: 3.2.3
90
+ signing_key:
77
91
  specification_version: 4
78
92
  summary: Define and draw fretboards
79
93
  test_files: