clenver 0.1.10 → 0.1.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df349ceb9945165a4bf0f2c5e6258e8335544a79
4
- data.tar.gz: 9f1362e7e826c8329987bf4f701e31a7d017f69a
3
+ metadata.gz: e6615635905444802e77cd25ff92232495181812
4
+ data.tar.gz: 7fbcb7463f62b4d328bf6cd80d1aa0255c4c8b2c
5
5
  SHA512:
6
- metadata.gz: 59fc7a9e72442f9a98e40cf9a949e55b68b8fe9627c7a06b1e890a9b49814304f95ecfd94c8116fcda4dc94866fe1446436f613c12f474c5c08d0a9e52012a90
7
- data.tar.gz: 12efe8b91b05f0a7cb425fb7f49abbb52e02dcb6fd1a609687388bfc202cc322f539ba054e3717777ee5e07fa36eaaa98e7e17678cc9580a069d38952a2e3659
6
+ metadata.gz: 17a40c5c82382d3b441cd27e065991113f1b7bad77495c94a307cf15c2173e608428fd70ac8ffcd37e719fdffc3ac9ea46c525fd154a2f566d5bf1bd0326f464
7
+ data.tar.gz: 4d70749859828c34c68f1fd7e9e26e77b1a142c8a07344e70b1835e9f27bfd9e89065e655ff86a2d1e76893cf2f4665eae8b3745ebedbbb9215167bb43349a94
data/.gitignore CHANGED
@@ -16,3 +16,6 @@ tmp
16
16
  .yardoc
17
17
  _yardoc
18
18
  doc/
19
+
20
+ # cucumber
21
+ results.html
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- clenver (0.1.10)
4
+ clenver (0.1.12)
5
5
  git (= 1.2.6)
6
6
  gli (= 2.8.0)
7
7
 
@@ -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 gem and package
171
- Given The default aruba timeout is 45 seconds
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"
@@ -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
- File.symlink(@src, d.to_s)
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)
@@ -7,7 +7,7 @@ class PackageManger
7
7
  def install()
8
8
  case @name
9
9
  when 'apt'
10
- out = %x[sudo apt-get install #{@pkgs}]
10
+ out = %x[sudo apt-get -y install #{@pkgs}]
11
11
  when 'gem'
12
12
  out = %x[gem install #{@pkgs}]
13
13
  end
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Clenver
2
- VERSION = '0.1.10'
2
+ VERSION = '0.1.12'
3
3
  end
@@ -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
- ssh_cmd "bash -l -c $1"
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
- clenver_install $1
66
- #ssh_cmd 'bash -l -c "clenver init http://bit.ly/1cpqEqp"'
67
- ssh_cmd 'git clone https://github.com/pietrushnic/clenver_projects.git src/clenver_projects'
68
- ssh_cmd 'bash -l -c "clenver init src/clenver_projects/general.yml"'
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.10
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-15 00:00:00.000000000 Z
11
+ date: 2013-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake