homeseed 0.0.15 → 0.0.16

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: 54692603f8072693a7673c98dfc51208b33b518c
4
- data.tar.gz: 941d1ff27b2598a8f198fc3dd1b9d7b1d32424e2
3
+ metadata.gz: e4e2162e7ab5ff24a5c7ec699b97b85146e13157
4
+ data.tar.gz: 974de6e59cd38fdb4be2c386d0a3503369486ea8
5
5
  SHA512:
6
- metadata.gz: a1ecb3b0e55500e7c87466a0859a69f6102aa4748798ba0c83813a8dedd24115354d81b4b62e2d88ed2851ee9fc99ced39939c73e5c2feb86ddf5bb802d9904f
7
- data.tar.gz: 858fa3fb7c7d5b263b13aeb94867c20f948d187e3a2f8928f0eb8e3d8ed320aac09cb0e97bf4f8faaf59326bfd000c94d52f2f82c77fc6545a2855beb75dba16
6
+ metadata.gz: 8ad123e26a1ca61a73e857b77596381aadd50e8db8618a40cf37daa731391396680203b555f27571e53bcf824cdb31862d256dcd68334ecee9726a11ad5199d9
7
+ data.tar.gz: 5659bc5ab5dfb8d30faf645941ce19791378d8fac877c00cfb1d3a7a8e65e0b1ee526ee36539d8be3f86efe7bebca951954c3afcb2289953523d71558fa2b144
data/README.md CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
20
20
  ## Usage
21
21
 
22
22
  homeseed commands
23
- ```
23
+ ```bash
24
24
  $ homeseed
25
25
  Commands:
26
26
  homeseed exec [-e <command> or -f <files>] [-u <user>] [-p <has_password>] -s, --servers=SERVERS # executes bash login session(s) on remote servers to run inline bash commands or bash ...
@@ -31,46 +31,34 @@ Commands:
31
31
  ```
32
32
 
33
33
  to distribute and install your dot profile(s) on multiple of servers run
34
- ```
34
+ ```bash
35
35
  $ homeseed plant -s blackberry,blueberry,raspberry
36
36
  ```
37
- this uses localhost's $HOME/.homeseed.yml by default; a url can given instead
38
- ```
37
+ this uses your user's local $HOME/.homeseed.yml by default; a url can be given instead to override this
38
+ ```bash
39
39
  $ homeseed plant -s pom --url 'i_am_a_homeseed.yml_file'
40
40
  ```
41
41
  localhost can be specified as the target for system initialization
42
- ```
42
+ ```bash
43
43
  $ homeseed exec -s localhost --url 'setup_bluez_mupen_and_such.yml'
44
44
  ```
45
45
 
46
- ex $HOME/.homeseed.yml
47
- ```
48
- homeshick:
49
- clone:
50
- - https://github.com/rbuchss/terminator.git --batch
51
- - https://github.com/rbuchss/vim-4-eva.git --batch
52
- link:
53
- - terminator --force
54
- - vim-4-eva --force
55
- ```
56
-
57
- to update run; uses $HOME/.homeup.yml (same url based overrides apply here as well)
58
- ```
46
+ to update run; uses $HOME/.homeseed.yml by default (same url based overrides apply here as well)
47
+ ```bash
59
48
  $ homeseed update -s soho
60
49
  ```
61
50
  localhost can be specified here as well
62
- ```
51
+ ```bash
63
52
  $ homeseed update -s localhost
64
53
  ```
65
54
 
