hfam 0.1.1 → 0.1.2
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/README.md +45 -6
- data/lib/hfam/application.rb +2 -2
- data/lib/hfam/argument_parser.rb +10 -2
- data/lib/hfam/constants.rb +4 -5
- data/lib/hfam/dsl.rb +12 -5
- data/lib/hfam/payload.rb +8 -0
- data/lib/hfam/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f717e2e3ed53363cc3edf32ede40df3e0a36ab0
|
4
|
+
data.tar.gz: df8e9ce5b49b07946d9b486d16accf4697c2a1cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3b6d91a15895f9aaf232b7bb0611e85bc236e5b5aa3efc597cd30138ad922cb633283e838f9a559ecc2a8b8567d555879a1a5f5b7d698592d2df5bf47277fb8
|
7
|
+
data.tar.gz: 25768a7db70201cd1952a6872e4d4b2574b32c0b3ff9e0910a3430668bcbe5a2edc17fe47d8bb7cd72f4e3384fa39dcbf5b59a2fb7d38392ba8f20c055e83708
|
data/README.md
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
<b>H</b>idden <b>F</b>iles <b>A</b>re <b>M</b>anageable - Manage, source and reload you dotfiles in a specific directory
|
4
4
|
|
5
|
-
1. You create/clone your `dotfiles
|
6
|
-
2. You edit a
|
5
|
+
1. You create/clone your `dotfiles`.
|
6
|
+
2. You edit a `dotfiles/.hfamconfig` file with its intuitive DSL.
|
7
7
|
3. You call `hfam`.
|
8
8
|
|
9
9
|
The main advantage of this tool is that you can easily move your `dotfiles` from a machine to another one. Then, with only one command, you can configure your environment.
|
@@ -45,6 +45,45 @@ Example
|
|
45
45
|
|- .hfamconfig
|
46
46
|
```
|
47
47
|
|
48
|
+
####Options
|
49
|
+
|
50
|
+
Option `-h --help`
|
51
|
+
|
52
|
+
Display the usage:
|
53
|
+
|
54
|
+
```shell
|
55
|
+
?> hfam --help
|
56
|
+
HFAM - Hidden Files Are Manageable
|
57
|
+
|
58
|
+
Centralize your dotfiles in one directory and manage them using some basic operations (symlink, source, ...)
|
59
|
+
This tool attempts to locate a ~/dotfiles/.hfamconfig file. Then it executes a set of commands
|
60
|
+
listed in the config file.
|
61
|
+
|
62
|
+
For further information: https://github.com/mehdi-farsi/hfam
|
63
|
+
|
64
|
+
USAGE:
|
65
|
+
|
66
|
+
hfam [-h|--help] [-p|--path]
|
67
|
+
|
68
|
+
OPTIONS:
|
69
|
+
|
70
|
+
-h # help
|
71
|
+
-p # change the default dotfiles path
|
72
|
+
```
|
73
|
+
|
74
|
+
Option `-p --path`
|
75
|
+
|
76
|
+
Change the default dotfiles path.
|
77
|
+
|
78
|
+
```shell
|
79
|
+
?> hfam --path /Users/zoidberg/Documents/dotfiles
|
80
|
+
Symlink: ln -s /Users/mehdi/Documents/dotfiles/testpath /Users/zoidberg/Documents/dotfiles/.testpath
|
81
|
+
```
|
82
|
+
|
83
|
+
> The path set by --path option is the default symlink target path.
|
84
|
+
> use the DSL symlink option `:dest` to override this path.
|
85
|
+
|
86
|
+
####Hfamconfig
|
48
87
|
|
49
88
|
`hfam` works with a `.hfamconfig` file. This config file provide an intuitive DSL for managing your dotfiles.
|
50
89
|
|
@@ -57,9 +96,9 @@ For the following examples, let's say that the following environment variables a
|
|
57
96
|
|
58
97
|
Now, let's have look to the `.hfamconfig` DSL.
|
59
98
|
|
60
|
-
|
99
|
+
#####Symlink
|
61
100
|
|
62
|
-
The `symlink` command creates a symlink with the source file passed as argument. The symlink target is
|
101
|
+
The `symlink` command creates a symlink with the source file passed as argument. The symlink target is created in `$HOME/.target`.
|
63
102
|
|
64
103
|
Example:
|
65
104
|
|
@@ -78,7 +117,7 @@ Symlink: ln -s /Users/zoidberg/dotfiles/gitconfig /Users/zoidberg/.gitconfig
|
|
78
117
|
/Users/zoidberg/.gitconfig -> /Users/zoidberg/dotfiles/gitconfig
|
79
118
|
```
|
80
119
|
|
81
|
-
The `symlink` command accepts another argument to specify the destination's directory
|
120
|
+
The `symlink` command accepts another argument to specify the destination's directory. This arguments is named `dest`.
|
82
121
|
|
83
122
|
Example:
|
84
123
|
|
@@ -99,7 +138,7 @@ Symlink: ln -s /Users/mehdi/dotfiles/gitignore /Users/zoidberg/apps/my_app/.giti
|
|
99
138
|
> lrwxr-xr-x 1 lol cat 27B Nov 11 16:35 .gitconfig -> /Users/zoidberg/dotfiles/gitconfig
|
100
139
|
> ```
|
101
140
|
|
102
|
-
|
141
|
+
#####Source
|
103
142
|
|
104
143
|
The `source` command creates a symlink using the file passed as argument and source the symlink target. The symlink target file is defined at `$HOME/.target`.
|
105
144
|
|
data/lib/hfam/application.rb
CHANGED
data/lib/hfam/argument_parser.rb
CHANGED
@@ -6,12 +6,17 @@ module HFAM
|
|
6
6
|
options = {}
|
7
7
|
|
8
8
|
o = ::OptionParser.new do |opts|
|
9
|
+
|
9
10
|
opts.banner = ::HFAM::HELP
|
10
11
|
|
11
|
-
|
12
|
-
opts.on("-h") do |h|
|
12
|
+
opts.on("-h", "--help") do |h|
|
13
13
|
options[:help] = ::HFAM::HELP
|
14
14
|
end
|
15
|
+
|
16
|
+
opts.on("-p=PATH", "--path=PATH") do |p|
|
17
|
+
options[:path] = p
|
18
|
+
end
|
19
|
+
|
15
20
|
end
|
16
21
|
begin
|
17
22
|
o.parse!
|
@@ -19,6 +24,9 @@ module HFAM
|
|
19
24
|
$stderr.puts e
|
20
25
|
$stderr.puts o.banner
|
21
26
|
exit
|
27
|
+
rescue ::OptionParser::MissingArgument => e
|
28
|
+
$stderr.puts e
|
29
|
+
exit
|
22
30
|
end
|
23
31
|
options
|
24
32
|
end
|
data/lib/hfam/constants.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module HFAM
|
2
|
-
HOME
|
3
|
-
|
4
|
-
HFAMCONFIG_PATH = "#{DEFAULT_DOTFILE_PATH}/.hfamconfig"
|
2
|
+
HOME = "#{ENV['HOME']}"
|
3
|
+
DEFAULT_DOTFILES_PATH = "#{ENV['HOME']}/dotfiles"
|
5
4
|
|
6
5
|
HELP = <<-SHELL
|
7
6
|
HFAM - Hidden Files Are Manageable
|
@@ -14,11 +13,11 @@ For further information: https://github.com/mehdi-farsi/hfam
|
|
14
13
|
|
15
14
|
USAGE:
|
16
15
|
|
17
|
-
hfam [-h]
|
16
|
+
hfam [-h|--help] [-p|--path]
|
18
17
|
|
19
18
|
OPTIONS:
|
20
19
|
|
21
20
|
-h # help
|
22
|
-
|
21
|
+
-p # change the default dotfiles path
|
23
22
|
SHELL
|
24
23
|
end
|
data/lib/hfam/dsl.rb
CHANGED
@@ -6,16 +6,16 @@ module HFAM
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def tokenize
|
9
|
-
raw_commands = eval(::File.open(
|
9
|
+
raw_commands = eval(::File.open("#{dotfiles_path}/.hfamconfig").read)
|
10
10
|
end
|
11
11
|
|
12
12
|
def symlink(file, options = {})
|
13
|
-
@payload.commands << [:symlink, "#{
|
13
|
+
@payload.commands << [:symlink, "#{dotfiles_path}/#{file}", dest_path(options)]
|
14
14
|
end
|
15
15
|
|
16
16
|
def source(file, options = {})
|
17
17
|
symlink(file)
|
18
|
-
@payload.commands << [:source, "#{
|
18
|
+
@payload.commands << [:source, "#{dotfiles_path}/#{file}", dest_path(options)]
|
19
19
|
end
|
20
20
|
|
21
21
|
def route
|
@@ -26,8 +26,15 @@ module HFAM
|
|
26
26
|
@payload.commands << [:unknown, { command: method, args: args }]
|
27
27
|
end
|
28
28
|
|
29
|
-
|
30
|
-
|
29
|
+
private
|
30
|
+
def dotfiles_path
|
31
|
+
# File::expand_path convert the builtin "~/" to the path defined in ENV["HOME"]
|
32
|
+
File.expand_path(@payload.metadata[:path] || DEFAULT_DOTFILES_PATH)
|
33
|
+
end
|
34
|
+
|
35
|
+
def dest_path(options = {})
|
36
|
+
# File::expand_path convert the builtin "~/" to the path defined in ENV["HOME"]
|
37
|
+
File.expand_path(options[:dest] || ::HFAM::HOME)
|
31
38
|
end
|
32
39
|
end
|
33
40
|
end
|
data/lib/hfam/payload.rb
CHANGED
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.2
|
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-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
95
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.4.
|
96
|
+
rubygems_version: 2.4.5.1
|
97
97
|
signing_key:
|
98
98
|
specification_version: 4
|
99
99
|
summary: Hidden Files Are Manageable
|