hfam 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -2
- data/lib/hfam/commands/source.rb +2 -2
- data/lib/hfam/commands/symlink.rb +1 -1
- data/lib/hfam/dsl.rb +8 -4
- data/lib/hfam/version.rb +1 -1
- 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: f8ffbaf7379c27828847ba8cedc0aa708ec97dc4
|
4
|
+
data.tar.gz: c37cb86a42234f1332c31f78bcf035f7eefe23aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 714122a472c5cdcdbfeeb60982e9ee2751b66f08439569b2f1e24240e1199658a6573a8ed2d7d15d42b3bc3dbac370011243ffcfd8e8fa519f5385eabd09debb
|
7
|
+
data.tar.gz: 9d1bd61f378c7040dbdf4680d05514d423a473e70801c386d46d1c8c0fbee16bd8f4691d188c87b29de4c9907da057fdf151fb0caaa9d6c3e082fd3442742511
|
data/README.md
CHANGED
@@ -69,7 +69,7 @@ In `$HOME/dotfiles/.hfamconfig`
|
|
69
69
|
symlink "gitconfig" # you can add a comment using '#'
|
70
70
|
```
|
71
71
|
|
72
|
-
|
72
|
+
Then
|
73
73
|
|
74
74
|
```shell
|
75
75
|
?> hfam
|
@@ -78,6 +78,20 @@ Symlink: ln -s /Users/zoidberg/dotfiles/gitconfig /Users/zoidberg/.gitconfig
|
|
78
78
|
/Users/zoidberg/.gitconfig -> /Users/zoidberg/dotfiles/gitconfig
|
79
79
|
```
|
80
80
|
|
81
|
+
The `symlink` command accepts another argument to specify the destination's directory of the symlink. This arguments is named `dest`.
|
82
|
+
|
83
|
+
Example:
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
symlink "gitignore", dest: "/Users/zoidberg/apps/my_app/.gitignore"
|
87
|
+
```
|
88
|
+
|
89
|
+
Then
|
90
|
+
|
91
|
+
```shell
|
92
|
+
?> hfam
|
93
|
+
Symlink: ln -s /Users/mehdi/dotfiles/gitignore /Users/zoidberg/apps/my_app/.gitignore
|
94
|
+
```
|
81
95
|
|
82
96
|
> /!\ If the source file is not a dotfile, the prefix `.` is automatically prepended to the target file
|
83
97
|
> ```shell
|
@@ -97,7 +111,7 @@ In `$HOME/dotfiles/.hfamconfig`
|
|
97
111
|
source "zshrc"
|
98
112
|
```
|
99
113
|
|
100
|
-
|
114
|
+
Then
|
101
115
|
|
102
116
|
```shell
|
103
117
|
?> hfam
|
data/lib/hfam/commands/source.rb
CHANGED
@@ -13,7 +13,7 @@ module HFAM
|
|
13
13
|
# preprend the dest file with a '.' if the src file is not a hidden file
|
14
14
|
file = src.split('/').last
|
15
15
|
file = ::FileUtils.hidden_file?(file) ? file : ".#{file}"
|
16
|
-
dest = command[2]
|
16
|
+
dest = "#{command[2]}/#{file}"
|
17
17
|
|
18
18
|
# https://wiki.ubuntu.com/DashAsBinSh#My_production_system_has_broken_and_I_just_want_to_get_it_back_up.21
|
19
19
|
# Sometime the default shell /bin/sh is a symlink to another shell
|
@@ -25,7 +25,7 @@ module HFAM
|
|
25
25
|
|
26
26
|
(cmd = "#{real_shell_path} -c '#{cmd} #{dest}'") && result = `#{cmd}`
|
27
27
|
|
28
|
-
::HFAM::Logger.success(
|
28
|
+
::HFAM::Logger.success(result)
|
29
29
|
::HFAM::Logger.success("Source: #{cmd}")
|
30
30
|
|
31
31
|
rescue ::Errno::EACCES => e
|
@@ -12,7 +12,7 @@ module HFAM
|
|
12
12
|
# preprend the dest file with a '.' if the src file is not a hidden file
|
13
13
|
file = src.split('/').last
|
14
14
|
file = ::FileUtils.hidden_file?(file) ? file : ".#{file}"
|
15
|
-
dest = command[2]
|
15
|
+
dest = "#{command[2]}/#{file}"
|
16
16
|
|
17
17
|
# ln -s with --force option
|
18
18
|
::FileUtils.ln_sf(src, dest)
|
data/lib/hfam/dsl.rb
CHANGED
@@ -9,13 +9,13 @@ module HFAM
|
|
9
9
|
raw_commands = eval(::File.open(::HFAM::HFAMCONFIG_PATH).read)
|
10
10
|
end
|
11
11
|
|
12
|
-
def symlink(file)
|
13
|
-
@payload.commands << [:symlink, "#{DEFAULT_DOTFILE_PATH}/#{file}"]
|
12
|
+
def symlink(file, options = {})
|
13
|
+
@payload.commands << [:symlink, "#{DEFAULT_DOTFILE_PATH}/#{file}", dest_path(file, options)]
|
14
14
|
end
|
15
15
|
|
16
|
-
def source(file)
|
16
|
+
def source(file, options = {})
|
17
17
|
symlink(file)
|
18
|
-
@payload.commands << [:source, "#{DEFAULT_DOTFILE_PATH}/#{file}"]
|
18
|
+
@payload.commands << [:source, "#{DEFAULT_DOTFILE_PATH}/#{file}", dest_path(file, options)]
|
19
19
|
end
|
20
20
|
|
21
21
|
def route
|
@@ -25,5 +25,9 @@ module HFAM
|
|
25
25
|
def method_missing(method, *args, &block)
|
26
26
|
@payload.commands << [:unknown, { command: method, args: args }]
|
27
27
|
end
|
28
|
+
|
29
|
+
def dest_path(file, options = {})
|
30
|
+
options.include?(:dest) ? options[:dest] : ::HFAM::HOME
|
31
|
+
end
|
28
32
|
end
|
29
33
|
end
|
data/lib/hfam/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hfam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mehdi_farsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|