coltrane 3.0.0 → 3.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: 24aa3d9be0bb2cdecadedb502c16276e1d749cb59cd0e58be75ec92ba49e61f7
4
- data.tar.gz: b5cb786fc245433adec30d304aa13017a975bf031802082f82a43738e2e7ccfb
3
+ metadata.gz: 3e888d83950eea8d581348fb1ef12c40ab5577ea73e13398760c29a4957cdf9c
4
+ data.tar.gz: a5441c9bdfdc66d5d12426087164e2396ad49fdbc11bd179981590174104ca43
5
5
  SHA512:
6
- metadata.gz: f8364216d8f087301c4d9576f5f2722e6635a194e8bd4910d2114ff68bd79dbc1091a5a894680dc11e004063132d6add3bb5f43029dd6391b147db1ffc1c723a
7
- data.tar.gz: 05127ca168287aff2d5754eeb0f2cddce7ed27f0fa4b36bf149c1d6725b16bedc592df1a1842b0504904bf467a51e65255879175b8bd527b1d122316a5afc80e
6
+ metadata.gz: 6857cd706621735986c7ee7ca46bac9e226a6566539a93e03e9ca62c21bc6e39bd687dae45cb20845b8bbe960b9b7fc9974b8f59e5fcfdf1dc8851cd830fd7cc
7
+ data.tar.gz: 0df7240e3d1876a26bb44ca0e20b1490222da343d3c6654bb67c493ce094b7d9b6be14b13e8c47d44b8c2e703dda8a8568dd22074f4d0735f48da50fdcbb114e
data/Gemfile CHANGED
@@ -5,7 +5,6 @@ source 'https://rubygems.org'
5
5
  group :test, :development do
6
6
  gem 'pry'
7
7
  gem 'pry-byebug'
8
- gem 'pry-rescue'
9
8
  gem 'opal-rspec'
10
9
  end
11
10
 
@@ -1,22 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coltrane (3.0.0)
4
+ coltrane (3.1.0)
5
5
  color (~> 1.8)
6
6
  dry-monads (~> 0.4)
7
7
  mercenary (~> 0.3)
8
- paint (~> 2.0.1)
8
+ paint (~> 2.0)
9
+ tty-reader (~> 0.2)
9
10
 
10
11
  GEM
11
12
  remote: https://rubygems.org/
12
13
  specs:
13
- ast (2.3.0)
14
- byebug (9.1.0)
14
+ ast (2.4.0)
15
+ byebug (10.0.2)
15
16
  coderay (1.1.2)
16
17
  color (1.8)
17
18
  concurrent-ruby (1.0.5)
18
19
  diff-lcs (1.3)
19
- docile (1.1.5)
20
+ docile (1.3.0)
20
21
  dry-core (0.4.5)
21
22
  concurrent-ruby (~> 1.0)
22
23
  dry-equalizer (0.2.0)
@@ -26,7 +27,6 @@ GEM
26
27
  equatable (0.5.0)
27
28
  hike (1.2.3)
28
29
  hitimes (1.2.6)
29
- interception (0.5)
30
30
  json (2.1.0)
31
31
  mercenary (0.3.6)
32
32
  method_source (0.9.0)
@@ -40,8 +40,8 @@ GEM
40
40
  opal (>= 0.10.0, < 0.12)
41
41
  paint (2.0.1)
42
42
  parallel (1.12.1)
43
- parser (2.4.0.2)
44
- ast (~> 2.3)
43
+ parser (2.5.0.5)
44
+ ast (~> 2.4.0)
45
45
  pastel (0.7.2)
46
46
  equatable (~> 0.5.0)
47
47
  tty-color (~> 0.4.0)
@@ -49,12 +49,9 @@ GEM
49
49
  pry (0.11.3)
50
50
  coderay (~> 1.1.0)
51
51
  method_source (~> 0.9.0)
52
- pry-byebug (3.5.1)
53
- byebug (~> 9.1)
52
+ pry-byebug (3.6.0)
53
+ byebug (~> 10.0)
54
54
  pry (~> 0.10)
55
- pry-rescue (1.4.5)
56
- interception (>= 0.5)
57
- pry
58
55
  rack (2.0.4)
59
56
  rainbow (3.0.0)
60
57
  rake (10.5.0)
@@ -70,17 +67,17 @@ GEM
70
67
  rspec-mocks (3.7.0)
71
68
  diff-lcs (>= 1.2.0, < 2.0)
72
69
  rspec-support (~> 3.7.0)
73
- rspec-support (3.7.0)
74
- rubocop (0.52.1)
70
+ rspec-support (3.7.1)
71
+ rubocop (0.54.0)
75
72
  parallel (~> 1.10)
76
- parser (>= 2.4.0.2, < 3.0)
73
+ parser (>= 2.5)
77
74
  powerpack (~> 0.1)
78
75
  rainbow (>= 2.2.2, < 4.0)
79
76
  ruby-progressbar (~> 1.7)
80
77
  unicode-display_width (~> 1.0, >= 1.0.1)
81
78
  ruby-progressbar (1.9.0)
82
- simplecov (0.15.1)
83
- docile (~> 1.1.0)
79
+ simplecov (0.16.1)
80
+ docile (~> 1.1)
84
81
  json (>= 1.8, < 3)
85
82
  simplecov-html (~> 0.10.0)
86
83
  simplecov-html (0.10.2)
@@ -116,7 +113,6 @@ DEPENDENCIES
116
113
  opal-rspec
117
114
  pry
118
115
  pry-byebug
119
- pry-rescue
120
116
  rake (~> 10.0)
121
117
  rspec
122
118
  rubocop
data/README.md CHANGED
@@ -9,16 +9,12 @@ A music calculation library/CLI written in Ruby.
9
9
 
10
10
  ![Coltrane](img/coltrane-logo.png)
11
11
 
