bowie 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/bowie +6 -6
- data/lib/bowie.rb +41 -20
- data/lib/bowie/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3f3dcd114e7993cddaa2fce3ca40fe719ef78e9
|
4
|
+
data.tar.gz: 12bd80d892131101c4b3e266645b7a6649effbd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55ac835dec9ebb982a04a496cd39ce896668d41cc7812cef2d0b54aecea4543c813a1f1d779589a2a102c5c9794f485b67c355b8dbfb33ea56b71434e6f26c8c
|
7
|
+
data.tar.gz: 82e7bb8ffa0e182f8f1ddaf374c32921926ef9203ab01f73477ae19ce8ddc73dee82e850c3ca75406f47adb256f106ec9f537ff337afda09bc02ae82913d1747
|
data/bin/bowie
CHANGED
@@ -10,18 +10,18 @@ class BowieCLI < Thor
|
|
10
10
|
Bowie.get_local_lyrics
|
11
11
|
|
12
12
|
desc "install song", "install the selected package"
|
13
|
-
def install(
|
14
|
-
Bowie.install(
|
13
|
+
def install(*songs)
|
14
|
+
Bowie.install(*songs)
|
15
15
|
end
|
16
16
|
|
17
17
|
desc "update song", "update the selected package"
|
18
|
-
def update(
|
19
|
-
Bowie.update(
|
18
|
+
def update(*songs)
|
19
|
+
Bowie.update(*songs)
|
20
20
|
end
|
21
21
|
|
22
22
|
desc "uninstall song", "remove the selected package"
|
23
|
-
def uninstall(
|
24
|
-
Bowie.uninstall(
|
23
|
+
def uninstall(*songs)
|
24
|
+
Bowie.uninstall(*songs)
|
25
25
|
end
|
26
26
|
|
27
27
|
desc "search song", "list all availables packages matching [song]"
|
data/lib/bowie.rb
CHANGED
@@ -55,41 +55,62 @@ module Bowie
|
|
55
55
|
end
|
56
56
|
|
57
57
|
# Install the selected [song] in the bowie_songs directory
|
58
|
-
def self.install(
|
58
|
+
def self.install(*songs)
|
59
59
|
@songs = self.get_songs
|
60
60
|
@local_songs = self.get_local_songs
|
61
|
-
name = @songs[song]['name']
|
62
|
-
url = @songs[song]['url']
|
63
|
-
path = "bowie_songs/#{name}"
|
64
61
|
|
65
|
-
|
66
|
-
|
62
|
+
if songs.length > 0
|
63
|
+
songs.each do |song|
|
64
|
+
name = @songs[song]['name']
|
65
|
+
url = @songs[song]['url']
|
66
|
+
path = "bowie_songs/#{name}"
|
67
67
|
|
68
|
-
|
69
|
-
|
68
|
+
FileUtils.mkdir_p(path)
|
69
|
+
Git.clone(url, path)
|
70
|
+
|
71
|
+
unless @local_songs.include? song
|
72
|
+
@local_songs.push song
|
73
|
+
end
|
74
|
+
File.open("songs.yml", "w"){|f| YAML.dump(@local_songs, f)}
|
75
|
+
end
|
76
|
+
else
|
77
|
+
@local_songs.each {|song| self.install(song)}
|
78
|
+
end
|
70
79
|
end
|
71
80
|
|
72
81
|
# Remove the selected package
|
73
|
-
def self.uninstall(
|
82
|
+
def self.uninstall(*songs)
|
74
83
|
@songs = self.get_songs
|
75
84
|
@local_songs = self.get_local_songs
|
76
|
-
name = @songs[song]['name']
|
77
|
-
path = "bowie_songs/#{name}"
|
78
85
|
|
79
|
-
|
86
|
+
songs.each do |song|
|
87
|
+
name = @songs[song]['name']
|
88
|
+
path = "bowie_songs/#{name}"
|
80
89
|
|
81
|
-
|
82
|
-
|
90
|
+
FileUtils.rm_rf(path) # use remove_entry_secure for security reasons?
|
91
|
+
|
92
|
+
@local_songs.delete song
|
93
|
+
File.open("songs.yml", "w"){|f| YAML.dump(@local_songs, f)}
|
94
|
+
end
|
83
95
|
end
|
84
96
|
|
85
97
|
# Update the selected package
|
86
|
-
def self.update(
|
87
|
-
|
88
|
-
|
98
|
+
def self.update(*songs)
|
99
|
+
@songs = self.get_songs
|
100
|
+
@local_songs = self.get_local_songs
|
101
|
+
|
102
|
+
if songs.length > 0
|
103
|
+
songs.each do |song|
|
104
|
+
name = @songs[song]['name']
|
105
|
+
path = "bowie_songs/#{name}"
|
89
106
|
|
90
|
-
|
91
|
-
|
92
|
-
|
107
|
+
g = Git.open(path, :log => Logger.new(STDOUT))
|
108
|
+
g.reset_hard('HEAD')
|
109
|
+
g.pull
|
110
|
+
end
|
111
|
+
else
|
112
|
+
@local_songs.each {|song| self.update(song)}
|
113
|
+
end
|
93
114
|
end
|
94
115
|
|
95
116
|
end
|
data/lib/bowie/version.rb
CHANGED