tabscroll 1.0.40 → 1.1.0

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
  SHA1:
3
- metadata.gz: ee12d935ef76ceb70ff47c224fb0b9eb03a670b1
4
- data.tar.gz: 4d9f7d721e110bd9105329e6524d7a332577f535
3
+ metadata.gz: 99b7ce3438c86990d1e371a58dc0344faec3c2b2
4
+ data.tar.gz: f0dec39df6e7178087f25220cb97ab2d089008ca
5
5
  SHA512:
6
- metadata.gz: f63aa0639af372c80a70742876933614d22f9596761f0d3c199b0bb1e23881515c7227eccdc5a4b8088de6765003d5d25646d7defefc89488489dc93524e475a
7
- data.tar.gz: 8954f7d1eb656939bb70c249470de5dd2ca17c9e6690dc135c71cc6f2466dd646cfde1ff71c5f9cc8f5e6360001cc5c96a225e1589a805a2005d5c1ad37319e2
6
+ metadata.gz: a5f0afba94716225f46ae66bc70ba01c1169d38eaa53e3076bc0d165e93ae4650b9502cd7d084bacfbbe8fb0e4a0e7624ea3908147f9c1fe454082a07429937f
7
+ data.tar.gz: 9ca2e31c3ecfeb97cef96a1123315ef499f6bc28a49eb4e80bf4cdf7d84e0ff75871770cb7a3de2f8340628f2db8570f89d2333f38b6feb0406a10c169176cef
@@ -1,5 +1,12 @@
1
1
  <!-- My awesome changelog -->
2
2
 
3
+ ## 1.1.0 (Oct 14, 2013)
4
+
5
+ IMPROVEMENTS:
6
+
7
+ * Added a sample file so users can test the program without
8
+ having a guitar tab on their system.
9
+
3
10
  ## 1.0.40 (Oct 10, 2013)
4
11
 
5
12
  BUG FIXES:
@@ -13,6 +13,13 @@ begin
13
13
  $settings = Settings.new
14
14
  $settings.parse ARGV
15
15
 
16
- TabScroll::run $settings[:filename]
16
+ # We'll provide a sample file so the user can test the program
17
+ if $settings[:run_sample_file]
18
+ filename = $settings[:sample_filename]
19
+ else
20
+ filename = $settings[:filename]
21
+ end
22
+
23
+ TabScroll::run filename
17
24
  end
18
25
 
@@ -13,11 +13,18 @@ require 'tabscroll/version'
13
13
  # (Settings class).
14
14
  module TabScroll
15
15
 
16
- # Executes the whole program, loading contents in `filename`.
16
+ # Starts the Curses engine and parses `filename`, finally
17
+ # displaying things onscreen.
17
18
  def self.run filename
19
+
20
+ if not File.exists? filename
21
+ puts "Error: File '#{filename}' doesn't exist."
22
+ exit 69
23
+ end
24
+
18
25
  @engine = Engine.new
19
26
  if not @engine
20
- puts 'Failed to start curses!'
27
+ puts "Error: Failed to start Curses!"
21
28
  exit 1337
22
29
  end
23
30
  @engine.timeout 10
@@ -48,24 +55,24 @@ module TabScroll
48
55
  bars_hidden = (bars_hidden ? false : true)
49
56
  Curses::clear
50
57
  when '<'
51
- track.scroll -5
58
+ track.scroll -10
52
59
  when '>'
53
- track.scroll 5
60
+ track.scroll 10
54
61
  when Curses::KEY_LEFT
55
62
  track.speed -= 1
56
63
  when Curses::KEY_RIGHT
57
64
  track.speed += 1
58
- when Curses::KEY_DOWN, Curses::KEY_UP
65
+ when Curses::KEY_DOWN, Curses::KEY_UP, ' '
59
66
  track.speed = 0
60
67
  when 'q'
61
- $enigne.exit
62
- return nil
68
+ @engine.exit
69
+ exit
63
70
  end
64
71
 
65
72
  track.update
66
73
  track.show
67
74
  if not bars_hidden
68
- titlebar.mvaddstr(0, 0, "#{filename} (#{track.percent_completed}%) ", Engine::Colors[:cyan])
75
+ titlebar.mvaddstr(0, 0, "#{File.basename filename} (#{track.percent_completed}%) ", Engine::Colors[:cyan])
69
76
  titlebar.mvaddstr_right(0, " Speed: #{track.speed}", Engine::Colors[:cyan])
70
77
 
71
78
  statusbar.mvaddstr_left(0, "tabscroll v#{VERSION} - press `h` for help", Engine::Colors[:green])
@@ -80,22 +87,26 @@ module TabScroll
80
87
  def self.show_help_window
81
88
  title = 'Help'
82
89
  text = <<END_OF_TEXT
