minpaso 0.1.0

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.
@@ -0,0 +1,222 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "Search" do
4
+ before(:all) do
5
+ @result = Minpaso.search(:manufacturer => "HITACHI")
6
+ @item = @result.items.first
7
+ end
8
+
9
+ after(:all) do
10
+ @result = nil
11
+ end
12
+
13
+ it "size" do
14
+ @result.size > 0
15
+ end
16
+
17
+ it "page" do
18
+ @result.page == 1
19
+ end
20
+
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
28
+ end
29
+
30
+ it "prev" do
31
+ @result.prev.should be_nil
32
+ end
33
+
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
46
+
47
+ it "wei_score" do
48
+ @item.wei_score.should be_a_kind_of(Float)
49
+ @item.wei_score.should > 0
50
+ end
51
+
52
+ it "cpu_score" do
53
+ @item.cpu_score.should be_a_kind_of(Float)
54
+ @item.cpu_score.should > 0
55
+ end
56
+
57
+ it "memory_score" do
58
+ @item.memory_score.should be_a_kind_of(Float)
59
+ @item.memory_score.should > 0
60
+ end
61
+
62
+ it "video_score" do
63
+ @item.video_score.should be_a_kind_of(Float)
64
+ @item.video_score.should > 0
65
+ end
66
+
67
+ it "game_score" do
68
+ @item.game_score.should be_a_kind_of(Float)
69
+ @item.game_score.should > 0
70
+ end
71
+
72
+ it "hdd_score" do
73
+ @item.hdd_score.should be_a_kind_of(Float)
74
+ @item.hdd_score.should > 0
75
+ end
76
+
77
+ it "total_score" do
78
+ @item.total_score.should be_a_kind_of(Float)
79
+ @item.total_score.should > 0
80
+ end
81
+ end
82
+ end
83
+
84
+ describe Minpaso::PCInfo do
85
+ before(:all) do
86
+ @pcinfo = Minpaso::PCInfo.new(1788)
87
+ end
88
+
89
+ after(:all) do
90
+ @pcinfo = nil
91
+ end
92
+
93
+ describe "System" do
94
+ before do
95
+ @system = @pcinfo.system
96
+ end
97
+
98
+ it "score" do
99
+ @system.score.should == 7.4
100
+ end
101
+
102
+ it "total_score" do
103
+ @system.total_score.should == 40.7
104
+ end
105
+
106
+ it "manufacturer" do
107
+ @system.manufacturer.should == "Supermicro"
108
+ end
109
+
110
+ it "product_name" do
111
+ @system.product_name.should == "X7DA8"
112
+ end
113
+
114
+ it "os" do
115
+ @system.os.should == "Windows Vista (TM) Ultimate"
116
+ end
117
+ end
118
+
119
+ describe "CPU" do
120
+ before do
121
+ @cpu = @pcinfo.cpu
122
+ end
123
+
124
+ after do
125
+ @cpu = nil
126
+ end
127
+
128
+ it "score" do
129
+ @cpu.score.should == 9.7
130
+ end
131
+
132
+ it "processor_name" do
133
+ @cpu.processor_name.should == "Intel(R) Xeon(R) CPU E5345 @ 2.33GHz"
134
+ end
135
+ end
136
+
137
+ describe "Memory" do
138
+ before(:all) do
139
+ @memory = @pcinfo.memory
140
+ end
141
+
142
+ after(:all) do
143
+ @memory = nil
144
+ end
145
+
146
+ it "score" do
147
+ @memory.score.should == 7.5
148
+ end
149
+
150
+ it "size" do
151
+ @memory.size.should == 8588034048.byte
152
+ end
153
+ end
154
+
155
+ describe "Graphics" do
156
+ before(:all) do
157
+ @graphics = @pcinfo.graphics
158
+ end
159
+
160
+ after(:all) do
161
+ @graphics = nil
162
+ end
163
+
164
+ it "video_score" do
165
+ @graphics.video_score.should == 7.6
166
+ end
167
+
168
+ it "game_score" do
169
+ @graphics.game_score.should == 7.4
170
+ end
171
+
172
+ it "adapter" do
173
+ @graphics.adapter.should == "NVIDIA GeForce 8800 GTS"
174
+ end
175
+
176
+ it "driver_version" do
177
+ @graphics.driver_version.should == "7.15.11.65"
178
+ end
179
+
180
+ it "total_graphics_memory" do
181
+ @graphics.total_graphics_memory.should == 1438515200.byte
182
+ end
183
+
184
+ it "dedicated_video_memory" do
185
+ @graphics.dedicated_video_memory.should == 633733120.byte
186
+ end
187
+
188
+ it "dedicated_system_memory" do
189
+ @graphics.dedicated_system_memory.should == 0.byte
190
+ end
191
+
192
+ it "shared_system_memory" do
193
+ @graphics.shared_system_memory.should == 804782080.byte
194
+ end
195
+ end
196
+
197
+ describe "HDD" do
198
+ before(:all) do
199
+ @hdd = @pcinfo.hdd
200
+ end
201
+
202
+ after(:all) do
203
+ @hdd = nil
204
+ end
205
+
206
+ it "score" do
207
+ @hdd.score.should == 8.5
208
+ end
209
+
210
+ it "primary_size" do
211
+ @hdd.primary_size.should == 639460438016.byte
212
+ end
213
+
214
+ it "primary_free_space" do
215
+ @hdd.primary_free_space.should == 496327954432.byte
216
+ end
217
+
218
+ it "total_size" do
219
+ @hdd.total_size.should == 639460438016.byte
220
+ end
221
+ end
222
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ -fs --colour
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ require 'spec'
3
+
4
+ $KCODE = "UTF-8"
5
+ $LOAD_PATH << File.join(File.dirname(__FILE__), "..", "lib")
6
+ require "minpaso"
@@ -0,0 +1,34 @@
1
+ desc 'Release the website and new gem version'
2
+ task :deploy => [:check_version, :website, :release] do
3
+ puts "Remember to create SVN tag:"
4
+ puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
5
+ "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
6
+ puts "Suggested comment:"
7
+ puts "Tagging release #{CHANGES}"
8
+ end
9
+
10
+ desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
11
+ task :local_deploy => [:website_generate, :install_gem]
12
+
13
+ task :check_version do
14
+ unless ENV['VERSION']
15
+ puts 'Must pass a VERSION=x.y.z release version'
16
+ exit
17
+ end
18
+ unless ENV['VERSION'] == VERS
19
+ puts "Please update your version.rb to match the release version, currently #{VERS}"
20
+ exit
21
+ end
22
+ end
23
+
24
+ desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
25
+ task :install_gem_no_doc => [:clean, :package] do
26
+ sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
27
+ end
28
+
29
+ namespace :manifest do
30
+ desc 'Recreate Manifest.txt to include ALL files'
31
+ task :refresh do
32
+ `rake check_manifest | patch -p0 > Manifest.txt`
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ task :ruby_env do
2
+ RUBY_APP = if RUBY_PLATFORM =~ /java/
3
+ "jruby"
4
+ else
5
+ "ruby"
6
+ end unless defined? RUBY_APP
7
+ end
data/tasks/rspec.rake ADDED
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/*_spec.rb']
21
+ end
@@ -0,0 +1,17 @@
1
+ desc 'Generate website files'
2
+ task :website_generate => :ruby_env do
3
+ (Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
4
+ sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
5
+ end
6
+ end
7
+
8
+ desc 'Upload website files to rubyforge'
9
+ task :website_upload do
10
+ host = "#{rubyforge_username}@rubyforge.org"
11
+ remote_dir = "/var/www/gforge-projects/#{PATH}/"
12
+ local_dir = 'website'
13
+ sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
14
+ end
15
+
16
+ desc 'Generate and upload website files'
17
+ task :website => [:website_generate, :website_upload, :publish_docs]
@@ -0,0 +1,114 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
+ <title>
8
+ ruby-minpaso
9
+ </title>
10
+ <script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
11
+ <style>
12
+
13
+ </style>
14
+ <script type="text/javascript">
15
+ window.onload = function() {
16
+ settings = {
17
+ tl: { radius: 10 },
18
+ tr: { radius: 10 },
19
+ bl: { radius: 10 },
20
+ br: { radius: 10 },
21
+ antiAlias: true,
22
+ autoPad: true,
23
+ validTags: ["div"]
24
+ }
25
+ var versionBox = new curvyCorners(settings, document.getElementById("version"));
26
+ versionBox.applyCornersToAll();
27
+ }
28
+ </script>
29
+ </head>
30
+ <body>
31
+ <div id="main">
32
+
33
+ <h1>ruby-minpaso</h1>
34
+ <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/minpaso"; return false'>
35
+ <p>Get Version</p>
36
+ <a href="http://rubyforge.org/projects/minpaso" class="numbers">0.1.0</a>
37
+ </div>
38
+ <h2>What</h2>
39
+
40
+
41
+ <p>ruby-minpaso is a wrapper library for Minpaso <span class="caps">API</span>.</p>
42
+
43
+
44
+ <h2>Installing</h2>
45
+
46
+
47
+ <p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">minpaso</span></pre></p>
48
+
49
+
50
+ <h2>The basics</h2>
51
+
52
+
53
+ <h3>Search</h3>
54
+
55
+
56
+ <p><pre class='syntax'>
57
+ <span class="ident">pager</span> <span class="punct">=</span> <span class="constant">Minpaso</span><span class="punct">.</span><span class="ident">search</span><span class="punct">(</span><span class="symbol">:manufacturer</span> <span class="punct">=&gt;</span> <span class="punct">&quot;</span><span class="string">Sony</span><span class="punct">&quot;)</span>
58
+ <span class="ident">item</span> <span class="punct">=</span> <span class="ident">pager</span><span class="punct">.</span><span class="ident">items</span><span class="punct">.</span><span class="ident">first</span>
59
+ <span class="ident">item</span><span class="punct">.</span><span class="ident">product_name</span>
60
+ <span class="ident">item</span><span class="punct">.</span><span class="ident">wei_score</span>
61
+ <span class="ident">item</span><span class="punct">.</span><span class="ident">cpu_score</span>
62
+ <span class="ident">item</span><span class="punct">.</span><span class="ident">memory_score</span>
63
+ <span class="ident">item</span><span class="punct">.</span><span class="ident">video_score</span>
64
+ <span class="ident">item</span><span class="punct">.</span><span class="ident">game_score</span>
65
+ <span class="ident">item</span><span class="punct">.</span><span class="ident">hdd_score</span>
66
+ <span class="ident">item</span><span class="punct">.</span><span class="ident">total_score</span>
67
+ </pre></p>
68
+
69
+
70
+ <h3>Details</h3>
71
+
72
+
73
+ <p><pre class='syntax'>
74
+ <span class="ident">pcinfo</span> <span class="punct">=</span> <span class="constant">Minpaso</span><span class="punct">::</span><span class="constant">PCInfo</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="number">1788</span><span class="punct">)</span>
75
+ <span class="ident">pcinfo</span><span class="punct">.</span><span class="ident">cpu</span><span class="punct">.</span><span class="ident">score</span>
76
+ <span class="ident">pcinfo</span><span class="punct">.</span><span class="ident">memory</span><span class="punct">.</span><span class="ident">size</span><span class="punct">.</span><span class="ident">to_mb</span>
77
+ </pre></p>
78
+
79
+
80
+ <h2>Forum</h2>
81
+
82
+
83
+ <p><a href="http://groups.google.com/group/ruby-minpaso">http://groups.google.com/group/ruby-minpaso</a></p>
84
+
85
+
86
+ <h2>How to submit patches</h2>
87
+
88
+
89
+ <p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people&#8217;s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
90
+
91
+
92
+ <p>The trunk repository is <code>svn://rubyforge.org/var/svn/minpaso/trunk</code> for anonymous access.</p>
93
+
94
+
95
+ <h2>License</h2>
96
+
97
+
98
+ <p>This code is free to use under the terms of the Ruby license.</p>
99
+
100
+
101
+ <h2>Contact</h2>
102
+
103
+
104
+ <p>Comments are welcome. Send an email to <a href="mailto:keita.yamaguchi@gmail.com">Keita Yamaguchi</a> or the <a href="http://groups.google.com/group/ruby-minpaso">forum</a></p>
105
+ <p class="coda">
106
+ <a href="keita.yamaguchi@gmail.com">Keita Yamaguchi</a>, 1st January 2008<br>
107
+ Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
108
+ </p>
109
+ </div>
110
+
111
+ <!-- insert site tracking codes here, like Google Urchin -->
112
+
113
+ </body>
114
+ </html>
data/website/index.txt ADDED
@@ -0,0 +1,53 @@
1
+ h1. ruby-minpaso
2
+
3
+ h2. What
4
+
5
+ ruby-minpaso is a wrapper library for Minpaso API.
6
+
7
+ h2. Installing
8
+
9
+ <pre syntax="ruby">sudo gem install minpaso</pre>
10
+
11
+ h2. The basics
12
+
13
+ h3. Search
14
+
15
+ <pre syntax="ruby">
16
+ pager = Minpaso.search(:manufacturer => "Sony")
17
+ item = pager.items.first
18
+ item.product_name
19
+ item.wei_score
20
+ item.cpu_score
21
+ item.memory_score
22
+ item.video_score
23
+ item.game_score
24
+ item.hdd_score
25
+ item.total_score
26
+ </pre>
27
+
28
+ h3. Details
29
+
30
+ <pre syntax="ruby">
31
+ pcinfo = Minpaso::PCInfo.new(1788)
32
+ pcinfo.cpu.score
33
+ pcinfo.memory.size.to_mb
34
+ </pre>
35
+
36
+ h2. Forum
37
+
38
+ "http://groups.google.com/group/ruby-minpaso":http://groups.google.com/group/ruby-minpaso
39
+
40
+ h2. How to submit patches
41
+
42
+ Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above.
43
+
44
+ The trunk repository is <code>svn://rubyforge.org/var/svn/minpaso/trunk</code> for anonymous access.
45
+
46
+ h2. License
47
+
48
+ This code is free to use under the terms of the Ruby license.
49
+
50
+ h2. Contact
51
+
52
+ Comments are welcome. Send an email to "Keita Yamaguchi":mailto:keita.yamaguchi@gmail.com or the "forum":http://groups.google.com/group/ruby-minpaso
53
+