umwelt 0.1.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +21 -1
- data/README.md +9 -3
- data/lib/umwelt.rb +1 -1
- data/lib/umwelt/abstract.rb +2 -0
- data/lib/umwelt/abstract/file/restore.rb +4 -12
- data/lib/umwelt/abstract/file/store.rb +9 -2
- data/lib/umwelt/abstract/interactor.rb +15 -0
- data/lib/umwelt/abstract/mapper.rb +8 -8
- data/lib/umwelt/abstract/request.rb +51 -0
- data/lib/umwelt/cli/commands/clone.rb +31 -6
- data/lib/umwelt/cli/commands/convey.rb +15 -9
- data/lib/umwelt/command.rb +3 -0
- data/lib/umwelt/command/clone.rb +75 -0
- data/lib/umwelt/command/convey.rb +28 -40
- data/lib/umwelt/episode.rb +1 -0
- data/lib/umwelt/episode/file/store.rb +2 -2
- data/lib/umwelt/episode/get.rb +13 -0
- data/lib/umwelt/history.rb +1 -0
- data/lib/umwelt/history/aggregate.rb +1 -3
- data/lib/umwelt/history/file/store.rb +2 -2
- data/lib/umwelt/history/follow.rb +1 -3
- data/lib/umwelt/history/get.rb +13 -0
- data/lib/umwelt/history/trace.rb +1 -3
- data/lib/umwelt/project.rb +1 -0
- data/lib/umwelt/project/file/store.rb +2 -2
- data/lib/umwelt/project/get.rb +21 -0
- data/lib/umwelt/tree/imprint.rb +1 -3
- data/lib/umwelt/version.rb +1 -1
- data/spec/examples/project.json +6 -0
- data/spec/examples/short_history.json +28 -0
- data/umwelt.gemspec +2 -0
- metadata +38 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b09c7404541ae4d930a87a892759ff25a34e331075cec8ba4c1886e5dd4fb393
|
4
|
+
data.tar.gz: 44b3bec990a484b7d92bf75a8140a0c4d3aca1d7fdbdd7a535d73f9ddf025b47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa1c8c418bcd01669f04d6883679b753fb5434c3bf61d76826def775a7a53393f4f629b8ffd9b87c83e7bb671bf2dd8fcc80c5deb7b9a1ba2be7424ec51be7cb
|
7
|
+
data.tar.gz: 666cc5abb1392b5e709553a6e3b6c2b9804a0f63220266bf7aa80bccf7bf171c8382d8b203d75b3426482135bf304ffac8981b1d7c1de0f39eec0a9a32e9d040
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
umwelt (0.
|
4
|
+
umwelt (0.2)
|
5
5
|
hanami-cli
|
6
|
+
httparty
|
6
7
|
unparser
|
7
8
|
|
8
9
|
GEM
|
@@ -12,6 +13,8 @@ GEM
|
|
12
13
|
adamantium (0.2.0)
|
13
14
|
ice_nine (~> 0.11.0)
|
14
15
|
memoizable (~> 0.4.0)
|
16
|
+
addressable (2.6.0)
|
17
|
+
public_suffix (>= 2.0.2, < 4.0)
|
15
18
|
ansi (1.5.0)
|
16
19
|
ast (2.4.0)
|
17
20
|
builder (3.2.3)
|
@@ -20,6 +23,8 @@ GEM
|
|
20
23
|
adamantium (~> 0.2.0)
|
21
24
|
equalizer (~> 0.0.9)
|
22
25
|
concurrent-ruby (1.1.4)
|
26
|
+
crack (0.4.3)
|
27
|
+
safe_yaml (~> 1.0.0)
|
23
28
|
diff-lcs (1.3)
|
24
29
|
equalizer (0.0.11)
|
25
30
|
fabrication (2.20.1)
|
@@ -31,26 +36,36 @@ GEM
|
|
31
36
|
hanami-utils (1.3.1)
|
32
37
|
concurrent-ruby (~> 1.0)
|
33
38
|
transproc (~> 1.0)
|
39
|
+
hashdiff (0.3.8)
|
40
|
+
httparty (0.16.4)
|
41
|
+
mime-types (~> 3.0)
|
42
|
+
multi_xml (>= 0.5.2)
|
34
43
|
i18n (1.5.3)
|
35
44
|
concurrent-ruby (~> 1.0)
|
36
45
|
ice_nine (0.11.2)
|
37
46
|
memoizable (0.4.2)
|
38
47
|
thread_safe (~> 0.3, >= 0.3.1)
|
39
48
|
method_source (0.9.2)
|
49
|
+
mime-types (3.2.2)
|
50
|
+
mime-types-data (~> 3.2015)
|
51
|
+
mime-types-data (3.2018.0812)
|
40
52
|
minitest (5.11.3)
|
41
53
|
minitest-reporters (1.3.6)
|
42
54
|
ansi
|
43
55
|
builder
|
44
56
|
minitest (>= 5.0)
|
45
57
|
ruby-progressbar
|
58
|
+
multi_xml (0.6.0)
|
46
59
|
parser (2.6.0.0)
|
47
60
|
ast (~> 2.4.0)
|
48
61
|
procto (0.0.3)
|
49
62
|
pry (0.12.2)
|
50
63
|
coderay (~> 1.1.0)
|
51
64
|
method_source (~> 0.9.0)
|
65
|
+
public_suffix (3.0.3)
|
52
66
|
rake (10.5.0)
|
53
67
|
ruby-progressbar (1.10.0)
|
68
|
+
safe_yaml (1.0.5)
|
54
69
|
thread_safe (0.3.6)
|
55
70
|
transproc (1.0.3)
|
56
71
|
unparser (0.4.3)
|
@@ -61,6 +76,10 @@ GEM
|
|
61
76
|
equalizer (~> 0.0.9)
|
62
77
|
parser (~> 2.6.0)
|
63
78
|
procto (~> 0.0.2)
|
79
|
+
webmock (3.5.1)
|
80
|
+
addressable (>= 2.3.6)
|
81
|
+
crack (>= 0.3.2)
|
82
|
+
hashdiff
|
64
83
|
|
65
84
|
PLATFORMS
|
66
85
|
ruby
|
@@ -74,6 +93,7 @@ DEPENDENCIES
|
|
74
93
|
pry
|
75
94
|
rake (~> 10.0)
|
76
95
|
umwelt!
|
96
|
+
webmock
|
77
97
|
|
78
98
|
BUNDLED WITH
|
79
99
|
1.17.2
|
data/README.md
CHANGED
@@ -34,15 +34,21 @@ Main executable is `umwelt`
|
|
34
34
|
```shell
|
35
35
|
umwelt help
|
36
36
|
Commands:
|
37
|
-
umwelt clone PROJECT
|
37
|
+
umwelt clone PROJECT/USERNAME # Clone project from remote Umwelt
|
38
38
|
umwelt convey PHASE SEMANTIC # Convey Phase in Semantic from local Umwelt
|
39
39
|
umwelt example # Create example Umwelt
|
40
40
|
umwelt pull # Pull project from remote Umwelt
|
41
41
|
umwelt version
|
42
42
|
```
|
43
43
|
|
44
|
-
In
|
45
|
-
|
44
|
+
In 0.2 version only three command is implemented: `example`, `clone` and `convey`.
|
45
|
+
|
46
|
+
If you have project on [umwelt.dev](http://umwelt.dev), clone it and convey.
|
47
|
+
```shell
|
48
|
+
umwelt clone 'username/projectname'
|
49
|
+
```
|
50
|
+
|
51
|
+
If not, call `example`, it will copy source files in `./.umwelt`
|
46
52
|
```shell
|
47
53
|
umwelt example
|
48
54
|
```
|
data/lib/umwelt.rb
CHANGED
@@ -7,6 +7,7 @@ require 'unparser'
|
|
7
7
|
module Umwelt
|
8
8
|
end
|
9
9
|
|
10
|
+
require 'umwelt/version'
|
10
11
|
require 'umwelt/abstract'
|
11
12
|
|
12
13
|
require 'umwelt/episode'
|
@@ -17,7 +18,6 @@ require 'umwelt/project'
|
|
17
18
|
require 'umwelt/node'
|
18
19
|
require 'umwelt/semantic'
|
19
20
|
require 'umwelt/tree'
|
20
|
-
require 'umwelt/version'
|
21
21
|
|
22
22
|
require 'umwelt/command'
|
23
23
|
require 'umwelt/cli'
|
data/lib/umwelt/abstract.rb
CHANGED
@@ -4,9 +4,7 @@ require 'hanami/interactor'
|
|
4
4
|
require 'json'
|
5
5
|
|
6
6
|
module Umwelt::Abstract::File
|
7
|
-
class Restore
|
8
|
-
include Hanami::Interactor
|
9
|
-
|
7
|
+
class Restore < Umwelt::Abstract::Interactor
|
10
8
|
expose :struct
|
11
9
|
|
12
10
|
def initialize(path: '.umwelt',
|
@@ -30,15 +28,9 @@ module Umwelt::Abstract::File
|
|
30
28
|
end
|
31
29
|
|
32
30
|
def struct(struct_hash)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
def clean(result)
|
37
|
-
if result.success?
|
38
|
-
result.struct
|
39
|
-
else
|
40
|
-
error! result.errors
|
41
|
-
end
|
31
|
+
prove(
|
32
|
+
@mapper.new.call(struct_hash)
|
33
|
+
).struct
|
42
34
|
end
|
43
35
|
|
44
36
|
def umwelt_root_path
|
@@ -6,15 +6,22 @@ require 'fileutils'
|
|
6
6
|
require 'pathname'
|
7
7
|
|
8
8
|
module Umwelt::Abstract::File
|
9
|
-
class Store
|
10
|
-
|
9
|
+
class Store < Umwelt::Abstract::Interactor
|
10
|
+
expose :written_paths
|
11
11
|
|
12
12
|
def initialize(path: '.umwelt')
|
13
13
|
@path = path
|
14
|
+
@written_paths = {}
|
14
15
|
end
|
15
16
|
|
16
17
|
private
|
17
18
|
|
19
|
+
def write(path, struct)
|
20
|
+
path.dirname.mkpath
|
21
|
+
|
22
|
+
path.write serialize destruct struct
|
23
|
+
end
|
24
|
+
|
18
25
|
def serialize(struct)
|
19
26
|
JSON.pretty_generate struct
|
20
27
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'hanami/interactor'
|
4
|
+
# require_relative './structs/phase'
|
5
|
+
# require_relative './structs/fragment'
|
6
|
+
|
7
|
+
module Umwelt::Abstract
|
8
|
+
class Interactor
|
9
|
+
include Hanami::Interactor
|
10
|
+
|
11
|
+
def prove(result)
|
12
|
+
result.success? ? result : error!(result.errors)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -4,14 +4,14 @@ require 'hanami/interactor'
|
|
4
4
|
# require_relative './structs/phase'
|
5
5
|
# require_relative './structs/fragment'
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
module Umwelt::Abstract
|
8
|
+
class Mapper < Umwelt::Abstract::Interactor
|
9
|
+
expose :struct
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
error! [self.class.name, e.message, data]
|
11
|
+
def fill(struct, data)
|
12
|
+
struct.new(data)
|
13
|
+
rescue ArgumentError => e
|
14
|
+
error! [self.class.name, e.message, data]
|
15
|
+
end
|
16
16
|
end
|
17
17
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'hanami/interactor'
|
4
|
+
require 'httparty'
|
5
|
+
|
6
|
+
module Umwelt::Abstract
|
7
|
+
class Request < Umwelt::Abstract::Interactor
|
8
|
+
BASE_URL = 'http://umwelt.dev/api'
|
9
|
+
# BASE_URL = 'http://localhost:2300/api'
|
10
|
+
HEADERS = {
|
11
|
+
'Content-Type': 'application/json',
|
12
|
+
'User-Agent': "Umwelt client #{Umwelt::VERSION}",
|
13
|
+
'Accept': 'application/json'
|
14
|
+
}.freeze
|
15
|
+
|
16
|
+
def get(host: BASE_URL, path: '', params: {})
|
17
|
+
check HTTParty.get(
|
18
|
+
[host, path].join('/'), options(params)
|
19
|
+
)
|
20
|
+
rescue StandardError => e
|
21
|
+
error! [self.class.name, e.message, path]
|
22
|
+
end
|
23
|
+
|
24
|
+
def check(request)
|
25
|
+
if request.parsed_response.key?('errors')
|
26
|
+
error! request.parsed_response['errors']
|
27
|
+
else
|
28
|
+
request
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def parse(request)
|
33
|
+
request
|
34
|
+
.parsed_response
|
35
|
+
.transform_keys(&:to_sym)
|
36
|
+
end
|
37
|
+
|
38
|
+
def struct(data, mapper)
|
39
|
+
result = mapper.call(data)
|
40
|
+
if result.success?
|
41
|
+
result.struct
|
42
|
+
else
|
43
|
+
error! result.errors
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def options(params)
|
48
|
+
{ headers: HEADERS, format: :json }.merge(params)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1,16 +1,41 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Umwelt::CLI
|
4
|
-
class
|
3
|
+
module Umwelt::CLI::Commands
|
4
|
+
class Clone < Hanami::CLI::Command
|
5
5
|
desc 'Clone project from remote Umwelt'
|
6
6
|
|
7
|
-
argument :
|
7
|
+
argument :user_project,
|
8
8
|
type: :string, required: true,
|
9
9
|
desc: 'provide project as USERNAME/PROJECTNAME'
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
option :target,
|
12
|
+
type: :string,
|
13
|
+
default: '.umwelt',
|
14
|
+
desc: 'provide folder for store umwelt'
|
15
|
+
|
16
|
+
def call(user_project:, **options)
|
17
|
+
puts "Cloning project: <#{user_project}>"
|
18
|
+
puts options.inspect
|
19
|
+
puts options.fetch(:target)
|
20
|
+
|
21
|
+
report(
|
22
|
+
Umwelt::Command::Clone
|
23
|
+
.new(path: options.fetch(:target))
|
24
|
+
.call(user_project: user_project)
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def report(result)
|
31
|
+
if result.success?
|
32
|
+
result.written_paths.each_pair do |key, value|
|
33
|
+
puts "#{key} => (#{value})"
|
34
|
+
end
|
35
|
+
puts "#{result.written_paths.keys.count} files written succesfully"
|
36
|
+
else
|
37
|
+
result.errors.each { |e| puts "Error: #{e}" }
|
38
|
+
end
|
14
39
|
end
|
15
40
|
end
|
16
41
|
end
|
@@ -37,20 +37,26 @@ module Umwelt::CLI::Commands
|
|
37
37
|
return
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
report(
|
41
|
+
Umwelt::Command::Convey.new.call(
|
42
|
+
phase_id: phase.to_i,
|
43
|
+
semantic: classify(semantic).to_sym,
|
44
|
+
source: Pathname.new(options.fetch(:source)),
|
45
|
+
target: Pathname.new(options.fetch(:target))
|
46
|
+
)
|
45
47
|
)
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
46
51
|
|
47
|
-
|
48
|
-
|
52
|
+
def report(result)
|
53
|
+
if result.success?
|
54
|
+
result.written_paths.each_pair do |key, value|
|
49
55
|
puts "#{key} => (#{value})"
|
50
56
|
end
|
51
|
-
puts "#{
|
57
|
+
puts "#{result.written_paths.keys.count} files written succesfully"
|
52
58
|
else
|
53
|
-
|
59
|
+
result.errors.each { |e| puts "Error: #{e}" }
|
54
60
|
end
|
55
61
|
end
|
56
62
|
end
|
data/lib/umwelt/command.rb
CHANGED
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Umwelt::Command
|
4
|
+
class Clone < Base
|
5
|
+
expose :written_paths
|
6
|
+
|
7
|
+
def initialize(path: '.umwelt')
|
8
|
+
@path = path
|
9
|
+
@written_paths = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(user_project: '/')
|
13
|
+
user_name, project_name = user_project.split('/')
|
14
|
+
|
15
|
+
project = get_project(
|
16
|
+
project_name: project_name, user_name: user_name
|
17
|
+
)
|
18
|
+
store_project!(project)
|
19
|
+
|
20
|
+
history = get_history(project.project_id)
|
21
|
+
store_history!(history)
|
22
|
+
get_episodes(history)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def get_episodes(history)
|
28
|
+
history.phases.map do |phase|
|
29
|
+
next if episode_exist? phase.id
|
30
|
+
|
31
|
+
episode = get_episode(phase.id)
|
32
|
+
store_episode!(phase.id, episode)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def episode_exist?(phase_id)
|
37
|
+
Umwelt::Episode::File::Restore
|
38
|
+
.new(path: @path)
|
39
|
+
.call(phase_id)
|
40
|
+
.success?
|
41
|
+
end
|
42
|
+
|
43
|
+
def store_episode!(id, episode)
|
44
|
+
@written_paths.merge! prove(
|
45
|
+
Umwelt::Episode::File::Store
|
46
|
+
.new(path: @path)
|
47
|
+
.call(id, episode)
|
48
|
+
).written_paths
|
49
|
+
end
|
50
|
+
|
51
|
+
def get_episode(phase_id)
|
52
|
+
prove(Umwelt::Episode::Get.new.call(phase_id)).episode
|
53
|
+
end
|
54
|
+
|
55
|
+
def store_history!(history)
|
56
|
+
@written_paths.merge! prove(
|
57
|
+
Umwelt::History::File::Store.new(path: @path).call(history)
|
58
|
+
).written_paths
|
59
|
+
end
|
60
|
+
|
61
|
+
def get_history(project_id)
|
62
|
+
prove(Umwelt::History::Get.new.call(project_id)).history
|
63
|
+
end
|
64
|
+
|
65
|
+
def store_project!(project)
|
66
|
+
@written_paths.merge! prove(
|
67
|
+
Umwelt::Project::File::Store.new(path: @path).call(project)
|
68
|
+
).written_paths
|
69
|
+
end
|
70
|
+
|
71
|
+
def get_project(user_project)
|
72
|
+
prove(Umwelt::Project::Get.new.call(user_project)).project
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -1,14 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Umwelt::Command
|
4
|
-
class Convey
|
5
|
-
|
6
|
-
# TODO: change to dry-rb transaction here
|
7
|
-
|
8
|
-
expose :result
|
4
|
+
class Convey < Base
|
5
|
+
expose :written_paths
|
9
6
|
|
10
7
|
def call(phase_id:, semantic:, source:, target:)
|
11
|
-
@
|
8
|
+
@written_paths = imprint(
|
12
9
|
tree(source, phase_id), target, semantic
|
13
10
|
)
|
14
11
|
end
|
@@ -29,12 +26,11 @@ module Umwelt::Command
|
|
29
26
|
end
|
30
27
|
|
31
28
|
def imprint(tree, target, semantic)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
29
|
+
prove(
|
30
|
+
Umwelt::Tree::Imprint
|
31
|
+
.new(tree, location: target)
|
32
|
+
.call(semantic)
|
33
|
+
).written_paths
|
38
34
|
end
|
39
35
|
|
40
36
|
def tree_fill(fragments)
|
@@ -42,43 +38,35 @@ module Umwelt::Command
|
|
42
38
|
end
|
43
39
|
|
44
40
|
def aggregate_history(episodes)
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
41
|
+
prove(
|
42
|
+
Umwelt::History::Aggregate
|
43
|
+
.new
|
44
|
+
.call(episodes)
|
45
|
+
).fragments
|
51
46
|
end
|
52
47
|
|
53
48
|
def follow_history(continuity, source)
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
else
|
60
|
-
error! result.errors
|
61
|
-
end
|
49
|
+
prove(
|
50
|
+
Umwelt::History::Follow
|
51
|
+
.new(path: source)
|
52
|
+
.call(continuity)
|
53
|
+
).episodes
|
62
54
|
end
|
63
55
|
|
64
56
|
def trace_history(history, phase_id)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
57
|
+
prove(
|
58
|
+
Umwelt::History::Trace
|
59
|
+
.new
|
60
|
+
.call(history, phase_id)
|
61
|
+
).continuity
|
71
62
|
end
|
72
63
|
|
73
64
|
def restore_history(source)
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
else
|
80
|
-
error! "Cannot restore history from '#{source}': #{restored.errors}"
|
81
|
-
end
|
65
|
+
prove(
|
66
|
+
Umwelt::History::File::Restore
|
67
|
+
.new(path: source)
|
68
|
+
.call
|
69
|
+
).struct
|
82
70
|
end
|
83
71
|
end
|
84
72
|
end
|
data/lib/umwelt/episode.rb
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
module Umwelt::Episode::File
|
4
4
|
class Store < Umwelt::Abstract::File::Store
|
5
5
|
def call(id, struct)
|
6
|
-
full_path(id)
|
6
|
+
count = write(full_path(id), struct)
|
7
7
|
|
8
|
-
full_path(id)
|
8
|
+
@written_paths[full_path(id)] = count
|
9
9
|
end
|
10
10
|
|
11
11
|
def full_path(id)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Umwelt::Episode
|
4
|
+
class Get < Umwelt::Abstract::Request
|
5
|
+
expose :episode
|
6
|
+
|
7
|
+
def call(phase_id)
|
8
|
+
request = get(path: "episodes/#{phase_id}")
|
9
|
+
|
10
|
+
@episode = struct(parse(request), Mapper.new)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/umwelt/history.rb
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
module Umwelt::History::File
|
4
4
|
class Store < Umwelt::Abstract::File::Store
|
5
5
|
def call(struct)
|
6
|
-
full_path
|
6
|
+
count = write(full_path, struct)
|
7
7
|
|
8
|
-
full_path
|
8
|
+
@written_paths[full_path] = count
|
9
9
|
end
|
10
10
|
|
11
11
|
def full_path
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Umwelt::History
|
4
|
+
class Get < Umwelt::Abstract::Request
|
5
|
+
expose :history
|
6
|
+
|
7
|
+
def call(project_id)
|
8
|
+
request = get(path: "histories/#{project_id}")
|
9
|
+
|
10
|
+
@history = struct(parse(request), Mapper.new)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/umwelt/history/trace.rb
CHANGED
data/lib/umwelt/project.rb
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
module Umwelt::Project::File
|
4
4
|
class Store < Umwelt::Abstract::File::Store
|
5
5
|
def call(struct)
|
6
|
-
full_path
|
6
|
+
count = write(full_path, struct)
|
7
7
|
|
8
|
-
full_path
|
8
|
+
@written_paths[full_path] = count
|
9
9
|
end
|
10
10
|
|
11
11
|
def full_path
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Umwelt::Project
|
4
|
+
class Get < Umwelt::Abstract::Request
|
5
|
+
expose :project
|
6
|
+
|
7
|
+
# query = {
|
8
|
+
# project_name: 'genry',
|
9
|
+
# user_name: 'ford'
|
10
|
+
# }
|
11
|
+
|
12
|
+
def call(query)
|
13
|
+
request = get(
|
14
|
+
path: 'projects/find',
|
15
|
+
params: { query: query }
|
16
|
+
)
|
17
|
+
|
18
|
+
@project = struct(parse(request), Mapper.new)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/umwelt/tree/imprint.rb
CHANGED
data/lib/umwelt/version.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
{
|
2
|
+
"project": {
|
3
|
+
"user_name": "sovetnik",
|
4
|
+
"project_name": "example",
|
5
|
+
"project_id": "1",
|
6
|
+
"description": "Durable Rubber Watch"
|
7
|
+
},
|
8
|
+
"phases": [
|
9
|
+
{
|
10
|
+
"id": 1,
|
11
|
+
"parent_id": null,
|
12
|
+
"merge_id": null,
|
13
|
+
"user_id": 1,
|
14
|
+
"finished_at": "2018-12-19 22:54:23 UTC",
|
15
|
+
"name": "initial_phase",
|
16
|
+
"description": "Effulgence immemorial unnamable hideous."
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"id": 2,
|
20
|
+
"parent_id": 1,
|
21
|
+
"merge_id": null,
|
22
|
+
"user_id": 1,
|
23
|
+
"finished_at": "2018-12-19 22:54:23 UTC",
|
24
|
+
"name": "alfa",
|
25
|
+
"description": "Fungus amorphous madness noisome foetid."
|
26
|
+
}
|
27
|
+
]
|
28
|
+
}
|
data/umwelt.gemspec
CHANGED
@@ -44,6 +44,7 @@ Gem::Specification.new do |spec|
|
|
44
44
|
spec.require_paths = ['lib']
|
45
45
|
|
46
46
|
spec.add_dependency 'hanami-cli'
|
47
|
+
spec.add_dependency 'httparty'
|
47
48
|
spec.add_dependency 'unparser'
|
48
49
|
|
49
50
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
@@ -53,4 +54,5 @@ Gem::Specification.new do |spec|
|
|
53
54
|
spec.add_development_dependency 'minitest-reporters'
|
54
55
|
spec.add_development_dependency 'pry'
|
55
56
|
spec.add_development_dependency 'rake', '~> 10.0'
|
57
|
+
spec.add_development_dependency 'webmock'
|
56
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: umwelt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Sovetnik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hanami-cli
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: httparty
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: unparser
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +150,20 @@ dependencies:
|
|
136
150
|
- - "~>"
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: '10.0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: webmock
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
139
167
|
description: |
|
140
168
|
Umwelt is a domain architecture development(knowledge management) tool,
|
141
169
|
for handy prototyping domain specification with code structure.
|
@@ -166,7 +194,9 @@ files:
|
|
166
194
|
- lib/umwelt/abstract/file.rb
|
167
195
|
- lib/umwelt/abstract/file/restore.rb
|
168
196
|
- lib/umwelt/abstract/file/store.rb
|
197
|
+
- lib/umwelt/abstract/interactor.rb
|
169
198
|
- lib/umwelt/abstract/mapper.rb
|
199
|
+
- lib/umwelt/abstract/request.rb
|
170
200
|
- lib/umwelt/cli.rb
|
171
201
|
- lib/umwelt/cli/commands.rb
|
172
202
|
- lib/umwelt/cli/commands/clone.rb
|
@@ -175,11 +205,13 @@ files:
|
|
175
205
|
- lib/umwelt/cli/commands/pull.rb
|
176
206
|
- lib/umwelt/cli/commands/version.rb
|
177
207
|
- lib/umwelt/command.rb
|
208
|
+
- lib/umwelt/command/clone.rb
|
178
209
|
- lib/umwelt/command/convey.rb
|
179
210
|
- lib/umwelt/episode.rb
|
180
211
|
- lib/umwelt/episode/file.rb
|
181
212
|
- lib/umwelt/episode/file/restore.rb
|
182
213
|
- lib/umwelt/episode/file/store.rb
|
214
|
+
- lib/umwelt/episode/get.rb
|
183
215
|
- lib/umwelt/episode/mapper.rb
|
184
216
|
- lib/umwelt/fragment.rb
|
185
217
|
- lib/umwelt/fragment/mapper.rb
|
@@ -189,6 +221,7 @@ files:
|
|
189
221
|
- lib/umwelt/history/file/restore.rb
|
190
222
|
- lib/umwelt/history/file/store.rb
|
191
223
|
- lib/umwelt/history/follow.rb
|
224
|
+
- lib/umwelt/history/get.rb
|
192
225
|
- lib/umwelt/history/mapper.rb
|
193
226
|
- lib/umwelt/history/trace.rb
|
194
227
|
- lib/umwelt/node.rb
|
@@ -201,6 +234,7 @@ files:
|
|
201
234
|
- lib/umwelt/project/file.rb
|
202
235
|
- lib/umwelt/project/file/restore.rb
|
203
236
|
- lib/umwelt/project/file/store.rb
|
237
|
+
- lib/umwelt/project/get.rb
|
204
238
|
- lib/umwelt/project/mapper.rb
|
205
239
|
- lib/umwelt/semantic.rb
|
206
240
|
- lib/umwelt/semantic/plain.rb
|
@@ -225,6 +259,8 @@ files:
|
|
225
259
|
- spec/examples/episodes/5.json
|
226
260
|
- spec/examples/episodes/7.json
|
227
261
|
- spec/examples/history.json
|
262
|
+
- spec/examples/project.json
|
263
|
+
- spec/examples/short_history.json
|
228
264
|
- umwelt.gemspec
|
229
265
|
homepage: http://umwelt.dev
|
230
266
|
licenses:
|