confile 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +8 -0
- data/bin/confile +14 -0
- data/lib/confile.rb +37 -0
- data/test/test_confile.rb +5 -0
- metadata +49 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2a3405a8d91708ec16cf4513738333082e1f8a15
|
4
|
+
data.tar.gz: 334ef0877daad0c3dc5223f6f5cbbaa907fbd892
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 35090d1d6832daa75d1c58049e6e265ad5c8c485b0fb5cf5ce195012fbcb8067de3977ed9882453b2a4249058981bba0b9a890d09e846a2894bed63c937096b8
|
7
|
+
data.tar.gz: 6161e967198d3e9b5eda84ad2da249966e33d68e7873e3d267d8d911a290871b9cbce4a93bafe00ef948bb55d2a0c392851c81ac2aa83b51b2fb7084bdef8049
|
data/Rakefile
ADDED
data/bin/confile
ADDED
data/lib/confile.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
class Confile
|
5
|
+
def initialize(config_file)
|
6
|
+
conf = YAML.load_file(config_file)
|
7
|
+
|
8
|
+
@config_dir = conf['config_dir'] || 'config'
|
9
|
+
@links = {}
|
10
|
+
@files = []
|
11
|
+
|
12
|
+
conf['links'].each do |link|
|
13
|
+
link.each_pair do |from, to|
|
14
|
+
@links[File.join(@config_dir, from)] = to
|
15
|
+
@files.push(to)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def link
|
21
|
+
@links.each_pair do |from, to|
|
22
|
+
if File.exist?(from) && !File.exist?(to)
|
23
|
+
puts "linking... #{from} -> #{to}"
|
24
|
+
FileUtils.ln_s(from, to)
|
25
|
+
else
|
26
|
+
puts "skipping... #{from} -> #{to}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def unlink
|
32
|
+
@files.each do |file|
|
33
|
+
puts "unlinking... #{file}"
|
34
|
+
FileUtils.rm(file)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: confile
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Cade Scroggins
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-05 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Clean up your project repo by putting all of your config files in one
|
14
|
+
place.
|
15
|
+
email: me@cadejs.com
|
16
|
+
executables:
|
17
|
+
- confile
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- Rakefile
|
22
|
+
- bin/confile
|
23
|
+
- lib/confile.rb
|
24
|
+
- test/test_confile.rb
|
25
|
+
homepage: https://rubygems.org/gems/confile
|
26
|
+
licenses:
|
27
|
+
- MIT
|
28
|
+
metadata: {}
|
29
|
+
post_install_message:
|
30
|
+
rdoc_options: []
|
31
|
+
require_paths:
|
32
|
+
- lib
|
33
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
requirements: []
|
44
|
+
rubyforge_project:
|
45
|
+
rubygems_version: 2.4.5.1
|
46
|
+
signing_key:
|
47
|
+
specification_version: 4
|
48
|
+
summary: Organize your project configs.
|
49
|
+
test_files: []
|