coltrane 2.1.0 → 2.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aee4f6c4975a8d1c27e1c7d8b55bc89d58a73e65e93f9df8831cfbb68f0da689
4
- data.tar.gz: 3345417f778a55d64dc1d7bdf9348fdb98d7b60c9eb6eb1f8a8969ae6933e7ca
3
+ metadata.gz: 1af07ab95dbc675d21b3543f87c30389a38a95685d963a6f6b0af48b60fb5653
4
+ data.tar.gz: d066a320b2d192feafcc7bea90e0aaee0977c7bb5284392c555de1689afc900f
5
5
  SHA512:
6
- metadata.gz: 2c41d660a8d4d4d877a1614030196cca1c2f7b8b823795a259378b962e3f9dc5e22fbaa32086ff0d4cc830b7aa81ec7783c4e242552c94ee5bc069499bd055c5
7
- data.tar.gz: d0658a0f30b263a19f7d2f190ed4ac17906e80ee9a2c99c87f18c407bd2e2f60db5adaac96705271d761dd7b3602242cd4bf690307b4d379d3dfa2fdebfdda6f
6
+ metadata.gz: 20d76f287e71bf910e9ca40e8d586ea35e03f30d9598ab6ed7ee249b9341ad0ff99269ff73ea2dc2b945af8d97e8941bc9da87a88cba39913f71ab42c3c371ec
7
+ data.tar.gz: 3b43103aa6830b80faa581586b87099a56186dfa4bfa7e6f9fa19da388f119ae88e6a20b8a7e83de5ff2afbc7d2ad342a176a885853ce744989209095237cc67
data/README.md CHANGED
@@ -1,75 +1,53 @@
1
1
  # Coltrane
2
2
 
3
- A musical abacus written in ruby.
3
+ A music calculation library/CLI written in Ruby.
4
4
 
5
5
  ![Coltrane](img/coltrane-logo.png)
6
6
 
