song_pro 0.1.10 → 0.1.11

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: 3d51559bf23b8581a8dcba60800e39aab562439dc6e46ddce858feb46a4b86be
4
- data.tar.gz: 496d9b028ace33732b0a420b271feaa2cdf274f06e725fc5747968cd033ea325
3
+ metadata.gz: 493de9f0e847cc708651498787e30288deb0a3d4c56e386005a2d0c7e3a45acc
4
+ data.tar.gz: 8c847db3bb3081f92d01f8ca5b8b97ca494020b207fa082e4c4c4588089425b9
5
5
  SHA512:
6
- metadata.gz: 89ba491f7a8468cbe8746539b682461d00542d52bb17f6b68c622381c0e2399ed57b2714faa78e8496c24244bf5f623e867c51264f4a042c2f836e9162f29ca9
7
- data.tar.gz: 36b35726800500b43630430e0b17a0cbe93a8657936eef2b8ebc19878887b9d280b8647f520efbfa8afe79b47055da6c95144cbb4faa1851b2a06f58db04ebed
6
+ metadata.gz: 714d2daca1841acebb02202fe164fb287687b722777334eddb85f322d7cfcf5cf151d94df71a850503fbdc1049082787b5a553902d06a6bc8f665b921617a889
7
+ data.tar.gz: 8fda1e7a30888518b662e375729d3268ebc344dd54bf8e0ee4bee5b34b9bc8087fdea32d28005775ba207aeceae28063ccab706b148ef0fd3c737b26c8d12fa8
@@ -1,21 +1,21 @@
1
1
  name: Build
2
2
 
3
- on:
4
- push:
5
- branches: [ master ]
6
- pull_request:
7
- branches: [ master ]
3
+ on: [push, pull_request]
8
4
 
9
5
  jobs:
10
6
  test:
11
7
  runs-on: ubuntu-latest
8
+
9
+ strategy:
10
+ matrix:
11
+ ruby-version: [3.0, 3.1, 3.2]
12
+
12
13
  steps:
13
- - uses: actions/checkout@v2
14
- - name: Set up Ruby
14
+ - uses: actions/checkout@v3
15
+ - name: Set up Ruby ${{ matrix.ruby-version }}
15
16
  uses: ruby/setup-ruby@v1
16
17
  with:
17
- ruby-version: 2.7
18
- - name: Install dependencies
19
- run: bundle install
18
+ ruby-version: ${{ matrix.ruby-version }}
19
+ bundler-cache: true
20
20
  - name: Run tests
21
21
  run: bundle exec rake
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.3
1
+ 3.2.2
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.2.2
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
 
data/Gemfile.lock CHANGED
@@ -1,39 +1,68 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- song_pro (0.1.9)
5
- markaby
4
+ song_pro (0.1.11)
6
5
 
7
6
  GEM
8
7
  remote: https://rubygems.org/
9
8
  specs:
10
- builder (3.2.4)
11
- diff-lcs (1.4.4)
12
- markaby (0.9.0)
13
- builder
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)
9
+ ast (2.4.2)
10
+ diff-lcs (1.5.0)
11
+ json (2.6.3)
12
+ language_server-protocol (3.17.0.2)
13
+ parallel (1.22.1)
14
+ parser (3.1.3.0)
15
+ ast (~> 2.4.1)
16
+ rainbow (3.1.1)
17
+ rake (13.0.6)
18
+ regexp_parser (2.6.1)
19
+ rexml (3.2.5)
20
+ rspec (3.12.0)
21
+ rspec-core (~> 3.12.0)
22
+ rspec-expectations (~> 3.12.0)
23
+ rspec-mocks (~> 3.12.0)
24
+ rspec-core (3.12.0)
25
+ rspec-support (~> 3.12.0)
26
+ rspec-expectations (3.12.1)
22
27
  diff-lcs (>= 1.2.0, < 2.0)
23
- rspec-support (~> 3.10.0)
24
- rspec-mocks (3.10.2)
28
+ rspec-support (~> 3.12.0)
29
+ rspec-mocks (3.12.1)
25
30
  diff-lcs (>= 1.2.0, < 2.0)
26
- rspec-support (~> 3.10.0)
27
- rspec-support (3.10.2)
31
+ rspec-support (~> 3.12.0)
32
+ rspec-support (3.12.0)
33
+ rubocop (1.40.0)
34
+ json (~> 2.3)
35
+ parallel (~> 1.10)
36
+ parser (>= 3.1.2.1)
37
+ rainbow (>= 2.2.2, < 4.0)
38
+ regexp_parser (>= 1.8, < 3.0)
39
+ rexml (>= 3.2.5, < 4.0)
40
+ rubocop-ast (>= 1.23.0, < 2.0)
41
+ ruby-progressbar (~> 1.7)
42
+ unicode-display_width (>= 1.4.0, < 3.0)
43
+ rubocop-ast (1.24.1)
44
+ parser (>= 3.1.1.0)
45
+ rubocop-performance (1.15.1)
46
+ rubocop (>= 1.7.0, < 2.0)
47
+ rubocop-ast (>= 0.4.0)
48
+ ruby-progressbar (1.11.0)
49
+ standard (1.20.0)
50
+ language_server-protocol (~> 3.17.0.2)
51
+ rubocop (= 1.40.0)
52
+ rubocop-performance (= 1.15.1)
53
+ standardrb (1.0.1)
54
+ standard
55
+ unicode-display_width (2.3.0)
28
56
 
29
57
  PLATFORMS
30
58
  ruby
31
59
 
32
60
  DEPENDENCIES
33
- bundler (>= 2.2.19)
34
- rake (~> 13.0)
35
- rspec (~> 3.8)
61
+ bundler
62
+ rake
63
+ rspec
36
64
  song_pro!
65
+ standardrb
37
66
 
38
67
  BUNDLED WITH
39
- 2.2.21
68
+ 2.4.16
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # SongPro for Ruby ![Build](https://github.com/SongProOrg/songpro-ruby/workflows/Build/badge.svg?branch=master)
1
+ # SongPro for Ruby ![Build](https://github.com/SongProOrg/songpro-ruby/workflows/Build/badge.svg?branch=main)
2
2
 
