niso 2.0.4 → 2.0.6

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: 0074b90f949a83689f8db0031d321a8db28d939c
4
- data.tar.gz: 31135e9d544df3c9accd52c3b76d9170bd522cc1
3
+ metadata.gz: c5f95af227949721a4612240352f459ad8d6f01c
4
+ data.tar.gz: 5b1bcbb5623f421b285a587fd5a4b0b43d59cd45
5
5
  SHA512:
6
- metadata.gz: 89a037a690ad3174fcf675b5692671ea1e907f9b06805451279cd168a25b3379d85236f1c5dfc716b3ab91f9c14d9690ed2976f2118e5a8f232044d9846a5f70
7
- data.tar.gz: 2a4303b6f1b3e0cba82ce9b834eeb71aa6523615d6aae3b4ba5d8805e178b519cc717849799391100e71b1f680d291800bbe2b20d1269305699422b0bdd54db0
6
+ metadata.gz: 6f182621e2c65efe15a363cad4f05de4176e8b1bee02b59c707f6b08cee3cadb905cb792082e25f799b1ddc9d56c671a23f3f34261157a2254ac9216dec03f7b
7
+ data.tar.gz: 814016890448eb199eb937c38eab81ddad816b41f8c66f7bd19156a93552b5933a4cc32a8b971036670deef409ddb15ae9da01a5ba098b8b5888967c80881200
data/README.md CHANGED
@@ -1,11 +1,14 @@
1
1
  # nîso ᓃᓱ
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/niso.svg)](https://badge.fury.io/rb/niso) [![Build Status](https://travis-ci.org/dakotalightning/niso.svg?branch=master)](https://travis-ci.org/dakotalightning/niso)
3
+ [![Gem Version](https://badge.fury.io/rb/niso.svg)](https://badge.fury.io/rb/niso) [![Build Status](https://travis-ci.org/dakotalightning/niso.svg?branch=master)](https://travis-ci.org/dakotalightning/niso) [![Code Climate](https://codeclimate.com/github/dakotalightning/niso/badges/gpa.svg)](https://codeclimate.com/github/dakotalightning/niso) [![Dependency Status](https://gemnasium.com/badges/github.com/dakotalightning/niso.svg)](https://gemnasium.com/github.com/dakotalightning/niso)
4
+
4
5
 
5
6
  niso is the number 2 (two) in Cree
6
7
 
7
8
  ## Quickstart
8
9
 
10
+ Example: https://github.com/dakotalightning/niso-example
11
+
9
12
  Install:
10
13
 
11
14
  $ [sudo] gem install niso
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+
3
+ gem build niso.gemspec
4
+ gem install ./niso-2.0.6.gem
@@ -38,6 +38,7 @@ module Niso
38
38
  end
39
39
 
40
40
  no_tasks do
41
+ Niso::Dependency.load('highline')
41
42
  include Niso::Utility
42
43
 
43
44
  def self.source_root
@@ -55,6 +56,8 @@ module Niso
55
56
  end
56
57
 
57
58
  def do_deploy(first, *args)
59
+ @ui = HighLine.new
60
+
58
61
  if ['do'].include?(first)
59
62
  @instance_attributes = YAML.load(File.read("#{first}/instances/#{args[0]}.yml"))
60
63
  target = @instance_attributes[:networks]["v4"].first["ip_address"]
@@ -68,39 +71,53 @@ module Niso
68
71
  user, host, port = parse_target(target)
69
72
  endpoint = "#{user}@#{host}"
70
73
 
71
- # compile attributes and recipes
72
- do_compile(role)
73
-
74
- # The host key might change when we instantiate a new VM, so
75
- # we remove (-R) the old host key from known_hosts.
76
- `ssh-keygen -R #{host} 2> /dev/null`
77
-
78
- remote_commands = <<-EOS
79
- rm -rf ~/niso &&
80
- mkdir ~/niso &&
81
- cd ~/niso &&
82
- tar xz &&
83
- #{sudo}bash install.sh
84
- EOS
85
-
86
- remote_commands.strip! << ' && rm -rf ~/niso' if @config['preferences'] and @config['preferences']['erase_remote_folder']
87
-
88
- local_commands = <<-EOS
89
- cd compiled
90
- tar cz . | ssh -o 'StrictHostKeyChecking no' #{endpoint} -p #{port} '#{remote_commands}'
91
- EOS
92
-
93
- Open3.popen3(local_commands) do |stdin, stdout, stderr|
94
- stdin.close
95
- t = Thread.new do
96
- while (line = stderr.gets)
97
- print line.color(:red)
74
+ say "#{@ui.color("doing deploy", :green, :bold)}"
75
+ say " #{@ui.color("user", :green, :bold)} #{user}"
76
+ say " #{@ui.color("host", :green, :bold)} #{host}"
77
+ say " #{@ui.color("port", :green, :bold)} #{port}"
78
+ say " #{@ui.color("role", :green, :bold)} #{role}"
79
+
80
+ begin
81
+ # compile attributes and recipes
82
+ do_compile(role)
83
+ rescue Exception => e
84
+ abort_with "#{e.message}"
85
+ end
86
+
87
+ begin
88
+ # The host key might change when we instantiate a new VM, so
89
+ # we remove (-R) the old host key from known_hosts.
90
+ `ssh-keygen -R #{host} 2> /dev/null`
91
+
92
+ remote_commands = <<-EOS
93
+ rm -rf ~/niso &&
94
+ mkdir ~/niso &&
95
+ cd ~/niso &&
96
+ tar xz &&
97
+ #{sudo}bash install.sh
98
+ EOS
99
+
100
+ remote_commands.strip! << ' && rm -rf ~/niso' if @config['preferences'] and @config['preferences']['erase_remote_folder']
101
+
102
+ local_commands = <<-EOS
103
+ cd compiled
104
+ tar cz . | ssh -o 'StrictHostKeyChecking no' #{endpoint} -p #{port} '#{remote_commands}'
105
+ EOS
106
+
107
+ Open3.popen3(local_commands) do |stdin, stdout, stderr|
108
+ stdin.close
109
+ t = Thread.new do
110
+ while (line = stderr.gets)
111
+ print line.color(:red)
112
+ end
98
113
  end
114
+ while (line = stdout.gets)
115
+ print line.color(:green)
116
+ end
117
+ t.join
99
118
  end
100
- while (line = stdout.gets)
101
- print line.color(:green)
102
- end
103
- t.join
119
+ rescue Exception => e
120
+ abort_with e.message
104
121
  end
105
122
  end
106
123
 
@@ -121,10 +138,15 @@ module Niso
121
138
  (@config['attributes'] || {}).each {|key, value| create_file "compiled/attributes/#{key}", value }
122
139
 
123
140
  # Retrieve remote recipes via HTTP
124
- cache_remote_recipes = @config['preferences'] && @config['preferences']['cache_remote_recipes']
125
- (@config['recipes'] || []).each do |key, value|
126
- next if cache_remote_recipes and File.exists?("compiled/recipes/#{key}.sh")
127
- get value, "compiled/recipes/#{key}.sh"
141
+ begin
142
+ # compile attributes and recipes
143
+ cache_remote_recipes = @config['preferences'] && @config['preferences']['cache_remote_recipes']
144
+ (@config['recipes'] || []).each do |key, value|
145
+ next if cache_remote_recipes and File.exists?("compiled/recipes/#{key}.sh")
146
+ get value, "compiled/recipes/#{key}.sh"
147
+ end
148
+ rescue Exception => e
149
+ abort_with "check your remote recipes in (niso.yml)\n#{e.message}"
128
150
  end
129
151
 
130
152
  copy_or_template = (@config['preferences'] && @config['preferences']['eval_erb']) ? :template : :copy_file
@@ -15,18 +15,18 @@ module Niso
15
15
  unless File.exist? provider_config_path
16
16
  @cli.empty_directory "#{@provider}/instances"
17
17
  @cli.template "templates/setup/#{@provider}.yml", provider_config_path
18
- exit_with "Now go ahead and edit #{@provider}.yml, then run this command again!"
18
+ exit_with "Now go ahead and update the access_token:, name: of #{@provider}.yml, then run this command again!"
19
19
  end
20
20
 
21
21
  # get the config { provider }.yml
22
22
  assign_config
23
23
 
24
24
  if @config['name'] == 'example-droplet-01'
25
- abort_with "You must have your own settings in #{@provider}.yml"
25
+ abort_with "You must update the name in your settings file #{@provider}.yml"
26
26
  end
27
27
 
28
28
  if @config['access_token'] == 'your_api_key'
29
- abort_with "You must add a valid access_token in #{@provider}.yml"
29
+ abort_with "Access Token is invalid, please check your #{@provider}.yml"
30
30
  end
31
31
 
32
32
  # Ask environment and hostname
@@ -2,7 +2,7 @@
2
2
  set -e
3
3
 
4
4
  # Load base utility functions like niso.mute() and niso.install()
5
- source recipes/.sh
5
+ source recipes/niso.sh
6
6
 
7
7
  # This line is necessary for automated provisioning for Debian/Ubuntu.
8
8
  # Remove if you're not on Debian/Ubuntu.
@@ -6,10 +6,24 @@ attributes:
6
6
 
7
7
  # Remote recipes here will be downloaded to compiled/recipes.
8
8
  recipes:
9
- rvm: https://raw.githubusercontent.com/kenn/niso-recipes/master/ruby/rvm.sh
10
- # dotdeb: https://raw.githubusercontent.com/kenn/niso-recipes/master/debian/dotdeb-wheezy.sh
11
- # backports: https://raw.githubusercontent.com/kenn/niso-recipes/master/debian/backports-wheezy.sh
12
- # mongodb-10gen: https://raw.githubusercontent.com/kenn/niso-recipes/master/debian/mongodb-10gen.sh
9
+ # rvm: https://raw.githubusercontent.com/kenn/sunzi-recipes/master/ruby/rvm.sh
10
+ # dotdeb: https://raw.githubusercontent.com/kenn/sunzi-recipes/master/debian/dotdeb-wheezy.sh
11
+ # backports: https://raw.githubusercontent.com/kenn/sunzi-recipes/master/debian/backports-wheezy.sh
12
+ # mongodb-10gen: https://raw.githubusercontent.com/kenn/sunzi-recipes/master/debian/mongodb-10gen.sh
13
+ # niso recipies
14
+ # adduser: https://raw.githubusercontent.com/dakotalightning/niso-example/master/recipes/adduser.sh
15
+ # build-essential: https://raw.githubusercontent.com/dakotalightning/niso-example/master/recipes/build-essential.sh
16
+ # git: https://raw.githubusercontent.com/dakotalightning/niso-example/master/recipes/git.sh
17
+ # mysql-client: https://raw.githubusercontent.com/dakotalightning/niso-example/master/recipes/mysql-client.sh
18
+ # mysql: https://raw.githubusercontent.com/dakotalightning/niso-example/master/recipes/mysql.sh
19
+ # nginx: https://raw.githubusercontent.com/dakotalightning/niso-example/master/recipes/nginx.sh
20
+ # nodejs: https://raw.githubusercontent.com/dakotalightning/niso-example/master/recipes/nodejs.sh
21
+ # rbenv: https://raw.githubusercontent.com/dakotalightning/niso-example/master/recipes/rbenv.sh
22
+ # redis: https://raw.githubusercontent.com/dakotalightning/niso-example/master/recipes/redis.sh
23
+ # set_env_vars: https://raw.githubusercontent.com/dakotalightning/niso-example/master/recipes/set_env_vars.sh
24
+ # sidekiq: https://raw.githubusercontent.com/dakotalightning/niso-example/master/recipes/sidekiq.sh
25
+ # sudonopassword: https://raw.githubusercontent.com/dakotalightning/niso-example/master/recipes/sudonopassword.sh
26
+ # ufw: https://raw.githubusercontent.com/dakotalightning/niso-example/master/recipes/ufw.sh
13
27
 
14
28
  # Files specified here will be copied to compiled/files.
15
29
  # files:
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'niso'
5
- spec.version = '2.0.4'
5
+ spec.version = '2.0.6'
6
6
  spec.authors = ['Dakota Lightning']
7
7
  spec.email = ['im@koda.io']
8
8
  spec.homepage = 'http://github.com/dakotalightning/niso'
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.required_ruby_version = '>= 2.0.0'
19
19
 
20
20
  spec.add_runtime_dependency 'thor', '~> 0.19'
21
- spec.add_runtime_dependency 'rainbow', '~> 2.0'
22
- spec.add_runtime_dependency 'net-ssh', '~> 3.2'
21
+ spec.add_runtime_dependency 'rainbow', '~> 3.0'
22
+ spec.add_runtime_dependency 'net-ssh', '~> 4.2'
23
23
  spec.add_development_dependency 'rake', '~> 10.5'
24
24
  spec.add_development_dependency 'minitest', '~> 5.8'
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: niso
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dakota Lightning
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-31 00:00:00.000000000 Z
11
+ date: 2017-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: '3.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: net-ssh
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.2'
47
+ version: '4.2'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.2'
54
+ version: '4.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -95,6 +95,7 @@ files:
95
95
  - README.md
96
96
  - Rakefile
97
97
  - bin/niso
98
+ - build.sh
98
99
  - lib/niso.rb
99
100
  - lib/niso/cli.rb
100
101
  - lib/niso/cloud.rb