dream 1.0.0 → 2.0.0
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/lib/dream/version.rb +1 -1
- data/lib/dream.rb +33 -21
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95ac3ca827e3ba39a1baa95733c553f6996ba6bd
|
4
|
+
data.tar.gz: 81528a3d8e2ebf23b66793982130acfcb39db930
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06e0a3cce584a97083a5cffe10e6a1ecbc5bf6666dd3ccbfbb1a0f57a71cdc60cf7110ef5f9c51ca06fbce0a21cd7a864a7c2ab71cac7b51c23b5068070beccc
|
7
|
+
data.tar.gz: 11c10f60e91d72b24a4d66fb3001efd8025965d6e97b28654a39410dada1eaabd391272b42b89eb19c98ca5d3200c40da9f7aef52876f01368f777d8bb5a750a
|
data/lib/dream/version.rb
CHANGED
data/lib/dream.rb
CHANGED
@@ -5,25 +5,17 @@ module Dream
|
|
5
5
|
class Spectre
|
6
6
|
def initialize(library)
|
7
7
|
@library = library
|
8
|
-
@name = record_name()
|
9
8
|
@messages = library['records']['messages']
|
10
9
|
@format = library['records']['format']
|
11
10
|
@watches = {}
|
12
11
|
@book = Array.new
|
13
12
|
end
|
14
13
|
|
15
|
-
|
16
14
|
def record(status, directory, message)
|
17
15
|
timestamp = Time.now
|
18
16
|
path = directory.split("/")
|
19
17
|
node = branch(path[0..-2])
|
20
|
-
record =
|
21
|
-
"name" => path[-1],
|
22
|
-
"timestamp" => timestamp,
|
23
|
-
"status" => status,
|
24
|
-
"message" => message,
|
25
|
-
"children" => []
|
26
|
-
}
|
18
|
+
record = timeline(path[-1], timestamp, status, message)
|
27
19
|
node.push(record)
|
28
20
|
end
|
29
21
|
|
@@ -75,26 +67,41 @@ module Dream
|
|
75
67
|
return replica
|
76
68
|
end
|
77
69
|
|
78
|
-
def author(
|
79
|
-
|
80
|
-
node = branch(path[0..-2])
|
81
|
-
node.push(chapters)
|
70
|
+
def author(book)
|
71
|
+
@book = book
|
82
72
|
end
|
83
73
|
|
84
|
-
def save()
|
85
|
-
|
74
|
+
def save(path)
|
75
|
+
path = path.eql?(nil) ? '.' : path
|
76
|
+
iteration = 0
|
77
|
+
name = record_name(iteration)
|
78
|
+
record_path = "#{path}/#{name}"
|
79
|
+
while File.exist?(record_path)
|
80
|
+
iteration = iteration + 1
|
81
|
+
name = record_name(iteration)
|
82
|
+
record_path = "#{path}/#{name}"
|
83
|
+
end
|
84
|
+
File.open(record_path, "w+") do |f|
|
86
85
|
f.puts(@book.to_json)
|
87
86
|
end
|
87
|
+
return record_path
|
88
88
|
end
|
89
89
|
|
90
|
-
def clean()
|
91
|
-
FileUtils.rm_rf(
|
90
|
+
def clean(path)
|
91
|
+
return FileUtils.rm_rf(path)
|
92
92
|
end
|
93
93
|
|
94
94
|
private
|
95
95
|
|
96
|
-
def
|
97
|
-
|
96
|
+
def timeline(name, timestamp, status, message)
|
97
|
+
record = {
|
98
|
+
"name" => name,
|
99
|
+
"timestamp" => timestamp,
|
100
|
+
"status" => status,
|
101
|
+
"message" => message,
|
102
|
+
"children" => []
|
103
|
+
}
|
104
|
+
return record
|
98
105
|
end
|
99
106
|
|
100
107
|
def branch(branches)
|
@@ -104,14 +111,19 @@ module Dream
|
|
104
111
|
edge = edge[-1]["children"]
|
105
112
|
else
|
106
113
|
break
|
114
|
+
#edge = timeline(branch, Time.now, "Void", "Mystic")
|
107
115
|
end
|
108
116
|
end
|
109
117
|
return edge
|
110
118
|
end
|
111
119
|
|
112
|
-
def record_name()
|
120
|
+
def record_name(iteration)
|
113
121
|
timestamp = @library['records']['timestamp'] ? "-#{Time.now.strftime "%Y%m%d%H%M%S-%L"}" : ""
|
114
|
-
|
122
|
+
if iteration.eql?(0)
|
123
|
+
return "#{@library['records']['name']}#{timestamp}.#{@library['records']['extension']}"
|
124
|
+
else
|
125
|
+
return "#{@library['records']['name']}#{timestamp}-#{iteration}.#{@library['records']['extension']}"
|
126
|
+
end
|
115
127
|
end
|
116
128
|
|
117
129
|
def timestamp()
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Vecchio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|