diskid 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +18 -1
  2. data/bin/diskid-ws +10 -4
  3. data/lib/diskid.rb +1 -1
  4. metadata +15 -15
data/README.md CHANGED
@@ -4,15 +4,32 @@
4
4
 
5
5
  gem install diskid
6
6
 
7
+ diskid needs curl and head commands available in your system.
8
+
9
+ Internet access is also required, as diskid sends a few bytes to http://diskid.frameos.org to identify the disk.
10
+
7
11
  ## Usage
8
12
 
9
13
  diskid path-to-disk-file
10
14
 
11
15
  i.e.
12
16
 
13
- diskid my-vm-disk.vmdk
17
+ $ diskid ubuntu64-1104.vmdk
18
+
19
+ diskid.frameos.org
20
+
21
+ file name: ubuntu64-1104.vmdk
22
+ file format: vmdk
23
+ virtual size: 9.0G (9663676416 bytes)
24
+ disk size: 319M (334364672 bytes)
14
25
 
15
26
 
27
+ PROTIP: You don't need to install diskid to use the service
28
+
29
+ head -n 20 ubuntu64-1104.vmdk > /tmp/dchunk && curl -X POST -F chunk=@/tmp/dchunk http://diskid.frameos.org
30
+
31
+
32
+
16
33
  Copyright (c) 2011 Sergio Rubio. See LICENSE.txt for
17
34
  further details.
18
35
 
@@ -3,7 +3,7 @@ require 'sinatra'
3
3
  require 'alchemist'
4
4
 
5
5
  DOCS = """
6
- <h1>FrameOS Virtual Disk Identification Service</h1>
6
+ <h1>Virtual Disk Identification Service</h1>
7
7
 
8
8
  <h2>Installation:</h2>
9
9
 
@@ -23,7 +23,7 @@ class DiskIDWS < Sinatra::Base
23
23
 
24
24
  post '/' do
25
25
  tmpfile = params[:chunk][:tempfile] rescue nil
26
- file_name = params[:file_name] rescue ''
26
+ file_name = (params[:file_name] || '') rescue ''
27
27
 
28
28
  if tmpfile.nil?
29
29
  halt 400, "Couldn't understand the file you sent me dude."
@@ -36,12 +36,17 @@ class DiskIDWS < Sinatra::Base
36
36
 
37
37
  begin
38
38
  buf = ''
39
- buf << "file name: #{file_name}\n"
39
+ if file_name.empty?
40
+ buf << "\nSome fields are being omitted and 'disk size:' won't be accurate.\n"
41
+ buf << "Use diskid command for better results\n\n"
42
+ else
43
+ buf << "file name: #{file_name}\n"
44
+ end
40
45
  out.each_line do |l|
41
46
  buf << l if l !~ /(image:|disk size:)/
42
47
  end
43
48
 
44
- buf << "disk size: #{'%.0f' % file_size.to_i.bytes.to.megabytes.to_f}M (#{file_size} bytes)"
49
+ buf << "disk size: #{'%.0f' % file_size.to_i.bytes.to.megabytes.to_f}M (#{file_size} bytes)\n"
45
50
  tmpfile.close
46
51
  FileUtils.rm_f tmpfile.path
47
52
  buf
@@ -69,4 +74,5 @@ end
69
74
  DiskIDWS.set :bind => '127.0.0.1'
70
75
  #DiskIDWS.set :raise_errors => false
71
76
  DiskIDWS.set :show_exceptions => false
77
+ DiskIDWS.set :logging => true
72
78
  DiskIDWS.run!
@@ -1,3 +1,3 @@
1
1
  module DiskID
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diskid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: shoulda
16
- requirement: &22399900 !ruby/object:Gem::Requirement
16
+ requirement: &11993400 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *22399900
24
+ version_requirements: *11993400
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &22399340 !ruby/object:Gem::Requirement
27
+ requirement: &11992840 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *22399340
35
+ version_requirements: *11992840
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: jeweler
38
- requirement: &22398800 !ruby/object:Gem::Requirement
38
+ requirement: &11992220 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.6.4
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *22398800
46
+ version_requirements: *11992220
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rcov
49
- requirement: &22414600 !ruby/object:Gem::Requirement
49
+ requirement: &11991640 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *22414600
57
+ version_requirements: *11991640
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: sinatra
60
- requirement: &22414080 !ruby/object:Gem::Requirement
60
+ requirement: &11991000 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *22414080
68
+ version_requirements: *11991000
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: clamp
71
- requirement: &22413560 !ruby/object:Gem::Requirement
71
+ requirement: &11990400 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *22413560
79
+ version_requirements: *11990400
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: alchemist
82
- requirement: &22413020 !ruby/object:Gem::Requirement
82
+ requirement: &12006120 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *22413020
90
+ version_requirements: *12006120
91
91
  description: Virtual Disk Identification Service
92
92
  email: rubiojr@frameos.org
93
93
  executables: