minpaso 0.1.0 → 002

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,11 @@
1
+ ---
2
+ :summary: This is a wrapper library for Minpaso API(http://minpaso.goga.co.jp/).
3
+ :email: keita.yamaguchi@gmail.com
4
+ :has_rdoc: true
5
+ :name: minpaso
6
+ :homepage: http://rubyforge.org/projects/minpaso/
7
+ :version: "002"
8
+ :dependencies:
9
+ - units
10
+ :rubyforge_project: minpaso
11
+ :author: Keita Yamaguchi
@@ -1,4 +1,11 @@
1
- == 0.1.0 2007-12-31
1
+ == 002: 2008-04-16
2
2
 
3
- * 1 major enhancement:
3
+ * Keita Yamaguchi:
4
+ * GitHub: http://github.com/keita/ruby-minpaso/tree/master
5
+ * Reduced files included in the gem
6
+ * added bin/minpaso
7
+
8
+ == 0.1.0: 2007-12-31
9
+
10
+ * Keita Yamaguchi:
4
11
  * Initial release
@@ -1,3 +1,56 @@
1
- Copyright (c) 2007 Keita Yamaguchi
1
+ ruby-minpaso is copyrighted free software by Keita Yamaguchi <keita.yamaguchi@gmail.com>.
2
+ You can redistribute it and/or modify it under either the terms of the GPL
3
+ (see the file GPL), or the conditions below:
2
4
 
3
- ruby-minpaso is released under the Ruby license.
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a) place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b) use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c) give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d) make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a) distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b) accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c) give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d) make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
@@ -1,26 +1,10 @@
1
+ .gemified
1
2
  History.txt
2
3
  License.txt
3
4
  Manifest.txt
4
5
  README.txt
5
6
  Rakefile
6
- config/hoe.rb
7
- config/requirements.rb
8
7
  lib/minpaso.rb
9
- lib/minpaso/version.rb
10
- log/debug.log
11
- script/destroy
12
- script/generate
13
- script/txt2html
8
+ bin/minpaso
14
9
  setup.rb
15
10
  spec/minpaso_spec.rb
16
- spec/spec.opts
17
- spec/spec_helper.rb
18
- tasks/deployment.rake
19
- tasks/environment.rake
20
- tasks/rspec.rake
21
- tasks/website.rake
22
- website/index.html
23
- website/index.txt
24
- website/javascripts/rounded_corners_lite.inc.js
25
- website/stylesheets/screen.css
26
- website/template.rhtml
data/README.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  = README
2
2
 
3
3
  Authors:: Keita Yamaguchi(山口慶太)
4
- Copyright:: Copyright (C) Keita Yamaguchi, 2007. All rights reserved.
4
+ Copyright:: © Keita Yamaguchi, 2007-2008. All rights reserved.
5
5
  License:: Ruby License
6
6
 
7
7
  == What
