homey 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 357b83661a2b8753ec5b4b9ff49a1f0835ae202b
4
+ data.tar.gz: b6f944bf6877044b79f55591630f08293eb465ca
5
+ SHA512:
6
+ metadata.gz: 0b122fc8275ab3c1cce8a1aea1fae5013e6c8968c99e2fc0dea0d76d9b5973c679abfc4d10d7149442f0ac3fb80596bcf1274edc11d09a02a944f257eccca1d2
7
+ data.tar.gz: 4c770bbf9fde1e6398da28a605a5fb260370b302afbd20b9549df24b10609fb1fc3c4954fba273c433a4bf52001679a1f883e449b1609b65700018c89595101b
@@ -0,0 +1,2 @@
1
+ .bundle
2
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,16 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ homey (0.0.1)
5
+ thor (~> 0.18, >= 0.18.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ thor (0.18.1)
11
+
12
+ PLATFORMS
13
+ ruby
14
+
15
+ DEPENDENCIES
16
+ homey!
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'homey'
4
+
5
+ Homey::Tasks.start
@@ -0,0 +1,18 @@
1
+ sym_links:
2
+ - target: i3
3
+ link: ~/.i3
4
+
5
+ - target: Xdefaults
6
+ link: ~/.Xdefaults
7
+
8
+ - target: ! "gitconfig.%{flavor}"
9
+ link: ~/.gitconfig
10
+
11
+ - target: vimrc
12
+ link: ~/.vimrc
13
+
14
+ - target: zshrc
15
+ link: ~/.zshrc
16
+
17
+ commands:
18
+ - wget --no-check-certificate https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | zsh
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'homey/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'homey'
8
+ s.version = Homey::VERSION
9
+ s.date = '2014-01-05'
10
+
11
+ s.summary = 'A tool to setup your home enviroment'
12
+ s.description = "Homey is a basic tool for your dotfiles. Homey will setup " \
13
+ "your symbolic links and run the scripts you want to " \
14
+ "initialize your enviroment"
15
+
16
+ s.authors = ["Mike Zaby"]
17
+ s.email = 'mikezaby@gmail.com'
18
+ s.homepage = 'https://github.com/mikezaby/homey'
19
+
20
+ s.executables = %w(homey)
21
+ s.files = `git ls-files`.split($/)
22
+
23
+ s.license = 'MIT'
24
+
25
+ s.add_runtime_dependency 'thor', '~> 0.18', '>= 0.18.1'
26
+ end
@@ -0,0 +1,9 @@
1
+ require "thor"
2
+ require "yaml"
3
+ require "fileutils"
4
+ require "pathname"
5
+
6
+ require "homey/tasks.rb"
7
+ require "homey/flavorizer.rb"
8
+
9
+
@@ -0,0 +1,23 @@
1
+ module Homey
2
+ module Flavorizer
3
+ def self.flavorize_group(group, options = {})
4
+ flavor = options[:flavor]
5
+ flavorized_attributes = options[:flavorized_attributes]
6
+ return group if flavor.nil?
7
+
8
+ group.map do |value|
9
+ value = value.dup
10
+ flavorized_attributes.each { |attr| value[attr] = flavorize(value[attr], flavor) }
11
+ value
12
+ end
13
+ end
14
+
15
+ def self.flavorize(string, flavor)
16
+ string.include?("%{flavor}") ? (string % { flavor: flavor }) : string
17
+ end
18
+
19
+ def self.flavorize!(string, flavor)
20
+ string.replace(flavorize(string, flavor))
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,39 @@
1
+ module Homey
2
+ class Tasks < Thor
3
+ desc "create_symlinks", "Creating the sym links that you have set in home.yml"
4
+ method_option :flavor, type: :string
5
+ method_option :force, aliases: "-f", type: :boolean
6
+ def create_symlinks
7
+ opts = { flavor: options[:flavor], flavorized_attributes: %w(target) }
8
+ symlinks = Flavorizer::flavorize_group(home_file["sym_links"], opts)
9
+ symlinks.each do |sym|
10
+ paths = replace_home_char(sym['target'], sym['link'])
11
+ target, link = absolutize_paths(*paths)
12
+ FileUtils.rm_rf(link) if options[:force]
13
+ File.symlink target, link
14
+ end
15
+ end
16
+
17
+ desc "setup", "Run the initialize commands that you want"
18
+ def setup
19
+ home_file["commands"].each { |command| system command }
20
+ 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
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ module Homey
2
+ VERSION = '0.0.1'
3
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: homey
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mike Zaby
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.18'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.18.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.18'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.18.1
33
+ description: Homey is a basic tool for your dotfiles. Homey will setup your symbolic
34
+ links and run the scripts you want to initialize your enviroment
35
+ email: mikezaby@gmail.com
36
+ executables:
37
+ - homey
38
+ extensions: []
39
+ extra_rdoc_files: []
40
+ files:
41
+ - ".gitignore"
42
+ - Gemfile
43
+ - Gemfile.lock
44
+ - bin/homey
45
+ - home.yml.example
46
+ - homey.gemspec
47
+ - lib/homey.rb
48
+ - lib/homey/flavorizer.rb
49
+ - lib/homey/tasks.rb
50
+ - lib/homey/version.rb
51
+ homepage: https://github.com/mikezaby/homey
52
+ licenses:
53
+ - MIT
54
+ metadata: {}
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ requirements: []
70
+ rubyforge_project:
71
+ rubygems_version: 2.2.0
72
+ signing_key:
73
+ specification_version: 4
74
+ summary: A tool to setup your home enviroment
75
+ test_files: []