bowie 0.3.2 → 0.3.3
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.rb +45 -13
- data/lib/bowie/semver.rb +7 -3
- data/lib/bowie/utils.rb +11 -0
- data/lib/bowie/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2a1627386c87e3785efd62c3c32e9a2e05a89863
|
|
4
|
+
data.tar.gz: 961ca9b6ee29c6a7db3ce15a50741119b83985b2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2b17b0c8664ad75cf4b12ca14b3a5799096e4f35382530075ea8be0d2fa50f4e0d388e844ae0800466171a071a3330cc1e400aa8433435b1fc2a7eeb0eb07eda
|
|
7
|
+
data.tar.gz: 15b9cac6ae41dca43c96b1c60c882c3cb2f1c4c8fe2fe009758c986938ed8c082151ce984608113def20924d444fafd2c90d09f305d0f252920f61af737dfc89
|
data/lib/bowie.rb
CHANGED
|
@@ -8,10 +8,6 @@ require "bowie/utils"
|
|
|
8
8
|
require "bowie/semver"
|
|
9
9
|
|
|
10
10
|
module Bowie
|
|
11
|
-
|
|
12
|
-
@songs
|
|
13
|
-
@local_songs
|
|
14
|
-
@local_lyrics
|
|
15
11
|
|
|
16
12
|
# Retrive the online registry of available songs
|
|
17
13
|
def self.get_songs
|
|
@@ -63,15 +59,31 @@ module Bowie
|
|
|
63
59
|
|
|
64
60
|
if songs.length > 0
|
|
65
61
|
songs.each do |song|
|
|
66
|
-
name =
|
|
67
|
-
|
|
62
|
+
name = Utils.parse_song_name song
|
|
63
|
+
version = Semver.new(Utils.parse_song_version song)
|
|
64
|
+
url = @songs[name]['url']
|
|
68
65
|
path = "bowie_songs/#{name}"
|
|
69
66
|
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
if File.directory? path
|
|
68
|
+
self.update(name)
|
|
69
|
+
else
|
|
70
|
+
FileUtils.mkdir_p(path)
|
|
71
|
+
Git.clone(url, path)
|
|
72
|
+
if version.major != nil
|
|
73
|
+
g = Git.open(path)
|
|
74
|
+
begin
|
|
75
|
+
g.checkout(version.to_s)
|
|
76
|
+
rescue
|
|
77
|
+
begin
|
|
78
|
+
g.checkout(version.to_s :v => true)
|
|
79
|
+
rescue
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
72
84
|
|
|
73
|
-
unless @local_songs.include?
|
|
74
|
-
@local_songs.push
|
|
85
|
+
unless @local_songs.include? name or @local_songs.include? name+'#'+version.to_s
|
|
86
|
+
version.major ? @local_songs.push(name+'#'+version.to_s) : @local_songs.push(name)
|
|
75
87
|
end
|
|
76
88
|
File.open("songs.yml", "w"){|f| YAML.dump(@local_songs, f)}
|
|
77
89
|
end
|
|
@@ -86,12 +98,17 @@ module Bowie
|
|
|
86
98
|
@local_songs = self.get_local_songs
|
|
87
99
|
|
|
88
100
|
songs.each do |song|
|
|
89
|
-
name =
|
|
101
|
+
name = Utils.parse_song_name song
|
|
102
|
+
version = Semver.new(Utils.parse_song_version song)
|
|
90
103
|
path = "bowie_songs/#{name}"
|
|
91
104
|
|
|
92
105
|
FileUtils.rm_rf(path) # use remove_entry_secure for security reasons?
|
|
93
106
|
|
|
94
|
-
|
|
107
|
+
if version.major != nil
|
|
108
|
+
@local_songs.delete "#{name}##{version}"
|
|
109
|
+
else
|
|
110
|
+
@local_songs.delete_if {|el| not (el =~ /^#{name}#/).nil?}
|
|
111
|
+
end
|
|
95
112
|
File.open("songs.yml", "w"){|f| YAML.dump(@local_songs, f)}
|
|
96
113
|
end
|
|
97
114
|
end
|
|
@@ -103,12 +120,27 @@ module Bowie
|
|
|
103
120
|
|
|
104
121
|
if songs.length > 0
|
|
105
122
|
songs.each do |song|
|
|
106
|
-
name =
|
|
123
|
+
name = Utils.parse_song_name song
|
|
124
|
+
version = Semver.new(Utils.parse_song_version song)
|
|
107
125
|
path = "bowie_songs/#{name}"
|
|
108
126
|
|
|
109
127
|
g = Git.open(path, :log => Logger.new(STDOUT))
|
|
110
128
|
g.reset_hard('HEAD')
|
|
111
129
|
g.pull
|
|
130
|
+
unless version.major.nil?
|
|
131
|
+
begin
|
|
132
|
+
g.checkout(version.to_s)
|
|
133
|
+
rescue
|
|
134
|
+
begin
|
|
135
|
+
g.checkout(version.to_s :v => true)
|
|
136
|
+
rescue
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
@local_songs.delete name
|
|
141
|
+
@local_songs.delete_if {|el| not (el =~ /^#{name}#/).nil?}
|
|
142
|
+
version.major ? @local_songs.push(name+'#'+version.to_s) : @local_songs.push(name)
|
|
143
|
+
File.open("songs.yml", "w"){|f| YAML.dump(@local_songs, f)}
|
|
112
144
|
end
|
|
113
145
|
else
|
|
114
146
|
@local_songs.each {|song| self.update(song)}
|
data/lib/bowie/semver.rb
CHANGED
|
@@ -16,15 +16,19 @@ class Semver
|
|
|
16
16
|
@minor = Integer v[1]
|
|
17
17
|
@patch = Integer v[2]
|
|
18
18
|
else
|
|
19
|
-
|
|
19
|
+
false
|
|
20
20
|
end
|
|
21
21
|
else
|
|
22
|
-
|
|
22
|
+
false
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def to_s opts = {}
|
|
27
|
-
|
|
27
|
+
if(@major.nil? or @minor.nil? or patch.nil?)
|
|
28
|
+
return ""
|
|
29
|
+
else
|
|
30
|
+
opts[:v]? "v#{@major}.#{@minor}.#{@patch}" : "#{@major}.#{@minor}.#{@patch}"
|
|
31
|
+
end
|
|
28
32
|
end
|
|
29
33
|
|
|
30
34
|
def bump *type
|
data/lib/bowie/utils.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require "git"
|
|
2
|
+
|
|
1
3
|
module Bowie
|
|
2
4
|
module Utils
|
|
3
5
|
|
|
@@ -22,5 +24,14 @@ module Bowie
|
|
|
22
24
|
s.split("#")[1]
|
|
23
25
|
end
|
|
24
26
|
|
|
27
|
+
def self.get_git_tags(path)
|
|
28
|
+
result = Array.new
|
|
29
|
+
g = Git.open(path)
|
|
30
|
+
g.tags.each do |tag|
|
|
31
|
+
result.push tag.name
|
|
32
|
+
end
|
|
33
|
+
return result
|
|
34
|
+
end
|
|
35
|
+
|
|
25
36
|
end
|
|
26
37
|
end
|
data/lib/bowie/version.rb
CHANGED
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.3
|
|
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-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|