@@ -13,5 +13,5 @@ ruby-minpaso is a wrapper library for Minpaso API.
13
13
  * {Minpaso}[http://minpaso.goga.co.jp/]
14
14
  * {API}[http://minpaso.goga.co.jp/ja-JP/api.php]
15
15
  * ruby-minpaso
16
- {Website}[http://minpaso.rubyforge.org/]
17
- {Rubyforge Project}[http://rubyforge.org/projects/minpaso/]
16
+ * {Website}[http://minpaso.rubyforge.org/]
17
+ * {Rubyforge Project}[http://rubyforge.org/projects/minpaso/]
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- require 'config/requirements'
2
- require 'config/hoe' # setup Hoe + all gem configuration
1
+ require "rubygems"
2
+ require "rtask"
3
3
 
4
- Dir['tasks/**/*.rake'].each { |rake| load rake }
4
+ RTask.new(:use => :all, :version => Minpaso::VERSION)
@@ -0,0 +1,132 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubygems"
4
+ require "minpaso"
5
+ require "optparse"
6
+
7
+ $config = Hash.new
8
+
9
+ Option = OptionParser.new do |opt|
10
+ opt.on("-m", "--manifacturer NAME", "Search by manufacturer") do |name|
11
+ $config[:manifacturer] = name
12
+ end
13
+
14
+ opt.on("-p", "--product NAME", "Search by product") do |name|
15
+ $config[:product_name] = name
16
+ end
17
+
18
+ opt.on("-c", "--cpu NAME", "Search by CPU") do |name|
19
+ $config[:cpu_name] = name
20
+ end
21
+
22
+ opt.on("-g", "--graphics NAME", "Search by graphic adapter") do |name|
23
+ $config[:graphics_adapter] = name
24
+ end
25
+
26
+ opt.on("--wei-min SCORE", "Sets minimum WEI score") do |score|
27
+ $config[:web_min] = score.to_i
28
+ end
29
+
30
+ opt.on("--wei-max SCORE", "Sets maximum WEI score") do |score|
31
+ $config[:wei_max] = score.to_i
32
+ end
33
+
34
+ opt.on("--cpu-min SCORE", "Sets minimum CPU score") do |score|
35
+ $config[:cpu_min] = score.to_i
36
+ end
37
+
38
+ opt.on("--cpu-max SCORE", "Sets maximum CPU score") do |score|
39
+ $config[:cpu_max] = score.to_i
40
+ end
41
+
42
+ opt.on("--memory-min SCORE", "Sets minimum memory score") do |score|
43
+ $config[:memory_min] = score.to_i
44
+ end
45
+
46
+ opt.on("--memory-max SCORE", "Sets maximum memory score") do |score|
47
+ $config[:memory_max] = score.to_i
48
+ end
49
+
50
+ opt.on("--video-min SCORE", "Sets minimum video score") do |score|
51
+ $config[:video_min] = score.to_i
52
+ end
53
+
54
+ opt.on("--video-max SCORE", "Sets maximum video score") do |score|
55
+ $config[:video_max] = score.to_i
56
+ end
57
+
58
+ opt.on("--game-min SCORE", "Sets minimum game score") do |score|
59
+ $config[:game_min] = score.to_i
60
+ end
61
+
62
+ opt.on("--game-max SCORE", "Sets maximum game score") do |score|
63
+ $config[:game_max] = score.to_i
64
+ end
65
+
66
+ opt.on("--hdd_min SCORE", "Sets minimum HDD score") do |score|
67
+ $config[:hdd_min] = score.to_i
68
+ end
69
+
70
+ opt.on("--hdd_max SCORE", "Sets maximum HDD score") do |score|
71
+ $config[:hdd_max] = score.to_i
72
+ end
73
+
74
+ opt.on("--total_min SCORE", "Sets minimum total score") do |score|
75
+ $config[:total_min] = score.to_i
76
+ end
77
+
78
+ opt.on("--tatal_max SCORE", "Sets maximum total score") do |score|
79
+ $config[:total_max] = score.to_i
80
+ end
81
+
82
+ opt.on("--sort CRITERION", "Sets sort criterion") do |c|
83
+ $config[:sort] = c
84
+ end
85
+
86
+ opt.on("--page NUMBER", "Specifies the page number") do |n|
87
+ $config[:page] = n
88
+ end
89
+
90
+ opt.on("--hide-homebuilt-computers", "Hides home-built computers") do
91
+ $config[:h] = 0
92
+ end
93
+
94
+ opt.on("--disable-score-estimation", "Disable score estimation") do
95
+ $config[:e] = 0
96
+ end
97
+
98
+ opt.on("-h", "--help", "Show this message") do
99
+ puts opt.help
100
+ exit
101
+ end
102
+
103
+ opt.on("-v", "--version", "Show the version of ruby-minpaso") do
104
+ puts Minpaso::VERSION
105
+ exit
106
+ end
107
+
108
+ opt.parse!(ARGV)
109
+ end
110
+
111
+ $label_width = 15
112
+
113
+ def show(label, val)
114
+ puts "#{label}:".ljust($label_width) + val.to_s
115
+ end
116
+
117
+ result = Minpaso.search($config)
118
+ result.items.each do |item|
119
+ puts "=== ID #{item.id} ==="
120
+ show "Product Name", item.product_name
121
+ show "Manufacture", item.manufacture
122
+ show "WEI Score", item.wei_score
123
+ show "CPU Score", item.cpu_score
124
+ show "Memory Score", item.memory_score
125
+ show "Video Score", item.video_score
126
+ show "Game Score", item.game_score
127
+ show "HDD Score", item.hdd_score
128
+ show "Total Score", item.total_score
129
+ puts
130
+ end
131
+
132
+ show "Nunber of Result", result.size
@@ -4,6 +4,8 @@ require "rexml/document"
4
4
  require "units/standard"
5
5
 
6
6
  module Minpaso
7
+ VERSION = "002"
8
+
7
9
  # params:: See http://minpaso.goga.co.jp/ja-JP/api.php for details.
8
10
  # - :manufacturer
9
11
  # - :product_name
@@ -1,222 +1,187 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
1
+ $KCODE = "UTF-8"
2
+ require "rubygems"
3
+ $LOAD_PATH << File.join(File.dirname(__FILE__), "..", "lib")
4
+ require "minpaso"
5
+ require "bacon"
2
6
 
3
- describe "Search" do
4
- before(:all) do
5
- @result = Minpaso.search(:manufacturer => "HITACHI")
6
- @item = @result.items.first
7
- end
7
+ $result = Minpaso.search(:manufacturer => "HITACHI")
8
8
 
9
- after(:all) do
10
- @result = nil
11
- end
9
+ describe "Minpaso::SearchResultPager" do
10
+ @result = $result
11
+ @item = @result.items.first
12
12
 
13
13
  it "size" do
14
- @result.size > 0
14
+ @result.size.should > 0
15
15
  end
16
16
 
17
17
  it "page" do
18
- @result.page == 1
18
+ @result.page.should == 1
19
19
  end
20
20
 
21
21
  it "next" do
22
- pager = @result
23
- while pager do
24
- pager.should be_a_kind_of(Minpaso::SearchResultPager)
25
- pager.items.size.should > 0
26
- pager = pager.next
27
- end
22
+ pager = @result.next
23
+ pager.should.be.kind_of(Minpaso::SearchResultPager)
24
+ pager.items.size.should > 0
28
25
  end
29
26
 
30
27
  it "prev" do
31
- @result.prev.should be_nil
28
+ @result.prev.should.be.nil
32
29
  end
30
+ end
33
31
 
34
- describe "Item" do
35
- it "id" do
36
- @item.id.should be_a_kind_of(Integer)
37
- end
38
-
39
- it "manufacture" do
40
- @item.manufacture.should == "HITACHI"
41
- end
42
-
43
- it "product_name" do
44
- @item.product_name.should be_a_kind_of(String)
45
- end
32
+ describe "Minpaso::SearchResultPager::Item" do
33
+ @item = $result.items.first
46
34
 
47
- it "wei_score" do
48
- @item.wei_score.should be_a_kind_of(Float)
49
- @item.wei_score.should > 0
50
- end
35
+ it "id" do
36
+ @item.id.should.be.kind_of(Integer)
37
+ end
51
38
 
52
- it "cpu_score" do
53
- @item.cpu_score.should be_a_kind_of(Float)
54
- @item.cpu_score.should > 0
55
- end
39
+ it "manufacture" do
40
+ @item.manufacture.should == "HITACHI"
41
+ end
56
42
 
57
- it "memory_score" do
58
- @item.memory_score.should be_a_kind_of(Float)
59
- @item.memory_score.should > 0
60
- end
43
+ it "product_name" do
44
+ @item.product_name.should.be.kind_of(String)
45
+ end
61
46
 
62
- it "video_score" do
63
- @item.video_score.should be_a_kind_of(Float)
64
- @item.video_score.should > 0
65
- end
47
+ it "wei_score" do
48
+ @item.wei_score.should.be.kind_of(Float)
49
+ @item.wei_score.should > 0
50
+ end
66
51
 
67
- it "game_score" do
68
- @item.game_score.should be_a_kind_of(Float)
69
- @item.game_score.should > 0
70
- end
52
+ it "cpu_score" do
53
+ @item.cpu_score.should.be.kind_of(Float)
54
+ @item.cpu_score.should > 0
55
+ end
71
56
 
72
- it "hdd_score" do
73
- @item.hdd_score.should be_a_kind_of(Float)
74
- @item.hdd_score.should > 0
75
- end
57
+ it "memory_score" do
58
+ @item.memory_score.should.be.kind_of(Float)
59
+ @item.memory_score.should > 0
60
+ end
76
61
 
77
- it "total_score" do
78
- @item.total_score.should be_a_kind_of(Float)
79
- @item.total_score.should > 0
80
- end
62
+ it "video_score" do
63
+ @item.video_score.should.be.kind_of(Float)
64
+ @item.video_score.should > 0
81
65
  end
82
- end
83
66
 
84
- describe Minpaso::PCInfo do
85
- before(:all) do
86
- @pcinfo = Minpaso::PCInfo.new(1788)
67
+ it "game_score" do
68
+ @item.game_score.should.be.kind_of(Float)
69
+ @item.game_score.should > 0
87
70
  end
88
71
 
89
- after(:all) do
90
- @pcinfo = nil
72
+ it "hdd_score" do
73
+ @item.hdd_score.should.be.kind_of(Float)
74
+ @item.hdd_score.should > 0
91
75
  end
92
76
 
93
- describe "System" do
94
- before do
95
- @system = @pcinfo.system
96
- end
77
+ it "total_score" do
78
+ @item.total_score.should.be.kind_of(Float)
79
+ @item.total_score.should > 0
80
+ end
81
+ end
97
82
 
98
- it "score" do
99
- @system.score.should == 7.4
100
- end
83
+ $pcinfo = Minpaso::PCInfo.new(1788)
101
84
 
102
- it "total_score" do
103
- @system.total_score.should == 40.7
104
- end
85
+ describe "Minpaso::PCInfo::System" do
86
+ @system = $pcinfo.system
105
87
 
106
- it "manufacturer" do
107
- @system.manufacturer.should == "Supermicro"
108
- end
88
+ it "score" do
89
+ @system.score.should == 7.4
90
+ end
109
91
 
110
- it "product_name" do
111
- @system.product_name.should == "X7DA8"
112
- end
92
+ it "total_score" do
93
+ @system.total_score.should == 40.7
94
+ end
113
95
 
114
- it "os" do
115
- @system.os.should == "Windows Vista (TM) Ultimate"
116
- end
96
+ it "manufacturer" do
97
+ @system.manufacturer.should == "Supermicro"
117
98
  end
118
99
 
119
- describe "CPU" do
120
- before do
121
- @cpu = @pcinfo.cpu
122
- end
100
+ it "product_name" do
101
+ @system.product_name.should == "X7DA8"
102
+ end
123
103
 
124
- after do
125
- @cpu = nil
126
- end
104
+ it "os" do
105
+ @system.os.should == "Windows Vista (TM) Ultimate"
106
+ end
107
+ end
127
108
 
128
- it "score" do
129
- @cpu.score.should == 9.7
130
- end
109
+ describe "Minpaso::PCInfo::CPU" do
110
+ @cpu = $pcinfo.cpu
131
111
 
132
- it "processor_name" do
133
- @cpu.processor_name.should == "Intel(R) Xeon(R) CPU E5345 @ 2.33GHz"
134
- end
112
+ it "score" do
113
+ @cpu.score.should == 9.7
135
114
  end
136
115
 
137
- describe "Memory" do
138
- before(:all) do
139
- @memory = @pcinfo.memory
140
- end
141
-
142
- after(:all) do
143
- @memory = nil
144
- end
116
+ it "processor_name" do
117
+ @cpu.processor_name.should == "Intel(R) Xeon(R) CPU E5345 @ 2.33GHz"
118
+ end
119
+ end
145
120
 
146
- it "score" do
147
- @memory.score.should == 7.5
148
- end
121
+ describe "Minpaso::PCInfo::Memory" do
122
+ @memory = $pcinfo.memory
149
123
 
150
- it "size" do
151
- @memory.size.should == 8588034048.byte
152
- end
124
+ it "score" do
125
+ @memory.score.should == 7.5
153
126
  end
154
127
 
155
- describe "Graphics" do
156
- before(:all) do
157
- @graphics = @pcinfo.graphics
158
- end
159
-
160
- after(:all) do
161
- @graphics = nil
162
- end
128
+ it "size" do
129
+ @memory.size.should == 8588034048
130
+ end
131
+ end
163
132
 
164
- it "video_score" do
165
- @graphics.video_score.should == 7.6
166
- end
133
+ describe "Graphics" do
134
+ @graphics = $pcinfo.graphics
167
135
 
168
- it "game_score" do
169
- @graphics.game_score.should == 7.4
170
- end
136
+ it "video_score" do
137
+ @graphics.video_score.should == 7.6
138
+ end
171
139
 
172
- it "adapter" do
173
- @graphics.adapter.should == "NVIDIA GeForce 8800 GTS"
174
- end
140
+ it "game_score" do
141
+ @graphics.game_score.should == 7.4
142
+ end
175
143
 
176
- it "driver_version" do
177
- @graphics.driver_version.should == "7.15.11.65"
178
- end
144
+ it "adapter" do
145
+ @graphics.adapter.should == "NVIDIA GeForce 8800 GTS"
146
+ end
179
147
 
180
- it "total_graphics_memory" do
181
- @graphics.total_graphics_memory.should == 1438515200.byte
182
- end
148
+ it "driver_version" do
149
+ @graphics.driver_version.should == "7.15.11.65"
150
+ end
183
151
 
184
- it "dedicated_video_memory" do
185
- @graphics.dedicated_video_memory.should == 633733120.byte
186
- end
152
+ it "total_graphics_memory" do
153
+ @graphics.total_graphics_memory.should == 1438515200.byte
154
+ end
187
155
 
188
- it "dedicated_system_memory" do
189
- @graphics.dedicated_system_memory.should == 0.byte
190
- end
156
+ it "dedicated_video_memory" do
157
+ @graphics.dedicated_video_memory.should == 633733120.byte
158
+ end
191
159
 
192
- it "shared_system_memory" do
193
- @graphics.shared_system_memory.should == 804782080.byte
194
- end
160
+ it "dedicated_system_memory" do
161
+ @graphics.dedicated_system_memory.should == 0.byte
195
162
  end
196
163
 
197
- describe "HDD" do
198
- before(:all) do
199
- @hdd = @pcinfo.hdd
200
- end
164
+ it "shared_system_memory" do
165
+ @graphics.shared_system_memory.should == 804782080.byte
166
+ end
167
+ end
201
168
 
202
- after(:all) do
203
- @hdd = nil
204
- end
169
+ describe "Minpaso::PCInfo::HDD" do
170
+ @hdd = $pcinfo.hdd
205
171
 
206
- it "score" do
207
- @hdd.score.should == 8.5
208
- end
172
+ it "score" do
173
+ @hdd.score.should == 8.5
174
+ end
209
175
 
210
- it "primary_size" do
211
- @hdd.primary_size.should == 639460438016.byte
212
- end
176
+ it "primary_size" do
177
+ @hdd.primary_size.should == 639460438016.byte
178
+ end
213
179
 
214
- it "primary_free_space" do
215
- @hdd.primary_free_space.should == 496327954432.byte
216
- end
180
+ it "primary_free_space" do
181
+ @hdd.primary_free_space.should == 496327954432.byte
182
+ end
217
183
 
218
- it "total_size" do
219
- @hdd.total_size.should == 639460438016.byte
220
- end
184
+ it "total_size" do
185
+ @hdd.total_size.should == 639460438016.byte
221
186
  end
222
187
  end