7
- More info, story and purpose of the library [here](https://medium.com/@pedrozath/so-i-wrote-a-library-to-help-me-compose-music-ddb4ae7c8227).
8
-
9
- Chat room for discussing the project, answering questions, etc:
10
- https://gitter.im/coltrane-music/Lobby
7
+ * [How to use this library](https://github.com/pedrozath/coltrane/wiki/Core-music-theory-library).
8
+ * [Why did I wrote this library](https://medium.com/@pedrozath/so-i-wrote-a-library-to-help-me-compose-music-ddb4ae7c8227).
9
+ * [Chat room for discussing the project, answering questions, etc.](https://gitter.im/coltrane-music/Lobby)
11
10
 
12
11
  ## CLI (Command Line Interface)
13
12
 
14
13
  ![Screenshot](img/using-coltrane.gif)
14
+ ![Screenshot](img/guitar-chords.png)
15
+
16
+ ## Features
15
17
 
16
- ### Installation
18
+ * Generate chord progressions for Jazz, Blues, Pop, or custom and see how to play them
19
+ * Seek chords, see their notes and how to play them
20
+ * Seek scales, see their notes and see how to play them
21
+ * Find chords that are common between 2 scales
22
+ * Find scales containing a chord or a set of notes
23
+ * Find possible progressions of a chord sequence
24
+ * All of the above can be seen on guitar, bass, piano or ukelele representations, no sheet music needed
17
25
 
18
- #### Ruby command
26
+ ## Installation
19
27
 
20
28
  ```bash
21
29
  $ gem install coltrane
22
30
  ```
23
31
 
24
- Once you install the gem the CLI is instaled in your system and it's ready to be used.
25
-
26
- ### Usage
27
-
28
- It allows you to query for notes and chords and display them on your favorite instrument. No sheet music reading skills needed. It also allows you to find scales with a chord and find chords shared between two scales (that is actually the main goal when I did this project).
29
-
30
- ## As a library
31
-
32
- Add this line to your application's Gemfile:
33
-
34
- ```ruby
35
- gem 'coltrane'
36
- ```
37
-
38
- And then execute:
39
- ```sh
40
- $ bundle
41
- ```
42
-
43
- The whole library will be available under the `Coltrane` module. The CLI code won't be imported to your application as default. Here's a quick example on how to use it:
44
-
45
- ```ruby
46
- require 'coltrane'
47
-
48
- puts Coltrane::Scale.major('C').sevenths.map(&:name)
49
- # => ["CM7", "Dm7", "Em7", "FM7", "G7", "Am7", "Bm7b5"]
50
-
51
- puts Coltrane::Scale.having_chord('CM7').scales.map(&:name)
52
- # => ["C Major", "G Major", "E Natural Minor", "A Natural Minor", "E Harmonic Minor", "B Flamenco"]
53
- ```
32
+ PS: Once you install the gem the CLI is instaled in your system and it's ready to be used.
54
33
 
55
34
  ## Changelog
56
35
 
57
- See the changelog [here](CHANGELOG.md)
36
+ [See the changelog](CHANGELOG.md)
58
37
 
59
38
  ## Contributing
60
39
 
61
- Install the test suite (RSpec) by running good old `bundle` command
62
-
63
- Fork the code, make your changes and maybe write a test or two. Then run:
64
-
65
- Then run:
66
- ```
67
- bundle exec rspec spec
68
- ```
40
+ We are looking for contributors. Find me on [our chatroom](https://gitter.im/coltrane-music/Lobby) if you need any kind of information.
69
41
 
70
- Make sure the specs pass and submit a PR.
42
+ ### How to contribute
43
+ 1. Fork this code
44
+ 2. Install the test suite (RSpec) by running good old `bundle` command
45
+ 3. Make your changes and maybe write a test or two.
46
+ 4. Check if specs pass `bundle exec rspec spec`
47
+ 5. Submit a PR.
71
48
 
72
49
  ## License
73
50
 
74
51
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
75
52
 
53
+ by Pedro Maciel | [twitter](http://twitter.com/pedrozath) | pedro@pedromaciel.com
data/coltrane.gemspec CHANGED
@@ -32,7 +32,7 @@ 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 'coreaudio'
35
+ # spec.add_runtime_dependency 'coreaudio'
36
36
  spec.add_runtime_dependency 'paint', '~> 2.0'
37
37
  spec.add_runtime_dependency 'color', '~> 1.8'
38
38
  spec.add_runtime_dependency 'pedrozath-mercenary', '~> 0.3'
data/exe/coltrane CHANGED
@@ -222,26 +222,26 @@ Mercenary.program(:Coltrane) do |p|
222
222
  end
223
223
  end
224
224
 
225
- p.command(:start) do |c|
226
- c.description 'Starts interactive mode'
227
- c.action do
228
- begin
229
- Coltrane::Cli.erase_config
230
- puts "\n"
231
- print Paint['coltrane ', '#F88550']
232
- cmd = gets.chomp
233
- return if %w[exit exit q quit stop].include?(cmd)
234
- puts "\n"
235
- p.go(cmd.split(' '))
236
- rescue Exception
237
- ensure
238
- p.instance_variable_set :'@config', {}
239
- end
240
- p.execute(['start'], {})
241
- end
242
- end
243
-
244
- p.default_command(:start)
225
+ # p.command(:start) do |c|
226
+ # c.description 'Starts interactive mode'
227
+ # c.action do
228
+ # begin
229
+ # Coltrane::Cli.erase_config
230
+ # puts "\n"
231
+ # print Paint['coltrane ', '#F88550']
232
+ # cmd = gets.chomp
233
+ # return if %w[exit exit q quit stop].include?(cmd)
234
+ # puts "\n"
235
+ # p.go(cmd.split(' '))
236
+ # rescue Exception
237
+ # ensure
238
+ # p.instance_variable_set :'@config', {}
239
+ # end
240
+ # p.execute(['start'], {})
241
+ # end
242
+ # end
243
+
244
+ # p.default_command(:start)
245
245
  end
246
246
 
247
247
  # rubocop:enable Metrics/BlockLength
data/lib/cli/chord.rb CHANGED
@@ -24,6 +24,8 @@ module Coltrane
24
24
  [Coltrane::Chord.new(notes: notes)]
25
25
  end
26
26
 
27
+ raise BadChordError unless @chords
28
+
27
29
  @chords.each do |chord|
28
30
  desc = "#{chord.name} chord:"
29
31
  Coltrane::Cli::Notes.new chord.notes, desc: desc
data/lib/cli/errors.rb CHANGED
@@ -28,6 +28,18 @@ module Coltrane
28
28
  'is not available at the moment.'
29
29
  end
30
30
  end
31
+
32
+ class BadScaleError < ColtraneCliError
33
+ def initialize(msg = nil)
34
+ super msg || 'Incorrect scale, please specify scale and root separated by `-`. Ex: `coltrane scale major-C'
35
+ end
36
+ end
37
+
38
+ class BadChordError < ColtraneCliError
39
+ def initialize(msg = nil)
40
+ super msg || 'Incorrect chord, please specify a set of chords separated by `-`. Ex: coltrane chord CM7'
41
+ end
42
+ end
31
43
  end
32
44
  end
33
45
 
data/lib/cli/scale.rb CHANGED
@@ -5,6 +5,7 @@ module Coltrane
5
5
  # Interfaces commands with the scales functionality
6
6
  class Scale
7
7
  def self.parse(str)
8
+ raise BadScaleError unless str && str.include?('-')
8
9
  *scale_name, tone = str.split('-')
9
10
  Coltrane::Scale.fetch(scale_name.join('_'), tone)
10
11
  end
@@ -48,15 +48,15 @@ module Coltrane
48
48
  end
49
49
 
50
50
  def next_inversion
51
- Chord.new(notes.rotate(1))
51
+ Chord.new(notes: notes.rotate(1))
52
52
  end
53
53
 
54
54
  def invert(n = 1)
55
- Chord.new(notes.rotate(n))
55
+ Chord.new(notes: notes.rotate(n))
56
56
  end
57
57
 
58
58
  def previous_inversion
59
- Chord.new(notes.rotate(-1))
59
+ Chord.new(notes: notes.rotate(-1))
60
60
  end
61
61
 
62
62
  def +(other)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Coltrane
4
- VERSION = '2.1.0'
4
+ VERSION = '2.1.5'
5
5
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coltrane
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.5
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-03-14 00:00:00.000000000 Z
11
+ date: 2018-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: coreaudio
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: paint
29
15
  requirement: !ruby/object:Gem::Requirement