hatecf 0.1.1 → 0.2.0
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/bootstrap_ruby +1 -1
- data/lib/local.rb +8 -2
- data/lib/local_dsl.rb +5 -1
- data/remote/remote.rb +11 -4
- data/remote/remote_dsl.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1b4ef8bbe6a61660fa428de1cf061be314514244a3d5d94f766167133ecf0a9
|
4
|
+
data.tar.gz: fb1bd239e0475e6f56540c0588deb1f6bd2532d43aaadc80c760ffe6dbf2f324
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2234677084a122e92cb02b91e7e9015829f7f3225bc29078557263b1dc8704036d6fe3cc3ae7cfe128c0529d95f0fb865d44dc1be0251d3a581c5e3cf3faa7b4
|
7
|
+
data.tar.gz: fe8c113c6f812fc6d355788904bfaad665bc171dc11b6d43347b685117fa7af6981ff13e799c9193176a94c7a9a54313ba426a4b6d3a25ffd842f77db2204777
|
data/bootstrap_ruby
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
#!/bin/sh
|
2
|
-
|
2
|
+
which ruby > /dev/null || (echo "machine has no ruby; installing..."; apt-get install --no-install-recommends -y ruby)
|
data/lib/local.rb
CHANGED
@@ -66,6 +66,8 @@ module Local
|
|
66
66
|
@local_files = []
|
67
67
|
|
68
68
|
require 'pathname'
|
69
|
+
# TODO: we are not able to copy directories with this,
|
70
|
+
# but we should be
|
69
71
|
def copy_local_files_to(dir)
|
70
72
|
@local_files.each do |local_file|
|
71
73
|
# dublicating the whole directory stucture
|
@@ -87,11 +89,14 @@ module Local
|
|
87
89
|
end
|
88
90
|
end
|
89
91
|
|
92
|
+
@performed = false
|
90
93
|
require 'tmpdir'
|
91
94
|
def perform!
|
95
|
+
return if @performed # just for compatibility with < 0.2
|
96
|
+
# when manual invoke of peform! was needed
|
92
97
|
die "no target host specified!" if (@target[:host] || "").empty?
|
93
|
-
script_path = File.expand_path
|
94
|
-
script_dir = File.dirname
|
98
|
+
script_path = File.expand_path ENV["_"]
|
99
|
+
script_dir = File.dirname script_path
|
95
100
|
status = nil
|
96
101
|
Dir.mktmpdir "hatecf" do |tmp_dir|
|
97
102
|
debug "using temporary dir #{tmp_dir}"
|
@@ -117,6 +122,7 @@ module Local
|
|
117
122
|
pid, status = Process.wait2(Process.spawn(cmd))
|
118
123
|
debug "exit status: #{status.exitstatus}"
|
119
124
|
end
|
125
|
+
@performed = true
|
120
126
|
# FIXME: this always returns the status of "; rm" above, doesn't it?
|
121
127
|
exit status.exitstatus
|
122
128
|
end
|
data/lib/local_dsl.rb
CHANGED
data/remote/remote.rb
CHANGED
@@ -341,7 +341,7 @@ module Remote
|
|
341
341
|
end
|
342
342
|
end
|
343
343
|
|
344
|
-
# TODO:
|
344
|
+
# TODO: handle "dst is a dir" case
|
345
345
|
def cp(src, dst, mode)
|
346
346
|
src = src.remote_path if src.is_a? LocalFile
|
347
347
|
dst = File.expand_path dst
|
@@ -376,10 +376,12 @@ module Remote
|
|
376
376
|
end
|
377
377
|
end
|
378
378
|
|
379
|
+
# TODO: handle "dst is a dir" case
|
380
|
+
# TODO: relative path case
|
379
381
|
def ln_s(src, dst)
|
380
382
|
src = File.expand_path src
|
381
383
|
dst = File.expand_path dst
|
382
|
-
if File.exist?(dst) &&File.lstat(dst).symlink? && File.readlink(dst) == src
|
384
|
+
if File.exist?(dst) && File.lstat(dst).symlink? && File.readlink(dst) == src
|
383
385
|
ok "#{dst} leads to #{src}"
|
384
386
|
else
|
385
387
|
destructive "ln -s #{src} #{dst}" do
|
@@ -388,8 +390,6 @@ module Remote
|
|
388
390
|
end
|
389
391
|
end
|
390
392
|
|
391
|
-
#attr_accessor :impressionating_user
|
392
|
-
|
393
393
|
def spawn(cmd, expect_status: nil)
|
394
394
|
expect_status = [expect_status] unless expect_status.nil? || expect_status.respond_to?(:include?)
|
395
395
|
stdout_r, stdout_w = IO.pipe
|
@@ -510,4 +510,11 @@ module Remote
|
|
510
510
|
@verbose = true
|
511
511
|
end
|
512
512
|
end.parse!
|
513
|
+
|
514
|
+
@performed = false
|
515
|
+
def perform!
|
516
|
+
return if @performed
|
517
|
+
info "ok: #{ok_counter}, changed: #{changed_counter}"
|
518
|
+
@performed = true
|
519
|
+
end
|
513
520
|
end
|
data/remote/remote_dsl.rb
CHANGED
@@ -181,8 +181,12 @@ def remote_file(path)
|
|
181
181
|
Remote::RemoteFile.new(path)
|
182
182
|
end
|
183
183
|
|
184
|
-
def perform!
|
185
|
-
Remote.
|
184
|
+
def perform! # legacy, not needed since 0.2
|
185
|
+
Remote.perform!
|
186
|
+
end
|
187
|
+
|
188
|
+
Kernel.at_exit do
|
189
|
+
Remote.perform!
|
186
190
|
end
|
187
191
|
|
188
192
|
# Monkey-patching
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hatecf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Markov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Configuration management engine like Ansible but without YAML and 30
|
14
14
|
times faster
|