Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add os update for linux #3

Merged
merged 1 commit into from
Mar 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ end

desc 'Start the Chid app'
task :chid do
prompt = TTY::Prompt.new(help_color: :green)
confirm_install = -> (action, &block) {
prompt = TTY::Prompt.new(help_color: :green)
confirm_install = -> (action, &block) {
matched = /^install:(.*)/.match(action)
return block.() unless matched

action_name = matched.captures.first
if prompt.yes?("Can I install the #{action_name}?")
block.()
else
puts "\nNo problem. What do you need?"
end
if prompt.yes?("Can I install the #{action_name}?")
block.()
else
puts "\nNo problem. What do you need?"
end
}

Main.new(chid_config: chid_config).init do |action, args|
Expand Down Expand Up @@ -251,6 +251,15 @@ task :news do
end
end

namespace :update do
desc 'Update os'
task :os do
chid_config.on_linux do
system('sudo apt-get update && sudo apt-get -y upgrade')
end
end
end

namespace :workstation do

desc 'List all workstations'
Expand Down
3 changes: 2 additions & 1 deletion main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class Main
:'workstation:open' => [/workstation/, /work/, /open/, /open workstation/, /open work/],
:'workstation:create' => [/workstation/, /work/, /create/, /create workstation/, /create work/],
:'workstation:destroy' => [/workstation/, /work/, /destroy/, /destroy workstation/,
/destroy work/, /remove/, /remove workstation/, /remove work/]
/destroy work/, /remove/, /remove workstation/, /remove work/],
:'update:os' => [/update os/, /update/]
}

ActionWithArgs = Struct.new(:action, :args)
Expand Down