activefolder 0.0.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_folder/base.rb +3 -2
- data/lib/active_folder/metal/adapters/bare.rb +6 -0
- data/lib/active_folder/metal/client.rb +4 -0
- data/lib/active_folder/metal/connections/bare.rb +0 -4
- data/lib/active_folder/metal/connections/git.rb +1 -3
- data/lib/active_folder/model/traits/collection.rb +5 -1
- data/lib/active_folder/model/traits/discovery.rb +0 -4
- data/lib/active_folder/model/traits/persistence.rb +10 -11
- data/lib/active_folder/model/traits/{has_belongs.rb → relation.rb} +1 -1
- 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: d723e1b9eb722d530100fd75e13a97d744dd2e52
|
4
|
+
data.tar.gz: 546326b52d4274cbe274f6584634ed0856b92d0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24c74a9e783e9eae1507936258a53f6d8807d012c3a88d2a870aef9940a5d99c80b96498c878a790e891102875e6056bd37b27d3c5d9cf9f0d5f337dbb888008
|
7
|
+
data.tar.gz: 439e64fc90e91311a24f5779130e0f0023e98a13b3d249b94b8c278d25a39d70efb2935878782ed46143d82014addaa3f7075b17fec0559681eaad1adceed516
|
data/lib/active_folder/base.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
require 'ostruct'
|
2
2
|
|
3
3
|
require 'active_folder/model/traits/persistence'
|
4
|
-
require 'active_folder/model/traits/
|
4
|
+
require 'active_folder/model/traits/relation'
|
5
|
+
require 'active_folder/model/traits/collection'
|
5
6
|
require 'active_folder/model/errors'
|
6
7
|
|
7
8
|
module ActiveFolder
|
8
9
|
class Base < OpenStruct
|
9
10
|
include Model::Traits::Persistence
|
10
|
-
include Model::Traits::
|
11
|
+
include Model::Traits::Relation
|
11
12
|
extend Model::Traits::Collection
|
12
13
|
|
13
14
|
class << self
|
@@ -16,7 +16,11 @@ module ActiveFolder
|
|
16
16
|
|
17
17
|
def create(args, &block)
|
18
18
|
instance = build(args, &block);
|
19
|
-
instance.save
|
19
|
+
instance.save; instance
|
20
|
+
end
|
21
|
+
|
22
|
+
def destroy_all
|
23
|
+
all.each { |element| element.destroy }
|
20
24
|
end
|
21
25
|
|
22
26
|
def find_or_create(args, &block)
|
@@ -8,7 +8,7 @@ module ActiveFolder
|
|
8
8
|
extend ActiveSupport::Concern
|
9
9
|
|
10
10
|
included do
|
11
|
-
def load
|
11
|
+
def load
|
12
12
|
attrs = attributes_file.load
|
13
13
|
attrs.each_pair do |key,val|
|
14
14
|
self[key] = val
|
@@ -17,23 +17,21 @@ module ActiveFolder
|
|
17
17
|
self
|
18
18
|
end
|
19
19
|
|
20
|
-
def save
|
20
|
+
def save
|
21
21
|
attributes_file.save(attributes)
|
22
22
|
self
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
args.each { |k,v| self[k] = v }
|
27
|
-
self.save!
|
28
|
-
end
|
25
|
+
def save!; self.save end
|
29
26
|
|
30
27
|
def update(**args)
|
31
28
|
args.each { |k,v| self[k] = v }
|
32
29
|
self.save
|
33
30
|
end
|
34
31
|
|
35
|
-
def
|
36
|
-
|
32
|
+
def destroy
|
33
|
+
ActiveFolder.client.del(path: path)
|
34
|
+
end
|
37
35
|
|
38
36
|
private
|
39
37
|
|
@@ -45,9 +43,10 @@ module ActiveFolder
|
|
45
43
|
|
46
44
|
class_methods do
|
47
45
|
def load(path)
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
instance = new(name: File.basename(path),
|
47
|
+
base_dir: File.dirname(path))
|
48
|
+
|
49
|
+
instance.load; instance
|
51
50
|
end
|
52
51
|
end
|
53
52
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activefolder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Thorner
|
@@ -53,8 +53,8 @@ files:
|
|
53
53
|
- lib/active_folder/model/traits/collection.rb
|
54
54
|
- lib/active_folder/model/traits/discovery.rb
|
55
55
|
- lib/active_folder/model/traits/enumeration.rb
|
56
|
-
- lib/active_folder/model/traits/has_belongs.rb
|
57
56
|
- lib/active_folder/model/traits/persistence.rb
|
57
|
+
- lib/active_folder/model/traits/relation.rb
|
58
58
|
- lib/active_folder/model/utilities/collection.rb
|
59
59
|
- lib/active_folder/model/utilities/match.rb
|
60
60
|
- lib/active_folder/model/utilities/symbol.rb
|