velcro-strap 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/bin/velcro +3 -3
- data/lib/velcro/status/ruby.rb +0 -2
- data/lib/velcro/strap.rb +23 -16
- data/lib/velcro/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: b2fcdddf76d72f34dc5f998013c9ad486e35149d
|
4
|
+
data.tar.gz: 92061745b13327e62d8ea62a18ce6c72c5e0d1cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a3b1abd2294d0804f129900adb1ad1313820c754a0b35ff65682866a232be2a78d2c17a1dc315d5ee2070d0e6304ecdd4d38ad1a7499d2cfd0a4383be7fc84b
|
7
|
+
data.tar.gz: 0df99cb9e346b4242ed31173199a274da1f0842ee9c9a2771ee4f3a43e3ce10099441c459930eda3e19b743fe2bfc8ff63caabe9fc62b23d4269c47b537ff0da
|
data/bin/velcro
CHANGED
@@ -7,13 +7,13 @@ module Velcro
|
|
7
7
|
class Command < Thor
|
8
8
|
option :dryrun, type: :boolean, aliases: :n
|
9
9
|
option :apps, type: :boolean, aliases: :a
|
10
|
-
option :host, type: :boolean, aliases: :o
|
11
10
|
option :dotfiles, type: :boolean, aliases: :d
|
12
11
|
option :symlinks, type: :boolean, aliases: :y
|
13
12
|
option :scaffold, type: :boolean, aliases: :c
|
14
13
|
option :settings, type: :boolean, aliases: :s
|
15
|
-
desc 'strap [REPO]', 'Setup a blank system with your dotfiles'
|
16
|
-
def strap(repo = nil)
|
14
|
+
desc 'strap [REPO] [HOST]', 'Setup a blank system with your dotfiles'
|
15
|
+
def strap(repo = nil, host = nil)
|
16
|
+
options[:host] = host unless host == nil
|
17
17
|
Strap.new(repo, options).run
|
18
18
|
rescue ArgumentError
|
19
19
|
puts 'ERROR: "velcro strap" must be provided a repo url when cloning dotfiles'
|
data/lib/velcro/status/ruby.rb
CHANGED
data/lib/velcro/strap.rb
CHANGED
@@ -9,14 +9,18 @@ module Velcro
|
|
9
9
|
include Velcro::Flags
|
10
10
|
include Velcro::Shell
|
11
11
|
|
12
|
-
attr_reader :rcfile
|
12
|
+
attr_reader :rcfile, :host
|
13
13
|
|
14
|
-
FLAGS = %w(apps
|
14
|
+
FLAGS = %w(apps dotfiles symlinks scaffold settings).freeze
|
15
15
|
|
16
16
|
def initialize(repo, options = {})
|
17
17
|
establish_inclusions(FLAGS, options)
|
18
|
-
|
18
|
+
if options.key?(:host)
|
19
|
+
@host = options[:host]
|
20
|
+
fail ArgumentError if host.nil? || host == ''
|
21
|
+
end
|
19
22
|
|
23
|
+
@dryrun = options[:dryrun] || false
|
20
24
|
fail ArgumentError if repo.nil? && included?(:dotfiles)
|
21
25
|
Velcro.config.repo_url = repo if repo
|
22
26
|
end
|
@@ -31,7 +35,14 @@ module Velcro
|
|
31
35
|
install_apps(rcfile['apps'])
|
32
36
|
apply_settings(rcfile['settings'])
|
33
37
|
|
34
|
-
|
38
|
+
if host
|
39
|
+
set_hostname unless host == Velcro.host
|
40
|
+
|
41
|
+
puts "\nSetting up #{host_data['name']}:"
|
42
|
+
install_scaffold(host_data)
|
43
|
+
install_apps(host_data['apps'])
|
44
|
+
apply_settings(host_data['settings'])
|
45
|
+
end
|
35
46
|
end
|
36
47
|
# rubocop:enable Metrics/AbcSize
|
37
48
|
|
@@ -58,13 +69,9 @@ module Velcro
|
|
58
69
|
scaffolder.install(config)
|
59
70
|
end
|
60
71
|
|
61
|
-
def
|
62
|
-
|
63
|
-
|
64
|
-
puts "\nSetting up #{host['name']}:"
|
65
|
-
install_scaffold(host)
|
66
|
-
install_apps(host['apps'])
|
67
|
-
apply_settings(host['settings'])
|
72
|
+
def set_hostname
|
73
|
+
shell("sudo scutil --set LocalHostName #{host}")
|
74
|
+
shell("sudo scutil --set ComputerName #{host}")
|
68
75
|
end
|
69
76
|
|
70
77
|
def install_dotfiles
|
@@ -104,12 +111,12 @@ module Velcro
|
|
104
111
|
@scaffolder ||= Scaffold.new(dryrun: dryrun)
|
105
112
|
end
|
106
113
|
|
107
|
-
def
|
108
|
-
return @
|
109
|
-
@
|
110
|
-
puts "No host settings found for: #{Velcro.hostname}" if
|
114
|
+
def host_data
|
115
|
+
return @host_data if defined?(@host_data)
|
116
|
+
@host_data = rcfile['hosts'].detect{|n| n['name'] == Velcro.hostname }
|
117
|
+
puts "No host settings found for: #{Velcro.hostname}" if host_data.nil?
|
111
118
|
|
112
|
-
@
|
119
|
+
@host_data
|
113
120
|
end
|
114
121
|
end
|
115
122
|
end
|
data/lib/velcro/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: velcro-strap
|
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
|
- Matthew Werner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|