libgfapi-ruby 0.0.12 → 0.0.13

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c08505f252f199c03d82fa2cc3c5f34022bc1770
4
- data.tar.gz: 8b8117f1ce2e57f19a2ef5fa4355e66f207fabee
3
+ metadata.gz: aba878b6bcc6ef0e8133badf2db3178e16fb43d8
4
+ data.tar.gz: ceb89cd0e31d9b179f498372532cf2ae4847a6d4
5
5
  SHA512:
6
- metadata.gz: c76ab9e12a88904348382523f2a1ab797a2da60712bab2dcfd6bab9ed58d366f1ebf0f2f186688dea14f413b85beaa846040b941d11900b632628237547bdce8
7
- data.tar.gz: 117e848b899a00517f9b04324ba046520f08c4b1202863d82d4337c42dd8c9fe39f9c32573776dab29f158854a58dbb2db8f406335bff90e4a2e55e54abc3a8f
6
+ metadata.gz: cc0a87d0cfc355e95276507117ae3cfc3e09a6f7164052a00e516aededf6ed034a708e4eb8985970f2031a0dc1ebf62fca62b97a53cd2d256bdbcd0b1714b13e
7
+ data.tar.gz: dc4670f682ba0c65fb65d7c2d575fe45fd39edd3c51ba4a51ae3b5ce006fca05685e24fdc288b969e28c492205e9dadd6b6ba5850a595a4336efa1451807a080
@@ -20,6 +20,6 @@ class GlusterFS::Directory
20
20
  end
21
21
 
22
22
  def exists?
23
- lstat[:st_size] > 0
23
+ GlusterFS::Stat.dir?(lstat)
24
24
  end
25
25
  end
@@ -66,7 +66,7 @@ class GlusterFS::File
66
66
  end
67
67
 
68
68
  def exists?
69
- lstat[:st_blocks] > 0
69
+ GlusterFS::Stat.file?(lstat)
70
70
  end
71
71
 
72
72
  def size
@@ -1,4 +1,29 @@
1
1
  class GlusterFS::Stat < FFI::Struct
2
+
3
+ S_IFMT = 0170000 #bit mask for the file type bit fields
4
+ S_IFSOCK = 0140000 #socket
5
+ S_IFLNK = 0120000 #symbolic link
6
+ S_IFREG = 0100000 #regular file
7
+ S_IFBLK = 0060000 #block device
8
+ S_IFDIR = 0040000 #directory
9
+ S_IFCHR = 0020000 #character device
10
+ S_IFIFO = 0010000 #FIFO
11
+ S_ISUID = 0004000 #set UID bit
12
+ S_ISGID = 0002000 #set-group-ID bit (see below)
13
+ S_ISVTX = 0001000 #sticky bit (see below)
14
+ S_IRWXU = 00700 #mask for file owner permissions
15
+ S_IRUSR = 00400 #owner has read permission
16
+ S_IWUSR = 00200 #owner has write permission
17
+ S_IXUSR = 00100 #owner has execute permission
18
+ S_IRWXG = 00070 #mask for group permissions
19
+ S_IRGRP = 00040 #group has read permission
20
+ S_IWGRP = 00020 #group has write permission
21
+ S_IXGRP = 00010 #group has execute permission
22
+ S_IRWXO = 00007 #mask for permissions for others (not in group)
23
+ S_IROTH = 00004 #others have read permission
24
+ S_IWOTH = 00002 #others have write permission
25
+ S_IXOTH = 00001 #others have execute permission
26
+
2
27
  layout :st_dev, :dev_t,
3
28
  :st_ino, :ino_t,
4
29
  :st_nlink, :nlink_t,
@@ -15,4 +40,37 @@ class GlusterFS::Stat < FFI::Struct
15
40
  :st_mtimesec, :ulong,
16
41
  :st_ctime, :ulong,
17
42
  :st_ctimesec, :ulong
43
+
44
+ def self.dir?(lstat)
45
+ lstat[:st_mode] & S_IFDIR > 0
46
+ end
47
+
48
+ def self.file?(lstat)
49
+ lstat[:st_mode] & S_IFREG > 0
50
+ end
51
+
52
+ def self.symlink?(lstat)
53
+ lstat[:st_mode] & S_IFLNK > 0
54
+ end
55
+
56
+ def to_hash
57
+ {
58
+ :st_dev => self[:st_dev],
59
+ :st_ino => self[:st_ino],
60
+ :st_nlink => self[:st_nlink],
61
+ :st_mode => self[:st_mode],
62
+ :st_uid => self[:st_uid],
63
+ :st_gid => self[:st_gid],
64
+ :st_rdev => self[:st_rdev],
65
+ :st_size => self[:st_size],
66
+ :st_blksize => self[:st_blksize],
67
+ :st_blocks => self[:st_blocks],
68
+ :st_atime => self[:st_atime],
69
+ :st_atimesec => self[:st_atimesec],
70
+ :st_mtime => self[:st_mtime],
71
+ :st_mtimesec => self[:st_mtimesec],
72
+ :st_ctime => self[:st_ctime],
73
+ :st_ctimesec => self[:st_ctimesec],
74
+ }
75
+ end
18
76
  end
@@ -1,3 +1,3 @@
1
1
  module GlusterFS
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libgfapi-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Varaneckas
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  requirements: []
144
144
  rubyforge_project:
145
- rubygems_version: 2.0.6
145
+ rubygems_version: 2.0.3
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: Ruby bindings for libgfapi (GlusterFS API)
@@ -153,4 +153,3 @@ test_files:
153
153
  - spec/glusterfs/stress/performance_spec.rb
154
154
  - spec/glusterfs/volume_spec.rb
155
155
  - spec/spec_helper.rb
156
- has_rdoc: