slapp 0.1.3 → 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: 0ce9903469327aab318ff50b88cc417d94b4836c
4
- data.tar.gz: 94b5b1081d35d9efe684984ba14b3b632cc95b83
3
+ metadata.gz: 069be1a726d2449efa13cb54319bc8d934350c27
4
+ data.tar.gz: ebc6d36142bbcc380c039cd697197f466c4da36a
5
5
  SHA512:
6
- metadata.gz: 64cc07ea988821934c647db33f361de9680b9c7819252f0c582ed28e56bbdcb909a2e7aaeee8756ba3e84db1d45165c2c2b55d882c49df374642c27523bce39a
7
- data.tar.gz: 17ea0cc0a07ad04b155a90790521ece188c1b7cd438f4c7c8a398db4f004066a04f5c1c24af836a1f4a7220de54d9255ec2ee223cb68ede5d56819b2083fccf4
6
+ metadata.gz: b8f7c249400a6bedccd2f09e460a0e1e225be80b40c4e0b8266a70dec6d580a1d7f4e7affbbd99e3997a8626bcbe8716aa12fa2780772fd97acb2c149749f6ae
7
+ data.tar.gz: ce89e40c7dd939eb29c913a716053510f5ea8df38669b5c488d796bbeab9c6528396e7c39282fa133addb8de8fef95c3d2f20e4d7bd39a4d2aa5a054e5967522
data/lib/slapp/package.rb CHANGED
@@ -17,11 +17,11 @@ class Slapp::Package
17
17
  @name_match[3]
18
18
  end
19
19
 
20
- def package_name
20
+ def file_name
21
21
  @name_match[2]
22
22
  end
23
23
 
24
- def file_name
24
+ def package_name
25
25
  @name_match[1]
26
26
  end
27
27
 
@@ -33,16 +33,16 @@ class Slapp::Package
33
33
  @name_match[5]
34
34
  end
35
35
 
36
+ def build
37
+ @name_match[6]
38
+ end
39
+
36
40
  def location
37
41
  @location_match[1]
38
42
  end
39
43
 
40
44
  def path
41
- File.join "/slackware/slackware-#{@slackware_version}", location, file_name
42
- end
43
-
44
- def build
45
- @name_match[5]
45
+ File.join "/slackware/slackware-#{@slackware_version}", location, package_name
46
46
  end
47
47
 
48
48
  def size_uncompressed
@@ -80,22 +80,9 @@ class Slapp::Package
80
80
  end
81
81
 
82
82
  def to_hash
83
- {
84
- file_name: file_name,
85
- package_name: package_name,
86
- name: name,
87
- version: version,
88
- arch: arch,
89
- build: build,
90
- size: {
91
- compressed: size_compressed,
92
- uncompressed: size_uncompressed
93
- },
94
- location: location,
95
- path: path,
96
- description: description,
97
- original_description: original_description,
98
- summary: summary
83
+ methods = [:name, :file_name, :package_name, :version, :arch, :build, :location, :path, :size_uncompressed, :size_compressed, :description, :original_description, :summary]
84
+ methods.each_with_object({}) { |m, hash|
85
+ hash[m] = self.send(m)
99
86
  }
100
87
  end
101
88
 
data/lib/slapp/parser.rb CHANGED
@@ -23,8 +23,7 @@ class Slapp::Parser
23
23
 
24
24
  def packages
25
25
  raw_packages.map { |pkg|
26
- package = Slapp::Package.new pkg.first, slackware_version
27
- package.to_hash
26
+ Slapp::Package.new pkg.first, slackware_version
28
27
  }
29
28
  end
30
29
 
data/lib/slapp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Slapp
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
data/spec/parser_spec.rb CHANGED
@@ -24,34 +24,47 @@ describe Slapp::Parser do
24
24
  @package = @parser.packages.first
25
25
  end
26
26
 
27
- it "parses the filename" do
28
- @package[:file_name].should == 'ConsoleKit-0.4.3-i486-1.txz'
27
+ it ".package_name" do
28
+ @package.package_name.should == 'ConsoleKit-0.4.3-i486-1.txz'
29
29
  end
30
30
 
31
- it "parses the name" do
32
- @package[:name].should == 'ConsoleKit'
31
+ it ".file_name" do
32
+ @package.file_name.should == 'ConsoleKit-0.4.3-i486-1'
33
33
  end
34
34
 
35
- it "parses the version" do
36
- @package[:version].should == '0.4.3'
35
+ it ".name" do
36
+ @package.name.should == 'ConsoleKit'
37
37
  end
38
38
 
39
- it "parses the location" do
40
- @package[:location].should == '/slackware/l'
39
+ it ".version" do
40
+ @package.version.should == '0.4.3'
41
41
  end
42
42
 
43
- it "parses the path" do
44
- @package[:path].should == '/slackware/slackware-13.37/slackware/l/ConsoleKit-0.4.3-i486-1.txz'
43
+ it ".location" do
44
+ @package.location.should == '/slackware/l'
45
45
  end
46
46
 
47
- it "parses the size" do
48
- @package[:size].should == {
49
- :compressed => 131072,
50
- :uncompressed => 624640
51
- }
47
+ it ".arch" do
48
+ @package.arch.should == 'i486'
49
+ end
50
+
51
+ it ".build" do
52
+ @package.build.should == '1'
53
+ end
54
+
55
+ it ".path" do
56
+ @package.path.should == '/slackware/slackware-13.37/slackware/l/ConsoleKit-0.4.3-i486-1.txz'
57
+ end
58
+
59
+ it ".size_compressed" do
60
+ @package.size_compressed.should == 131072
52
61
  end
53
62
 
54
- it "parses the description" do
63
+ it ".size_uncompressed" do
64
+ @package.size_uncompressed.should == 624640
65
+ end
66
+
67
+ it ".description" do
55
68
  desc = <<-desc
56
69
  ConsoleKit (user, login, and seat tracking framework)
57
70
 
@@ -60,10 +73,10 @@ ConsoleKit is a framework for defining and tracking users, login sessions, and s
60
73
  Homepage: http://freedesktop.org/wiki/Software/ConsoleKit
61
74
  desc
62
75
 
63
- @package[:description].should == desc.strip
76
+ @package.description.should == desc.strip
64
77
  end
65
78
 
66
- it "parses the original description" do
79
+ it ".original_description" do
67
80
  desc = <<-desc
68
81
  ConsoleKit (user, login, and seat tracking framework)
69
82
 
@@ -73,17 +86,35 @@ sessions, and seats.
73
86
  Homepage: http://freedesktop.org/wiki/Software/ConsoleKit
74
87
  desc
75
88
 
76
- @package[:original_description].should == desc.strip
89
+ @package.original_description.should == desc.strip
77
90
  end
78
91
 
79
- it "parses the summary" do
80
- @package[:summary].should == "ConsoleKit (user, login, and seat tracking framework)"
92
+ it ".summary" do
93
+ @package.summary.should == "ConsoleKit (user, login, and seat tracking framework)"
94
+ end
95
+
96
+ it ".to_hash" do
97
+ @package.to_hash.should == {
98
+ :name=>"ConsoleKit",
99
+ :file_name=>"ConsoleKit-0.4.3-i486-1",
100
+ :package_name=>"ConsoleKit-0.4.3-i486-1.txz",
101
+ :version=>"0.4.3",
102
+ :arch=>"i486",
103
+ :build=>"1",
104
+ :location=>"/slackware/l",
105
+ :path=>"/slackware/slackware-13.37/slackware/l/ConsoleKit-0.4.3-i486-1.txz",
106
+ :size_uncompressed=>624640,
107
+ :size_compressed=>131072,
108
+ :description=>"ConsoleKit (user, login, and seat tracking framework)\n\nConsoleKit is a framework for defining and tracking users, login sessions, and seats.\n\nHomepage: http://freedesktop.org/wiki/Software/ConsoleKit",
109
+ :original_description=>"ConsoleKit (user, login, and seat tracking framework)\n\nConsoleKit is a framework for defining and tracking users, login\nsessions, and seats.\n\nHomepage: http://freedesktop.org/wiki/Software/ConsoleKit",
110
+ :summary=>"ConsoleKit (user, login, and seat tracking framework)"
111
+ }
81
112
  end
82
113
  end
83
114
 
84
115
  describe 'aalib' do
85
116
  before do
86
- @aalib = @parser.packages.select { |pkg| pkg[:name] == 'aalib' }.first
117
+ @aalib = @parser.packages.select { |pkg| pkg.name == 'aalib' }.first
87
118
  end
88
119
 
89
120
  it "parses the original description" do
@@ -101,7 +132,7 @@ Jan Hubicka, Thomas A. K. Kjaer,
101
132
  Tim Newsome, and Kamil Toman.
102
133
  desc
103
134
 
104
- @aalib[:original_description].should == original_desc.strip
135
+ @aalib.original_description.should == original_desc.strip
105
136
  end
106
137
 
107
138
  it 'parses the description' do
@@ -111,7 +142,7 @@ aalib (ASCII Art library)
111
142
  AA-lib is an ASCII art graphics library. Internally, the AA-lib API is similar to other graphics libraries, but it renders the the output into ASCII art (like the example to the right :^) The developers of AA-lib are Jan Hubicka, Thomas A. K. Kjaer, Tim Newsome, and Kamil Toman.
112
143
  desc
113
144
 
114
- @aalib[:description].should == desc.strip
145
+ @aalib.description.should == desc.strip
115
146
  end
116
147
  end
117
148
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nic Aitch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-19 00:00:00.000000000 Z
11
+ date: 2014-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler