doggy 2.0.14 → 2.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/doggy/cli/edit.rb +28 -13
- data/lib/doggy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1a5d235c5e0d8ef358ef0fb74e8fdff03f5ea01
|
4
|
+
data.tar.gz: 3783e29d01e4dcdd5c4b7a5b4333ddb3d40c6886
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b37a7aa0cf6f8598d7c18ac550ab9271fc85a4753fd1a160dd7f461c4adbbf3c0b265d70c8bbb8d10cc0773108c96477fefb7cc631705ee9a5502903fa2a7d1
|
7
|
+
data.tar.gz: 5e872fc853661cc5b9c3e4a33bb23c8ab4c41952ca376ed780a16c78c24d34c12c7208accfbe8276103e092d3807324b3a1fcb1ddafe549f2f09034f2940205f
|
data/Gemfile.lock
CHANGED
data/lib/doggy/cli/edit.rb
CHANGED
@@ -12,20 +12,29 @@ module Doggy
|
|
12
12
|
return Doggy.ui.error("Could not find resource with #{ @param }") unless resource
|
13
13
|
|
14
14
|
Dir.chdir(File.dirname(resource.path)) do
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
if resource.class.to_s.downcase =~ /dashboard/
|
16
|
+
forked_resource = fork(resource)
|
17
|
+
system("open '#{ forked_resource.human_edit_url }'")
|
18
|
+
|
19
|
+
wait_for_edit
|
20
|
+
|
21
|
+
new_resource = Doggy::Models::Dashboard.find(forked_resource.id)
|
22
|
+
new_resource.id = resource.id
|
23
|
+
new_resource.title = resource.title
|
24
|
+
new_resource.description = resource.description
|
25
|
+
new_resource.path = resource.path
|
26
|
+
new_resource.save_local
|
27
|
+
|
28
|
+
forked_resource.destroy
|
29
|
+
else
|
30
|
+
system("open '#{ resource.human_edit_url }'")
|
20
31
|
|
21
|
-
|
22
|
-
new_resource.id = resource.id
|
23
|
-
new_resource.title = resource.title
|
24
|
-
new_resource.description = resource.description
|
25
|
-
new_resource.path = resource.path
|
26
|
-
new_resource.save_local
|
32
|
+
wait_for_edit
|
27
33
|
|
28
|
-
|
34
|
+
new_resource = resource.class.find(resource.id)
|
35
|
+
new_resource.path = resource.path
|
36
|
+
new_resource.save_local
|
37
|
+
end
|
29
38
|
end
|
30
39
|
end
|
31
40
|
|
@@ -40,11 +49,17 @@ module Doggy
|
|
40
49
|
id = @param.to_i
|
41
50
|
return resources.find { |res| res.id == id }
|
42
51
|
else
|
43
|
-
full_path = File.expand_path(@param,
|
52
|
+
full_path = File.expand_path(@param, Doggy.object_root)
|
44
53
|
return resources.find { |res| res.path == full_path }
|
45
54
|
end
|
46
55
|
end
|
47
56
|
|
57
|
+
def wait_for_edit
|
58
|
+
while !Doggy.ui.yes?('Are you done editing?') do
|
59
|
+
Doggy.ui.say "run, rabbit run / dig that hole, forget the sun / and when at last the work is done / don't sit down / it's time to dig another one"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
48
63
|
def fork(resource)
|
49
64
|
salt = (0...12).map { (65 + rand(26)).chr.downcase }.join
|
50
65
|
|
data/lib/doggy/version.rb
CHANGED