bowie 0.3.9 → 0.3.10
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 +4 -4
- data/lib/bowie/actions/install.rb +7 -3
- data/lib/bowie/actions/uninstall.rb +6 -2
- data/lib/bowie/actions/update.rb +7 -3
- data/lib/bowie/song_utils.rb +1 -1
- data/lib/bowie/version.rb +1 -1
- data/lib/semver/semver.rb +3 -3
- data/spec/semver/semver_spec.rb +44 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42aab442a0a17cea8dd78c49d288f59dd5906aff
|
4
|
+
data.tar.gz: e6ef02f2594e95dfd81b2e92f7f2e2ed1c7becf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f487c1da790206168320b44d040d15ebda1a43f568355fdb1f816f05989077ede2ce394662cebbdb4166a591c8a34f9f6af2f1f6b7c630c3a0d2c0ca5cb1197
|
7
|
+
data.tar.gz: ee60ffb690f85fd246027754ce8cb1dfb01078533c7ff93a7e4a75927983a310968297881d7338ec66cf632c523698a53e22d238dde7f86e8fcf51addb337e46
|
@@ -7,7 +7,11 @@ module Bowie
|
|
7
7
|
if songs.length > 0
|
8
8
|
songs.each do |song|
|
9
9
|
name = SongUtils.parse_song_name song
|
10
|
-
|
10
|
+
begin
|
11
|
+
version = Semver.new(SongUtils.parse_song_version song)
|
12
|
+
rescue
|
13
|
+
version = false
|
14
|
+
end
|
11
15
|
url = @songs[name]['url']
|
12
16
|
path = "bowie_songs/#{name}"
|
13
17
|
|
@@ -16,7 +20,7 @@ module Bowie
|
|
16
20
|
else
|
17
21
|
FileUtils.mkdir_p(path)
|
18
22
|
Git.clone(url, path)
|
19
|
-
if version
|
23
|
+
if version
|
20
24
|
g = Git.open(path)
|
21
25
|
begin
|
22
26
|
g.checkout(version.to_s)
|
@@ -30,7 +34,7 @@ module Bowie
|
|
30
34
|
end
|
31
35
|
|
32
36
|
unless @local_songs.include? name or @local_songs.include? name+'#'+version.to_s
|
33
|
-
version
|
37
|
+
version ? @local_songs.push(name+'#'+version.to_s) : @local_songs.push(name)
|
34
38
|
end
|
35
39
|
File.open("songs.yml", "w"){|f| YAML.dump(@local_songs, f)}
|
36
40
|
end
|
@@ -7,12 +7,16 @@ module Bowie
|
|
7
7
|
|
8
8
|
songs.each do |song|
|
9
9
|
name = SongUtils.parse_song_name song
|
10
|
-
|
10
|
+
begin
|
11
|
+
version = Semver.new(SongUtils.parse_song_version song)
|
12
|
+
rescue
|
13
|
+
version = false
|
14
|
+
end
|
11
15
|
path = "bowie_songs/#{name}"
|
12
16
|
|
13
17
|
FileUtils.rm_rf(path) # use remove_entry_secure for security reasons?
|
14
18
|
|
15
|
-
if version
|
19
|
+
if version
|
16
20
|
@local_songs.delete "#{name}##{version}"
|
17
21
|
else
|
18
22
|
@local_songs.delete_if {|el| not (el =~ /^#{name}#/).nil?}
|
data/lib/bowie/actions/update.rb
CHANGED
@@ -8,13 +8,17 @@ module Bowie
|
|
8
8
|
if songs.length > 0
|
9
9
|
songs.each do |song|
|
10
10
|
name = SongUtils.parse_song_name song
|
11
|
-
|
11
|
+
begin
|
12
|
+
version = Semver.new(SongUtils.parse_song_version song)
|
13
|
+
rescue
|
14
|
+
version = false
|
15
|
+
end
|
12
16
|
path = "bowie_songs/#{name}"
|
13
17
|
|
14
18
|
g = Git.open(path, :log => Logger.new(STDOUT))
|
15
19
|
g.reset_hard('HEAD')
|
16
20
|
g.pull
|
17
|
-
unless version
|
21
|
+
unless version
|
18
22
|
begin
|
19
23
|
g.checkout(version.to_s)
|
20
24
|
rescue
|
@@ -26,7 +30,7 @@ module Bowie
|
|
26
30
|
end
|
27
31
|
@local_songs.delete name
|
28
32
|
@local_songs.delete_if {|el| not (el =~ /^#{name}#/).nil?}
|
29
|
-
version
|
33
|
+
version ? @local_songs.push(name+'#'+version.to_s) : @local_songs.push(name)
|
30
34
|
File.open("songs.yml", "w"){|f| YAML.dump(@local_songs, f)}
|
31
35
|
end
|
32
36
|
else
|
data/lib/bowie/song_utils.rb
CHANGED
@@ -76,7 +76,7 @@ module Bowie
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def self.valid_song?(string)
|
79
|
-
(string =~
|
79
|
+
(string =~ /\A[a-z0-9]+(-?[a-z0-9])*(#\d+.\d+.\d+)?\z/) == nil ? false : true
|
80
80
|
end
|
81
81
|
|
82
82
|
def self.valid_lyrics_file?(file)
|
data/lib/bowie/version.rb
CHANGED
data/lib/semver/semver.rb
CHANGED
@@ -16,10 +16,10 @@ class Semver
|
|
16
16
|
@minor = Integer v[1]
|
17
17
|
@patch = Integer v[2]
|
18
18
|
else
|
19
|
-
|
19
|
+
raise "invalid semver"
|
20
20
|
end
|
21
21
|
else
|
22
|
-
|
22
|
+
raise ArgumentError
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -87,6 +87,6 @@ private
|
|
87
87
|
|
88
88
|
# return true if [string] is a valid semantic version in the form x.x.x or vx.x.x
|
89
89
|
def valid?(string)
|
90
|
-
(
|
90
|
+
(/\Av?\d+.\d+.\d+\z/ =~ string)? true : false
|
91
91
|
end
|
92
92
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require './lib/semver/semver'
|
3
|
+
|
4
|
+
describe Semver do
|
5
|
+
|
6
|
+
context "when valid #semver in x.x.x form" do
|
7
|
+
it "initialize without errors" do
|
8
|
+
expect {Semver.new "1.2.3"}.to_not raise_error
|
9
|
+
end
|
10
|
+
|
11
|
+
subject(:version) {Semver.new "1.2.3"}
|
12
|
+
it "initialize correctly major, minor and patch parameters" do
|
13
|
+
expect(version.major).to be 1
|
14
|
+
expect(version.minor).to be 2
|
15
|
+
expect(version.patch).to be 3
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "when valid #semver in vx.x.x form" do
|
20
|
+
it "initialize without errors" do
|
21
|
+
expect {Semver.new "v1.2.3"}.to_not raise_error
|
22
|
+
end
|
23
|
+
|
24
|
+
subject(:version) {Semver.new "v1.2.3"}
|
25
|
+
it "initialize correctly major, minor and patch parameters" do
|
26
|
+
expect(version.major).to be 1
|
27
|
+
expect(version.minor).to be 2
|
28
|
+
expect(version.patch).to be 3
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "when initialized with invalid semver string" do
|
33
|
+
it "raise invalid semver error" do
|
34
|
+
expect {Semver.new "v1.2.3.4"}.to raise_error "invalid semver"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "when initialized with too mani arguments" do
|
39
|
+
it "raise ArgumentError" do
|
40
|
+
expect {Semver.new "v1.2.3", "foo"}.to raise_error ArgumentError
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bowie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrea Moretti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- spec/bowie/actions/update_spec.rb
|
117
117
|
- spec/bowie/song_utils_spec.rb
|
118
118
|
- spec/bowie_spec.rb
|
119
|
+
- spec/semver/semver_spec.rb
|
119
120
|
- spec/spec_helper.rb
|
120
121
|
homepage: http://axyz.github.io/bowie/
|
121
122
|
licenses:
|
@@ -150,4 +151,5 @@ test_files:
|
|
150
151
|
- spec/bowie/actions/update_spec.rb
|
151
152
|
- spec/bowie/song_utils_spec.rb
|
152
153
|
- spec/bowie_spec.rb
|
154
|
+
- spec/semver/semver_spec.rb
|
153
155
|
- spec/spec_helper.rb
|