coltrane 4.0.3 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/.ruby-version +1 -1
- data/.travis.yml +1 -1
- data/CHANGELOG.md +3 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +85 -83
- data/bin/bundle +23 -14
- data/bin/console +24 -12
- data/bin/gambiarra +29 -0
- data/bin/setup +27 -6
- data/bin/thor +1 -1
- data/coltrane.gemspec +2 -2
- data/exe/coltrane +2 -73
- data/lib/coltrane/.DS_Store +0 -0
- data/lib/coltrane/commands/find_scale_by_chords.rb +1 -1
- data/lib/coltrane/renderers/text_renderer/representation_guitar_chord_drawer.rb +2 -2
- data/lib/coltrane/renderers/text_renderer/representation_piano_note_set_drawer.rb +1 -1
- data/lib/coltrane/theory/interval.rb +1 -1
- data/lib/coltrane/ui.rb +4 -5
- data/lib/coltrane/ui/.DS_Store +0 -0
- data/lib/coltrane/ui/base_view.rb +9 -0
- data/lib/coltrane/ui/views/.DS_Store +0 -0
- data/lib/coltrane/ui/views/chords.rb +1 -1
- data/lib/coltrane/ui/views/custom_progression.rb +1 -1
- data/lib/coltrane/ui/views/find_chord_by_notes.rb +1 -1
- data/lib/coltrane/ui/views/find_chords_in_scale.rb +3 -1
- data/lib/coltrane/ui/views/find_common_chords_in_scales.rb +1 -1
- data/lib/coltrane/ui/views/find_progressions_from_chords.rb +1 -1
- data/lib/coltrane/ui/views/find_scale.rb +1 -1
- data/lib/coltrane/ui/views/find_scale_by_chords.rb +1 -1
- data/lib/coltrane/ui/views/find_scale_by_notes.rb +1 -1
- data/lib/coltrane/ui/views/index.rb +1 -1
- data/lib/coltrane/ui/views/notes.rb +1 -1
- data/lib/coltrane/ui/views/progressions.rb +1 -1
- data/lib/coltrane/ui/views/scales.rb +1 -1
- data/lib/coltrane/ui/views/show_chord.rb +1 -1
- data/lib/coltrane/ui/views/show_progression.rb +1 -1
- data/lib/coltrane/ui/views/show_scale.rb +1 -1
- data/lib/coltrane/version.rb +1 -1
- metadata +17 -18
- data/lib/coltrane/ui/router.rb +0 -87
- data/lib/coltrane/ui/views.rb +0 -4
- data/lib/coltrane/ui/views/view.rb +0 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c3c8660bcafcc989ef1797670510d821ab023664d7275095a6ee0fde7e93d6f
|
4
|
+
data.tar.gz: 4ff8579977fb1bd8f6a4702504d036e5dbff517936f730ba79d2c620aa2e642c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb931e46e6c45a238dc736e4b9de93fc9f56b0267163eca869add5fc091ff9a199eb94c31638b613444ff33c28e8c251709f2cfb820acc77129fdde76395167e
|
7
|
+
data.tar.gz: 7cf87180e20807855537afad00d1657fd414b00fdf64ef75210b0eb759e07c15d6f261fb776dbcc2760e6a420d6540ff36cf53e4fbb7e89751ed744131de897e
|
data/.DS_Store
CHANGED
Binary file
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.0
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,9 @@
|
|
5
5
|
- Fix chords so that they generate a barre and a non-barre version and prevent
|
6
6
|
barre chords from picking notes before the barre.
|
7
7
|
|
8
|
+
## [4.0.6]
|
9
|
+
- Change the CLI into a more intuitive one
|
10
|
+
|
8
11
|
## [4.0.0]
|
9
12
|
- Includes totally revamped, easy to use command line interface.
|
10
13
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,125 +1,127 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
coltrane (4.
|
4
|
+
coltrane (4.1.1)
|
5
5
|
activesupport (> 5.2)
|
6
|
-
cli-ui (~> 1.1)
|
7
6
|
color (~> 1.8)
|
8
7
|
dry-monads (~> 0.4)
|
8
|
+
gambiarra (~> 0)
|
9
9
|
paint (~> 2.0)
|
10
10
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
activesupport (
|
14
|
+
activesupport (6.1.1)
|
15
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
-
i18n (>=
|
17
|
-
minitest (
|
18
|
-
tzinfo (~>
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
i18n (>= 1.6, < 2)
|
17
|
+
minitest (>= 5.1)
|
18
|
+
tzinfo (~> 2.0)
|
19
|
+
zeitwerk (~> 2.3)
|
20
|
+
ast (2.4.2)
|
21
|
+
byebug (11.1.3)
|
22
|
+
cli-ui (1.4.0)
|
23
|
+
coderay (1.1.3)
|
23
24
|
color (1.8)
|
24
|
-
concurrent-ruby (1.
|
25
|
-
diff-lcs (1.
|
26
|
-
docile (1.3.
|
27
|
-
dry-core (0.
|
25
|
+
concurrent-ruby (1.1.8)
|
26
|
+
diff-lcs (1.4.4)
|
27
|
+
docile (1.3.5)
|
28
|
+
dry-core (0.5.0)
|
28
29
|
concurrent-ruby (~> 1.0)
|
29
|
-
dry-equalizer (0.
|
30
|
+
dry-equalizer (0.3.0)
|
30
31
|
dry-monads (0.4.0)
|
31
32
|
dry-core (~> 0.3, >= 0.3.3)
|
32
33
|
dry-equalizer
|
33
|
-
|
34
|
+
gambiarra (0.0.5)
|
35
|
+
activesupport (> 5.2)
|
36
|
+
cli-ui (~> 1.1)
|
37
|
+
thor (~> 1.1.0)
|
34
38
|
hike (1.2.3)
|
35
|
-
|
36
|
-
i18n (1.1.1)
|
39
|
+
i18n (1.8.8)
|
37
40
|
concurrent-ruby (~> 1.0)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
necromancer (0.4.0)
|
42
|
-
opal (0.10.5)
|
41
|
+
method_source (1.0.0)
|
42
|
+
minitest (5.14.3)
|
43
|
+
opal (0.10.6)
|
43
44
|
hike (~> 1.2)
|
44
45
|
sourcemap (~> 0.1.0)
|
45
46
|
sprockets (~> 3.1)
|
46
47
|
tilt (>= 1.4)
|
47
|
-
opal-rspec (0.6.
|
48
|
+
opal-rspec (0.6.2)
|
48
49
|
opal (>= 0.10.0, < 0.12)
|
49
|
-
paint (2.
|
50
|
-
parallel (1.
|
51
|
-
parser (
|
52
|
-
ast (~> 2.4.
|
53
|
-
pastel (0.
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
pry (~> 0.10)
|
63
|
-
rack (2.0.4)
|
50
|
+
paint (2.2.1)
|
51
|
+
parallel (1.20.1)
|
52
|
+
parser (3.0.0.0)
|
53
|
+
ast (~> 2.4.1)
|
54
|
+
pastel (0.8.0)
|
55
|
+
tty-color (~> 0.5)
|
56
|
+
pry (0.13.1)
|
57
|
+
coderay (~> 1.1)
|
58
|
+
method_source (~> 1.0)
|
59
|
+
pry-byebug (3.9.0)
|
60
|
+
byebug (~> 11.0)
|
61
|
+
pry (~> 0.13.0)
|
62
|
+
rack (2.2.3)
|
64
63
|
rainbow (3.0.0)
|
65
64
|
rake (10.5.0)
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
rspec-
|
70
|
-
|
71
|
-
rspec-
|
72
|
-
rspec-
|
65
|
+
regexp_parser (2.0.3)
|
66
|
+
rexml (3.2.4)
|
67
|
+
rspec (3.10.0)
|
68
|
+
rspec-core (~> 3.10.0)
|
69
|
+
rspec-expectations (~> 3.10.0)
|
70
|
+
rspec-mocks (~> 3.10.0)
|
71
|
+
rspec-core (3.10.1)
|
72
|
+
rspec-support (~> 3.10.0)
|
73
|
+
rspec-expectations (3.10.1)
|
73
74
|
diff-lcs (>= 1.2.0, < 2.0)
|
74
|
-
rspec-support (~> 3.
|
75
|
-
rspec-mocks (3.
|
75
|
+
rspec-support (~> 3.10.0)
|
76
|
+
rspec-mocks (3.10.2)
|
76
77
|
diff-lcs (>= 1.2.0, < 2.0)
|
77
|
-
rspec-support (~> 3.
|
78
|
-
rspec-support (3.
|
79
|
-
rubocop (
|
78
|
+
rspec-support (~> 3.10.0)
|
79
|
+
rspec-support (3.10.2)
|
80
|
+
rubocop (1.9.1)
|
80
81
|
parallel (~> 1.10)
|
81
|
-
parser (>=
|
82
|
-
powerpack (~> 0.1)
|
82
|
+
parser (>= 3.0.0.0)
|
83
83
|
rainbow (>= 2.2.2, < 4.0)
|
84
|
+
regexp_parser (>= 1.8, < 3.0)
|
85
|
+
rexml
|
86
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
84
87
|
ruby-progressbar (~> 1.7)
|
85
|
-
unicode-display_width (
|
86
|
-
|
87
|
-
|
88
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
89
|
+
rubocop-ast (1.4.1)
|
90
|
+
parser (>= 2.7.1.5)
|
91
|
+
ruby-progressbar (1.11.0)
|
92
|
+
simplecov (0.21.2)
|
88
93
|
docile (~> 1.1)
|
89
|
-
|
90
|
-
|
91
|
-
simplecov-html (0.
|
94
|
+
simplecov-html (~> 0.11)
|
95
|
+
simplecov_json_formatter (~> 0.1)
|
96
|
+
simplecov-html (0.12.3)
|
97
|
+
simplecov_json_formatter (0.1.2)
|
92
98
|
sourcemap (0.1.1)
|
93
|
-
sprockets (3.7.
|
99
|
+
sprockets (3.7.2)
|
94
100
|
concurrent-ruby (~> 1.0)
|
95
101
|
rack (> 1, < 3)
|
96
|
-
|
97
|
-
tilt (2.0.
|
98
|
-
|
99
|
-
|
100
|
-
tty-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
tzinfo (1.2.5)
|
114
|
-
thread_safe (~> 0.1)
|
115
|
-
unicode-display_width (1.3.0)
|
116
|
-
wisper (2.0.0)
|
102
|
+
thor (1.1.0)
|
103
|
+
tilt (2.0.10)
|
104
|
+
tty-color (0.6.0)
|
105
|
+
tty-cursor (0.7.1)
|
106
|
+
tty-prompt (0.23.0)
|
107
|
+
pastel (~> 0.8)
|
108
|
+
tty-reader (~> 0.8)
|
109
|
+
tty-reader (0.9.0)
|
110
|
+
tty-cursor (~> 0.7)
|
111
|
+
tty-screen (~> 0.8)
|
112
|
+
wisper (~> 2.0)
|
113
|
+
tty-screen (0.8.1)
|
114
|
+
tzinfo (2.0.4)
|
115
|
+
concurrent-ruby (~> 1.0)
|
116
|
+
unicode-display_width (2.0.0)
|
117
|
+
wisper (2.0.1)
|
118
|
+
zeitwerk (2.4.2)
|
117
119
|
|
118
120
|
PLATFORMS
|
119
121
|
ruby
|
120
122
|
|
121
123
|
DEPENDENCIES
|
122
|
-
bundler (~>
|
124
|
+
bundler (~> 2.2.5)
|
123
125
|
coltrane!
|
124
126
|
opal-rspec
|
125
127
|
pry
|
@@ -131,4 +133,4 @@ DEPENDENCIES
|
|
131
133
|
tty-prompt
|
132
134
|
|
133
135
|
BUNDLED WITH
|
134
|
-
|
136
|
+
2.2.5
|
data/bin/bundle
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
require "rubygems"
|
12
12
|
|
13
13
|
m = Module.new do
|
14
|
-
|
14
|
+
module_function
|
15
15
|
|
16
16
|
def invoked_as_script?
|
17
17
|
File.expand_path($0) == File.expand_path(__FILE__)
|
@@ -31,7 +31,7 @@ m = Module.new do
|
|
31
31
|
bundler_version = a
|
32
32
|
end
|
33
33
|
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
-
bundler_version = $1
|
34
|
+
bundler_version = $1
|
35
35
|
update_index = i
|
36
36
|
end
|
37
37
|
bundler_version
|
@@ -61,32 +61,41 @@ m = Module.new do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def bundler_version
|
64
|
-
@bundler_version ||=
|
64
|
+
@bundler_version ||=
|
65
65
|
env_var_version || cli_arg_version ||
|
66
|
-
lockfile_version
|
67
|
-
|
66
|
+
lockfile_version
|
67
|
+
end
|
68
|
+
|
69
|
+
def bundler_requirement
|
70
|
+
return "#{Gem::Requirement.default}.a" unless bundler_version
|
71
|
+
|
72
|
+
bundler_gem_version = Gem::Version.new(bundler_version)
|
73
|
+
|
74
|
+
requirement = bundler_gem_version.approximate_recommendation
|
75
|
+
|
76
|
+
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
|
77
|
+
|
78
|
+
requirement += ".a" if bundler_gem_version.prerelease?
|
79
|
+
|
80
|
+
requirement
|
68
81
|
end
|
69
82
|
|
70
83
|
def load_bundler!
|
71
84
|
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
72
85
|
|
73
|
-
|
74
|
-
activate_bundler(bundler_version.dup)
|
86
|
+
activate_bundler
|
75
87
|
end
|
76
88
|
|
77
|
-
def activate_bundler
|
78
|
-
if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
|
79
|
-
bundler_version = "< 2"
|
80
|
-
end
|
89
|
+
def activate_bundler
|
81
90
|
gem_error = activation_error_handling do
|
82
|
-
gem "bundler",
|
91
|
+
gem "bundler", bundler_requirement
|
83
92
|
end
|
84
93
|
return if gem_error.nil?
|
85
94
|
require_error = activation_error_handling do
|
86
95
|
require "bundler/version"
|
87
96
|
end
|
88
|
-
return if require_error.nil? && Gem::Requirement.new(
|
89
|
-
warn "Activating bundler (#{
|
97
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
98
|
+
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
90
99
|
exit 42
|
91
100
|
end
|
92
101
|
|
data/bin/console
CHANGED
@@ -1,17 +1,29 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'console' 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)
|
9
14
|
|
10
|
-
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
11
16
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /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"
|
16
28
|
|
17
|
-
|
29
|
+
load Gem.bin_path("wisper", "console")
|
data/bin/gambiarra
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 'gambiarra' 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, 300) =~ /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("gambiarra", "gambiarra")
|
data/bin/setup
CHANGED
@@ -1,8 +1,29 @@
|
|
1
|
-
#!/usr/bin/env
|
2
|
-
|
3
|
-
IFS=$'\n\t'
|
4
|
-
set -vx
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
5
3
|
|
6
|
-
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'setup' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
7
10
|
|
8
|
-
|
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, 300) =~ /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("wisper", "setup")
|
data/bin/thor
CHANGED
@@ -15,7 +15,7 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
|
15
15
|
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
16
|
|
17
17
|
if File.file?(bundle_binstub)
|
18
|
-
if File.read(bundle_binstub,
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
19
|
load(bundle_binstub)
|
20
20
|
else
|
21
21
|
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
data/coltrane.gemspec
CHANGED
@@ -33,10 +33,10 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.require_paths = ["lib"]
|
34
34
|
|
35
35
|
spec.add_runtime_dependency 'dry-monads', '~> 0.4'
|
36
|
+
spec.add_runtime_dependency 'gambiarra', '~> 0'
|
36
37
|
spec.add_runtime_dependency 'paint', '~> 2.0'
|
37
38
|
spec.add_runtime_dependency 'color', '~> 1.8'
|
38
|
-
spec.add_runtime_dependency 'cli-ui', '~> 1.1'
|
39
39
|
spec.add_runtime_dependency 'activesupport', '> 5.2'
|
40
|
-
spec.add_development_dependency "bundler", '~>
|
40
|
+
spec.add_development_dependency "bundler", '~> 2.2.5'
|
41
41
|
spec.add_development_dependency "rake", '~> 10.0'
|
42
42
|
end
|
data/exe/coltrane
CHANGED
@@ -6,10 +6,8 @@ require 'coltrane/ui'
|
|
6
6
|
|
7
7
|
module Coltrane
|
8
8
|
module UI
|
9
|
-
class App
|
10
|
-
|
11
|
-
|
12
|
-
def self.start(initial_route)
|
9
|
+
class App < Gambiarra::App
|
10
|
+
def setup
|
13
11
|
if ENV['COLORTERM'] == 'truecolor'
|
14
12
|
Paint.mode = 0xFFFFFF
|
15
13
|
else
|
@@ -18,75 +16,6 @@ module Coltrane
|
|
18
16
|
"Try something like iTerm2 (for macOS), VTE or Konsole (for linux) or Hyper" \
|
19
17
|
" (for Windows) and you'll see the true magic!"
|
20
18
|
end
|
21
|
-
|
22
|
-
path, params = initial_route.split(' ').each_with_object([nil, {}]) do |segment, memo|
|
23
|
-
if segment =~ /:/
|
24
|
-
key, value = segment.split(':')
|
25
|
-
memo[1].merge!([[key.to_sym, value.gsub('-', ' ')]].to_h)
|
26
|
-
else
|
27
|
-
memo[0] = [memo[0], segment].compact.join(' ')
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
response = {path: (path || ''), **params}
|
32
|
-
loop { response = app.flow(**response) }
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.app
|
36
|
-
@app ||= new
|
37
|
-
end
|
38
|
-
|
39
|
-
def initialize
|
40
|
-
@router = Router.new
|
41
|
-
end
|
42
|
-
|
43
|
-
def ask_questions(questions)
|
44
|
-
questions.map { |name, question| [name, ask_question(question)] }.to_h
|
45
|
-
end
|
46
|
-
|
47
|
-
def ask_question(question)
|
48
|
-
CLI::UI::Prompt.ask(question[:statement], options: question[:options])
|
49
|
-
end
|
50
|
-
|
51
|
-
def navigation(params)
|
52
|
-
return {} if params.empty?
|
53
|
-
CLI::UI::Prompt.ask('What to do now?') do |h|
|
54
|
-
params.each do |key, _value|
|
55
|
-
h.option("Different #{key}") { params[key] = nil }
|
56
|
-
end
|
57
|
-
h.option("Go back") { params[:path] = '' }
|
58
|
-
end
|
59
|
-
params
|
60
|
-
end
|
61
|
-
|
62
|
-
def output(response)
|
63
|
-
return unless response[:content]
|
64
|
-
puts [
|
65
|
-
nil,
|
66
|
-
"-> coltrane #{router.url}",
|
67
|
-
nil,
|
68
|
-
response[:content],
|
69
|
-
nil
|
70
|
-
]
|
71
|
-
end
|
72
|
-
|
73
|
-
def flow(response)
|
74
|
-
raise 'Response is empty' unless response
|
75
|
-
output(response)
|
76
|
-
response.delete(:content)
|
77
|
-
questions = response&.delete(:questions) || {}
|
78
|
-
response.merge!(navigation(response)) unless response.has_key?(:path) || questions.any?
|
79
|
-
response.merge!(ask_questions(questions)) if questions.any?
|
80
|
-
exit if response[:path] == 'exit'
|
81
|
-
router.get(**response.compact)
|
82
|
-
rescue => e
|
83
|
-
response.delete(:path)
|
84
|
-
puts e
|
85
|
-
retry
|
86
|
-
end
|
87
|
-
|
88
|
-
def exit
|
89
|
-
Kernel.exit(0)
|
90
19
|
end
|
91
20
|
end
|
92
21
|
end
|
data/lib/coltrane/.DS_Store
CHANGED
Binary file
|
@@ -77,7 +77,7 @@ module Coltrane
|
|
77
77
|
memo +
|
78
78
|
if chord.guitar_notes.select do |n|
|
79
79
|
n.string == s && n.fret == 0 end.any?
|
80
|
-
highlight '
|
80
|
+
highlight '• '
|
81
81
|
elsif chord.guitar_notes.select { |n| n.string == s && n.fret.nil? }.any?
|
82
82
|
alt 'x '
|
83
83
|
else
|
@@ -87,7 +87,7 @@ module Coltrane
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def render_note(found)
|
90
|
-
found ? highlight('
|
90
|
+
found ? highlight('•') : base_color('│')
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
@@ -40,7 +40,7 @@ module Coltrane
|
|
40
40
|
when :intervals then (note_set.root - note).name
|
41
41
|
when :marks then '◼ '
|
42
42
|
when :degrees then note_set.notes.degree(note).to_s.rjust(2, '0')
|
43
|
-
when :notes then note.pretty_name.to_s.ljust(2, "
|
43
|
+
when :notes then note.pretty_name.to_s.ljust(2, " ")
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
data/lib/coltrane/ui.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
require 'active_support/inflector'
|
2
1
|
require 'paint'
|
3
2
|
require 'color'
|
4
|
-
require 'cli/ui' # shopify cli
|
5
3
|
|
6
|
-
require '
|
4
|
+
require 'gambiarra'
|
7
5
|
require 'coltrane/commands'
|
8
|
-
|
9
|
-
require '
|
6
|
+
|
7
|
+
require File.expand_path('../ui/base_view', __FILE__)
|
8
|
+
views = Dir[File.expand_path('../ui/views/*', __FILE__)].map { |view| require(view) }
|
data/lib/coltrane/ui/.DS_Store
CHANGED
Binary file
|
Binary file
|
@@ -18,7 +18,9 @@ module Coltrane
|
|
18
18
|
chord_representation: {
|
19
19
|
statement: 'How do you wanna see this',
|
20
20
|
options: Commands::AvailableChordRepresentations.run
|
21
|
-
}
|
21
|
+
},
|
22
|
+
|
23
|
+
representation: nil
|
22
24
|
})
|
23
25
|
def render
|
24
26
|
scale = Commands::GetClassicScale.run(*params.values_at(:scale, :tone))
|
data/lib/coltrane/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coltrane
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Maciel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-monads
|
@@ -25,47 +25,47 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: gambiarra
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
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: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: paint
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.0'
|
48
48
|
type: :runtime
|
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: '
|
54
|
+
version: '2.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: color
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
61
|
+
version: '1.8'
|
62
62
|
type: :runtime
|
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: '1.
|
68
|
+
version: '1.8'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: activesupport
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 2.2.5
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 2.2.5
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- bin/console
|
143
143
|
- bin/erubis
|
144
144
|
- bin/flay
|
145
|
+
- bin/gambiarra
|
145
146
|
- bin/gitlab
|
146
147
|
- bin/guard
|
147
148
|
- bin/htmldiff
|
@@ -258,8 +259,8 @@ files:
|
|
258
259
|
- lib/coltrane/theory/voicing.rb
|
259
260
|
- lib/coltrane/ui.rb
|
260
261
|
- lib/coltrane/ui/.DS_Store
|
261
|
-
- lib/coltrane/ui/
|
262
|
-
- lib/coltrane/ui/views
|
262
|
+
- lib/coltrane/ui/base_view.rb
|
263
|
+
- lib/coltrane/ui/views/.DS_Store
|
263
264
|
- lib/coltrane/ui/views/chords.rb
|
264
265
|
- lib/coltrane/ui/views/custom_progression.rb
|
265
266
|
- lib/coltrane/ui/views/find_chord_by_notes.rb
|
@@ -276,7 +277,6 @@ files:
|
|
276
277
|
- lib/coltrane/ui/views/show_chord.rb
|
277
278
|
- lib/coltrane/ui/views/show_progression.rb
|
278
279
|
- lib/coltrane/ui/views/show_scale.rb
|
279
|
-
- lib/coltrane/ui/views/view.rb
|
280
280
|
- lib/coltrane/version.rb
|
281
281
|
- lib/core_ext.rb
|
282
282
|
homepage: http://github.com/pedrozath/coltrane
|
@@ -299,8 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
299
299
|
- !ruby/object:Gem::Version
|
300
300
|
version: '0'
|
301
301
|
requirements: []
|
302
|
-
|
303
|
-
rubygems_version: 2.7.7
|
302
|
+
rubygems_version: 3.0.8
|
304
303
|
signing_key:
|
305
304
|
specification_version: 4
|
306
305
|
summary: It deals with all sorts of calculations around music theory and allows for
|
data/lib/coltrane/ui/router.rb
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
module Coltrane
|
2
|
-
module UI
|
3
|
-
class Router
|
4
|
-
|
5
|
-
class Route
|
6
|
-
attr_reader :path, :view, :last
|
7
|
-
attr_accessor :params
|
8
|
-
|
9
|
-
def initialize(path, to:, with: {})
|
10
|
-
@path = path
|
11
|
-
@view = to
|
12
|
-
@params = with
|
13
|
-
end
|
14
|
-
|
15
|
-
def render(**other_params)
|
16
|
-
view.render(**params, **other_params)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
class History
|
21
|
-
attr_reader :routes
|
22
|
-
|
23
|
-
def initialize
|
24
|
-
@routes = []
|
25
|
-
end
|
26
|
-
|
27
|
-
def add(route)
|
28
|
-
@routes << route
|
29
|
-
end
|
30
|
-
|
31
|
-
def previous
|
32
|
-
routes[-2]&.path || ''
|
33
|
-
end
|
34
|
-
|
35
|
-
def current_route
|
36
|
-
routes[-1]
|
37
|
-
end
|
38
|
-
|
39
|
-
def back
|
40
|
-
routes.pop.render
|
41
|
-
end
|
42
|
-
|
43
|
-
def refresh(params={})
|
44
|
-
current_route.render(params)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
attr_reader :path, :params, :routes, :history, :url
|
49
|
-
|
50
|
-
def initialize
|
51
|
-
@routes = []
|
52
|
-
@history = History.new
|
53
|
-
|
54
|
-
draw_route '', to: Coltrane::UI::Views::Index
|
55
|
-
Views.constants.each do |view|
|
56
|
-
draw_route view.to_s.underscore.humanize.downcase, to: "Coltrane::UI::Views::#{view}".constantize
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def get(**params)
|
61
|
-
path = params.delete(:path)
|
62
|
-
@url = build_url(path || history.current_route.path, **params)
|
63
|
-
route = @routes.detect { |route| route.path == path }
|
64
|
-
return history.refresh(params) unless route
|
65
|
-
history.add(route)
|
66
|
-
route.render(**params)
|
67
|
-
end
|
68
|
-
|
69
|
-
def build_url(path, params)
|
70
|
-
[
|
71
|
-
path,
|
72
|
-
(params || {}).map do |k,v|
|
73
|
-
[k,v.gsub(' ', '-')].join(':')
|
74
|
-
end
|
75
|
-
].compact.join(' ')
|
76
|
-
end
|
77
|
-
|
78
|
-
def previous_path
|
79
|
-
history.previous
|
80
|
-
end
|
81
|
-
|
82
|
-
def draw_route(*args, **keyword_args, &block)
|
83
|
-
@routes << Route.new(*args, **keyword_args, &block)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
data/lib/coltrane/ui/views.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
module Coltrane
|
2
|
-
module UI
|
3
|
-
module Views
|
4
|
-
class View
|
5
|
-
attr_reader :params, :path
|
6
|
-
|
7
|
-
class << self
|
8
|
-
def inherited(subclass)
|
9
|
-
@questions ||= {}
|
10
|
-
subclass.instance_variable_set(:@questions, @questions.deep_dup)
|
11
|
-
end
|
12
|
-
|
13
|
-
def questions(question_data)
|
14
|
-
@questions.merge!(question_data)
|
15
|
-
end
|
16
|
-
|
17
|
-
def set_path(value)
|
18
|
-
@params[:path] = value
|
19
|
-
end
|
20
|
-
|
21
|
-
def render(**params)
|
22
|
-
remaining_questions = @questions.slice(*(@questions.keys - params.keys))
|
23
|
-
return { questions: remaining_questions, **params } if remaining_questions.any?
|
24
|
-
view = new(**params)
|
25
|
-
{ content: Commands::Render.run(view.render), **params }
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def initialize(**params)
|
30
|
-
@params = params
|
31
|
-
end
|
32
|
-
|
33
|
-
def output(object)
|
34
|
-
self.class.output(object)
|
35
|
-
end
|
36
|
-
|
37
|
-
def go_to(path, **params)
|
38
|
-
# App.router.set_next(path, **params) and return
|
39
|
-
end
|
40
|
-
|
41
|
-
def ensure_param(param_name, &block)
|
42
|
-
@params[param_name] = block.call if @params[param_name].nil?
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|