homey 0.0.1 → 0.1.1
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/Gemfile.lock +17 -1
- data/homey.gemspec +2 -1
- data/lib/homey.rb +3 -2
- data/lib/homey/path_helpers.rb +26 -0
- data/lib/homey/tasks.rb +17 -19
- data/lib/homey/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3efb1e2edf108e81036e5cab193c9d34bfb98ae
|
4
|
+
data.tar.gz: 0d88573727ab257b6ee95d177fb63eeb248ee976
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 371b1bbc9ce88c405d0ec7f9a45f73010ecb452d872c802ded698a1fa7b20f8146ea47f5169115743b185d3ee2ac10abe30c63905321a0ddaab810d06782f2ed
|
7
|
+
data.tar.gz: 2c45cfcfd1b90331739c4333b9f13b9bea300abf347d3cd7bf8c7d2f7b89738de09a27f8bc29183ada76589bb7dc5ace79dad1418ef61bf625e37a1154331823
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,27 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
homey (0.
|
4
|
+
homey (0.1.1)
|
5
5
|
thor (~> 0.18, >= 0.18.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
+
byebug (2.5.0)
|
11
|
+
columnize (~> 0.3.6)
|
12
|
+
debugger-linecache (~> 1.2.0)
|
13
|
+
coderay (1.1.0)
|
14
|
+
columnize (0.3.6)
|
15
|
+
debugger-linecache (1.2.0)
|
16
|
+
method_source (0.8.2)
|
17
|
+
pry (0.9.12.4)
|
18
|
+
coderay (~> 1.0)
|
19
|
+
method_source (~> 0.8)
|
20
|
+
slop (~> 3.4)
|
21
|
+
pry-byebug (1.2.1)
|
22
|
+
byebug (~> 2.2)
|
23
|
+
pry (~> 0.9.12)
|
24
|
+
slop (3.4.7)
|
10
25
|
thor (0.18.1)
|
11
26
|
|
12
27
|
PLATFORMS
|
@@ -14,3 +29,4 @@ PLATFORMS
|
|
14
29
|
|
15
30
|
DEPENDENCIES
|
16
31
|
homey!
|
32
|
+
pry-byebug (~> 1.2)
|
data/homey.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'homey/version'
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'homey'
|
8
8
|
s.version = Homey::VERSION
|
9
|
-
s.date = '2014-01-
|
9
|
+
s.date = '2014-01-07'
|
10
10
|
|
11
11
|
s.summary = 'A tool to setup your home enviroment'
|
12
12
|
s.description = "Homey is a basic tool for your dotfiles. Homey will setup " \
|
@@ -23,4 +23,5 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.license = 'MIT'
|
24
24
|
|
25
25
|
s.add_runtime_dependency 'thor', '~> 0.18', '>= 0.18.1'
|
26
|
+
s.add_development_dependency 'pry-byebug', '~> 1.2'
|
26
27
|
end
|
data/lib/homey.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Homey
|
2
|
+
module PathHelpers
|
3
|
+
def dotfiles_path
|
4
|
+
@dotfiles_path ||= File.open("#{ENV['HOME']}/.homey", 'rb').read
|
5
|
+
end
|
6
|
+
|
7
|
+
def home_file
|
8
|
+
@home_file ||= begin
|
9
|
+
path = File.join dotfiles_path, "home.yml"
|
10
|
+
home = YAML.load_file(path)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def prepare_paths(*paths)
|
15
|
+
absolutize_paths(*replace_home_char(*paths))
|
16
|
+
end
|
17
|
+
|
18
|
+
def absolutize_paths(*paths)
|
19
|
+
paths.map { |path| Pathname.new(path).expand_path(dotfiles_path) }
|
20
|
+
end
|
21
|
+
|
22
|
+
def replace_home_char(*strings)
|
23
|
+
strings.map { |string| string.sub(/^~\//, "#{ENV['HOME']}/") }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/homey/tasks.rb
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
module Homey
|
2
2
|
class Tasks < Thor
|
3
|
+
include PathHelpers
|
4
|
+
|
5
|
+
desc "dotfiles", "Fetching your dotfiles from github"
|
6
|
+
method_option :path, type: :string
|
7
|
+
method_option :force, aliases: "-f", type: :boolean
|
8
|
+
method_option :local, aliases: "-l", type: :boolean
|
9
|
+
def dotfiles(repo)
|
10
|
+
path = replace_home_char(options.fetch("path", "~/.dotfiles")).first
|
11
|
+
if !options[:local]
|
12
|
+
FileUtils.rm_rf(path) if options["force"]
|
13
|
+
command = "git clone git@github.com:#{repo}.git #{path}"
|
14
|
+
system command
|
15
|
+
end
|
16
|
+
File.open("#{ENV['HOME']}/.homey", 'w') { |f| f.write(path) }
|
17
|
+
end
|
18
|
+
|
3
19
|
desc "create_symlinks", "Creating the sym links that you have set in home.yml"
|
4
20
|
method_option :flavor, type: :string
|
5
21
|
method_option :force, aliases: "-f", type: :boolean
|
@@ -7,8 +23,7 @@ module Homey
|
|
7
23
|
opts = { flavor: options[:flavor], flavorized_attributes: %w(target) }
|
8
24
|
symlinks = Flavorizer::flavorize_group(home_file["sym_links"], opts)
|
9
25
|
symlinks.each do |sym|
|
10
|
-
|
11
|
-
target, link = absolutize_paths(*paths)
|
26
|
+
target, link = prepare_paths(sym['target'], sym['link'])
|
12
27
|
FileUtils.rm_rf(link) if options[:force]
|
13
28
|
File.symlink target, link
|
14
29
|
end
|
@@ -18,22 +33,5 @@ module Homey
|
|
18
33
|
def setup
|
19
34
|
home_file["commands"].each { |command| system command }
|
20
35
|
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def home_file
|
25
|
-
@home_file ||= begin
|
26
|
-
home = YAML.load_file('home.yml')
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def absolutize_paths(*paths)
|
31
|
-
paths.map { |path| Pathname.new(path).expand_path }
|
32
|
-
end
|
33
|
-
|
34
|
-
def replace_home_char(*strings)
|
35
|
-
new_strings = strings.map { |string| string.sub(/^~\//, "#{ENV['HOME']}/") }
|
36
|
-
new_strings.one? ? new_strings.first : new_strings
|
37
|
-
end
|
38
36
|
end
|
39
37
|
end
|
data/lib/homey/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: homey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Zaby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -30,6 +30,20 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.18.1
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: pry-byebug
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.2'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.2'
|
33
47
|
description: Homey is a basic tool for your dotfiles. Homey will setup your symbolic
|
34
48
|
links and run the scripts you want to initialize your enviroment
|
35
49
|
email: mikezaby@gmail.com
|
@@ -46,6 +60,7 @@ files:
|
|
46
60
|
- homey.gemspec
|
47
61
|
- lib/homey.rb
|
48
62
|
- lib/homey/flavorizer.rb
|
63
|
+
- lib/homey/path_helpers.rb
|
49
64
|
- lib/homey/tasks.rb
|
50
65
|
- lib/homey/version.rb
|
51
66
|
homepage: https://github.com/mikezaby/homey
|