gdnsd_io 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 89f5abf7d324f76d166496a687f0fd754d67a8d1
4
- data.tar.gz: ea3ef43eca93c8ef8df0562fb2c37aeea0bbe100
3
+ metadata.gz: 2ea6e61103e573e00eb0f7dd5f3b6fc8eb48bea7
4
+ data.tar.gz: 275785da7e39e27d4874095d744241c1afce2714
5
5
  SHA512:
6
- metadata.gz: 30113427db3e7f76dcc8cbee4bb97ac26be1d74688818c350c1115534ff29b0bc06c20ab5646e89b032d04323796c33e644efdb974d076ed9753a6d4195597e5
7
- data.tar.gz: 1b34f336b83e2aa081e9661a95dfe9f3dd6527c260c074b745bc6607ac551168024cd0c1317d0704aa5a2dfc7211a9469bec7f9830863279f04da9fbb16f847e
6
+ metadata.gz: fb669482f66416af9c0b7d747b5424019f2551e1f1fb9710aa879a33269ec26612913e8b4ffdbb416cc62c1d871d33c2c93b31c47c8946534d2108a7dc2f1fdc
7
+ data.tar.gz: bdc63ed1469d219485bbe272f83f4262396ff3df13e014f2b40d36e83827603f5f062b118018b7382977d8bdfe9726d272e0ae3cc75873bb9b0c629b750e8922
Binary file
@@ -0,0 +1,29 @@
1
+ module GdnsdIo
2
+ class FileOperations
3
+ def initialize(*args)
4
+ options = args.last.is_a?(Hash) ? args.pop : {}
5
+ @config = GdnsdIo::FilePath.new options
6
+ end
7
+
8
+ def write_record(records, text_file_name)
9
+ tmp_file = File.new(@config.filepath + "/" + text_file_name + ".txt", "w+") unless File.exists?(text_file_name)
10
+ records.each do |record|
11
+ if record[:prio].nil?
12
+ tmp_file.puts(record[:name].to_s + " \t" + record[:rtype].to_s + "\t" + record[:content].to_s + "\t" + record[:ttl].to_s )
13
+ else
14
+ tmp_file.puts(record[:name].to_s + " \t" + record[:rtype].to_s + "\t" + record[:content].to_s + "\t" + record[:ttl].to_s + " \t" + record[:prio].to_s )
15
+ end
16
+ end
17
+ tmp_file.close
18
+ end
19
+
20
+ def create_text(text_file_name)
21
+ tmp_file = File.new(@config.filepath + "/" + text_file_name + ".txt", "w+") unless File.exists?(text_file_name)
22
+ tmp_file.close
23
+ end
24
+
25
+ def delete_text(text_file_name)
26
+ File.delete(@config.filepath + "/" + text_file_name + ".txt")
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,17 @@
1
+ module GdnsdIo
2
+ class FilePath
3
+ DEFAULTS = {
4
+ filepath: ""
5
+ }
6
+
7
+ DEFAULTS.each_key do |attribute|
8
+ attr_accessor attribute
9
+ end
10
+
11
+ def initialize(filepath = {})
12
+ DEFAULTS.each do |attribute, value|
13
+ send("#{attribute}=".to_sym, filepath.fetch(attribute, value))
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module GdnsdIo
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gdnsd_io
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esref Viduslu
@@ -53,8 +53,11 @@ files:
53
53
  - Rakefile
54
54
  - bin/console
55
55
  - bin/setup
56
+ - gdnsd_io-1.0.0.gem
56
57
  - gdnsd_io.gemspec
57
58
  - lib/gdnsd_io.rb
59
+ - lib/gdnsd_io/file_operations.rb
60
+ - lib/gdnsd_io/file_path.rb
58
61
  - lib/gdnsd_io/version.rb
59
62
  homepage: https://bitbucket.org/lab2023corp/gdnsd-io
60
63
  licenses: