nm_datafile 0.0.0 → 0.0.1a
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 +4 -4
- data/.gitignore +1 -0
- data/lib/nm_datafile/data_loading.rb +36 -0
- data/lib/nm_datafile/nm_datafile.rb +1 -32
- data/lib/nm_datafile/version.rb +1 -1
- data/lib/nm_datafile.rb +12 -4
- data/nm_datafile.gemspec +3 -3
- data/spec/nm_datafile_spec.rb +4 -2
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6829ccb9f77199998b245dafdb2f7cdd83fccd9
|
4
|
+
data.tar.gz: 991f2245c4499ec773dfde29b5c0c321fbe14d03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a01b8ac33581aa1a986af733010dec0746dd36796b66e4c3e0568c5247aa5128900815e6de8959fc2a5088fc3f4328f02b789141e790a7a247d8cbdfd8042a13
|
7
|
+
data.tar.gz: cd23e29a30a7ce15e6f448c691f0575d850394bcb30352a1ee3851bd713fbea15131150274df26ee428aa29a8bc0f9aed50b27150996f429e7178eb455cbbb45
|
data/.gitignore
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
module NmDatafile
|
2
|
+
|
3
|
+
module DataLoading
|
4
|
+
# (m) Load: loads a file into memory as an NmDatafile
|
5
|
+
# TODO: Make lowercase
|
6
|
+
def Load(file_path)
|
7
|
+
zip_data = File.read(file_path)
|
8
|
+
LoadBinaryData(zip_data)
|
9
|
+
end
|
10
|
+
|
11
|
+
# TODO: Make lowercase
|
12
|
+
def LoadBinaryData(binary_data)
|
13
|
+
hash = extract_entities_from_binary_data(binary_data)
|
14
|
+
|
15
|
+
file_type = determine_file_type(hash[:attributes])
|
16
|
+
nmd = NmDatafile.new( file_type )
|
17
|
+
|
18
|
+
nmd.load_attributes(hash[:attributes]) unless hash[:attributes].nil?
|
19
|
+
nmd.load_encryption(hash[:encryption])
|
20
|
+
|
21
|
+
nmd.load_data([*hash[:data_collections], *hash[:data_objects]])
|
22
|
+
end
|
23
|
+
|
24
|
+
def determine_file_type(attributes_hash)
|
25
|
+
attributes_hash = YAML::load attributes_hash
|
26
|
+
attributes_hash["file_type"].to_sym
|
27
|
+
end
|
28
|
+
|
29
|
+
def determine_password(hash)
|
30
|
+
d = YAML::load hash[:encryption]
|
31
|
+
clean_decrypt_string(d["password"])
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -102,38 +102,7 @@ module NmDatafile
|
|
102
102
|
# Loading and Dumping Methods #
|
103
103
|
###############################
|
104
104
|
|
105
|
-
#
|
106
|
-
def self.Load(file_path)
|
107
|
-
zip_data = File.read(file_path)
|
108
|
-
LoadBinaryData(zip_data)
|
109
|
-
end
|
110
|
-
|
111
|
-
def self.LoadBinaryData(binary_data)
|
112
|
-
hash = extract_entities_from_binary_data(binary_data)
|
113
|
-
|
114
|
-
file_type = determine_file_type(hash[:attributes])
|
115
|
-
nmd = self.new( file_type )
|
116
|
-
|
117
|
-
nmd.load_attributes(hash[:attributes]) unless hash[:attributes].nil?
|
118
|
-
nmd.load_encryption(hash[:encryption])
|
119
|
-
|
120
|
-
nmd.load_data([*hash[:data_collections], *hash[:data_objects]])
|
121
|
-
end
|
122
|
-
|
123
|
-
def self.determine_file_type(attributes_hash)
|
124
|
-
attributes_hash = YAML::load attributes_hash
|
125
|
-
attributes_hash["file_type"].to_sym
|
126
|
-
end
|
127
|
-
|
128
|
-
def self.determine_password(hash)
|
129
|
-
d = YAML::load hash[:encryption]
|
130
|
-
clean_decrypt_string(d["password"])
|
131
|
-
end
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
105
|
+
# notice migration to loading.rb
|
137
106
|
|
138
107
|
def initialize(file_type, *args)
|
139
108
|
set_file_type(file_type)
|
data/lib/nm_datafile/version.rb
CHANGED
data/lib/nm_datafile.rb
CHANGED
@@ -1,19 +1,27 @@
|
|
1
1
|
require 'json'
|
2
|
+
require 'zip'
|
2
3
|
|
3
|
-
require
|
4
|
-
require
|
4
|
+
require 'nm_datafile/version'
|
5
|
+
require 'nm_datafile/schema'
|
5
6
|
require 'nm_datafile/b_f'
|
7
|
+
require 'nm_datafile/data_loading'
|
6
8
|
require 'nm_datafile/crypto'
|
7
|
-
require
|
9
|
+
require 'nm_datafile/nm_datafile'
|
10
|
+
|
8
11
|
|
9
12
|
|
10
13
|
module NmDatafile
|
11
14
|
# Your code goes here...
|
12
15
|
|
16
|
+
# extend Loading
|
17
|
+
|
13
18
|
def self.new(file_type, *args)
|
14
19
|
NmDatafile.new(file_type, args)
|
15
20
|
end
|
16
|
-
|
21
|
+
|
22
|
+
def self.hello
|
23
|
+
puts "hi"
|
24
|
+
end
|
17
25
|
|
18
26
|
end
|
19
27
|
|
data/nm_datafile.gemspec
CHANGED
@@ -6,11 +6,11 @@ require 'nm_datafile/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "nm_datafile"
|
8
8
|
spec.version = NmDatafile::VERSION
|
9
|
-
spec.authors = ["
|
10
|
-
spec.email = ["
|
9
|
+
spec.authors = ["dsj"]
|
10
|
+
spec.email = ["anonymouspublicationz@riseup.net"]
|
11
11
|
spec.summary = %q{A gem that saves files into a secure encrypted file.}
|
12
12
|
spec.description = %q{A gem that creates a data file based on arrays or strings that you feed it. When you save the file, you can choose from multiple encryption methods, asymetric, symetric, etc. etc.}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/AnonymousPublications/nm_datafile"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
data/spec/nm_datafile_spec.rb
CHANGED
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nm_datafile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1a
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- dsj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
@@ -84,7 +84,7 @@ description: A gem that creates a data file based on arrays or strings that you
|
|
84
84
|
it. When you save the file, you can choose from multiple encryption methods, asymetric,
|
85
85
|
symetric, etc. etc.
|
86
86
|
email:
|
87
|
-
-
|
87
|
+
- anonymouspublicationz@riseup.net
|
88
88
|
executables: []
|
89
89
|
extensions: []
|
90
90
|
extra_rdoc_files: []
|
@@ -99,13 +99,14 @@ files:
|
|
99
99
|
- lib/nm_datafile.rb
|
100
100
|
- lib/nm_datafile/b_f.rb
|
101
101
|
- lib/nm_datafile/crypto.rb
|
102
|
+
- lib/nm_datafile/data_loading.rb
|
102
103
|
- lib/nm_datafile/nm_datafile.rb
|
103
104
|
- lib/nm_datafile/schema.rb
|
104
105
|
- lib/nm_datafile/version.rb
|
105
106
|
- nm_datafile.gemspec
|
106
107
|
- spec/nm_datafile_spec.rb
|
107
108
|
- spec/spec_helper.rb
|
108
|
-
homepage:
|
109
|
+
homepage: https://github.com/AnonymousPublications/nm_datafile
|
109
110
|
licenses:
|
110
111
|
- MIT
|
111
112
|
metadata: {}
|
@@ -120,9 +121,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
120
121
|
version: '0'
|
121
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
123
|
requirements:
|
123
|
-
- - '
|
124
|
+
- - '>'
|
124
125
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
126
|
+
version: 1.3.1
|
126
127
|
requirements: []
|
127
128
|
rubyforge_project:
|
128
129
|
rubygems_version: 2.4.6
|