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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0e2702e30b76edee854437b9198f80aa8a0e17f
4
- data.tar.gz: 2d6c9faeded184a7f7b460541c386be6f6a9a03b
3
+ metadata.gz: a6829ccb9f77199998b245dafdb2f7cdd83fccd9
4
+ data.tar.gz: 991f2245c4499ec773dfde29b5c0c321fbe14d03
5
5
  SHA512:
6
- metadata.gz: 599da7c695dca546ddf93b02e2020454acd3aa4a90119dc8cf9ac0e16424797c757a867736002288f9862b5496e5259a44ea811d735a2966b66184b0ecbb235a
7
- data.tar.gz: bead10acc0a21dc9332ef46d87c9d0269efee22175d8728610a78cbd93a0c82d4c2867de358bbfa91b234be21c5dd91ded066c48478f7768238e4a8d9db61790
6
+ metadata.gz: a01b8ac33581aa1a986af733010dec0746dd36796b66e4c3e0568c5247aa5128900815e6de8959fc2a5088fc3f4328f02b789141e790a7a247d8cbdfd8042a13
7
+ data.tar.gz: cd23e29a30a7ce15e6f448c691f0575d850394bcb30352a1ee3851bd713fbea15131150274df26ee428aa29a8bc0f9aed50b27150996f429e7178eb455cbbb45
data/.gitignore CHANGED
@@ -12,3 +12,4 @@
12
12
  *.o
13
13
  *.a
14
14
  mkmf.log
15
+ *.swp
@@ -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
- # (m) Load: loads a file into memory as an NmDatafile
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)
@@ -1,3 +1,3 @@
1
1
  module NmDatafile
2
- VERSION = "0.0.0"
2
+ VERSION = "0.0.1a"
3
3
  end
data/lib/nm_datafile.rb CHANGED
@@ -1,19 +1,27 @@
1
1
  require 'json'
2
+ require 'zip'
2
3
 
3
- require "nm_datafile/version"
4
- require "nm_datafile/schema"
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 "nm_datafile/nm_datafile"
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 = ["antisec"]
10
- spec.email = ["antisec@antisec.com"]
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")
@@ -28,8 +28,10 @@ describe "nm_datafile" do
28
28
  str = nmd_shippable.save_to_string
29
29
 
30
30
  # TODO: actually test data and make more data in @sample_data
31
-
32
-
31
+ end
32
+
33
+ it "should toss me a binding" do
34
+ binding.pry
33
35
  end
34
36
 
35
37
  end
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.0
4
+ version: 0.0.1a
5
5
  platform: ruby
6
6
  authors:
7
- - antisec
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
- - antisec@antisec.com
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: '0'
126
+ version: 1.3.1
126
127
  requirements: []
127
128
  rubyforge_project:
128
129
  rubygems_version: 2.4.6