83
- q quit
84
- h help/go back
85
- left/right auto-scroll left/right
86
- up/down stop auto-scrolling
87
- </> step scroll left/right
88
- o toggle status/title bars
90
+ q quit
91
+ h help/go back
92
+ left/right auto-scroll left/right
93
+ up/down/space bar stop auto-scrolling
94
+ </> step scroll left/right
95
+ o toggle status/title bars
89
96
 
97
+ _|_ _. |_ _ _ ._ _ | |
98
+ |_ (_| |_) _> (_ | (_) | | #{VERSION}
90
99
 
91
- tabscroll v#{VERSION}
92
- homepage alexdantas.net/projects/tabscroll
93
- author Alexandre Dantas <eu@alexdantas.net>
100
+ homepage alexdantas.net/projects/tabscroll
101
+ author Alexandre Dantas <eu@alexdantas.net>
94
102
  END_OF_TEXT
95
103
 
96
104
  pop = Popup.new(title, text)
97
105
  will_quit = pop.show
98
- quit if will_quit
106
+ if will_quit
107
+ @engine.exit
108
+ exit
109
+ end
99
110
  end
100
111
  end
101
112
 
@@ -12,6 +12,21 @@ class Settings
12
12
  def initialize
13
13
  @settings = {}
14
14
  @settings[:filename] = nil
15
+
16
+ # We have a way to test the program.
17
+ # We're distributing a sample tab file with the Gem so
18
+ # when users run `tabscroll --sample` they can see
19
+ # how the program works.
20
+ # This setting enables it
21
+ @settings[:run_sample_file] = false
22
+
23
+ # And this is the absolute filename of the file
24
+ # distributed with the gem.
25
+ # It'll be `../../sample_tab.txt` based on `settings.rb` path.
26
+ filename = File.expand_path("../../", __FILE__)
27
+ filename = File.dirname filename
28
+ filename += "/sample_tab.txt"
29
+ @settings[:sample_filename] = filename
15
30
  end
16
31
 
17
32
  # Sets options based on commandline arguments `args`.
@@ -23,8 +38,13 @@ class Settings
23
38
 
24
39
  # Make output beautiful
25
40
  parser.separator ""
26
- parser.separator "Specific options:"
41
+ parser.separator "Options:"
42
+
43
+ parser.on("--sample", "Run `tabscroll` with sample file") do
44
+ @settings[:run_sample_file] = true
45
+ end
27
46
 
47
+ # These options appear if no other is given.
28
48
  parser.on_tail("-h", "--help", "Show this message") do
29
49
  puts parser
30
50
  exit
@@ -37,7 +57,7 @@ class Settings
37
57
  end
38
58
  opts.parse! args
39
59
 
40
- # After parsing all '--args' and '-a' we will check if
60
+ # After parsing all dashed arguments we will check if
41
61
  # the user has provided a filename.
42
62
  #
43
63
  # The first argument without a leading '-' will be
@@ -49,7 +69,7 @@ class Settings
49
69
  end
50
70
  end
51
71
 
52
- if not @settings[:filename]
72
+ if not @settings[:filename] and not @settings[:run_sample_file]
53
73
  puts opts
54
74
  exit 666
55
75
  end
@@ -59,8 +59,11 @@ class Track
59
59
  # I will also make every line have the same width
60
60
  # as of the biggest one.
61
61
 
62
- # Any tab line MUST have EITHER ---1---9--| OR |---3----0
63
- tab_line = /[-[:alnum:]]\||\|[-[:alnum:]]/
62
+ # Any tab line MUST have EITHER:
63
+ # ---1---9--|
64
+ # or
65
+ # |---3----0
66
+ tab_line = /[-[:alnum:]*]\||\|[-[:alnum:]*]/
64
67
 
65
68
  # Duration of each note only has those chars.
66
69
  # So we look for anything BUT these chars.
@@ -1,3 +1,3 @@
1
1
  module TabScroll
2
- VERSION = '1.0.40'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -1,4 +1,4 @@
1
- # Adding lib directory to load path
1
+ # Adding ./lib directory to load path
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $:.unshift lib unless $:.include? lib
4
4
 
@@ -20,7 +20,7 @@ END_OF_DESCRIPTION
20
20
  s.homepage = 'http://www.alexdantas.net/projects/tabscroll'
21
21
  s.license = "GPL-3.0"
22
22
 
23
- # Including everything that's on `git`
23
+ # Including everything that's checked out on git
24
24
  s.files = `git ls-files`.split($/)
25
25
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
26
26
  s.require_paths = ['lib']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tabscroll
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.40
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Dantas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-10 00:00:00.000000000 Z
11
+ date: 2013-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -49,6 +49,7 @@ files:
49
49
  - lib/tabscroll/timer.rb
50
50
  - lib/tabscroll/track.rb
51
51
  - lib/tabscroll/version.rb
52
+ - sample_tab.txt
52
53
  - tabscroll.gemspec
53
54
  homepage: http://www.alexdantas.net/projects/tabscroll
54
55
  licenses: