central 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/central.rb +23 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c28cbd68d80c217678f5b6d81dc82cd2d4de4eed
|
4
|
+
data.tar.gz: 152e89721d347f991b177e6e81165619c3bfff70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b873dba32172c267f1419657c5d500736880dbcfe9f04b431984e489406e91ac55a809c9358bb71a361f1f5bf120e238cdf89dc5ee91d9fda7c8bd1c76070dcc
|
7
|
+
data.tar.gz: 70e5070de43a592bb09234e82e130025516139fbea193caf0cc6d1892ca9a90f98681b83be4118670a3ee01f0fdafcb6d738bf8f61ec2ae6e1a6d6e3a9796d4d
|
data/lib/central.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
# -------------------------------------------------------------------------
|
2
3
|
# # central - dot files manager licensed under LGPLv3 (see LICENSE file) |
|
3
4
|
# # written in Ruby by Dmitry Geurkov (d.geurkov@gmail.com) |
|
@@ -6,6 +7,7 @@
|
|
6
7
|
require 'erb'
|
7
8
|
require 'socket'
|
8
9
|
require 'open3'
|
10
|
+
require 'fileutils'
|
9
11
|
|
10
12
|
# get hostname
|
11
13
|
def hostname
|
@@ -379,6 +381,27 @@ def ls(path,options={})
|
|
379
381
|
return ls
|
380
382
|
end
|
381
383
|
|
384
|
+
# copy
|
385
|
+
def copy(from,to)
|
386
|
+
from = abs(from)
|
387
|
+
to = abs(to)
|
388
|
+
if dir_exists?(from)
|
389
|
+
(Dir.entries(from).select { |f| f != "." and f != ".." }).each do |f|
|
390
|
+
FileUtils.mkdir_p(to)
|
391
|
+
copy("#{from}/#{f}","#{to}/#{f}")
|
392
|
+
end
|
393
|
+
else
|
394
|
+
unless file_exists?(from)
|
395
|
+
STDERR.puts "Couldn't access file #{from}..."
|
396
|
+
exit 1
|
397
|
+
end
|
398
|
+
if !file_exists?(to) or !FileUtils.compare_file(from,to)
|
399
|
+
FileUtils.copy_file(from,to)
|
400
|
+
puts "Copied file: #{from} → #{to}"
|
401
|
+
end
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
382
405
|
# process erb template into an output_file
|
383
406
|
def erb(file,output_file = nil)
|
384
407
|
file = abs(file)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: central
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Geurkov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: central dotfile management system
|
14
14
|
email: d.geurkov@gmail.com
|
@@ -17,11 +17,11 @@ executables:
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- lib/central.rb
|
21
20
|
- bin/central
|
21
|
+
- lib/central.rb
|
22
22
|
homepage: https://github.com/troydm/central
|
23
23
|
licenses:
|
24
|
-
-
|
24
|
+
- LGPL-3.0
|
25
25
|
metadata: {}
|
26
26
|
post_install_message:
|
27
27
|
rdoc_options: []
|
@@ -29,17 +29,17 @@ require_paths:
|
|
29
29
|
- lib
|
30
30
|
required_ruby_version: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
35
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0'
|
40
40
|
requirements: []
|
41
41
|
rubyforge_project:
|
42
|
-
rubygems_version: 2.
|
42
|
+
rubygems_version: 2.5.2
|
43
43
|
signing_key:
|
44
44
|
specification_version: 4
|
45
45
|
summary: central dotfile management
|