note-transpose 0.1.0 → 0.1.1

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: 267fda6624a3fb3cec72a2b542a7acc962c3eb3d6a7f010135e31ca569802257
4
- data.tar.gz: d5a6fe312b3e2e88414f06708cbe256b7efd196e517661db6f10f2b2382bf702
3
+ metadata.gz: 34d45237ed688088cea474edda1664dd711f07ef1faef0de6b7d43fedb5c8935
4
+ data.tar.gz: 5e6f510857dafd65c8df058b9c58dcd6a9ab9e1c7e07a4c3f7dacfc04b509448
5
5
  SHA512:
6
- metadata.gz: 47531afdb9e94df614fdebd0460575f3414a2be19bbd1bf5ec4f3898e874ddbc12d351558e36e0cecdca75a2f3c7caefc5810df7e95b88f0fd5b7ed4d940943b
7
- data.tar.gz: a2e12cbe20818bce4beec5ffccfc02658a9eed96cb5e281d4136591d695f51460ab5f62ad0d809273764d05c25c91b239d6c148a4eb5eba8d9aa53fa458ced34
6
+ metadata.gz: 9f514f4d0e3a5e9a470247c095c2d888d14e2aebbab59cf533e9a7da8d236cce68cacb51bb6d2c60c03d0c713d4750adb579f5c376c766c8915bbd14ea760bff
7
+ data.tar.gz: 90d79c48f039580910e7251f0383781dec1811057ef40cc5754e5b5f6c7368c94e3a2cb5483d974a7e598a63f8ec941e872ccfac2c55e7ce1b624ce7f3efbac5
data/README.md CHANGED
@@ -0,0 +1,49 @@
1
+ # Note Transpose
2
+
3
+ A CLI tool to transpose notes by half steps
4
+
5
+ ## Table of Contents
6
+
7
+ - [Install](#install)
8
+ - [Usage](#usage)
9
+ - [Support](#support)
10
+ - [Contributing](#contributing)
11
+
12
+ ## Install
13
+
14
+ ❯ gem install note-transpose
15
+
16
+ ## Usage
17
+
18
+ ❯ note-transpose --help
19
+
20
+ Usage: note-transpose [-]<number half steps> <notes> [--pref-flat]
21
+ --pref-flat Always uses flat notes in output instead of sharp ones
22
+
23
+ Examples:
24
+ ❯ note-transpose +1 C G F Am
25
+ => Db Ab Gb Bbm
26
+
27
+ ❯ note-transpose 2 C G F Am
28
+ => D A G Bm
29
+
30
+ ❯ note-transpose -2 D# G7 F Am7 Cadd7
31
+ => C# F7 Eb Gm7 Bbadd7
32
+
33
+ ❯ note-transpose -2 D# G7 F Am7 Cadd7 --pref-flat
34
+ => Db F7 Eb Gm7 Bbadd7
35
+
36
+ You can even include the module in your code if you need that for some reason:
37
+
38
+ require 'note-transpose'
39
+
40
+ NoteTranspose.transpose(-3, "C", "F", "Am", "G")
41
+ # => ["A", "D", "Gbm", "E"]
42
+
43
+ ## Support
44
+
45
+ Please [open an issue](https://github.com/vyder/note-transpose/issues/new) for support.
46
+
47
+ ## Contributing
48
+
49
+ Please contribute using [Github Flow](https://guides.github.com/introduction/flow/). Create a branch, add commits, and [open a pull request](https://github.com/vyder/note-transpose/compare/).
@@ -37,7 +37,9 @@ end
37
37
 
38
38
  pref_flat = !input.delete(PREF_FLAT_OPT).nil?
39
39
 
40
+ result = NoteTranspose.transpose(half_steps, input, pref_flat: pref_flat)
41
+
40
42
  puts <<EOF
41
43
 
42
- => #{NoteTranspose.transpose(half_steps, input, pref_flat: pref_flat)}
44
+ => #{result.join(' ')}
43
45
  EOF
@@ -34,7 +34,7 @@ module NoteTranspose
34
34
  note.downcase!
35
35
  begin
36
36
  m = note.match /^[a-g](#|b)?/
37
- actual_note = m[0].downcase
37
+ actual_note = m[0]
38
38
 
39
39
  index = NOTES[:flat].find_index(actual_note)
40
40
 
@@ -57,14 +57,13 @@ module NoteTranspose
57
57
  transposed_note = source[index]
58
58
  end
59
59
 
60
- transposed_notes << note.gsub(actual_note.downcase, transposed_note.downcase).capitalize
60
+ transposed_notes << note.gsub(actual_note, transposed_note).capitalize
61
61
  rescue
62
62
  puts "'#{note.capitalize}' is not a valid note!"
63
63
  exit 1
64
64
  end
65
65
  end
66
66
 
67
- # %w(D A G Bm).join ' '
68
- transposed_notes.join ' '
67
+ transposed_notes
69
68
  end
70
69
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: note-transpose
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vidur Murali