66
- ex $HOME/.homeup.yml
67
- ```
68
- homeshick:
69
- pull:
70
- - --force --batch
71
- link:
72
- - terminator --force
73
- - vim-4-eva --force
55
+ ex user config ($HOME/.homeseed.yml)
56
+ ```ruby
57
+ :repos:
58
+ terminator:
59
+ :origin: https://github.com/rbuchss/terminator.git
60
+ vim-4-eva:
61
+ :origin: https://github.com/rbuchss/vim-4-eva.git
74
62
  ```
75
63
 
76
64
  ## Contributing
@@ -34,7 +34,7 @@ module Homeseed
34
34
  method_option :servers, required: true, aliases: '-s', desc: 'ssh hostname(s) or localhost; csv if multiple'
35
35
  method_option :user, aliases: '-u', desc: 'ssh username', default: ENV['USER']
36
36
  method_option :has_password, aliases: '-p', type: :boolean, default: false, desc: 'connection uses password; no ssh keys'
37
- method_option :clean, type: :boolean, default: true, desc: 'clean install toogle'
37
+ method_option :clean, alias: '-c', type: :boolean, default: false, desc: 'clean install toogle'
38
38
  method_option :url, desc: "url to use vs file default: #{ENV['HOME']}/.homeseed.yml"
39
39
  def plant
40
40
  homeshick = Homeseed::Homeshick.new options
@@ -71,11 +71,13 @@ module Homeseed
71
71
  combined_key = [current_key, new_key].delete_if { |k| k == '' }.join(" ")
72
72
  process_hash(commands, combined_key, value)
73
73
  end
74
- else obj.is_a?(Array)
74
+ elsif obj.is_a?(Array)
75
75
  obj.each do |value|
76
76
  combined_key = [current_key, value].delete_if { |k| k == '' }.join(" ")
77
77
  commands << combined_key
78
78
  end
79
+ else
80
+ commands
79
81
  end
80
82
  end
81
83
 
@@ -2,7 +2,7 @@ module Homeseed
2
2
  class Homeshick < Connection
3
3
  include Logging
4
4
 
5
- EXEC_PATH = '$HOME/.homesick/repos/homeshick/bin/homeshick '
5
+ EXEC_PATH = '$HOME/.homesick/repos/homeshick/bin/homeshick'
6
6
 
7
7
  def initialize(params={})
8
8
  super
@@ -13,36 +13,32 @@ module Homeseed
13
13
  @config_files = Array[config_file_path('homeshick-install.yml')]
14
14
  @config_files.unshift(config_file_path('homeshick-prep.yml')) if params[:clean]
15
15
  push_commands(files: @config_files)
16
- if params[:url]
17
- exec(params.merge(user_config: :url))
18
- else
19
- exec(params.merge(user_config: :local, file: '.homeseed.yml'))
16
+ fetch_user_config(params)
17
+ user_commands = @user_config[:repos].map do |repo_name,repo_meta|
18
+ "#{EXEC_PATH} clone #{repo_meta[:origin]} --batch && #{EXEC_PATH} symlink #{repo_name} --force"
20
19
  end
20
+ push_commands(command: user_commands)
21
+ exec
21
22
  end
22
23
 
23
24
  def update(params={})
24
25
  fetch_user_config(params)
25
- if params[:url]
26
- exec(params.merge(user_config: :url))
27
- else
28
- exec(params.merge(user_config: :local, file: '.homeup.yml'))
26
+ user_commands = @user_config[:repos].map do |repo_name,repo_meta|
27
+ "#{EXEC_PATH} pull #{repo_name} --batch && #{EXEC_PATH} symlink #{repo_name} --force"
29
28
  end
29
+ push_commands(command: user_commands)
30
+ exec
30
31
  end
31
32
 
32
33
  def fetch_user_config(params={})
33
- case params[:user_config]
34
- when :url
35
- push_commands(url: params[:url])
36
- when :local
37
- file = File.expand_path(params[:file], ENV['HOME'])
38
- push_commands(file: file)
34
+ if params[:url]
35
+ response = HTTParty.get(params[:url])
36
+ raise HTTPartyError unless response.code == 200
37
+ @user_config = YAML.load(response.body)
38
+ else
39
+ file = File.expand_path('.homeseed.yml', ENV['HOME'])
40
+ @user_config = YAML.load_file(file)
39
41
  end
40
- @commands.map! { |command| command.gsub(/^homeshick /, EXEC_PATH) }
41
- end
42
-
43
- def exec(params={})
44
- fetch_user_config(params)
45
- super
46
42
  end
47
43
  end
48
44
  end
@@ -1,3 +1,3 @@
1
1
  module Homeseed
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.16"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: homeseed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - rbuchss