song_pro 0.1.5 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +21 -0
- data/.ruby-version +1 -1
- data/.travis.yml +4 -2
- data/Gemfile.lock +19 -37
- data/README.md +23 -18
- data/lib/song_pro.rb +9 -3
- data/lib/song_pro/line.rb +8 -4
- data/lib/song_pro/version.rb +1 -1
- data/song_pro.gemspec +4 -9
- metadata +14 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d51559bf23b8581a8dcba60800e39aab562439dc6e46ddce858feb46a4b86be
|
4
|
+
data.tar.gz: 496d9b028ace33732b0a420b271feaa2cdf274f06e725fc5747968cd033ea325
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89ba491f7a8468cbe8746539b682461d00542d52bb17f6b68c622381c0e2399ed57b2714faa78e8496c24244bf5f623e867c51264f4a042c2f836e9162f29ca9
|
7
|
+
data.tar.gz: 36b35726800500b43630430e0b17a0cbe93a8657936eef2b8ebc19878887b9d280b8647f520efbfa8afe79b47055da6c95144cbb4faa1851b2a06f58db04ebed
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name: Build
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
- name: Set up Ruby
|
15
|
+
uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: 2.7
|
18
|
+
- name: Install dependencies
|
19
|
+
run: bundle install
|
20
|
+
- name: Run tests
|
21
|
+
run: bundle exec rake
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.3
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,57 +1,39 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
song_pro (0.1.
|
4
|
+
song_pro (0.1.9)
|
5
5
|
markaby
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
|
11
|
-
|
12
|
-
diff-lcs (1.3)
|
13
|
-
jaro_winkler (1.5.1)
|
10
|
+
builder (3.2.4)
|
11
|
+
diff-lcs (1.4.4)
|
14
12
|
markaby (0.9.0)
|
15
13
|
builder
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
rspec-expectations (~> 3.8.0)
|
25
|
-
rspec-mocks (~> 3.8.0)
|
26
|
-
rspec-core (3.8.0)
|
27
|
-
rspec-support (~> 3.8.0)
|
28
|
-
rspec-expectations (3.8.1)
|
14
|
+
rake (13.0.3)
|
15
|
+
rspec (3.10.0)
|
16
|
+
rspec-core (~> 3.10.0)
|
17
|
+
rspec-expectations (~> 3.10.0)
|
18
|
+
rspec-mocks (~> 3.10.0)
|
19
|
+
rspec-core (3.10.1)
|
20
|
+
rspec-support (~> 3.10.0)
|
21
|
+
rspec-expectations (3.10.1)
|
29
22
|
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
-
rspec-support (~> 3.
|
31
|
-
rspec-mocks (3.
|
23
|
+
rspec-support (~> 3.10.0)
|
24
|
+
rspec-mocks (3.10.2)
|
32
25
|
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
-
rspec-support (~> 3.
|
34
|
-
rspec-support (3.
|
35
|
-
rubocop (0.58.2)
|
36
|
-
jaro_winkler (~> 1.5.1)
|
37
|
-
parallel (~> 1.10)
|
38
|
-
parser (>= 2.5, != 2.5.1.1)
|
39
|
-
powerpack (~> 0.1)
|
40
|
-
rainbow (>= 2.2.2, < 4.0)
|
41
|
-
ruby-progressbar (~> 1.7)
|
42
|
-
unicode-display_width (~> 1.0, >= 1.0.1)
|
43
|
-
ruby-progressbar (1.10.0)
|
44
|
-
unicode-display_width (1.4.0)
|
26
|
+
rspec-support (~> 3.10.0)
|
27
|
+
rspec-support (3.10.2)
|
45
28
|
|
46
29
|
PLATFORMS
|
47
30
|
ruby
|
48
31
|
|
49
32
|
DEPENDENCIES
|
50
|
-
bundler (
|
51
|
-
rake (~>
|
52
|
-
rspec (~> 3.
|
53
|
-
rubocop
|
33
|
+
bundler (>= 2.2.19)
|
34
|
+
rake (~> 13.0)
|
35
|
+
rspec (~> 3.8)
|
54
36
|
song_pro!
|
55
37
|
|
56
38
|
BUNDLED WITH
|
57
|
-
|
39
|
+
2.2.21
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# SongPro for Ruby
|
1
|
+
# SongPro for Ruby ![Build](https://github.com/SongProOrg/songpro-ruby/workflows/Build/badge.svg?branch=master)
|
2
2
|
|
3
3
|
[SongPro](https://songpro.org) is a text format for transcribing songs.
|
4
4
|
|
@@ -14,30 +14,36 @@ gem 'song_pro'
|
|
14
14
|
|
15
15
|
And then execute:
|
16
16
|
|
17
|
-
|
17
|
+
```bash
|
18
|
+
$ bundle
|
19
|
+
```
|
18
20
|
|
19
21
|
Or install it yourself as:
|
20
22
|
|
21
|
-
|
23
|
+
```bash
|
24
|
+
$ gem install song_pro
|
25
|
+
```
|
22
26
|
|
23
27
|
## Usage
|
24
28
|
|
25
|
-
Given then file `
|
29
|
+
Given then file `escape-capsule.sng` with the following contents:
|
26
30
|
|
27
31
|
```
|
28
|
-
@title=
|
29
|
-
@artist=
|
32
|
+
@title=Escape Capsule
|
33
|
+
@artist=Brian Kelly
|
34
|
+
!bandcamp=https://spilth.bandcamp.com/track/escape-capsule-nashville-edition
|
30
35
|
|
31
|
-
#
|
36
|
+
# Verse 1
|
32
37
|
|
33
|
-
[D][A]
|
38
|
+
Climb a-[D]board [A]
|
39
|
+
I've been [Bm]waiting for you [F#m]
|
40
|
+
Climb a-[G]board [D]
|
41
|
+
You'll be [Asus4]safe in [A7]here
|
34
42
|
|
35
|
-
#
|
43
|
+
# Chorus 1
|
36
44
|
|
37
|
-
[
|
38
|
-
[
|
39
|
-
[D]I see [A]earth-[G]quakes and [D]lightnin'
|
40
|
-
[D]I see [A]bad [G]times to-[D]day
|
45
|
+
[G] I'm a [D]rocket [F#]made for your pro-[Bm]tection
|
46
|
+
You're [G]safe with me, un-[A]til you leave
|
41
47
|
```
|
42
48
|
|
43
49
|
You can then parse the file to create a `Song` object:
|
@@ -45,18 +51,17 @@ You can then parse the file to create a `Song` object:
|
|
45
51
|
```ruby
|
46
52
|
require 'song_pro'
|
47
53
|
|
48
|
-
text = File.read('
|
54
|
+
text = File.read('escape-capsule.sng')
|
49
55
|
song = SongPro.parse(text)
|
50
56
|
|
51
57
|
puts song.title
|
52
|
-
#
|
58
|
+
# Escape Capsule
|
53
59
|
|
54
60
|
puts song.artist
|
55
|
-
#
|
61
|
+
# Brian Kelly
|
56
62
|
|
57
63
|
puts song.sections[1].title
|
58
|
-
#
|
59
|
-
|
64
|
+
# Chorus 1
|
60
65
|
```
|
61
66
|
|
62
67
|
## Development
|
data/lib/song_pro.rb
CHANGED
@@ -11,9 +11,11 @@ module SongPro
|
|
11
11
|
SECTION_REGEX = /#\s*([^$]*)/
|
12
12
|
ATTRIBUTE_REGEX = /@(\w*)=([^%]*)/
|
13
13
|
CUSTOM_ATTRIBUTE_REGEX = /!(\w*)=([^%]*)/
|
14
|
-
CHORDS_AND_LYRICS_REGEX = %r{(\[[\w#b
|
14
|
+
CHORDS_AND_LYRICS_REGEX = %r{(\[[\w#b+\/]+\])?([^\[]*)}i
|
15
|
+
|
15
16
|
MEASURES_REGEX = %r{([\[[\w#b\/]+\]\s]+)[|]*}i
|
16
|
-
CHORDS_REGEX = %r{\[([\w#b
|
17
|
+
CHORDS_REGEX = %r{\[([\w#b+\/]+)\]?}i
|
18
|
+
COMMENT_REGEX = />\s*([^$]*)/
|
17
19
|
|
18
20
|
def self.parse(lines)
|
19
21
|
song = Song.new
|
@@ -88,6 +90,10 @@ module SongPro
|
|
88
90
|
end
|
89
91
|
|
90
92
|
line.measures = measures
|
93
|
+
elsif text.start_with?('>')
|
94
|
+
matches = COMMENT_REGEX.match(text)
|
95
|
+
comment = matches[1].strip
|
96
|
+
line.comment = comment
|
91
97
|
else
|
92
98
|
captures = text.scan(CHORDS_AND_LYRICS_REGEX).flatten
|
93
99
|
|
@@ -95,7 +101,7 @@ module SongPro
|
|
95
101
|
part = Part.new
|
96
102
|
chord = pair[0]&.strip || ''
|
97
103
|
part.chord = chord.delete('[').delete(']')
|
98
|
-
part.lyric = pair[1]
|
104
|
+
part.lyric = pair[1] || ''
|
99
105
|
|
100
106
|
line.parts << part unless (part.chord == '') && (part.lyric == '')
|
101
107
|
end
|
data/lib/song_pro/line.rb
CHANGED
@@ -2,21 +2,25 @@
|
|
2
2
|
|
3
3
|
module SongPro
|
4
4
|
class Line
|
5
|
-
attr_accessor :parts, :tablature, :measures
|
5
|
+
attr_accessor :parts, :tablature, :measures, :comment
|
6
6
|
|
7
7
|
def initialize
|
8
8
|
@parts = []
|
9
9
|
@tablature = nil
|
10
10
|
@measures = nil
|
11
|
+
@comment = nil
|
11
12
|
end
|
12
13
|
|
13
14
|
def tablature?
|
14
|
-
|
15
|
+
!@tablature.nil?
|
15
16
|
end
|
16
17
|
|
17
18
|
def measures?
|
18
|
-
|
19
|
+
!@measures.nil?
|
19
20
|
end
|
20
21
|
|
22
|
+
def comment?
|
23
|
+
!@comment.nil?
|
24
|
+
end
|
21
25
|
end
|
22
|
-
end
|
26
|
+
end
|
data/lib/song_pro/version.rb
CHANGED
data/song_pro.gemspec
CHANGED
@@ -8,15 +8,13 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = 'song_pro'
|
9
9
|
spec.version = SongPro::VERSION
|
10
10
|
spec.authors = ['Brian Kelly']
|
11
|
-
spec.email = ['polymonic@gmail.com
|
11
|
+
spec.email = ['polymonic@gmail.com']
|
12
12
|
|
13
13
|
spec.summary = 'Converts SongPro files to HTML'
|
14
14
|
spec.description = 'Provides classes for creating, parsing and rendering SongPro files'
|
15
15
|
spec.homepage = 'https://songpro.org'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
18
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
19
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
20
18
|
if spec.respond_to?(:metadata)
|
21
19
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
22
20
|
else
|
@@ -27,13 +25,10 @@ Gem::Specification.new do |spec|
|
|
27
25
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
28
26
|
f.match(%r{^(test|spec|features)/})
|
29
27
|
end
|
30
|
-
spec.bindir = 'exe'
|
31
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
28
|
spec.require_paths = ['lib']
|
33
29
|
|
34
30
|
spec.add_dependency 'markaby'
|
35
|
-
spec.add_development_dependency
|
36
|
-
spec.add_development_dependency 'rake', '~>
|
37
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
38
|
-
spec.add_development_dependency 'rubocop'
|
31
|
+
spec.add_development_dependency "bundler", ">= 2.2.19"
|
32
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
33
|
+
spec.add_development_dependency 'rspec', '~> 3.8'
|
39
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: song_pro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Kelly
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: markaby
|
@@ -28,65 +28,52 @@ dependencies:
|
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.2.19
|
34
34
|
type: :development
|
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: 2.2.19
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
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: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
61
|
+
version: '3.8'
|
62
62
|
type: :development
|
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: '3.
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
68
|
+
version: '3.8'
|
83
69
|
description: Provides classes for creating, parsing and rendering SongPro files
|
84
70
|
email:
|
85
|
-
-
|
71
|
+
- polymonic@gmail.com
|
86
72
|
executables: []
|
87
73
|
extensions: []
|
88
74
|
extra_rdoc_files: []
|
89
75
|
files:
|
76
|
+
- ".github/workflows/build.yml"
|
90
77
|
- ".gitignore"
|
91
78
|
- ".rspec"
|
92
79
|
- ".ruby-version"
|
@@ -126,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
113
|
- !ruby/object:Gem::Version
|
127
114
|
version: '0'
|
128
115
|
requirements: []
|
129
|
-
rubygems_version: 3.
|
116
|
+
rubygems_version: 3.1.6
|
130
117
|
signing_key:
|
131
118
|
specification_version: 4
|
132
119
|
summary: Converts SongPro files to HTML
|