pondize 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 +7 -0
- data/Gemfile +3 -0
- data/Makefile +4 -0
- data/README.md +24 -0
- data/bin/pondize +4 -0
- data/lib/pondize/runner.rb +45 -0
- data/lib/pondize/version.rb +3 -0
- data/lib/pondize.rb +5 -0
- data/pondize.gemspec +21 -0
- metadata +66 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fecb15a50eb9e673a140a9554e7965607d5c9c98
|
4
|
+
data.tar.gz: c71b63c4544298c20092b7199755406555c55eba
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c9686308e16995ad8c6d9540774ebc9effade0a7b3b9e1769c1e5136261a62219c35cf39bf9e1d3ef4681ec27112ca9f949d3fc89ea7223cd0c41f03e906152e
|
7
|
+
data.tar.gz: 8f6c1fbc29b307caf53bfdc5b265cec044db0710355bfdf03a5f0ea9c55ab562b988591bb28c75b55c4b6c914f77a3042062d21a9013deee261f7de234f1c2b4
|
data/Gemfile
ADDED
data/Makefile
ADDED
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Pondize
|
2
|
+
|
3
|
+
Converter for lilypond strings.
|
4
|
+
Appends flats and sharps based on given key.
|
5
|
+
|
6
|
+
# Installation
|
7
|
+
|
8
|
+
make
|
9
|
+
|
10
|
+
# Usage
|
11
|
+
|
12
|
+
pondize.rb <key> <lilypondlike string>
|
13
|
+
|
14
|
+
## Key
|
15
|
+
|
16
|
+
Positive number means number of sharps.
|
17
|
+
|
18
|
+
Negative number means number of flats.
|
19
|
+
|
20
|
+
## Examples
|
21
|
+
|
22
|
+
pondize.rb -2 "g16edc"
|
23
|
+
|
24
|
+
pondize.rb 4 "g16e8a16|a4"
|
data/bin/pondize
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
module Pondize
|
2
|
+
class Runner
|
3
|
+
CIRCLE = "fcgdaeb"
|
4
|
+
|
5
|
+
ACCIDENTALS = ['l', 'n', 's']
|
6
|
+
|
7
|
+
OCTAVES = [",", "'"]
|
8
|
+
|
9
|
+
def start
|
10
|
+
if ARGV.length != 2
|
11
|
+
puts '2 arguments are needed tonality (-7..7) and string'
|
12
|
+
exit 1
|
13
|
+
end
|
14
|
+
|
15
|
+
key_signature= ARGV.first.to_i
|
16
|
+
|
17
|
+
notes_to_change = []
|
18
|
+
if key_signature > 0
|
19
|
+
notes_to_change = CIRCLE[0...key_signature]
|
20
|
+
change_to = 's'
|
21
|
+
end
|
22
|
+
|
23
|
+
if key_signature < 0
|
24
|
+
notes_to_change = CIRCLE[key_signature..-1]
|
25
|
+
change_to = 'l'
|
26
|
+
end
|
27
|
+
|
28
|
+
p notes_to_change
|
29
|
+
|
30
|
+
puts ARGV
|
31
|
+
.last
|
32
|
+
.each_char
|
33
|
+
.map
|
34
|
+
.with_index { |char, index| (notes_to_change.include?(char) && !ACCIDENTALS.include?(ARGV.last[index + 1]) ) ? "#{char}#{change_to}" : char }
|
35
|
+
.map.with_index { |char, index| (ACCIDENTALS + OCTAVES).include?(ARGV.last[index + 1]) ? char : "#{char} " }
|
36
|
+
.join('')
|
37
|
+
.gsub('n', '')
|
38
|
+
.gsub(/ (\d)/, '\1')
|
39
|
+
.gsub('< <', '<<')
|
40
|
+
.gsub('> >', '>>')
|
41
|
+
.gsub(' .', '.')
|
42
|
+
.gsub('l', 'f')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/pondize.rb
ADDED
data/pondize.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'pondize/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "pondize"
|
8
|
+
gem.version = Pondize::VERSION
|
9
|
+
gem.authors = ["Tomasz Tokarski"]
|
10
|
+
gem.email = ["tomasz@tomasztokarski.com"]
|
11
|
+
gem.description = %q{Converter for lilypond strings}
|
12
|
+
gem.summary = %q{Appends flats and sharps based on given key.}
|
13
|
+
gem.homepage = ""
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
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.add_development_dependency "rspec"
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pondize
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tomasz Tokarski
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Converter for lilypond strings
|
28
|
+
email:
|
29
|
+
- tomasz@tomasztokarski.com
|
30
|
+
executables:
|
31
|
+
- pondize
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- Gemfile
|
36
|
+
- Makefile
|
37
|
+
- README.md
|
38
|
+
- bin/pondize
|
39
|
+
- lib/pondize.rb
|
40
|
+
- lib/pondize/runner.rb
|
41
|
+
- lib/pondize/version.rb
|
42
|
+
- pondize.gemspec
|
43
|
+
homepage: ''
|
44
|
+
licenses: []
|
45
|
+
metadata: {}
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
requirements: []
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 2.4.5
|
63
|
+
signing_key:
|
64
|
+
specification_version: 4
|
65
|
+
summary: Appends flats and sharps based on given key.
|
66
|
+
test_files: []
|