bowie 0.0.1 → 0.0.2
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/bin/bowie +13 -2
- data/lib/bowie.rb +14 -6
- 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: c9b107c89b5f3647d132d994af73e341afd2d36c
|
4
|
+
data.tar.gz: d37b94e0a81352959a8da418a9aa2024eb68cb2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8cdf313ff26138c51eff1c01557c6bacdbc512c5d07a42e4727d6d6f71a3e678b6df5733a1993c7fb0575a62c1680d9d917cb2a9eba1c63fc1a3b7c398270dc
|
7
|
+
data.tar.gz: a2721819f16d45819ae7cdb889a4113b1aedb1d8c6564a7f4ded87f390f569fc809d838993ae3853ba0a53c6b1fc321fcaa067916aaef98e9819ecfc3895b681
|
data/bin/bowie
CHANGED
@@ -4,11 +4,22 @@ require 'bowie'
|
|
4
4
|
require 'thor'
|
5
5
|
|
6
6
|
class BowieCLI < Thor
|
7
|
-
|
8
|
-
|
7
|
+
|
8
|
+
desc "install song", "install the selected package"
|
9
9
|
def install(song)
|
10
10
|
Bowie.install(song)
|
11
11
|
end
|
12
|
+
|
13
|
+
desc "uninstall song", "remove the selected package"
|
14
|
+
def uninstall(song)
|
15
|
+
Bowie.uninstall(song)
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "search song", "list all availables packages matching [song]"
|
19
|
+
def search(song)
|
20
|
+
results = Bowie.search(song)
|
21
|
+
results.each { |key, values| puts "#{values['name']}:\n #{values['description']}" }
|
22
|
+
end
|
12
23
|
end
|
13
24
|
|
14
25
|
BowieCLI.start(ARGV)
|
data/lib/bowie.rb
CHANGED
@@ -6,27 +6,35 @@ require "git"
|
|
6
6
|
|
7
7
|
module Bowie
|
8
8
|
|
9
|
+
# Parse the remote list of packages
|
9
10
|
@songs = YAML.parse(open("https://raw.github.com/axyz/bowie-songs/master/songs.yml")).to_ruby
|
10
11
|
|
12
|
+
# Returns the list of packages
|
11
13
|
def self.get_songs
|
12
14
|
@songs
|
13
15
|
end
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
17
|
+
# Return a printable list of available packages matching the [query]
|
18
|
+
def self.search(query)
|
19
|
+
@songs.select { |el| /.*#{query}.*/ =~ el }
|
19
20
|
end
|
20
21
|
|
22
|
+
# Install the selected [song] in the bowie_songs directory
|
21
23
|
def self.install(song)
|
22
24
|
name = @songs[song]['name']
|
23
25
|
url = @songs[song]['url']
|
24
26
|
path = "bowie_songs/#{name}"
|
25
27
|
|
26
|
-
puts "name: #{name}, url: #{url}" #TO-DELETE
|
27
|
-
|
28
28
|
FileUtils.mkdir_p(path)
|
29
29
|
Git.clone(url, path)
|
30
30
|
end
|
31
31
|
|
32
|
+
# Remove the selected package
|
33
|
+
def self.uninstall(song)
|
34
|
+
name = @songs[song]['name']
|
35
|
+
path = "bowie_songs/#{name}"
|
36
|
+
|
37
|
+
FileUtils.rm_rf(path) # use remove_entry_secure for security reasons?
|
38
|
+
end
|
39
|
+
|
32
40
|
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.0.
|
4
|
+
version: 0.0.2
|
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-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|