coltrane 0.0.2 → 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 +5 -5
- data/.gitignore +2 -0
- data/.ruby-version +1 -0
- data/Gemfile +15 -10
- data/Gemfile.lock +47 -128
- data/README.md +30 -8
- data/Rakefile +0 -4
- data/bin/bundle +105 -0
- data/bin/byebug +29 -0
- data/bin/coderay +12 -0
- data/bin/coltrane +25 -7
- data/bin/htmldiff +12 -0
- data/bin/kill-pry-rescue +12 -0
- data/bin/ldiff +12 -0
- data/bin/pry +12 -0
- data/bin/rake +12 -0
- data/bin/rescue +12 -0
- data/bin/rspec +12 -0
- data/bin/rubocop +12 -0
- data/bin/ruby-parse +12 -0
- data/bin/ruby-rewrite +12 -0
- data/exe/coltrane +173 -0
- data/lib/cli/bass_guitar.rb +9 -0
- data/lib/cli/chord.rb +24 -0
- data/lib/cli/errors.rb +28 -0
- data/lib/cli/guitar.rb +55 -0
- data/lib/cli/notes.rb +18 -0
- data/lib/cli/piano.rb +54 -0
- data/lib/cli/representation.rb +47 -0
- data/lib/cli/scale.rb +48 -0
- data/lib/cli/text.rb +13 -0
- data/lib/cli/ukulele.rb +11 -0
- data/lib/coltrane-cli.rb +12 -0
- data/lib/coltrane.rb +16 -31
- data/lib/coltrane/cache.rb +34 -0
- data/lib/coltrane/chord.rb +28 -41
- data/lib/coltrane/chord_quality.rb +14 -39
- data/lib/coltrane/classic_progressions.rb +37 -0
- data/lib/coltrane/classic_scales.rb +92 -118
- data/lib/coltrane/errors.rb +54 -0
- data/lib/coltrane/interval.rb +25 -17
- data/lib/coltrane/interval_sequence.rb +57 -27
- data/lib/coltrane/note.rb +44 -30
- data/lib/coltrane/note_set.rb +37 -22
- data/lib/coltrane/piano_representation.rb +0 -58
- data/lib/coltrane/pitch.rb +12 -3
- data/lib/coltrane/progression.rb +31 -0
- data/lib/coltrane/qualities.rb +115 -114
- data/lib/coltrane/roman_chord.rb +36 -0
- data/lib/coltrane/scale.rb +85 -77
- data/lib/coltrane/version.rb +1 -1
- data/lib/core_ext.rb +12 -0
- data/pkg/coltrane-0.0.2.gem +0 -0
- metadata +27 -14
- data/lib/coltrane/essential_guitar_chords.rb +0 -82
- data/lib/coltrane/fret_set.rb +0 -0
- data/lib/coltrane/guitar.rb +0 -15
- data/lib/coltrane/guitar_chord.rb +0 -50
- data/lib/coltrane/guitar_chord_finder.rb +0 -98
- data/lib/coltrane/guitar_note.rb +0 -50
- data/lib/coltrane/guitar_note_set.rb +0 -61
- data/lib/coltrane/guitar_representation.rb +0 -96
- data/lib/coltrane/guitar_string.rb +0 -52
- data/lib/coltrane/scale_cache.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 512414fa0854b3ef1215953cbea3d5c545da0cef7978f098b4fbb945ea490ef0
|
4
|
+
data.tar.gz: a9b854252e121e7f1a3a74b3c51b9470cdb8205f7f6328247a6b213e3e60f1c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa8eb9cc7e52398c4566717d86ff2291fc2793b1a5348c5f495acb7dc932ad1956f584791a5f0992e7e8cf5edb6bfc6f014fff9a20e34f69280319427dbcbf63
|
7
|
+
data.tar.gz: '09eb103f1df2e6c7294b74c2f21e9690fa1a21d1ce8c6da5ea7b9407614c44643d093241f0b5d964849c32972b05db57ab59579f8b6549ff2243bdb4422646cf'
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.0
|
data/Gemfile
CHANGED
@@ -2,16 +2,21 @@
|
|
2
2
|
|
3
3
|
source 'https://rubygems.org'
|
4
4
|
|
5
|
-
gem '
|
6
|
-
gem 'standalone_migrations', '5.2.0'
|
5
|
+
gem 'facets', require: false
|
7
6
|
|
8
|
-
|
9
|
-
gem '
|
10
|
-
gem '
|
11
|
-
gem '
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
gem '
|
7
|
+
group :cli do
|
8
|
+
gem 'paint'
|
9
|
+
gem 'chroma'
|
10
|
+
gem 'mercenary'
|
11
|
+
end
|
12
|
+
|
13
|
+
group :test do
|
14
|
+
gem 'rspec'
|
15
|
+
gem 'pry'
|
16
|
+
gem 'pry-byebug'
|
17
|
+
gem 'pry-rescue'
|
18
|
+
gem 'simplecov', require: false
|
19
|
+
gem 'rubocop', require: false
|
20
|
+
end
|
16
21
|
|
17
22
|
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,164 +1,83 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
coltrane (0.0
|
4
|
+
coltrane (1.0.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
actionpack (5.1.0)
|
10
|
-
actionview (= 5.1.0)
|
11
|
-
activesupport (= 5.1.0)
|
12
|
-
rack (~> 2.0)
|
13
|
-
rack-test (~> 0.6.3)
|
14
|
-
rails-dom-testing (~> 2.0)
|
15
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
16
|
-
actionview (5.1.0)
|
17
|
-
activesupport (= 5.1.0)
|
18
|
-
builder (~> 3.1)
|
19
|
-
erubi (~> 1.4)
|
20
|
-
rails-dom-testing (~> 2.0)
|
21
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
22
|
-
activemodel (5.1.0)
|
23
|
-
activesupport (= 5.1.0)
|
24
|
-
activerecord (5.1.0)
|
25
|
-
activemodel (= 5.1.0)
|
26
|
-
activesupport (= 5.1.0)
|
27
|
-
arel (~> 8.0)
|
28
|
-
activesupport (5.1.0)
|
29
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
30
|
-
i18n (~> 0.7)
|
31
|
-
minitest (~> 5.1)
|
32
|
-
tzinfo (~> 1.1)
|
33
|
-
arel (8.0.0)
|
34
9
|
ast (2.3.0)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
coderay (1.1.1)
|
39
|
-
concurrent-ruby (1.0.5)
|
40
|
-
debug_inspector (0.0.2)
|
10
|
+
byebug (9.1.0)
|
11
|
+
chroma (0.2.0)
|
12
|
+
coderay (1.1.2)
|
41
13
|
diff-lcs (1.3)
|
42
|
-
|
43
|
-
|
44
|
-
formatador (0.2.5)
|
45
|
-
guard (2.14.1)
|
46
|
-
formatador (>= 0.2.4)
|
47
|
-
listen (>= 2.7, < 4.0)
|
48
|
-
lumberjack (~> 1.0)
|
49
|
-
nenv (~> 0.1)
|
50
|
-
notiffany (~> 0.0)
|
51
|
-
pry (>= 0.9.12)
|
52
|
-
shellany (~> 0.0)
|
53
|
-
thor (>= 0.18.1)
|
54
|
-
guard-compat (1.2.1)
|
55
|
-
guard-rspec (4.7.3)
|
56
|
-
guard (~> 2.1)
|
57
|
-
guard-compat (~> 1.1)
|
58
|
-
rspec (>= 2.99.0, < 4.0)
|
59
|
-
i18n (0.8.1)
|
14
|
+
docile (1.1.5)
|
15
|
+
facets (3.1.0)
|
60
16
|
interception (0.5)
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
method_source (0.8.2)
|
69
|
-
mini_portile2 (2.1.0)
|
70
|
-
minitest (5.10.1)
|
71
|
-
nenv (0.3.0)
|
72
|
-
nokogiri (1.7.1)
|
73
|
-
mini_portile2 (~> 2.1.0)
|
74
|
-
notiffany (0.1.1)
|
75
|
-
nenv (~> 0.1)
|
76
|
-
shellany (~> 0.0)
|
77
|
-
paint (2.0.0)
|
78
|
-
parser (2.4.0.0)
|
79
|
-
ast (~> 2.2)
|
17
|
+
json (2.1.0)
|
18
|
+
mercenary (0.3.6)
|
19
|
+
method_source (0.9.0)
|
20
|
+
paint (2.0.1)
|
21
|
+
parallel (1.12.1)
|
22
|
+
parser (2.4.0.2)
|
23
|
+
ast (~> 2.3)
|
80
24
|
powerpack (0.1.1)
|
81
|
-
pry (0.
|
25
|
+
pry (0.11.3)
|
82
26
|
coderay (~> 1.1.0)
|
83
|
-
method_source (~> 0.
|
84
|
-
|
27
|
+
method_source (~> 0.9.0)
|
28
|
+
pry-byebug (3.5.1)
|
29
|
+
byebug (~> 9.1)
|
30
|
+
pry (~> 0.10)
|
85
31
|
pry-rescue (1.4.5)
|
86
32
|
interception (>= 0.5)
|
87
33
|
pry
|
88
|
-
|
89
|
-
binding_of_caller (>= 0.7)
|
90
|
-
pry (>= 0.9.11)
|
91
|
-
rack (2.0.1)
|
92
|
-
rack-test (0.6.3)
|
93
|
-
rack (>= 1.0)
|
94
|
-
rails-dom-testing (2.0.2)
|
95
|
-
activesupport (>= 4.2.0, < 6.0)
|
96
|
-
nokogiri (~> 1.6)
|
97
|
-
rails-html-sanitizer (1.0.3)
|
98
|
-
loofah (~> 2.0)
|
99
|
-
railties (5.1.0)
|
100
|
-
actionpack (= 5.1.0)
|
101
|
-
activesupport (= 5.1.0)
|
102
|
-
method_source
|
103
|
-
rake (>= 0.8.7)
|
104
|
-
thor (>= 0.18.1, < 2.0)
|
105
|
-
rainbow (2.2.2)
|
106
|
-
rake
|
34
|
+
rainbow (3.0.0)
|
107
35
|
rake (10.5.0)
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
rspec-
|
114
|
-
|
115
|
-
rspec-core (3.6.0)
|
116
|
-
rspec-support (~> 3.6.0)
|
117
|
-
rspec-expectations (3.6.0)
|
36
|
+
rspec (3.7.0)
|
37
|
+
rspec-core (~> 3.7.0)
|
38
|
+
rspec-expectations (~> 3.7.0)
|
39
|
+
rspec-mocks (~> 3.7.0)
|
40
|
+
rspec-core (3.7.1)
|
41
|
+
rspec-support (~> 3.7.0)
|
42
|
+
rspec-expectations (3.7.0)
|
118
43
|
diff-lcs (>= 1.2.0, < 2.0)
|
119
|
-
rspec-support (~> 3.
|
120
|
-
rspec-mocks (3.
|
44
|
+
rspec-support (~> 3.7.0)
|
45
|
+
rspec-mocks (3.7.0)
|
121
46
|
diff-lcs (>= 1.2.0, < 2.0)
|
122
|
-
rspec-support (~> 3.
|
123
|
-
rspec-support (3.
|
124
|
-
rubocop (0.
|
125
|
-
|
47
|
+
rspec-support (~> 3.7.0)
|
48
|
+
rspec-support (3.7.0)
|
49
|
+
rubocop (0.52.1)
|
50
|
+
parallel (~> 1.10)
|
51
|
+
parser (>= 2.4.0.2, < 3.0)
|
126
52
|
powerpack (~> 0.1)
|
127
|
-
rainbow (>=
|
53
|
+
rainbow (>= 2.2.2, < 4.0)
|
128
54
|
ruby-progressbar (~> 1.7)
|
129
55
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
130
|
-
ruby-progressbar (1.
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
railties (>= 4.2.7, < 5.2.0)
|
138
|
-
rake (~> 10.0)
|
139
|
-
thor (0.19.4)
|
140
|
-
thread_safe (0.3.6)
|
141
|
-
tzinfo (1.2.3)
|
142
|
-
thread_safe (~> 0.1)
|
143
|
-
unicode-display_width (1.2.1)
|
56
|
+
ruby-progressbar (1.9.0)
|
57
|
+
simplecov (0.15.1)
|
58
|
+
docile (~> 1.1.0)
|
59
|
+
json (>= 1.8, < 3)
|
60
|
+
simplecov-html (~> 0.10.0)
|
61
|
+
simplecov-html (0.10.2)
|
62
|
+
unicode-display_width (1.3.0)
|
144
63
|
|
145
64
|
PLATFORMS
|
146
65
|
ruby
|
147
66
|
|
148
67
|
DEPENDENCIES
|
149
68
|
bundler (~> 1.14)
|
69
|
+
chroma
|
150
70
|
coltrane!
|
151
|
-
|
152
|
-
|
71
|
+
facets
|
72
|
+
mercenary
|
153
73
|
paint
|
154
74
|
pry
|
75
|
+
pry-byebug
|
155
76
|
pry-rescue
|
156
|
-
pry-stack_explorer
|
157
77
|
rake (~> 10.0)
|
158
78
|
rspec
|
159
79
|
rubocop
|
160
|
-
|
161
|
-
standalone_migrations (= 5.2.0)
|
80
|
+
simplecov
|
162
81
|
|
163
82
|
BUNDLED WITH
|
164
|
-
1.
|
83
|
+
1.16.1
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# Coltrane
|
2
2
|
|
3
|
-
|
3
|
+
A musical abacus written in ruby.
|
4
4
|
|
5
|
-
|
5
|
+
More info, story and purpose of the library:
|
6
|
+
https://medium.com/@pedrozath/so-i-wrote-a-library-to-help-me-compose-music-ddb4ae7c8227
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
@@ -20,20 +21,41 @@ Or install it yourself as:
|
|
20
21
|
|
21
22
|
$ gem install coltrane
|
22
23
|
|
23
|
-
##
|
24
|
+
## CLI (Command Line Interface)
|
24
25
|
|
25
|
-
|
26
|
+
When you install the gem on your system, you automatically gain access to the
|
27
|
+
CLI.
|
26
28
|
|
27
|
-
|
29
|
+
You can run it on terminal:
|
28
30
|
|
29
|
-
|
31
|
+
```bash
|
32
|
+
$ coltrane help
|
33
|
+
```
|
34
|
+
|
35
|
+
## Roadmap
|
30
36
|
|
31
|
-
|
37
|
+
There's a lot of things that need to be done on this library, specially on the CLI:
|
38
|
+
|
39
|
+
+ Refactor the CLI into a more succinct and elegantly organized architecture
|
40
|
+
+ Amplify the test coverage
|
41
|
+
+ Move Scale#chords method to NoteSet
|
42
|
+
+ Write tests for the caching
|
43
|
+
+ Write up a caching cleaning command
|
44
|
+
+ Include CLI commands to output chord progressions
|
45
|
+
+ Include a command to output a pretty HTML document containing the query
|
32
46
|
|
33
47
|
## Contributing
|
34
48
|
|
35
|
-
|
49
|
+
Install the test suite (RSpec) by running good old `bundle` command
|
50
|
+
|
51
|
+
Fork the code, make your changes and maybe write a test or two. Then run:
|
52
|
+
|
53
|
+
Then run:
|
54
|
+
```
|
55
|
+
bundle exec rspec spec
|
56
|
+
```
|
36
57
|
|
58
|
+
Make sure the specs pass and submit a PR.
|
37
59
|
|
38
60
|
## License
|
39
61
|
|
data/Rakefile
CHANGED
data/bin/bundle
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'bundle' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "rubygems"
|
12
|
+
|
13
|
+
m = Module.new do
|
14
|
+
module_function
|
15
|
+
|
16
|
+
def invoked_as_script?
|
17
|
+
File.expand_path($0) == File.expand_path(__FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
def env_var_version
|
21
|
+
ENV["BUNDLER_VERSION"]
|
22
|
+
end
|
23
|
+
|
24
|
+
def cli_arg_version
|
25
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
+
bundler_version = nil
|
28
|
+
update_index = nil
|
29
|
+
ARGV.each_with_index do |a, i|
|
30
|
+
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
31
|
+
bundler_version = a
|
32
|
+
end
|
33
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
+
bundler_version = $1 || ">= 0.a"
|
35
|
+
update_index = i
|
36
|
+
end
|
37
|
+
bundler_version
|
38
|
+
end
|
39
|
+
|
40
|
+
def gemfile
|
41
|
+
gemfile = ENV["BUNDLE_GEMFILE"]
|
42
|
+
return gemfile if gemfile && !gemfile.empty?
|
43
|
+
|
44
|
+
File.expand_path("../../Gemfile", __FILE__)
|
45
|
+
end
|
46
|
+
|
47
|
+
def lockfile
|
48
|
+
lockfile =
|
49
|
+
case File.basename(gemfile)
|
50
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
|
51
|
+
else "#{gemfile}.lock"
|
52
|
+
end
|
53
|
+
File.expand_path(lockfile)
|
54
|
+
end
|
55
|
+
|
56
|
+
def lockfile_version
|
57
|
+
return unless File.file?(lockfile)
|
58
|
+
lockfile_contents = File.read(lockfile)
|
59
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
60
|
+
Regexp.last_match(1)
|
61
|
+
end
|
62
|
+
|
63
|
+
def bundler_version
|
64
|
+
@bundler_version ||= begin
|
65
|
+
env_var_version || cli_arg_version ||
|
66
|
+
lockfile_version || "#{Gem::Requirement.default}.a"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def load_bundler!
|
71
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
72
|
+
|
73
|
+
# must dup string for RG < 1.8 compatibility
|
74
|
+
activate_bundler(bundler_version.dup)
|
75
|
+
end
|
76
|
+
|
77
|
+
def activate_bundler(bundler_version)
|
78
|
+
if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
|
79
|
+
bundler_version = "< 2"
|
80
|
+
end
|
81
|
+
gem_error = activation_error_handling do
|
82
|
+
gem "bundler", bundler_version
|
83
|
+
end
|
84
|
+
return if gem_error.nil?
|
85
|
+
require_error = activation_error_handling do
|
86
|
+
require "bundler/version"
|
87
|
+
end
|
88
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
89
|
+
warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`"
|
90
|
+
exit 42
|
91
|
+
end
|
92
|
+
|
93
|
+
def activation_error_handling
|
94
|
+
yield
|
95
|
+
nil
|
96
|
+
rescue StandardError, LoadError => e
|
97
|
+
e
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
m.load_bundler!
|
102
|
+
|
103
|
+
if m.invoked_as_script?
|
104
|
+
load Gem.bin_path("bundler", "bundle")
|
105
|
+
end
|
data/bin/byebug
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'byebug' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("byebug", "byebug")
|