Skip to content

Commit

Permalink
Merge pull request #155 from openflighthpc/develop
Browse files Browse the repository at this point in the history
Remove group support and start fixing deprecation warnings
  • Loading branch information
WilliamMcCumstie authored Jul 8, 2020
2 parents 62cce0b + 6759973 commit abaf283
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 41 deletions.
41 changes: 19 additions & 22 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ GEM
commander-openflighthpc (1.1.0)
highline (~> 1.7.2)
paint (~> 2.1.0)
equatable (0.5.0)
equatable (0.6.1)
erubis (2.7.0)
escape_utils (1.2.1)
ffi (1.10.0)
Expand All @@ -13,40 +13,37 @@ GEM
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
necromancer (0.4.0)
necromancer (0.5.1)
nodeattr_utils (1.0.0)
ox (2.10.0)
paint (2.1.0)
pastel (0.7.2)
equatable (~> 0.5.0)
tty-color (~> 0.4.0)
pastel (0.7.4)
equatable (~> 0.6)
tty-color (~> 0.5)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
recursive-open-struct (1.1.0)
rerun (0.13.0)
listen (~> 3.0)
ruby_dep (1.5.0)
rubyzip (1.2.2)
timers (4.3.0)
tty-color (0.4.3)
tty-cursor (0.6.0)
tty-editor (0.5.0)
tty-prompt (~> 0.18)
rubyzip (1.3.0)
tty-color (0.5.1)
tty-cursor (0.7.1)
tty-editor (0.5.1)
tty-prompt (~> 0.19)
tty-which (~> 0.4)
tty-prompt (0.18.1)
necromancer (~> 0.4.0)
tty-prompt (0.21.0)
necromancer (~> 0.5.0)
pastel (~> 0.7.0)
timers (~> 4.0)
tty-cursor (~> 0.6.0)
tty-reader (~> 0.5.0)
tty-reader (0.5.0)
tty-cursor (~> 0.6.0)
tty-screen (~> 0.6.4)
tty-reader (~> 0.7.0)
tty-reader (0.7.0)
tty-cursor (~> 0.7)
tty-screen (~> 0.7)
wisper (~> 2.0.0)
tty-screen (0.6.5)
tty-which (0.4.0)
wisper (2.0.0)
tty-screen (0.8.0)
tty-which (0.4.2)
wisper (2.0.1)
xmlhasher (1.0.4)
escape_utils (~> 1.2)
ox (~> 2.10.0)
Expand Down
14 changes: 0 additions & 14 deletions lib/inventoryware/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ def add_create_option(command)

def add_multi_node_options(command)
command.option '--all', "Select all assets"
command.option '-g', '--group GROUP',
"Select assets in GROUP, specify comma-separated list for multiple groups"
end
end

Expand Down Expand Up @@ -91,16 +89,6 @@ def add_multi_node_options(command)
c.action Commands, :'modifys-other'
end

command :'modify-groups' do |c|
cli_syntax(c, 'GROUP [ASSET_SPEC]')
c.description = "Modify group data for one or more assets"
add_multi_node_options(c)
add_create_option(c)
c.option '-p', '--primary', "Modify the primary group of one or more assets"
c.option '-r', '--remove', "Remove one or more assets from this group"
c.action Commands, :'modifys-groups'
end

command :'edit-map' do |c|
cli_syntax(c, 'MAP_NAME [ASSET_SPEC]')
c.description = "Edit mapping data for one or more assets"
Expand All @@ -120,8 +108,6 @@ def add_multi_node_options(command)
command :list do |c|
cli_syntax(c)
c.description = "List all assets that have stored data"
c.option '-g', '--group [GROUP]',
"Optionally select assets in GROUP, specify comma-separated list for multiple groups"
c.option '-t', '--type [TYPE]',
"Optionally select assets in TYPE, specify comma-separated list for multiple types"
c.action Commands, :list
Expand Down
7 changes: 4 additions & 3 deletions lib/inventoryware/commands/delete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
# ==============================================================================
require 'inventoryware/commands/multi_node_command'
require 'fileutils'
require 'tty-prompt'

module Inventoryware
module Commands
Expand All @@ -36,11 +37,11 @@ def run
prefix = "You are about to delete"
node_paths = nodes.map { |n| File.expand_path(n.path) }
if node_paths.length > 1
node_msg = "#{prefix}:\n#{node_paths.join("\n")}\nProceed? (y/n)"
node_msg = "#{prefix}:\n#{node_paths.join("\n")}\nProceed?"
else
node_msg = "#{prefix} #{node_paths[0]} - proceed? (y/n)"
node_msg = "#{prefix} #{node_paths[0]} - proceed?"
end
if $terminal.agree(node_msg)
if TTY::Prompt.new.yes?(node_msg, default: false)
node_paths.each { |path| FileUtils.rm path }
end
end
Expand Down
3 changes: 2 additions & 1 deletion lib/inventoryware/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# https://github.com/openflighthpc/flight-inventory
# ==============================================================================
require 'inventoryware/exceptions'
require 'tty-prompt'

module Inventoryware
module Utils
Expand Down Expand Up @@ -77,7 +78,7 @@ def self.find_file(search_val, dir)
def self.get_new_asset_type
type = ''
while type.empty?
type = $terminal.ask('Enter the type of the new assets being created')
type = TTY::Prompt.new.ask('Enter the type of the new assets being created')
end
return type
end
Expand Down
2 changes: 1 addition & 1 deletion lib/inventoryware/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# ==============================================================================

module Inventoryware
VERSION = '2.0.0.rc0'
VERSION = '2.0.0.rc1'
SCHEMA_NUM = 4
REQ_SCHEMA_NUM = 4
end

0 comments on commit abaf283

Please sign in to comment.