chid 0.1.6.1 → 0.1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/#README.md# +1 -0
- data/CONTRIBUTING.md +4 -0
- data/README.md +1 -0
- data/lib/chid/commands/installs/vim.rb +61 -0
- data/lib/chid/commands/workstation/create.rb +63 -0
- data/lib/chid/commands/workstation/destroy.rb +61 -0
- data/lib/chid/version.rb +1 -1
- metadata +7 -8
- data/tasks/workstation/create.rake +0 -23
- data/tasks/workstation/destroy.rake +0 -14
- data/tasks/workstation/list.rake +0 -10
- data/tasks/workstation/open.rake +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 07e50f1ef170df37a4371d430f3e9489ec399a008d72c6a456c88ea96e6f1731
|
4
|
+
data.tar.gz: 324f150e53d9481e0ea8eed0297faecba52bc65c95c66dfe0faebfaf6b974543
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3a08a8b99acaa5bf889ffe460a25676378c8556b3ee6eaa4ad661854b82272eaf25b2949927bc762e593495002052df56af265bbea9ecf197764ee269dc9296
|
7
|
+
data.tar.gz: 40b6a3b51980481880acb530f4da92bdd9a75ce69a4d32263702b736a514d50bf23308cbe3d8b3d509673dc7ea0ef52297bfd26d160f92651cd7d0daa84e4ee3
|
data/#README.md#
CHANGED
data/CONTRIBUTING.md
ADDED
data/README.md
CHANGED
@@ -0,0 +1,61 @@
|
|
1
|
+
module Chid
|
2
|
+
module Commands
|
3
|
+
module Installs
|
4
|
+
class Vim < Command
|
5
|
+
|
6
|
+
command :'install vim'
|
7
|
+
|
8
|
+
self.summary = 'Install vim and gvim'
|
9
|
+
self.description = <<-DESC
|
10
|
+
|
11
|
+
Usage:
|
12
|
+
$ chid install vim or chid install gvim
|
13
|
+
|
14
|
+
For Linux users will install through apt-get
|
15
|
+
|
16
|
+
For OSx users will install through brew
|
17
|
+
|
18
|
+
DESC
|
19
|
+
self.arguments = []
|
20
|
+
|
21
|
+
def run
|
22
|
+
puts "\nInstalling vim..."
|
23
|
+
|
24
|
+
is_vim = do_vim?
|
25
|
+
is_gvim = do_gvim?
|
26
|
+
|
27
|
+
::Chid::on_linux do
|
28
|
+
system('sudo apt-get install vim') if is_vim
|
29
|
+
system('sudo apt-get install vim-gnome') if is_gvim
|
30
|
+
end
|
31
|
+
|
32
|
+
::Chid::on_osx do
|
33
|
+
system('brew install vim && brew install macvim')
|
34
|
+
end
|
35
|
+
|
36
|
+
puts "\nVim installed successfully" if is_vim
|
37
|
+
puts "\nGvim installed successfully" if is_gvim
|
38
|
+
|
39
|
+
puts "\nNothing installed =(" unless is_vim || is_gvim
|
40
|
+
end
|
41
|
+
|
42
|
+
def prompt
|
43
|
+
@prompt ||= TTY::Prompt.new
|
44
|
+
end
|
45
|
+
|
46
|
+
def do_vim?
|
47
|
+
answers = ['Yes','No']
|
48
|
+
should_install_vim = prompt.select('Install vim ?', answers)
|
49
|
+
should_install_vim == 'Yes'
|
50
|
+
end
|
51
|
+
|
52
|
+
def do_gvim?
|
53
|
+
answers = ['Yes','No']
|
54
|
+
should_install_gvim = prompt.select('Install gvim too?', answers)
|
55
|
+
should_install_gvim == 'Yes'
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Chid
|
2
|
+
module Commands
|
3
|
+
module Workstation
|
4
|
+
class Create < Command
|
5
|
+
|
6
|
+
command :'workstation create'
|
7
|
+
|
8
|
+
self.summary = 'Create a new workstation'
|
9
|
+
self.description = <<-DESC
|
10
|
+
|
11
|
+
Usage:
|
12
|
+
|
13
|
+
$ chid workstation create
|
14
|
+
|
15
|
+
Create a new workstation with the selected apps.
|
16
|
+
|
17
|
+
To see all workstations you can run
|
18
|
+
|
19
|
+
$ chid workstation list
|
20
|
+
|
21
|
+
DESC
|
22
|
+
self.arguments = []
|
23
|
+
|
24
|
+
def run
|
25
|
+
workstation_name = get_workstation_name
|
26
|
+
result = chid_config.on_osx { select_apps_on_osx }
|
27
|
+
|
28
|
+
if result.empty?
|
29
|
+
puts "\nYou did not select any App, please try again."
|
30
|
+
return
|
31
|
+
end
|
32
|
+
|
33
|
+
chid_config.create_workstation(workstation_name, result)
|
34
|
+
|
35
|
+
puts "\n#{workstation_name} workstation was created!"
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def get_workstation_name
|
41
|
+
puts 'tell me the name of the new workstation'
|
42
|
+
print "> "
|
43
|
+
STDIN.gets.strip
|
44
|
+
end
|
45
|
+
|
46
|
+
def chid_config
|
47
|
+
::Chid.chid_config
|
48
|
+
end
|
49
|
+
|
50
|
+
def select_apps_on_osx
|
51
|
+
prompt = TTY::Prompt.new
|
52
|
+
|
53
|
+
choices = %x{ls /applications}.strip
|
54
|
+
choices = choices
|
55
|
+
.gsub(/\n/, ' - ')
|
56
|
+
.gsub('.app', '')
|
57
|
+
.split(' - ')
|
58
|
+
prompt.multi_select('select all apps for that workstation?', choices)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Chid
|
2
|
+
module Commands
|
3
|
+
module Workstation
|
4
|
+
class Destroy < Command
|
5
|
+
|
6
|
+
command :'workstation destroy'
|
7
|
+
|
8
|
+
self.summary = 'Destroy a specific workstation'
|
9
|
+
self.description = <<-DESC
|
10
|
+
|
11
|
+
Usage:
|
12
|
+
|
13
|
+
$ chid workstation destroy
|
14
|
+
|
15
|
+
Destroy a specific workstation with the selected name.
|
16
|
+
|
17
|
+
To see all workstations you can run
|
18
|
+
|
19
|
+
$ chid workstation list
|
20
|
+
|
21
|
+
DESC
|
22
|
+
self.arguments = []
|
23
|
+
|
24
|
+
def run
|
25
|
+
result = select_workstations
|
26
|
+
|
27
|
+
if result.empty?
|
28
|
+
puts "\nYou did not select any Workstation, please try again."
|
29
|
+
return
|
30
|
+
end
|
31
|
+
|
32
|
+
chid_config.destroy_workstations(result)
|
33
|
+
|
34
|
+
puts "\nWorkstations removed!"
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def get_workstation_name
|
40
|
+
puts 'tell me the name of the new workstation'
|
41
|
+
print "> "
|
42
|
+
STDIN.gets.strip
|
43
|
+
end
|
44
|
+
|
45
|
+
def chid_config
|
46
|
+
::Chid.chid_config
|
47
|
+
end
|
48
|
+
|
49
|
+
def select_workstations
|
50
|
+
prompt = TTY::Prompt.new
|
51
|
+
workstations = chid_config.all_workstations
|
52
|
+
choices = workstations.keys.map(&:to_s)
|
53
|
+
|
54
|
+
prompt
|
55
|
+
.multi_select('Select all workstations to destroy', choices)
|
56
|
+
.map(&:to_sym)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/chid/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.6.
|
4
|
+
version: 0.1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rachid Calazans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -105,6 +105,7 @@ extra_rdoc_files: []
|
|
105
105
|
files:
|
106
106
|
- "#README.md#"
|
107
107
|
- CHANGELOG.md
|
108
|
+
- CONTRIBUTING.md
|
108
109
|
- Gemfile
|
109
110
|
- Gemfile.lock
|
110
111
|
- README.md
|
@@ -122,10 +123,13 @@ files:
|
|
122
123
|
- lib/chid/commands/installs/node.rb
|
123
124
|
- lib/chid/commands/installs/postgres.rb
|
124
125
|
- lib/chid/commands/installs/rvm.rb
|
126
|
+
- lib/chid/commands/installs/vim.rb
|
125
127
|
- lib/chid/commands/news.rb
|
126
128
|
- lib/chid/commands/stack_overflow.rb
|
127
129
|
- lib/chid/commands/tmux/list.rb
|
128
130
|
- lib/chid/commands/tmux/open.rb
|
131
|
+
- lib/chid/commands/workstation/create.rb
|
132
|
+
- lib/chid/commands/workstation/destroy.rb
|
129
133
|
- lib/chid/commands/workstation/list.rb
|
130
134
|
- lib/chid/commands/workstation/open.rb
|
131
135
|
- lib/chid/currency_api.rb
|
@@ -162,10 +166,6 @@ files:
|
|
162
166
|
- tasks/translate/yandex_list.rake
|
163
167
|
- tasks/translate/yandex_translate.rake
|
164
168
|
- tasks/update/os.rake
|
165
|
-
- tasks/workstation/create.rake
|
166
|
-
- tasks/workstation/destroy.rake
|
167
|
-
- tasks/workstation/list.rake
|
168
|
-
- tasks/workstation/open.rake
|
169
169
|
homepage: https://github.com/rachidcalazans/chid
|
170
170
|
licenses:
|
171
171
|
- MIT
|
@@ -186,8 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0'
|
188
188
|
requirements: []
|
189
|
-
|
190
|
-
rubygems_version: 2.6.14
|
189
|
+
rubygems_version: 3.0.1
|
191
190
|
signing_key:
|
192
191
|
specification_version: 4
|
193
192
|
summary: Simple assistant for day-to-day life. Developers and common users
|
@@ -1,23 +0,0 @@
|
|
1
|
-
namespace :workstation do
|
2
|
-
|
3
|
-
desc 'Create a new workstation'
|
4
|
-
task :create do
|
5
|
-
prompt = TTY::Prompt.new
|
6
|
-
|
7
|
-
puts 'Tell me the name of the new Workstation'
|
8
|
-
print "> "
|
9
|
-
workstation_name = STDIN.gets.strip
|
10
|
-
|
11
|
-
@chid_config.on_osx do
|
12
|
-
choices = %x{ls /Applications}.strip
|
13
|
-
choices = choices
|
14
|
-
.gsub(/\n/, ' - ')
|
15
|
-
.gsub('.app', '')
|
16
|
-
.split(' - ')
|
17
|
-
result = prompt.multi_select('Select all apps for that workstation?', choices)
|
18
|
-
@chid_config.create_workstation(workstation_name, result)
|
19
|
-
puts "\n#{workstation_name} Workstation was created!"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
namespace :workstation do
|
2
|
-
|
3
|
-
desc 'Destroy workstations'
|
4
|
-
task :destroy do
|
5
|
-
prompt = TTY::Prompt.new
|
6
|
-
workstations = @chid_config.all_workstations
|
7
|
-
choices = workstations.keys
|
8
|
-
result = prompt.multi_select('Select all workstations to destroy', choices)
|
9
|
-
|
10
|
-
@chid_config.destroy_workstations(result)
|
11
|
-
puts "\nWorkstations removed!"
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
data/tasks/workstation/list.rake
DELETED
data/tasks/workstation/open.rake
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
namespace :workstation do
|
2
|
-
|
3
|
-
desc 'Open a specific workstation'
|
4
|
-
task :open, [:workstation] do |t, args|
|
5
|
-
workstations = @chid_config.all_workstations
|
6
|
-
|
7
|
-
workstation_name = args[:workstation]
|
8
|
-
apps = workstations[workstation_name.to_sym] unless workstation_name.nil?
|
9
|
-
|
10
|
-
if apps.nil?
|
11
|
-
prompt = TTY::Prompt.new
|
12
|
-
choices = workstations.keys
|
13
|
-
result = prompt.select('Choose a workstation to open', choices)
|
14
|
-
apps = workstations[result.to_sym]
|
15
|
-
end
|
16
|
-
|
17
|
-
puts "\nOpening all Apps"
|
18
|
-
apps.each do |app_name|
|
19
|
-
@chid_config.on_osx do
|
20
|
-
system("open -a #{app_name}")
|
21
|
-
end
|
22
|
-
|
23
|
-
@chid_config.on_linux do
|
24
|
-
system("#{app_name} >/dev/null 2>&1 &")
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|