12
- * [How to use this library](https://github.com/pedrozath/coltrane/wiki/Core-music-theory-library).
13
- * [Why did I write this library](https://medium.com/@pedrozath/so-i-wrote-a-library-to-help-me-compose-music-ddb4ae7c8227).
14
- * [Chat room for discussing the project, answering questions, etc.](http://coltrane-ruby.herokuapp.com/)
15
-
16
12
  ## CLI (Command Line Interface)
17
13
 
18
14
  ![Screenshot](img/using-coltrane.gif)
19
15
  ![Screenshot](img/guitar-chords.png)
20
16
 
21
- ## Features
17
+ ### Features
22
18
 
23
19
  * Generate chord progressions for Jazz, Blues, Pop, or custom and see how to play them
24
20
  * Seek chords, see their notes and how to play them
@@ -28,6 +24,219 @@ A music calculation library/CLI written in Ruby.
28
24
  * Find possible progressions of a chord sequence
29
25
  * All of the above can be seen on guitar, bass, piano or ukelele representations, no sheet music needed
30
26
 
27
+
28
+ ### How to discover a chord name using the notes
29
+
30
+ ```sh
31
+ coltrane chords --notes C-E-G
32
+
33
+ CM: C E G
34
+
35
+ ```
36
+
37
+ To see it on guitar:
38
+
39
+ ```sh
40
+ coltrane chords --notes C-E-G --on guitar
41
+
42
+ CM:
43
+
44
+ ⬤ ⬤ ⬤ ⬤ ⬤ ⬤ ⬤ ⬤ ⬤ ⬤
45
+ ┍━┯━┯━┯━┯━┑ ┍━┯━┯━┯━┯━┑ ┍━┯━┯━┯━┯━┑ ┍━┯━┯━┯━┯━┑
46
+ 3 │ ⬤│ │ │ │ 8 │ │ │ │ ⬤│ 3 │ ⬤│ │ │ ⬤1 │ │ │ │ ⬤│
47
+ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥
48
+ 4 │ │ │ │ │ │ 9 │ │ │ │ │ │ 4 │ │ │ │ │ │ 2 │ │ ⬤│ │ │
49
+ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥
50
+ 5 │ │ ⬤│ ⬤│ 10 │ ⬤⬤│ │ │ 5 │ │ ⬤│ ⬤│ 3 ⬤⬤│ │ │ │
51
+ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥
52
+ 6 │ │ │ │ │ │ 11 │ │ │ │ │ │ 6 │ │ │ │ │ │ 4 │ │ │ │ │ │
53
+ ┕━┷━┷━┷━┷━┙ ┕━┷━┷━┷━┷━┙ ┕━┷━┷━┷━┷━┙ ┕━┷━┷━┷━┷━┙
54
+ ```
55
+
56
+ PS: It looks way better on the terminal 😒, specially on [iTerm](http://iterm2.com)
57
+
58
+ ### How to discover a Scale by providing chords
59
+
60
+ You shall provide chords separated by dashes (`--chords CM7-Dm7-EM`) or notes (`--notes C-Ab-F-G`).
61
+
62
+
63
+ For example:
64
+
65
+ ```sh
66
+ coltrane find-scale --chords E6/9-BM
67
+
68
+ Pentatonic Major C(1) C#(3) D(3) D#(1) E(5) F(0) F#(4) G(2) G#(2) A(4) A#(0) B(5)
69
+ Blues Major C(2) C#(4) D(3) D#(2) E(5) F(1) F#(4) G(2) G#(3) A(4) A#(1) B(5)
70
+ Harmonic Minor C(3) C#(5) D(2) D#(4) E(4) F(3) F#(4) G(2) G#(5) A(3) A#(3) B(4)
71
+ Hungarian Minor C(2) C#(6) D(2) D#(4) E(3) F(3) F#(5) G(1) G#(5) A(3) A#(4) B(4)
72
+ Pentatonic Minor C(1) C#(5) D(0) D#(4) E(2) F(2) F#(4) G(0) G#(5) A(1) A#(3) B(3)
73
+ Blues Minor C(2) C#(5) D(1) D#(4) E(2) F(3) F#(4) G(1) G#(5) A(2) A#(4) B(3)
74
+ Whole Tone C(3) C#(3) D(3) D#(3) E(3) F(3) F#(3) G(3) G#(3) A(3) A#(3) B(3)
75
+ Flamenco C(3) C#(4) D(2) D#(5) E(3) F(3) F#(4) G(3) G#(5) A(2) A#(4) B(4)
76
+ Major C(2) C#(4) D(4) D#(2) E(6) F(1) F#(5) G(3) G#(3) A(5) A#(1) B(6)
77
+ Natural Minor C(2) C#(6) D(1) D#(5) E(3) F(3) F#(5) G(1) G#(6) A(2) A#(4) B(4)
78
+ ```
79
+
80
+ When on terminal, the command above will highlight the Scales that have all needed notes. The number in the parenthesis show how many chord notes were included.
81
+
82
+ ### How to find common chords
83
+
84
+ You may use this command to find a chord that may serve as bridge to a different scale/key (i.e. modulation). Coltrane offers you a command to find common chords shared between both keys/scales. Here is how you use it. Say you wanna transition from C Major to D Natural Minor.
85
+
86
+ ```sh
87
+ coltrane common-chords C Major, D Natural Minor
88
+
89
+ Dm: D F A
90
+ Am: A C E
91
+ Dm7: D F A C
92
+ Am7: A C E G
93
+ CM: C E G
94
+ FM: F A C
95
+ CM6: C E G A
96
+ FM6: F A C D
97
+ C6/9: C E G A D
98
+ F6/9: F A C D G
99
+ C6/9(add11): C E G A D F
100
+ [...]
101
+ ```
102
+
103
+ You can, whenever it fits, add an `--on <instrument>` to see the output in a graphical representation:
104
+
105
+ ```sh
106
+ coltrane common-chords C Major, D Natural Minor --on piano
107
+
108
+ Dm:
109
+
110
+ ┌─┬─┬┬─┬─╥─┬─┬┬─┬┬─┬─╥─┬─┬┬─┬─╥─┬─┬┬─┬┬─┬─┐
111
+ │ │ ││ │ ║ │ ││ ││ │ ║ │ ││ │ ║ │ ││ ││ │ │
112
+ │ │ ││ │ ║ │ ││ ││ │ ║ │ ││ │ ║ │ ││ ││ │ │
113
+ │ │ ││ │ ║ │ ││ ││ │ ║ │ ││ │ ║ │ ││ ││ │ │
114
+ │ ┕╥┙┕╥┙ ║ ┕╥┙┕╥┙┕╥┙ ║ ┕╥┙┕╥┙ ║ ┕╥┙┕╥┙┕╥┙ │
115
+ │ ║ ║ ║ ║ ║ ║ ║ ║ ║ ║ ║ ║ ║ │
116
+ │ ║D♮║ ║F♮║ ║A♮║ ║ ║D♮║ ║F♮║ ║A♮║ │
117
+ └──╨──╨──╨──╨──╨──╨──╨──╨──╨──╨──╨──╨──╨──┘
118
+
119
+ Am:
120
+
121
+ ┌─┬─┬┬─┬─╥─┬─┬┬─┬┬─┬─╥─┬─┬┬─┬─╥─┬─┬┬─┬┬─┬─┐
122
+ │ │ ││ │ ║ │ ││ ││ │ ║ │ ││ │ ║ │ ││ ││ │ │
123
+ │ │ ││ │ ║ │ ││ ││ │ ║ │ ││ │ ║ │ ││ ││ │ │
124
+ │ │ ││ │ ║ │ ││ ││ │ ║ │ ││ │ ║ │ ││ ││ │ │
125
+ │ ┕╥┙┕╥┙ ║ ┕╥┙┕╥┙┕╥┙ ║ ┕╥┙┕╥┙ ║ ┕╥┙┕╥┙┕╥┙ │
126
+ │ ║ ║ ║ ║ ║ ║ ║ ║ ║ ║ ║ ║ ║ │
127
+ │C♮║ ║E♮║ ║ ║A♮║ ║C♮║ ║E♮║ ║ ║A♮║ │
128
+ └──╨──╨──╨──╨──╨──╨──╨──╨──╨──╨──╨──╨──╨──┘
129
+
130
+ [...]
131
+ ```
132
+
133
+ ### Quickly generate chord progressions
134
+
135
+ ```sh
136
+ coltrane progression jazz in A --on guitar
137
+
138
+ Bm7:
139
+
140
+ ⬤ ⬤ ⬤⬤ ⬤ ⬤⬤ ⬤ ⬤
141
+ ┍━┯━┯━┯━┯━┑ ┍━┯━┯━┯━┯━┑ ┍━┯━┯━┯━┯━┑ ┍━┯━┯━┯━┯━┑
142
+ 2 ⬤⬤│ ⬤│ ⬤2 ⬤│ │ │ │ ⬤2 ⬤│ │ │ │ ⬤9 │ │ ⬤│ │ │
143
+ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥
144
+ 3 │ │ │ │ │ │ 3 │ │ │ │ │ │ 3 │ │ │ │ ⬤│ 10 ⬤│ │ │ │ ⬤
145
+ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥
146
+ 4 │ │ │ │ │ │ 4 │ │ │ ⬤│ │ 4 │ │ │ ⬤│ │ 11 │ │ │ ⬤│ │
147
+ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥
148
+ 5 │ │ │ │ │ │ 5 │ │ │ │ │ │ 5 │ │ │ │ │ │ 12 │ │ │ │ │ │
149
+ ┕━┷━┷━┷━┷━┙ ┕━┷━┷━┷━┷━┙ ┕━┷━┷━┷━┷━┙ ┕━┷━┷━┷━┷━┙
150
+
151
+
152
+ E7:
153
+
154
+ ⬤ ⬤ ⬤⬤ ⬤⬤ ⬤ ⬤⬤ ⬤ ⬤ ⬤
155
+ ┍━┯━┯━┯━┯━┑ ┍━┯━┯━┯━┯━┑ ┍━┯━┯━┯━┯━┑ ┍━┯━┯━┯━┯━┑
156
+ 1 │ │ │ ⬤│ │ 6 │ │ ⬤│ │ │ 4 │ │ │ ⬤│ │ 1 │ │ │ ⬤│ │
157
+ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥
158
+ 2 │ ⬤│ │ │ │ 7 ⬤⬤│ ⬤│ │ 5 │ ⬤│ │ │ │ 2 │ ⬤│ │ │ │
159
+ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥
160
+ 3 │ │ │ │ │ │ 8 │ │ │ │ │ │ 6 │ │ ⬤│ │ │ 3 │ │ │ │ ⬤│
161
+ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥
162
+ 4 │ │ │ │ │ │ 9 │ │ │ │ │ │ 7 │ │ │ │ │ │ 4 │ │ │ │ │ │
163
+ ┕━┷━┷━┷━┷━┙ ┕━┷━┷━┷━┷━┙ ┕━┷━┷━┷━┷━┙ ┕━┷━┷━┷━┷━┙
164
+
165
+
166
+ A7:
167
+
168
+ ⬤⬤ ⬤ ⬤ ⬤⬤ ⬤ ⬤⬤ ⬤⬤ ⬤
169
+ ┍━┯━┯━┯━┯━┑ ┍━┯━┯━┯━┯━┑ ┍━┯━┯━┯━┯━┑ ┍━┯━┯━┯━┯━┑
170
+ 10 │ │ │ │ ⬤│ 5 │ │ ⬤│ ⬤│ 5 │ │ ⬤│ ⬤⬤9 │ │ │ │ │ ⬤
171
+ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥
172
+ 11 │ │ ⬤│ │ │ 6 │ │ │ ⬤│ │ 6 │ │ │ ⬤│ │ 10 │ │ │ │ ⬤│
173
+ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥
174
+ 12 │ │ │ │ │ │ 7 │ │ │ │ │ │ 7 │ │ │ │ │ │ 11 │ │ ⬤│ │ │
175
+ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥ ┝━┿━┿━┿━┿━┥
176
+ 13 │ │ │ │ │ │ 8 │ │ │ │ │ │ 8 │ │ │ │ │ │ 12 │ │ │ │ │ │
177
+ ┕━┷━┷━┷━┷━┙ ┕━┷━┷━┷━┷━┙ ┕━┷━┷━┷━┷━┙ ┕━┷━┷━┷━┷━┙
178
+ ```
179
+
180
+ You can say Jazz, Pop, Blues, etc.
181
+ You can also generate progressions in a custom way, using roman numerals:
182
+
183
+ ```sh
184
+ coltrane progression I-vi-V-iidim in D
185
+ ```
186
+
187
+ ### Generate fretboard sheets for improvising
188
+
189
+ Sometimes you wanna see the scale on guitar for improvising:
190
+
191
+ ```sh
192
+
193
+ coltrane scale F pentatonic --on guitar
194
+
195
+ F Pentatonic Major:
196
+
197
+ E -- | F -- G -- A -- -- C -- D -- -- F -- G -- A -- -- C -- D --
198
+ A A | -- -- C -- D -- -- F -- G -- A -- -- C -- D -- -- F -- G --
199
+ D D | -- -- F -- G -- A -- -- C -- D -- -- F -- G -- A -- -- C --
200
+ G G | -- A -- -- C -- D -- -- F -- G -- A -- -- C -- D -- -- F --
201
+ B -- | C -- D -- -- F -- G -- A -- -- C -- D -- -- F -- G -- A --
202
+ E -- | F -- G -- A -- -- C -- D -- -- F -- G -- A -- -- C -- D --
203
+
204
+ 03 05 07 09 12 15 17 19
205
+ ```
206
+
207
+ The same work for `--on piano`, `--on bass`, `-- on ukulele`, etc.
208
+
209
+ You can also see the chords by typing `--tertians <size>` or `--chords [size]`. `--tertians` will give you chords by sequential thirds while `--chords` will give you all chords with supplied size (or simply all if empty).
210
+
211
+ ProTip: You can force the guitar frets visualization for chords too using the `--on guitar_frets` option.
212
+
213
+ ### Finding the progression of a chord sequence
214
+
215
+ Perhaps this is the most complex operation that Coltrane performs. It searches the chords on all known scales, generates the progression notation and print in, sorted by notes left out. That is because most songs, specially knowadays, may use chords that contain notes which are outside of that scale.
216
+
217
+ This command us to analyze songs and discover what they have in common, even tho they have different notes.
218
+
219
+ Let's say we want to find the possible progressions of Red Hot Chili Pepper's Otherside:
220
+
221
+ ```sh
222
+ coltrane find-progression Am-F-C-G
223
+
224
+ i-VI-III-VII in A Natural Minor (0 notes out)
225
+ vi-IV-I-V in C Major (0 notes out)
226
+ iii-I-V-II in F Major (1 notes out)
227
+ vi-III-VII-IV in D Hungarian Minor (1 notes out)
228
+ v-III-VII-IV in D Natural Minor (1 notes out)
229
+ ii-VII-IV-I in G Hungarian Minor (2 notes out)
230
+ ii-VII-IV-I in G Natural Minor (2 notes out)
231
+ vii-V-II-VI in A# Major (2 notes out)
232
+ iv-II-V-III in D Pentatonic Minor (2 notes out)
233
+ v-II-VI-III in D Blues Minor (2 notes out)
234
+ iii-I-IV-II in F Pentatonic Major (2 notes out)
235
+ iv-I-V-II in F Blues Major (2 notes out)
236
+ ```
237
+
238
+ PS: Notice that vi-IV-I-V is the well known I-V-vi-IV progression, [used in a lot of songs](http://www.wikiwand.com/en/List_of_songs_containing_the_I–V–vi–IV_progression).
239
+
31
240
  ## Installation
32
241
 
33
242
  ```bash
@@ -36,9 +245,18 @@ $ gem install coltrane
36
245
 
37
246
  PS: Once you install the gem the CLI is instaled in your system and it's ready to be used.
38
247
 
39
- ## Changelog
248
+ ## Any questions? Feature requests? Bugs?
40
249
 
41
- [See the changelog](CHANGELOG.md)
250
+ 1. Find me on [Twitter](https://twitter.com/pedrozath). I'll be glad to answer.
251
+ 2. Open an issue.
252
+ 3. Join [our chatroom](http://coltrane-ruby.herokuapp.com/)
253
+
254
+ ## Extra
255
+
256
+ * [How to use the Core Theory library](https://github.com/pedrozath/coltrane/wiki/Core-music-theory-library).
257
+ * [Why did I write this library](https://medium.com/@pedrozath/so-i-wrote-a-library-to-help-me-compose-music-ddb4ae7c8227).
258
+ * [Chat room for discussing the project, answering questions, etc.](http://coltrane-ruby.herokuapp.com/)
259
+ * [See the changelog](CHANGELOG.md)
42
260
 
43
261
  ## Contributing
44
262
 
data/Rakefile CHANGED
@@ -2,6 +2,4 @@
2
2
  task :default => :spec
3
3
 
4
4
  require 'opal/rspec/rake_task'
5
- Opal::RSpec::RakeTask.new(:opal_specs) do |server, task|
6
- task.pattern = 'spec/{coltrane_instruments,lib}/**/*_spec.rb'
7
- end
5
+ Opal::RSpec::RakeTask.new(:default)
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
5
+
6
+ require 'tty-reader'
7
+ require 'paint'
8
+
9
+ Class.new do
10
+ attr_reader :reader
11
+
12
+ def initialize
13
+ @reader = TTY::Reader.new(interrupt: :exit)
14
+ shell
15
+ end
16
+
17
+ def quit_commands
18
+ /quit|exit/
19
+ end
20
+
21
+ def command
22
+ reader.read_line(Paint['coltrane ', '#FF5A00'])
23
+ end
24
+
25
+ def shell
26
+ command
27
+ .tap { |cmd| exit if cmd =~ quit_commands }
28
+ .yield_self { |cmd| %x{coltrane #{cmd}}}
29
+ .yield_self { |response| puts ["\n", response, "\n"].join }
30
+ shell
31
+ end
32
+ end.new
@@ -32,10 +32,11 @@ Gem::Specification.new do |spec|
32
32
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
33
  spec.require_paths = ["lib"]
34
34
 
35
- spec.add_runtime_dependency 'dry-monads', '~> 0.4'
36
- spec.add_runtime_dependency 'paint', '~> 2.0.1'
37
- spec.add_runtime_dependency 'color', '~> 1.8'
38
- spec.add_runtime_dependency 'mercenary', '~> 0.3'
39
- spec.add_development_dependency "bundler", '~> 1.14'
40
- spec.add_development_dependency "rake", '~> 10.0'
35
+ spec.add_runtime_dependency 'tty-reader', '~> 0.2'
36
+ spec.add_runtime_dependency 'dry-monads', '~> 0.4'
37
+ spec.add_runtime_dependency 'paint', '~> 2.0'
38
+ spec.add_runtime_dependency 'color', '~> 1.8'
39
+ spec.add_runtime_dependency 'mercenary', '~> 0.3'
40
+ spec.add_development_dependency "bundler", '~> 1.14'
41
+ spec.add_development_dependency "rake", '~> 10.0'
41
42
  end
@@ -26,11 +26,16 @@ Mercenary.program(:Coltrane) do |p|
26
26
 
27
27
  p.command(:about) do |c|
28
28
  c.description 'Shows this screen'
29
+ c.action { puts p }
30
+ end
31
+
32
+ p.command(:shell) do |c|
33
+ c.description 'Starts an interactive shell'
29
34
  c.action do
30
- puts p
35
+ system File.expand_path('../../bin', __FILE__) + "/coltrane-interactive"
31
36
  end
32
37
  end
33
38
 
34
- p.default_command(:about)
39
+ p.default_command(:shell)
35
40
  end
36
41
 
@@ -65,7 +65,6 @@ module Coltrane
65
65
  c.alias(:chord)
66
66
  c.syntax 'chords [<chord-name>] [--on <instrument>]'
67
67
  c.description 'Shows the given chord. Ex: coltrane chord Cmaj7 --on piano'
68
- c.alias(:chords)
69
68
  c.option :notes, '--notes C-D-E', 'finds chords with those notes, ' \
70
69
  'provided they are separated by dashes'
71
70
 
@@ -18,7 +18,7 @@ module Coltrane
18
18
 
19
19
  ALTERATIONS = {
20
20
  'b' => -1,
21
- '#' => 1
21
+ '#' => +1
22
22
  }.freeze
23
23
 
24
24
  def initialize(arg)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Coltrane
4
- VERSION = '3.0.0'
4
+ VERSION = '3.1.0'
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coltrane
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Maciel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-02 00:00:00.000000000 Z
11
+ date: 2018-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: tty-reader
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.2'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: dry-monads
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -30,14 +44,14 @@ dependencies:
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: 2.0.1
47
+ version: '2.0'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: 2.0.1
54
+ version: '2.0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: color
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -123,6 +137,7 @@ files:
123
137
  - bin/byebug
124
138
  - bin/coderay
125
139
  - bin/coltrane
140
+ - bin/coltrane-interactive
126
141
  - bin/console
127
142
  - bin/erubis
128
143
  - bin/flay