bowie 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3f3dcd114e7993cddaa2fce3ca40fe719ef78e9
4
- data.tar.gz: 12bd80d892131101c4b3e266645b7a6649effbd9
3
+ metadata.gz: 66a2796cd8d8d57857968670dbd961835eef5c45
4
+ data.tar.gz: 55389b1254b14a5b1f157e09a2a8512fd64dbf26
5
5
  SHA512:
6
- metadata.gz: 55ac835dec9ebb982a04a496cd39ce896668d41cc7812cef2d0b54aecea4543c813a1f1d779589a2a102c5c9794f485b67c355b8dbfb33ea56b71434e6f26c8c
7
- data.tar.gz: 82e7bb8ffa0e182f8f1ddaf374c32921926ef9203ab01f73477ae19ce8ddc73dee82e850c3ca75406f47adb256f106ec9f537ff337afda09bc02ae82913d1747
6
+ metadata.gz: d29fff3ded65c449929219f8abfe5e659f63577073851a0c5181aebe59e26857c6bf60a55f232646ee8e3462de3db15d2822c1f170daf4f8d9840be1afeb23fe
7
+ data.tar.gz: 65a99deb50dd94068b997d3d354e060344ccde5adbdacfcbacd7a7f6d84ca29ba62e54bc52fbe776efd61be693713ecdb17593b2d073c7a3bce17494076472c0
data/bin/bowie CHANGED
@@ -29,6 +29,11 @@ class BowieCLI < Thor
29
29
  results = Bowie.search(song)
30
30
  results.each { |key, values| puts "#{values['name']}:\n #{values['description']}" }
31
31
  end
32
+
33
+ desc "prune", "remove all the packages not included in songs.yml"
34
+ def prune
35
+ Bowie.prune
36
+ end
32
37
  end
33
38
 
34
39
  BowieCLI.start(ARGV)
data/lib/bowie.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "bowie/version"
2
+ require "bowie/utils"
2
3
  require "yaml"
3
4
  require "open-uri"
4
5
  require "fileutils"
@@ -113,4 +114,15 @@ module Bowie
113
114
  end
114
115
  end
115
116
 
117
+ # Remove all the packages not included in songs.yml
118
+ def self.prune
119
+ @local_songs = self.get_local_songs
120
+
121
+ Utils.get_songs_dirs.each do |dir|
122
+ unless @local_songs.include? dir
123
+ FileUtils.rm_rf("bowie_songs/#{dir}")
124
+ end
125
+ end
126
+ end
127
+
116
128
  end
@@ -0,0 +1,16 @@
1
+ module Bowie
2
+ module Utils
3
+
4
+ # Return an array with all the direcotry inside bowye_songs
5
+ def self.get_songs_dirs
6
+ result = []
7
+ Dir.foreach('bowie_songs') do |el|
8
+ unless (el == "." or el == ".." or el == "lyrics.yml")
9
+ result.push el
10
+ end
11
+ end
12
+ result
13
+ end
14
+
15
+ end
16
+ end
data/lib/bowie/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Bowie
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  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.1.1
4
+ version: 0.2.0
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-09 00:00:00.000000000 Z
11
+ date: 2013-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -82,6 +82,7 @@ files:
82
82
  - bin/bowie
83
83
  - bowie.gemspec
84
84
  - lib/bowie.rb
85
+ - lib/bowie/utils.rb
85
86
  - lib/bowie/version.rb
86
87
  homepage: http://axyz.github.io/bowie/
87
88
  licenses: