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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc283147fe816d5f5c2235c5a58741cd8c076882
4
- data.tar.gz: e951b023756ca07ea250a89d8e9378533f899a16
3
+ metadata.gz: b2fcdddf76d72f34dc5f998013c9ad486e35149d
4
+ data.tar.gz: 92061745b13327e62d8ea62a18ce6c72c5e0d1cc
5
5
  SHA512:
6
- metadata.gz: 1cc95707c7cf3d707dc9e73baa6a8f8044c081c87714e9c4aefeb9643a39ea1b017e2ccc12d25496aa20a2e41d0edb4fbb0c72010a43424be5f4c2253106b132
7
- data.tar.gz: 009ab8342ff9308bcc6ab47a1fbd1ba7bff4751877c3acc09525a2f03195742bace2fae7bb2c692e8b545b33e7fde447addbe8118977a15c61350aaccb91470f
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'
@@ -18,8 +18,6 @@ module Velcro
18
18
  (`which rvm` =~ /not found/).nil?
19
19
  end
20
20
 
21
- private
22
-
23
21
  def self.rubies
24
22
  `rvm list`.split("\n").select{|str| str =~ /ruby-/}
25
23
  end
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 host dotfiles symlinks scaffold settings).freeze
14
+ FLAGS = %w(apps dotfiles symlinks scaffold settings).freeze
15
15
 
16
16
  def initialize(repo, options = {})
17
17
  establish_inclusions(FLAGS, options)
18
- @dryrun = options[:dryrun] || false
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
- install_host if included?(:host)
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 install_host
62
- return unless host
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 host
108
- return @host if defined?(@host)
109
- @host = rcfile['hosts'].detect{|n| n['name'] == Velcro.hostname }
110
- puts "No host settings found for: #{Velcro.hostname}" if host.nil?
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
- @host
119
+ @host_data
113
120
  end
114
121
  end
115
122
  end
@@ -1,4 +1,4 @@
1
1
  # Velcro version
2
2
  module Velcro
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
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.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-09-27 00:00:00.000000000 Z
11
+ date: 2015-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor