hieb 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +1 -1
  3. data/bin/hieb +4 -2
  4. data/lib/hieb.rb +9 -8
  5. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: e6168fe950c5a6dbbd3b0df0bde3ca84d87e6109c8c7cf6a47a2cb80e86ea195
4
- data.tar.gz: 73ca4f949ec8886fe18823d5ed383b7ae4885619d44d9e16cb3848ebe594ff51
2
+ SHA1:
3
+ metadata.gz: a9780c3e665c26a2a76b8397a452aa2477a86422
4
+ data.tar.gz: 158e0b9ab037288c293d66e9f62f8bce168e7a58
5
5
  SHA512:
6
- metadata.gz: 7027e84b042baaf9a7ef7a2612d6880bd720e1e0a5b997f28f629f18c8e986070fcf81b21a3d645cc81ce5eab9a3bcacb08cfd1dc45864ba3c4bce374980fda0
7
- data.tar.gz: 065c1c07974ed8acf95ec4738d09ce3c60d90d84f509ffa10b251b691d2fd25fdb7b93e65c482fce73b45ce1146c03dca18b040cb1b4edce0f613263ccce761e
6
+ metadata.gz: d2191b1b4b8c43a04ee641eef63026502b736a45fffc350c07827d1e345d6ce5b4c35aa4d260f7e29cebae8b2403c7d401248d7f2fb44afdd36eef52a8a414ac
7
+ data.tar.gz: c46ff1598ecaf86b6b5165aa14f573299018f4fd8654c12db54790b398e03b7a8a61adc01289439ab240b8c8f9dc152ab32b68f24865f7e0571813f3e3ba1329
data/README.md CHANGED
@@ -7,7 +7,7 @@ Simple deployment tool using SSH and supporting command execution and file uploa
7
7
  Call the `hieb` command for one server like this:
8
8
 
9
9
  ```
10
- hieb 192.168.0.1 user password
10
+ hieb 192.168.0.1 user password [[PATH TO UPLOAD DIR] [PATH TO EXE YAML]]
11
11
  ```
12
12
 
13
13
  or
data/bin/hieb CHANGED
@@ -5,6 +5,8 @@ require 'hieb'
5
5
  HOST = ARGV[0]
6
6
  USER = ARGV[1]
7
7
  KEY = ARGV[2]
8
+ DIR = ARGV[3] || DEFAULT_UPLOAD_DIR
9
+ EXE = ARGV[4] || DEFAULT_EXE_FILE
8
10
 
9
11
  10.times do |i|
10
12
  sleep 1
@@ -14,6 +16,6 @@ KEY = ARGV[2]
14
16
  end
15
17
  end
16
18
 
17
- upload_files(HOST, USER, KEY, DEFAULT_UPLOAD_DIR)
19
+ upload_files(HOST, USER, KEY, DIR)
18
20
 
19
- execute_commands(HOST, USER, KEY, DEFAULT_EXE_FILE)
21
+ execute_commands(HOST, USER, KEY, EXE)
data/lib/hieb.rb CHANGED
@@ -9,7 +9,7 @@ DEFAULT_EXE_FILE = '_exe.json'
9
9
 
10
10
  def ping ip
11
11
  begin
12
- r = `ping -c 1 -t1 -W1 #{ip} |grep packets`
12
+ r = `ping -c 1 -t1 -W1 #{ip}|grep packets`
13
13
  r.match(/transmitted, (.*?) packets/)[1].to_i == 1
14
14
  rescue
15
15
  false
@@ -23,19 +23,19 @@ def exe(ssh, cmd)
23
23
  end
24
24
  end
25
25
 
26
- def upload(scp, from, to)
27
- puts ">> UPLOAD: /#{to}"
28
- scp.upload! from, "/#{to}"
26
+ def upload(scp, file)
27
+ puts ">> UPLOAD: /#{file}"
28
+ scp.upload! "_files/#{file}", "/#{file}"
29
29
  end
30
30
 
31
- def upload_dir(scp, base_dir, dir)
31
+ def upload_dir(scp, dir)
32
32
  Dir.foreach dir do |f1|
33
33
  next if f1 =~ /^\.|\..$/
34
34
  f2 = File.join(dir, f1)
35
35
  if File.directory? f2
36
- upload_dir scp, base_dir, f2
36
+ upload_dir scp, f2
37
37
  else
38
- upload scp, f2, f2.sub(/^#{base_dir}\//, '')
38
+ upload scp, f2.sub!(/^#{DEFAULT_UPLOAD_DIR}\//, '')
39
39
  end
40
40
  end
41
41
  end
@@ -48,7 +48,7 @@ def upload_files(host, user, key, upload_dir, options = {})
48
48
  end
49
49
  # Upload deploy files
50
50
  Net::SCP.start(host, user, :password => key, :keys => [ key ], :verify_host_key => paranoid) do |scp|
51
- upload_dir scp, upload_dir, upload_dir
51
+ upload_dir scp, upload_dir
52
52
  end if File.exist? upload_dir
53
53
  end
54
54
 
@@ -67,3 +67,4 @@ def execute_commands(host, user, key, exe_file, options = {})
67
67
  end
68
68
  end if File.exist? exe_file
69
69
  end
70
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hieb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Bovensiepen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-08 00:00:00.000000000 Z
11
+ date: 2018-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  requirements: []
84
84
  rubyforge_project:
85
- rubygems_version: 2.7.3
85
+ rubygems_version: 2.5.2.3
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Simple deployment tool