3
3
  [SongPro](https://songpro.org) is a text format for transcribing songs.
4
4
 
@@ -60,8 +60,11 @@ puts song.title
60
60
  puts song.artist
61
61
  # Brian Kelly
62
62
 
63
- puts song.sections[1].title
63
+ puts song.sections[1].name
64
64
  # Chorus 1
65
+
66
+ p song.chords
67
+ # ["D", "A", "Bm", "F#m", "G", "Asus4", "A7", "F#"]
65
68
  ```
66
69
 
67
70
  ## Development
data/Rakefile CHANGED
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+ require "standard/rake"
5
6
 
6
7
  RSpec::Core::RakeTask.new(:spec)
7
8
 
8
- task default: :spec
9
+ task default: [:spec, :standard]
data/lib/song_pro/part.rb CHANGED
@@ -4,4 +4,4 @@ module SongPro
4
4
  class Part
5
5
  attr_accessor :lyric, :chord
6
6
  end
7
- end
7
+ end
@@ -4,9 +4,9 @@ module SongPro
4
4
  class Section
5
5
  attr_accessor :name, :lines
6
6
 
7
- def initialize(name: '')
7
+ def initialize(name: "")
8
8
  @name = name
9
9
  @lines = []
10
10
  end
11
11
  end
12
- end
12
+ end
data/lib/song_pro/song.rb CHANGED
@@ -1,19 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'markaby'
4
-
5
3
  module SongPro
6
4
  class Song
7
5
  attr_accessor :title,
8
- :artist,
9
- :capo,
10
- :key,
11
- :tempo,
12
- :year,
13
- :album,
14
- :tuning,
15
- :sections,
16
- :custom
6
+ :artist,
7
+ :capo,
8
+ :key,
9
+ :tempo,
10
+ :year,
11
+ :album,
12
+ :tuning,
13
+ :sections,
14
+ :custom
17
15
 
18
16
  def initialize
19
17
  @sections = []
@@ -35,76 +33,5 @@ module SongPro
35
33
  end
36
34
  end.flatten.uniq.reject(&:empty?)
37
35
  end
38
-
39
- def to_html
40
- mab = Markaby::Builder.new(song: self)
41
- mab.div.song do
42
- h1.title song.title if song.title
43
- h2.artist song.artist if song.artist
44
-
45
- dl.information do
46
- if song.tuning
47
- dt.tuning 'Tuning'
48
- dd.tuning song.tuning
49
- end
50
- if song.capo
51
- dt.capo 'Capo'
52
- dd.capo song.capo
53
- end
54
- if song.key
55
- dt.key 'Key'
56
- dd.key song.key
57
- end
58
- if song.tempo
59
- dt.tempo 'Tempo'
60
- dd.tempo song.tempo
61
- end
62
- if song.year
63
- dt.year 'Year'
64
- dd.year song.year
65
- end
66
- if song.album
67
- dt.album 'Album'
68
- dd.album song.album
69
- end
70
- end
71
-
72
- song.sections.each do |section|
73
- div.section do
74
- div.name section.name
75
- div.lines do
76
- section.lines.each do |line|
77
- if line.tablature?
78
- div.tablature do
79
- line.tablature
80
- end
81
- elsif line.measures?
82
- div.measures do
83
- line.measures.each do |measure|
84
- div.measure do
85
- measure.chords.each do |chord|
86
- div.chord chord
87
- end
88
- end
89
- end
90
- end
91
- else
92
- div.line do
93
- line.parts.each do |part|
94
- div.part do
95
- div.chord part.chord
96
- div.lyric part.lyric
97
- end
98
- end
99
- end
100
- end
101
- end
102
- end
103
- end
104
- end
105
- end
106
-
107
- mab.to_s
108
- end
109
36
  end
110
37
  end
@@ -1,3 +1,3 @@
1
1
  module SongPro
2
- VERSION = '0.1.10'.freeze
2
+ VERSION = "0.1.11".freeze
3
3
  end
data/lib/song_pro.rb CHANGED
@@ -1,20 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'song_pro/version'
4
- require 'song_pro/song'
5
- require 'song_pro/section'
6
- require 'song_pro/line'
7
- require 'song_pro/part'
8
- require 'song_pro/measure'
3
+ require "song_pro/version"
4
+ require "song_pro/song"
5
+ require "song_pro/section"
6
+ require "song_pro/line"
7
+ require "song_pro/part"
8
+ require "song_pro/measure"
9
9
 
10
10
  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+\/]+\])?([^\[]*)}i
14
+ CHORDS_AND_LYRICS_REGEX = %r{(\[[\w#b+/]+\])?([^\[]*)}i
15
15
 
16
- MEASURES_REGEX = %r{([\[[\w#b\/]+\]\s]+)[|]*}i
17
- CHORDS_REGEX = %r{\[([\w#b+\/]+)\]?}i
16
+ MEASURES_REGEX = %r{([\[[\w#b/]+\]\s]+)[|]*}i
17
+ CHORDS_REGEX = %r{\[([\w#b+/]+)\]?}i
18
18
  COMMENT_REGEX = />\s*([^$]*)/
19
19
 
20
20
  def self.parse(lines)
@@ -22,11 +22,11 @@ module SongPro
22
22
  current_section = nil
23
23
 
24
24
  lines.split("\n").each do |text|
25
- if text.start_with?('@')
25
+ if text.start_with?("@")
26
26
  process_attribute(song, text)
27
- elsif text.start_with?('!')
27
+ elsif text.start_with?("!")
28
28
  process_custom_attribute(song, text)
29
- elsif text.start_with?('#')
29
+ elsif text.start_with?("#")
30
30
  current_section = process_section(song, text)
31
31
  else
32
32
  process_lyrics_and_chords(song, current_section, text)
@@ -50,8 +50,8 @@ module SongPro
50
50
  key = matches[1]
51
51
  value = matches[2].strip
52
52
 
53
- if song.respond_to?("#{key}=".to_sym)
54
- song.send("#{key}=", value)
53
+ if song.respond_to?(:"#{key}=")
54
+ song.send(:"#{key}=", value)
55
55
  else
56
56
  puts "WARNING: Unknown attribute '#{key}'"
57
57
  end
@@ -66,18 +66,18 @@ module SongPro
66
66
  end
67
67
 
68
68
  def self.process_lyrics_and_chords(song, current_section, text)
69
- return if text == ''
69
+ return if text == ""
70
70
 
71
71
  if current_section.nil?
72
- current_section = Section.new(name: '')
72
+ current_section = Section.new(name: "")
73
73
  song.sections << current_section
74
74
  end
75
75
 
76
76
  line = Line.new
77
77
 
78
- if text.start_with?('|-')
78
+ if text.start_with?("|-")
79
79
  line.tablature = text
80
- elsif text.start_with?('| ')
80
+ elsif text.start_with?("| ")
81
81
  captures = text.scan(MEASURES_REGEX).flatten
82
82
 
83
83
  measures = []
@@ -90,7 +90,7 @@ module SongPro
90
90
  end
91
91
 
92
92
  line.measures = measures
93
- elsif text.start_with?('>')
93
+ elsif text.start_with?(">")
94
94
  matches = COMMENT_REGEX.match(text)
95
95
  comment = matches[1].strip
96
96
  line.comment = comment
@@ -99,11 +99,11 @@ module SongPro
99
99
 
100
100
  captures.each_slice(2) do |pair|
101
101
  part = Part.new
102
- chord = pair[0]&.strip || ''
103
- part.chord = chord.delete('[').delete(']')
104
- part.lyric = pair[1] || ''
102
+ chord = pair[0]&.strip || ""
103
+ part.chord = chord.delete("[").delete("]")
104
+ part.lyric = pair[1] || ""
105
105
 
106
- line.parts << part unless (part.chord == '') && (part.lyric == '')
106
+ line.parts << part unless (part.chord == "") && (part.lyric == "")
107
107
  end
108
108
  end
109
109
 
data/song_pro.gemspec CHANGED
@@ -1,34 +1,34 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('lib', __dir__)
3
+ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'song_pro/version'
5
+ require "song_pro/version"
6
6
 
7
7
  Gem::Specification.new do |spec|
8
- spec.name = 'song_pro'
9
- spec.version = SongPro::VERSION
10
- spec.authors = ['Brian Kelly']
11
- spec.email = ['polymonic@gmail.com']
8
+ spec.name = "song_pro"
9
+ spec.version = SongPro::VERSION
10
+ spec.authors = ["Brian Kelly"]
11
+ spec.email = ["polymonic@gmail.com"]
12
12
 
13
- spec.summary = 'Converts SongPro files to HTML'
14
- spec.description = 'Provides classes for creating, parsing and rendering SongPro files'
15
- spec.homepage = 'https://songpro.org'
16
- spec.license = 'MIT'
13
+ spec.summary = "Converts SongPro files to HTML"
14
+ spec.description = "Provides classes for creating, parsing and rendering SongPro files"
15
+ spec.homepage = "https://songpro.org"
16
+ spec.license = "MIT"
17
17
 
18
18
  if spec.respond_to?(:metadata)
19
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
19
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
20
20
  else
21
- raise 'RubyGems 2.0 or newer is required to protect against ' \
22
- 'public gem pushes.'
21
+ raise "RubyGems 2.0 or newer is required to protect against " \
22
+ "public gem pushes."
23
23
  end
24
24
 
25
25
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
26
26
  f.match(%r{^(test|spec|features)/})
27
27
  end
28
- spec.require_paths = ['lib']
28
+ spec.require_paths = ["lib"]
29
29
 
30
- spec.add_dependency 'markaby'
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'
30
+ spec.add_development_dependency "bundler"
31
+ spec.add_development_dependency "rake"
32
+ spec.add_development_dependency "rspec"
33
+ spec.add_development_dependency "standardrb"
34
34
  end
metadata CHANGED
@@ -1,23 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: song_pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Kelly
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-04 00:00:00.000000000 Z
11
+ date: 2024-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: markaby
14
+ name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
- type: :runtime
20
+ type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
@@ -25,47 +25,47 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: bundler
28
+ name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 2.2.19
33
+ version: '0'
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: 2.2.19
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rake
42
+ name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '13.0'
47
+ version: '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: '13.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
56
+ name: standardrb
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '3.8'
61
+ version: '0'
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.8'
68
+ version: '0'
69
69
  description: Provides classes for creating, parsing and rendering SongPro files
70
70
  email:
71
71
  - polymonic@gmail.com
@@ -77,7 +77,7 @@ files:
77
77
  - ".gitignore"
78
78
  - ".rspec"
79
79
  - ".ruby-version"
80
- - ".travis.yml"
80
+ - ".tool-versions"
81
81
  - Gemfile
82
82
  - Gemfile.lock
83
83
  - LICENSE.txt
@@ -98,7 +98,7 @@ licenses:
98
98
  - MIT
99
99
  metadata:
100
100
  allowed_push_host: https://rubygems.org
101
- post_install_message:
101
+ post_install_message:
102
102
  rdoc_options: []
103
103
  require_paths:
104
104
  - lib
@@ -113,8 +113,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
115
  requirements: []
116
- rubygems_version: 3.1.6
117
- signing_key:
116
+ rubygems_version: 3.5.11
117
+ signing_key:
118
118
  specification_version: 4
119
119
  summary: Converts SongPro files to HTML
120
120
  test_files: []
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.7.3
7
- before_install: gem install bundler -v 2.2