clenver 0.1.10 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/Gemfile.lock +1 -1
- data/features/clenver_init.feature +26 -3
- data/lib/clenver/link.rb +14 -2
- data/lib/clenver/package_manager.rb +1 -1
- data/lib/clenver/runner.rb +4 -2
- data/lib/clenver/version.rb +1 -1
- data/test/vbox/regression.sh +17 -5
- 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: e6615635905444802e77cd25ff92232495181812
|
4
|
+
data.tar.gz: 7fbcb7463f62b4d328bf6cd80d1aa0255c4c8b2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17a40c5c82382d3b441cd27e065991113f1b7bad77495c94a307cf15c2173e608428fd70ac8ffcd37e719fdffc3ac9ea46c525fd154a2f566d5bf1bd0326f464
|
7
|
+
data.tar.gz: 4d70749859828c34c68f1fd7e9e26e77b1a142c8a07344e70b1835e9f27bfd9e89065e655ff86a2d1e76893cf2f4665eae8b3745ebedbbb9215167bb43349a94
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -79,6 +79,24 @@ Feature: Initialization
|
|
79
79
|
| some_tmp/test_repo/foobar_link |
|
80
80
|
| some_tmp/test_repo/foobar_dir_link |
|
81
81
|
|
82
|
+
Scenario: files backup verification
|
83
|
+
Given The default aruba timeout is 10 seconds
|
84
|
+
Given a file named "test_repo.yml" with:
|
85
|
+
"""
|
86
|
+
https://github.com/pietrushnic/dummy.git:
|
87
|
+
links:
|
88
|
+
foobar.txt:
|
89
|
+
- foobar_link
|
90
|
+
- foobar_link
|
91
|
+
foobar:
|
92
|
+
- foobar_dir_link
|
93
|
+
"""
|
94
|
+
When I run `clenver init test_repo.yml some_tmp`
|
95
|
+
Then the following links should exist:
|
96
|
+
| some_tmp/test_repo/foobar_link |
|
97
|
+
| some_tmp/test_repo/foobar_link_old |
|
98
|
+
| some_tmp/test_repo/foobar_dir_link |
|
99
|
+
|
82
100
|
Scenario: use system variable in path
|
83
101
|
Given The default aruba timeout is 10 seconds
|
84
102
|
Given a file named "test_repo.yml" with:
|
@@ -166,19 +184,24 @@ Feature: Initialization
|
|
166
184
|
When I run `clenver init test_repo.yml some_tmp`
|
167
185
|
Then the output should contain "installed\n"
|
168
186
|
Then the output should contain "success!!!!\n"
|
187
|
+
|
169
188
|
@wip
|
170
|
-
Scenario: install
|
171
|
-
Given The default aruba timeout is
|
189
|
+
Scenario: install gems and packages
|
190
|
+
Given The default aruba timeout is 120 seconds
|
172
191
|
Given a file named "test_repo.yml" with:
|
173
192
|
"""
|
174
193
|
apt:
|
175
194
|
- vim
|
195
|
+
- mutt
|
176
196
|
gem:
|
177
197
|
- tmuxinator
|
198
|
+
- git
|
178
199
|
https://github.com/pietrushnic/dummy.git:
|
179
200
|
run:
|
180
201
|
- echo "success!!!!"
|
181
202
|
"""
|
182
203
|
When I run `clenver init test_repo.yml some_tmp`
|
183
|
-
Then the output should contain "installed\n"
|
204
|
+
Then the output should contain "gems installed\n"
|
205
|
+
Then the output should contain "vim is already the newest version.\n"
|
206
|
+
Then the output should contain "mutt is already the newest version.\n"
|
184
207
|
Then the output should contain "success!!!!\n"
|
data/lib/clenver/link.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
1
3
|
class Link
|
4
|
+
MAX_REPEAT = 3
|
2
5
|
def initialize(src,dst)
|
3
6
|
@src = src
|
4
7
|
@dst = expand_dst(dst)
|
@@ -9,8 +12,17 @@ class Link
|
|
9
12
|
@dst.each do |d|
|
10
13
|
puts "src:#{@src}"
|
11
14
|
puts "d:#{d} "
|
12
|
-
|
13
|
-
|
15
|
+
i = 0
|
16
|
+
while i < MAX_REPEAT do
|
17
|
+
begin
|
18
|
+
File.symlink(@src, d.to_s)
|
19
|
+
rescue SystemCallError
|
20
|
+
FileUtils.mv(d.to_s, d.to_s + "_old")
|
21
|
+
else
|
22
|
+
break
|
23
|
+
end
|
24
|
+
i += 1
|
25
|
+
end
|
14
26
|
end
|
15
27
|
end
|
16
28
|
def expand_dst(dst)
|
data/lib/clenver/runner.rb
CHANGED
@@ -20,17 +20,19 @@ module Clenver
|
|
20
20
|
logger.debug("yaml: #{yaml}")
|
21
21
|
#TODO: create test and fix this place with check for empty file
|
22
22
|
p = Project.new(File.basename("#{@path}", ".yml"), yaml, @dst)
|
23
|
+
pkgs = ""
|
23
24
|
unless yaml['apt'].nil?
|
24
25
|
for pkg in yaml['apt'] do
|
25
|
-
pkgs = pkg + " "
|
26
|
+
pkgs = pkgs + " " + pkg + " "
|
26
27
|
end
|
27
28
|
puts pkgs
|
28
29
|
p_mgr = PackageManger.new('apt', pkgs)
|
29
30
|
p_mgr.install()
|
30
31
|
end
|
32
|
+
pkgs = ""
|
31
33
|
unless yaml['gem'].nil?
|
32
34
|
for pkg in yaml['gem'] do
|
33
|
-
pkgs = pkg + " "
|
35
|
+
pkgs = pkgs + " " + pkg + " "
|
34
36
|
end
|
35
37
|
puts pkgs
|
36
38
|
p_mgr = PackageManger.new('gem', pkgs)
|
data/lib/clenver/version.rb
CHANGED
data/test/vbox/regression.sh
CHANGED
@@ -25,15 +25,21 @@ startvm() {
|
|
25
25
|
}
|
26
26
|
|
27
27
|
ssh_cmd () {
|
28
|
+
echo "ssh_cmd: $1"
|
28
29
|
ssh -oStrictHostKeyChecking=no user@localhost -p 2222 $1
|
29
30
|
}
|
30
31
|
|
31
32
|
scp_cmd () {
|
33
|
+
echo "scp_cmd: $1 $2"
|
32
34
|
scp -P 2222 -oStrictHostKeyChecking=no $1 user@localhost:$2
|
33
35
|
}
|
34
36
|
|
35
37
|
bash_cmd () {
|
36
|
-
|
38
|
+
st="bash -l -c '"
|
39
|
+
nd="$1"
|
40
|
+
rd="'"
|
41
|
+
echo "bash_cmd: $st$nd$rd"
|
42
|
+
ssh_cmd "$st$nd$rd"
|
37
43
|
}
|
38
44
|
|
39
45
|
no_pass_ssh () {
|
@@ -62,10 +68,10 @@ clenver_install() {
|
|
62
68
|
}
|
63
69
|
|
64
70
|
init_general () {
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
71
|
+
clenver_install $1
|
72
|
+
#ssh_cmd 'bash -l -c "clenver init http://bit.ly/1cpqEqp"'
|
73
|
+
ssh_cmd 'git clone https://github.com/pietrushnic/clenver_projects.git src/clenver_projects'
|
74
|
+
ssh_cmd 'bash -l -c "clenver init src/clenver_projects/general.yml"'
|
69
75
|
}
|
70
76
|
|
71
77
|
init_custom () {
|
@@ -73,6 +79,12 @@ init_custom () {
|
|
73
79
|
scp_cmd $2 /home/user
|
74
80
|
home_v='$HOME'
|
75
81
|
nd_pt="/${2##*/}"
|
82
|
+
# use local gem
|
83
|
+
if [[ $# -ge 3 ]]; then
|
84
|
+
scp_cmd $3 /home/user
|
85
|
+
nd_pt="$nd_pt $3"
|
86
|
+
echo "nd_pt: $nd_pt"
|
87
|
+
fi
|
76
88
|
bash_cmd "$home_v$nd_pt"
|
77
89
|
ssh_cmd "git clone https://github.com/pietrushnic/clenver_projects.git src/clenver_projects"
|
78
90
|
bash_cmd "clenver init $home_v/src/clenver_projects/general.yml"
|
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.12
|
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-11-
|
11
|
+
date: 2013-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|