clenver 0.1.5 → 0.1.6
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/clenver/project.rb +76 -46
- data/lib/clenver/version.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: d7aa01424b81804d531d62db9a00b2dc8a95010e
|
4
|
+
data.tar.gz: 46c81097146e872fe12dbbd824ea388245c83b4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a692d724142d568875ffb5d42c73b2778d9dce84d3626030c8c1ba472fbb3132d8bc33a76946089078788f55a7d87c8d60f9e259f6993d22bf625a36dc1d529f
|
7
|
+
data.tar.gz: c02318898f1ed739f607c2499352d3e38b0e325347d6c04365c07654b3b753d5b67c7e3daf02977257999b64371cf3dbc87d67adc97d1a210b10edf96bbe385d
|
data/lib/clenver/project.rb
CHANGED
@@ -2,27 +2,29 @@ require 'clenver/repository'
|
|
2
2
|
require 'clenver/link'
|
3
3
|
|
4
4
|
class Project
|
5
|
-
|
5
|
+
include Logging
|
6
|
+
attr_accessor :name, :repos, :dst, :abs_path
|
7
|
+
def initialize(name, repos, dst)
|
6
8
|
@name = name
|
7
9
|
@repos = repos
|
10
|
+
@dst = dst
|
8
11
|
@abs_path = Dir::pwd + "/" + @name
|
9
12
|
end
|
10
13
|
|
11
|
-
def
|
12
|
-
@
|
13
|
-
|
14
|
-
|
15
|
-
def create_repos(dst=nil)
|
16
|
-
puts "create_repos:"
|
17
|
-
if dst
|
18
|
-
path = self.get_abs_path + "/../" + dst.to_s + "/" + @name
|
19
|
-
puts path
|
14
|
+
def goto_dst
|
15
|
+
if @dst
|
16
|
+
path = @abs_path + "/../" + @dst + "/" + @name
|
20
17
|
FileUtils.mkdir_p(path)
|
21
18
|
else
|
22
|
-
path =
|
19
|
+
path = @abs_path
|
23
20
|
Dir::mkdir(path)
|
24
21
|
end
|
25
22
|
Dir::chdir(path)
|
23
|
+
end
|
24
|
+
|
25
|
+
def create_repos(dst=nil)
|
26
|
+
logger.debug("create_repos:")
|
27
|
+
goto_dst
|
26
28
|
case @repos
|
27
29
|
when Hash
|
28
30
|
@repos.each do |uri, content|
|
@@ -45,50 +47,78 @@ class Project
|
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
48
|
-
def
|
49
|
-
|
50
|
+
def init_project
|
51
|
+
logger.debug("init_project:")
|
50
52
|
case @repos
|
51
53
|
when Hash
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
54
|
+
init_links
|
55
|
+
init_repos
|
56
|
+
init_runs
|
57
|
+
when String
|
58
|
+
begin
|
59
|
+
unless @repos.nil?
|
60
|
+
@repos['links'].each do |s,d|
|
61
|
+
Link.new(s,d).create
|
62
|
+
end
|
63
|
+
end
|
64
|
+
rescue Exception => msg
|
65
|
+
puts msg
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def init_links
|
71
|
+
@repos.each do |uri, content|
|
72
|
+
begin
|
73
|
+
unless content.nil?
|
74
|
+
#links
|
75
|
+
unless content['links'].nil?
|
76
|
+
content['links'].each do |s,d|
|
77
|
+
if /\$\w+/.match(s)
|
78
|
+
#TODO: this is ugly and should be fixed
|
79
|
+
buf = Array.new().push(s)
|
80
|
+
s_path = Link.new(s,d).expand_dst(buf)[0]
|
81
|
+
elsif
|
82
|
+
s_path = content['object'].get_abs_path + "/" + s
|
73
83
|
end
|
84
|
+
Link.new(s_path,d).create
|
74
85
|
end
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
86
|
+
end
|
87
|
+
end
|
88
|
+
rescue Exception => msg
|
89
|
+
puts msg
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def init_repos
|
95
|
+
@repos.each do |uri, content|
|
96
|
+
begin
|
97
|
+
unless content.nil?
|
98
|
+
#remotes
|
99
|
+
unless content['remotes'].nil?
|
100
|
+
content['remotes'].each do |name, uri|
|
101
|
+
Dir::chdir(content['object'].get_abs_path)
|
102
|
+
content['object'].add_remote(name, uri)
|
81
103
|
end
|
82
104
|
end
|
83
|
-
rescue Exception => msg
|
84
|
-
puts msg
|
85
105
|
end
|
106
|
+
rescue Exception => msg
|
107
|
+
puts msg
|
86
108
|
end
|
87
|
-
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def init_runs
|
113
|
+
@repos.each do |uri, content|
|
88
114
|
begin
|
89
|
-
unless
|
90
|
-
|
91
|
-
|
115
|
+
unless content.nil?
|
116
|
+
#run
|
117
|
+
unless content['run'].nil?
|
118
|
+
content['run'].each do |cmd|
|
119
|
+
Dir::chdir(content['object'].get_abs_path)
|
120
|
+
puts %x[#{cmd}]
|
121
|
+
end
|
92
122
|
end
|
93
123
|
end
|
94
124
|
rescue Exception => msg
|
data/lib/clenver/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clenver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Król
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|