rvpc 0.0.1 → 0.0.3

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rvpc.rb +5 -0
  3. metadata +5 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed71842d1d6784991e0fef8ef5f2f476f4862e08
4
- data.tar.gz: 232b7703d5f0de1811b48e881902d423e9d495d3
3
+ metadata.gz: 2a7988db43b9333ea7531117b3cfe79f8733bc74
4
+ data.tar.gz: 80f5312f001f803a66dfcad7c6e027a59db30034
5
5
  SHA512:
6
- metadata.gz: 4097b9dfca1af73bc42f6cb5070cec47806ccf5b6b05be2c6709f22cbc62c9ccedba9a975224851cb440cbae3e5346bf29ecde69f87e243d7a0726517ccc3f79
7
- data.tar.gz: 4956c099078ed16bc8c74e220cdaa2704a40767bd07a6cd52402164dc3e80a461a0adc07cf466f8be573adf0a8778381d4a9fbc2e1bc10c6b6c1bd92160456ba
6
+ metadata.gz: b03cc754165e03d7cb50679e83dc27d5e3a0c1ea529d5d9db0bd39c3b672ef6e7548e49ddf1d1515ef1465360fe11bfef7796f76e598bb55837b0b14fd763edf
7
+ data.tar.gz: 7b344d12991339ed38a6dad0375425502cf850be52ef662af489a849f57e7b5c6079c04ccaa862c3366ae14b60ddd34d6bdbfdb3496f9da59450d65e80618190
@@ -68,6 +68,7 @@ class Computer
68
68
  #
69
69
  # @return (see #create)
70
70
  def delete(filename)
71
+ filename = filename.gsub(/[\x00\/\\:\*\?\"<>\|]/, '_')
71
72
  @files.delete(filename) if @files.has_key?(filename)
72
73
  self
73
74
  end
@@ -77,6 +78,7 @@ class Computer
77
78
  # @param filename [String] The filename of the file to return
78
79
  # @return [String] The contents of the selected file
79
80
  def get(filename)
81
+ filename = filename.gsub(/[\x00\/\\:\*\?\"<>\|]/, '_')
80
82
  @files[filename]["contents"] if @files.has_key?(filename).has_key?("contents")
81
83
  end
82
84
 
@@ -101,6 +103,7 @@ class Computer
101
103
  # @return [Hash, Computer] If a block is given, it returns +self+, otherwise it returns the file Hash
102
104
  # @yield [creator, contents, time] Optional yield block for the file
103
105
  def self.gfile(filename)
106
+ filename = filename.gsub(/[\x00\/\\:\*\?\"<>\|]/, '_')
104
107
  yield(@@gfiles[filename]["creator"], @@gfiles[filename]["contents"], @@gfiles[filename]["time"]) if block_given?
105
108
  @@gfiles[filename] unless block_given?
106
109
  self unless block_given?
@@ -111,6 +114,7 @@ class Computer
111
114
  # @param file [String] The relative path of the file, including the filename
112
115
  # @return (see #create)
113
116
  def self.gsave(file)
117
+ file = file.gsub(/[\x00\/\\:\*\?\"<>\|]/, '_')
114
118
  File.open(file, "w") do |f|
115
119
  f.write(JSON.pretty_generate(@@gfiles))
116
120
  end
@@ -127,6 +131,7 @@ class Computer
127
131
  # @param password [String] +sudo+-like verification
128
132
  # @return (see #create)
129
133
  def self.gopen(username, password, file)
134
+ file = file.gsub(/[\x00\/\\:\*\?\"<>\|]/, '_')
130
135
  if (Digest::SHA256.hexdigest password) == @@users[username.to_sym][:sha] && (Digest::MD5.hexdigest password) == @@users[username.to_sym][:md5]
131
136
  @@gfiles = JSON.parse(File.read(file)) if File.exists?(file)
132
137
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rvpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ariel Abreu
@@ -11,14 +11,16 @@ cert_chain: []
11
11
  date: 2015-05-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A simple Virtual Private Computer written in ruby with virtual memory
14
- files. Currently in development.
14
+ files. Currently in development. If you have found this useful, please go to <a
15
+ href='http://arielabreu.github.io/ruby-vpc/'>the project's homepage</a> and post
16
+ in the comments what you used it for. Trying to see how to improve it!
15
17
  email: facekapow2002@gmail.com
16
18
  executables: []
17
19
  extensions: []
18
20
  extra_rdoc_files: []
19
21
  files:
20
22
  - lib/rvpc.rb
21
- homepage: http://rubygems.org/gems/rvpc
23
+ homepage: http://arielabreu.github.io/ruby-vpc
22
24
  licenses:
23
25
  - MIT
24
26
  metadata: {}