bowie 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/bin/bowie +6 -6
  3. data/lib/bowie.rb +41 -20
  4. data/lib/bowie/version.rb +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4619ca670d4770bd49a0ca0952ee0fc9f73bd3ad
4
- data.tar.gz: d9ed7416284ff70208266cac8d00e9e499dc3f6b
3
+ metadata.gz: b3f3dcd114e7993cddaa2fce3ca40fe719ef78e9
4
+ data.tar.gz: 12bd80d892131101c4b3e266645b7a6649effbd9
5
5
  SHA512:
6
- metadata.gz: 1bd95c602a6f88992cd2e6ae431d54c9f72903476927e78af8251434762e48e53b8cdcdbb157d84fd609f1ecd8fb2f7086a3528f1cf8b3ea64b117f45f74538f
7
- data.tar.gz: d253c8c3643cadc21023f4cb0dcc8fe7808f77c9ccdac55728985f937676fada699cf85bb6dcd2d9b6451bf5e05bf3d1070ec43ef2386bde4f5760c406472c51
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(song)
14
- Bowie.install(song)
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(song)
19
- Bowie.update(song)
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(song)
24
- Bowie.uninstall(song)
23
+ def uninstall(*songs)
24
+ Bowie.uninstall(*songs)
25
25
  end
26
26
 
27
27
  desc "search song", "list all availables packages matching [song]"
@@ -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(song)
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
- FileUtils.mkdir_p(path)
66
- Git.clone(url, path)
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
- @local_songs.push song
69
- File.open("songs.yml", "w"){|f| YAML.dump(@local_songs, f)}
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(song)
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
- FileUtils.rm_rf(path) # use remove_entry_secure for security reasons?
86
+ songs.each do |song|
87
+ name = @songs[song]['name']
88
+ path = "bowie_songs/#{name}"
80
89
 
81
- @local_songs.delete song
82
- File.open("songs.yml", "w"){|f| YAML.dump(@local_songs, f)}
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(song)
87
- name = @songs[song]['name']
88
- path = "bowie_songs/#{name}"
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
- g = Git.open(path, :log => Logger.new(STDOUT))
91
- g.reset_hard('HEAD')
92
- g.pull
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
@@ -1,3 +1,3 @@
1
1
  module Bowie
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bowie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrea Moretti