infinum_setup 0.6.0 → 0.7.0
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 +4 -4
- data/README.md +30 -2
- data/lib/infinum_setup.rb +8 -1
- data/lib/infinum_setup/base.rb +29 -34
- data/lib/infinum_setup/program/base.rb +67 -0
- data/lib/infinum_setup/program/brew.rb +17 -0
- data/lib/infinum_setup/program/cask.rb +17 -0
- data/lib/infinum_setup/program/gem.rb +17 -0
- data/lib/infinum_setup/program/helpers.rb +44 -0
- data/lib/infinum_setup/program/npm.rb +17 -0
- data/lib/infinum_setup/program/ruby_script.rb +37 -0
- data/lib/infinum_setup/program/script.rb +29 -0
- data/lib/infinum_setup/team.rb +1 -1
- data/lib/infinum_setup/version.rb +1 -1
- data/programs/android.yml +9 -9
- data/programs/design.yml +9 -9
- data/programs/general.yml +56 -0
- data/programs/ios.yml +9 -9
- data/programs/javascript.yml +9 -9
- data/programs/pm.yml +9 -9
- data/programs/rails.yml +2 -0
- data/scripts/git_wizard.rb +13 -0
- metadata +11 -3
- data/lib/infinum_setup/program.rb +0 -65
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd77d68258782349e56237c0dcc94840c5d1e6b6
|
4
|
+
data.tar.gz: 0a28bba0c0af364e538f93a12ef561ab5c60f4ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8099b9fc31c7298c3e62627d94aaacff4b8bdd879523b3390d94cb47b65507b0ced340ac59a479f5db6d18a87b93cc1090344671f9edc7b9415b5db65cd56fe3
|
7
|
+
data.tar.gz: 6d2d65d94f8e6c3613873b2abb5e3a36a9b52de99c15b97899b3030ac059c377f4695108587f0b73553cefd000cc44b50186957c1613e27d696050b58819a8a1
|
data/README.md
CHANGED
@@ -32,14 +32,13 @@ During setup two config files are loaded: `general.yml` and `#{team}.yml`. These
|
|
32
32
|
|
33
33
|
``` ruby
|
34
34
|
{program_name}:
|
35
|
-
type: brew/cask/gem/npm/
|
35
|
+
type: brew/cask/gem/npm/script
|
36
36
|
mandatory: true/false
|
37
37
|
install_if_not_interactive: true/false
|
38
38
|
program: {program}
|
39
39
|
pre_install_comment: A comment to print out before installing
|
40
40
|
post_install_comment: A comment to print out after install
|
41
41
|
post_install_command: eg. open the app
|
42
|
-
script: a script to be run if type is `command`
|
43
42
|
```
|
44
43
|
|
45
44
|
### command type
|
@@ -52,6 +51,29 @@ There are (for now) 5 types of programs with which to install:
|
|
52
51
|
- npm => `npm -g install {program}`
|
53
52
|
- command => `{script}`
|
54
53
|
|
54
|
+
### Valid keys by type
|
55
|
+
|
56
|
+
For brew/cask/gem/npm valid keys are:
|
57
|
+
|
58
|
+
* :type
|
59
|
+
* :mandatory
|
60
|
+
* :install_if_not_interactive
|
61
|
+
* :pre_install_comment
|
62
|
+
* :post_install_comment
|
63
|
+
* :post_install_command
|
64
|
+
* :program
|
65
|
+
|
66
|
+
For script/ruby_script valid keys are
|
67
|
+
|
68
|
+
* :type
|
69
|
+
* :mandatory
|
70
|
+
* :install_if_not_interactive
|
71
|
+
* :pre_install_comment
|
72
|
+
* :post_install_comment
|
73
|
+
* :post_install_command
|
74
|
+
* :script
|
75
|
+
* :custom_install_question
|
76
|
+
|
55
77
|
### Mandatory
|
56
78
|
|
57
79
|
Set this setting to `true` if you feel like a program must be installed.
|
@@ -69,10 +91,16 @@ Comments to print out before/after installation.
|
|
69
91
|
|
70
92
|
Use this if you want to run a custom command after installation. Eg. `open /Applications/Alfred\ 3.app`
|
71
93
|
|
94
|
+
### Custom install question
|
95
|
+
|
96
|
+
For most of the types the install question is 'Installing #{program}?', but for scripts you can ask your own custom question.
|
97
|
+
|
72
98
|
### Writing your own scripts
|
73
99
|
|
74
100
|
You can use `scripts` folder for writing your own scripts just as I did for ruby.
|
75
101
|
|
102
|
+
|
103
|
+
|
76
104
|
## Contributing
|
77
105
|
|
78
106
|
Bug reports and pull requests are welcome on GitHub at https://github.com/infinum/infinum_setup. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
data/lib/infinum_setup.rb
CHANGED
@@ -2,8 +2,15 @@ require 'yaml'
|
|
2
2
|
require 'open-uri'
|
3
3
|
require 'tty-prompt'
|
4
4
|
require 'tty-which'
|
5
|
+
require 'infinum_setup/program/helpers'
|
6
|
+
require 'infinum_setup/program/base'
|
7
|
+
require 'infinum_setup/program/brew'
|
8
|
+
require 'infinum_setup/program/cask'
|
9
|
+
require 'infinum_setup/program/gem'
|
10
|
+
require 'infinum_setup/program/npm'
|
11
|
+
require 'infinum_setup/program/script'
|
12
|
+
require 'infinum_setup/program/ruby_script'
|
5
13
|
require 'infinum_setup/base'
|
6
|
-
require 'infinum_setup/program'
|
7
14
|
require 'infinum_setup/general'
|
8
15
|
require 'infinum_setup/team'
|
9
16
|
require 'infinum_setup/install'
|
data/lib/infinum_setup/base.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module InfinumSetup
|
2
2
|
class Base
|
3
|
-
def initialize(options)
|
3
|
+
def initialize(options = {})
|
4
4
|
@options = options
|
5
5
|
end
|
6
6
|
|
@@ -9,46 +9,41 @@ module InfinumSetup
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def call
|
12
|
-
|
13
|
-
|
14
|
-
puts
|
15
|
-
prompt.say("#{program.name} -- #{program.pre_install_comment}", color: :cyan) if program.pre_install_comment
|
16
|
-
next if skip_install?(program)
|
17
|
-
program.install
|
18
|
-
end
|
12
|
+
return unless team_programs.is_a?(Hash)
|
13
|
+
programs.map(&:install)
|
19
14
|
end
|
20
15
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
def programs(team = 'general')
|
26
|
-
@programs ||=
|
27
|
-
if InfinumSetup.dev?
|
28
|
-
YAML.load_file("programs/#{team}.yml")
|
29
|
-
else
|
30
|
-
YAML.load(
|
31
|
-
open("https://raw.github.com/infinum/infinum_setup/master/programs/#{team}.yml")
|
32
|
-
)
|
33
|
-
end.map do |name, settings|
|
34
|
-
Program.new(name, settings, options, prompt)
|
35
|
-
end
|
16
|
+
def programs
|
17
|
+
@programs ||= team_programs.map do |name, settings|
|
18
|
+
program_type(settings['type'], name).new(name, settings, options)
|
19
|
+
end
|
36
20
|
end
|
37
21
|
|
38
|
-
def
|
39
|
-
|
40
|
-
(
|
41
|
-
|
22
|
+
def team_programs(team = 'general')
|
23
|
+
if InfinumSetup.dev?
|
24
|
+
YAML.load_file("programs/#{team}.yml")
|
25
|
+
else
|
26
|
+
YAML.load(
|
27
|
+
open("https://raw.github.com/infinum/infinum_setup/master/programs/#{team}.yml")
|
28
|
+
)
|
29
|
+
end
|
42
30
|
end
|
43
31
|
|
44
|
-
|
45
|
-
!program.mandatory? &&
|
46
|
-
interactive? &&
|
47
|
-
!prompt.yes?("#{program.name} -- Install #{program.name}")
|
48
|
-
end
|
32
|
+
private
|
49
33
|
|
50
|
-
|
51
|
-
|
34
|
+
attr_reader :options
|
35
|
+
|
36
|
+
def program_type(type, name)
|
37
|
+
case type
|
38
|
+
when 'brew' then Program::Brew
|
39
|
+
when 'cask' then Program::Cask
|
40
|
+
when 'gem' then Program::Gem
|
41
|
+
when 'npm' then Program::Npm
|
42
|
+
when 'script' then Program::Script
|
43
|
+
when 'ruby_script' then Program::RubyScript
|
44
|
+
else
|
45
|
+
raise "#{name} -- Type #{type} not recognized"
|
46
|
+
end
|
52
47
|
end
|
53
48
|
|
54
49
|
def interactive?
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module InfinumSetup
|
2
|
+
module Program
|
3
|
+
class Base
|
4
|
+
include InfinumSetup::Program::Helpers
|
5
|
+
attr_reader :name, :settings, :options
|
6
|
+
|
7
|
+
def initialize(name, settings, options)
|
8
|
+
@name = name
|
9
|
+
@settings = settings
|
10
|
+
@options = options
|
11
|
+
end
|
12
|
+
|
13
|
+
def install
|
14
|
+
return unless will_install?
|
15
|
+
puts
|
16
|
+
prompt_pre_install_comment
|
17
|
+
return if skip_install?
|
18
|
+
prompt_installing
|
19
|
+
execute_command
|
20
|
+
prompt_post_install_comment
|
21
|
+
execute_command(post_install_command) if post_install_command
|
22
|
+
end
|
23
|
+
|
24
|
+
def valid_keys
|
25
|
+
[
|
26
|
+
:mandatory, :pre_install_comment, :post_install_comment, :type,
|
27
|
+
:install_if_not_interactive, :post_install_command
|
28
|
+
]
|
29
|
+
end
|
30
|
+
|
31
|
+
def valid?
|
32
|
+
return true if settings.keys.all? { |key| valid_keys.include?(key.to_sym) }
|
33
|
+
raise "#{name} -- Settings are not correct"
|
34
|
+
end
|
35
|
+
|
36
|
+
def mandatory?
|
37
|
+
settings['mandatory']
|
38
|
+
end
|
39
|
+
|
40
|
+
def install_if_not_interactive?
|
41
|
+
settings['install_if_not_interactive']
|
42
|
+
end
|
43
|
+
|
44
|
+
def pre_install_comment
|
45
|
+
settings['pre_install_comment']
|
46
|
+
end
|
47
|
+
|
48
|
+
def post_install_comment
|
49
|
+
settings['post_install_comment']
|
50
|
+
end
|
51
|
+
|
52
|
+
def post_install_command
|
53
|
+
settings['post_install_command']
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def command
|
59
|
+
raise NotImplementedError
|
60
|
+
end
|
61
|
+
|
62
|
+
def prompt
|
63
|
+
@prompt ||= TTY::Prompt.new
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module InfinumSetup
|
2
|
+
module Program
|
3
|
+
class Gem < Base
|
4
|
+
def valid_keys
|
5
|
+
super + [:program]
|
6
|
+
end
|
7
|
+
|
8
|
+
def command
|
9
|
+
%(export PATH="$HOME/.rbenv/bin:$PATH";eval "$(rbenv init -)";gem install #{program} --no-document)
|
10
|
+
end
|
11
|
+
|
12
|
+
def program
|
13
|
+
settings['program']
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module InfinumSetup
|
2
|
+
module Program
|
3
|
+
module Helpers
|
4
|
+
def prompt_pre_install_comment
|
5
|
+
prompt.say("#{name} -- #{pre_install_comment}", color: :cyan) if pre_install_comment
|
6
|
+
end
|
7
|
+
|
8
|
+
def prompt_installing
|
9
|
+
prompt.ok "#{name} -- Installing"
|
10
|
+
end
|
11
|
+
|
12
|
+
def prompt_post_install_comment
|
13
|
+
prompt.say("#{name} -- #{post_install_comment}", color: :cyan) if post_install_comment
|
14
|
+
end
|
15
|
+
|
16
|
+
def will_install?
|
17
|
+
mandatory? ||
|
18
|
+
(!mandatory? && options.interactive) ||
|
19
|
+
(!mandatory? && !options.interactive && install_if_not_interactive?)
|
20
|
+
end
|
21
|
+
|
22
|
+
def skip_install?
|
23
|
+
!mandatory? && options.interactive && !prompt.yes?(install_question)
|
24
|
+
end
|
25
|
+
|
26
|
+
def install_question
|
27
|
+
"Install #{name}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def execute_command(cmd = command)
|
31
|
+
options.simulate ? simulate(cmd) : execute(cmd)
|
32
|
+
end
|
33
|
+
|
34
|
+
def simulate(cmd)
|
35
|
+
prompt.warn "#{name} -- #{cmd}"
|
36
|
+
end
|
37
|
+
|
38
|
+
def execute(cmd)
|
39
|
+
prompt.warn cmd if options.verbose
|
40
|
+
puts `#{cmd}`
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module InfinumSetup
|
2
|
+
module Program
|
3
|
+
class RubyScript < Base
|
4
|
+
def valid_keys
|
5
|
+
super + [:script, :custom_install_question]
|
6
|
+
end
|
7
|
+
|
8
|
+
def command
|
9
|
+
script
|
10
|
+
end
|
11
|
+
|
12
|
+
def execute
|
13
|
+
eval script
|
14
|
+
end
|
15
|
+
|
16
|
+
def script
|
17
|
+
if InfinumSetup.dev?
|
18
|
+
File.read(settings['script'])
|
19
|
+
else
|
20
|
+
open("https://raw.github.com/infinum/infinum_setup/master/scripts/#{settings['scripts']}.yml")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def custom_install_question
|
25
|
+
settings['custom_install_question']
|
26
|
+
end
|
27
|
+
|
28
|
+
def install_question
|
29
|
+
[name, custom_install_question ? custom_install_question : "Install #{name}"].join(' -- ')
|
30
|
+
end
|
31
|
+
|
32
|
+
def prompt_installing
|
33
|
+
prompt.ok "#{name} -- #{custom_install_question ? 'Running' : 'Installing'}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module InfinumSetup
|
2
|
+
module Program
|
3
|
+
class Script < Base
|
4
|
+
def valid_keys
|
5
|
+
super + [:script, :custom_install_question]
|
6
|
+
end
|
7
|
+
|
8
|
+
def command
|
9
|
+
script
|
10
|
+
end
|
11
|
+
|
12
|
+
def script
|
13
|
+
settings['script']
|
14
|
+
end
|
15
|
+
|
16
|
+
def custom_install_question
|
17
|
+
settings['custom_install_question']
|
18
|
+
end
|
19
|
+
|
20
|
+
def install_question
|
21
|
+
[name, custom_install_question ? custom_install_question : "Install #{name}"].join(' -- ')
|
22
|
+
end
|
23
|
+
|
24
|
+
def prompt_installing
|
25
|
+
prompt.ok "#{name} -- #{custom_install_question ? 'Running' : 'Installing'}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/infinum_setup/team.rb
CHANGED
data/programs/android.yml
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
{program_name}:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
# {program_name}:
|
2
|
+
# type: brew/cask/gem/npm/command
|
3
|
+
# mandatory: true/false
|
4
|
+
# install_if_not_interactive: true/false
|
5
|
+
# program: {program}
|
6
|
+
# pre_install_comment: A comment to print out before installing
|
7
|
+
# post_install_comment: A comment to print out after install
|
8
|
+
# post_install_command: eg. open the app
|
9
|
+
# script: a script to be run if type is `command`
|
data/programs/design.yml
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
{program_name}:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
# {program_name}:
|
2
|
+
# type: brew/cask/gem/npm/command
|
3
|
+
# mandatory: true/false
|
4
|
+
# install_if_not_interactive: true/false
|
5
|
+
# program: {program}
|
6
|
+
# pre_install_comment: A comment to print out before installing
|
7
|
+
# post_install_comment: A comment to print out after install
|
8
|
+
# post_install_command: eg. open the app
|
9
|
+
# script: a script to be run if type is `command`
|
data/programs/general.yml
CHANGED
@@ -12,6 +12,36 @@ git:
|
|
12
12
|
mandatory: true
|
13
13
|
type: brew
|
14
14
|
program: git
|
15
|
+
coreutils:
|
16
|
+
mandatory: true
|
17
|
+
type: brew
|
18
|
+
program: coreutils
|
19
|
+
htop-osx:
|
20
|
+
mandatory: true
|
21
|
+
type: brew
|
22
|
+
program: htop-osx
|
23
|
+
curl:
|
24
|
+
mandatory: true
|
25
|
+
type: brew
|
26
|
+
program: curl
|
27
|
+
wget:
|
28
|
+
mandatory: true
|
29
|
+
type: brew
|
30
|
+
program: wget
|
31
|
+
bash:
|
32
|
+
mandatory: false
|
33
|
+
install_if_not_interactive: true
|
34
|
+
type: brew
|
35
|
+
program: bash
|
36
|
+
zsh:
|
37
|
+
mandatory: false
|
38
|
+
install_if_not_interactive: true
|
39
|
+
type: brew
|
40
|
+
program: zsh
|
41
|
+
fish:
|
42
|
+
mandatory: false
|
43
|
+
type: brew
|
44
|
+
program: fish
|
15
45
|
rbenv:
|
16
46
|
mandatory: true
|
17
47
|
type: brew
|
@@ -39,11 +69,23 @@ OhMyZsh:
|
|
39
69
|
install_if_not_interactive: true
|
40
70
|
type: script
|
41
71
|
script: curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
|
72
|
+
ssh-keygen:
|
73
|
+
pre_install_comment: Will run ssh-keygen
|
74
|
+
post_install_comment: Please add your public key to https://docs.google.com/spreadsheets/d/1Wo4OYVWsCW6I1IxrSzieLkmTiP6XjCjLtyoMmJpnkZg/edit
|
75
|
+
mandatory: false
|
76
|
+
install_if_not_interactive: true
|
77
|
+
type: script
|
78
|
+
script: ssh-keygen
|
79
|
+
custom_install_question: Setup ssh keys with ssh-keygen
|
42
80
|
ruby:
|
43
81
|
pre_install_comment: This will install the lastest ruby version and add rbenv to your .bash_profile and .zshrc files. Go grab a coffee
|
44
82
|
mandatory: true
|
45
83
|
type: script
|
46
84
|
script: curl -L https://raw.github.com/infinum/infinum_setup/master/scripts/ruby.sh | sh
|
85
|
+
python:
|
86
|
+
mandatory: false
|
87
|
+
type: brew
|
88
|
+
program: python
|
47
89
|
z:
|
48
90
|
pre_install_comment: After a short learning phase, z will take you to the most 'recent' directory that matches ALL of the regexes given on the command line, in order.
|
49
91
|
post_install_comment: "Please read 'brew info z' for how to enable it. How to use: https://github.com/rupa/z"
|
@@ -51,6 +93,13 @@ z:
|
|
51
93
|
install_if_not_interactive: true
|
52
94
|
type: brew
|
53
95
|
program: z
|
96
|
+
git-wizard:
|
97
|
+
type: ruby_script
|
98
|
+
mandatory: false
|
99
|
+
install_if_not_interactive: true
|
100
|
+
pre_install_comment: This will help you setup your git
|
101
|
+
script: scripts/git_wizard.rb
|
102
|
+
custom_install_question: Run git wizard
|
54
103
|
alfred:
|
55
104
|
pre_install_comment: App for Mac OS X which boosts your efficiency with hotkeys, keywords, text expansion and more.
|
56
105
|
post_install_comment: Please start alfred once, enable it and disable spotlight (http://apple.stackexchange.com/a/177987). Recommended to enable clipboard history
|
@@ -59,6 +108,13 @@ alfred:
|
|
59
108
|
type: cask
|
60
109
|
program: alfred
|
61
110
|
post_install_command: open /Application/Alfred\ 3.app
|
111
|
+
iterm2:
|
112
|
+
pre_install_comment: iTerm2 is a replacement for Terminal and the successor to iTerm
|
113
|
+
mandatory: false
|
114
|
+
install_if_not_interactive: true
|
115
|
+
type: cask
|
116
|
+
program: iterm2
|
117
|
+
post_install_command: open /Application/iTerm.app
|
62
118
|
flycut:
|
63
119
|
pre_install_comment: Clean and simple clipboard manager for developers
|
64
120
|
mandatory: false
|
data/programs/ios.yml
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
{program_name}:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
# {program_name}:
|
2
|
+
# type: brew/cask/gem/npm/command
|
3
|
+
# mandatory: true/false
|
4
|
+
# install_if_not_interactive: true/false
|
5
|
+
# program: {program}
|
6
|
+
# pre_install_comment: A comment to print out before installing
|
7
|
+
# post_install_comment: A comment to print out after install
|
8
|
+
# post_install_command: eg. open the app
|
9
|
+
# script: a script to be run if type is `command`
|
data/programs/javascript.yml
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
{program_name}:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
# {program_name}:
|
2
|
+
# type: brew/cask/gem/npm/command
|
3
|
+
# mandatory: true/false
|
4
|
+
# install_if_not_interactive: true/false
|
5
|
+
# program: {program}
|
6
|
+
# pre_install_comment: A comment to print out before installing
|
7
|
+
# post_install_comment: A comment to print out after install
|
8
|
+
# post_install_command: eg. open the app
|
9
|
+
# script: a script to be run if type is `command`
|
data/programs/pm.yml
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
{program_name}:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
# {program_name}:
|
2
|
+
# type: brew/cask/gem/npm/command
|
3
|
+
# mandatory: true/false
|
4
|
+
# install_if_not_interactive: true/false
|
5
|
+
# program: {program}
|
6
|
+
# pre_install_comment: A comment to print out before installing
|
7
|
+
# post_install_comment: A comment to print out after install
|
8
|
+
# post_install_command: eg. open the app
|
9
|
+
# script: a script to be run if type is `command`
|
data/programs/rails.yml
CHANGED
@@ -14,10 +14,12 @@ mysql:
|
|
14
14
|
mandatory: true
|
15
15
|
type: brew
|
16
16
|
program: mysql
|
17
|
+
post_install_command: brew services start mysql
|
17
18
|
postgresql:
|
18
19
|
mandatory: true
|
19
20
|
type: brew
|
20
21
|
program: postgresql
|
22
|
+
post_install_command: brew services start postgresql; createuser -s postgres
|
21
23
|
sequel-pro:
|
22
24
|
pre_install_comment: Sequel Pro is a fast, easy-to-use Mac database management application for working with MySQL databases.
|
23
25
|
mandatory: false
|
@@ -0,0 +1,13 @@
|
|
1
|
+
email = prompt.ask('Your git email')
|
2
|
+
`git config --global user.email "#{email}"`
|
3
|
+
|
4
|
+
name = prompt.ask('Your git name')
|
5
|
+
`git config --global user.name "#{name}"`
|
6
|
+
|
7
|
+
autocorrect = prompt.yes?('Turn on autocorrect')
|
8
|
+
`git config --global help.autocorrect #{autocorrect ? 1 : 0}`
|
9
|
+
|
10
|
+
editor = promtp.ask('Default editor command?(atom --wait, subl -n -w, vim)')
|
11
|
+
`git config --global core.editor "#{editor}"`
|
12
|
+
|
13
|
+
`git config --global push.default current`
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infinum_setup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stjepan Hadjic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -132,7 +132,14 @@ files:
|
|
132
132
|
- lib/infinum_setup/base.rb
|
133
133
|
- lib/infinum_setup/general.rb
|
134
134
|
- lib/infinum_setup/install.rb
|
135
|
-
- lib/infinum_setup/program.rb
|
135
|
+
- lib/infinum_setup/program/base.rb
|
136
|
+
- lib/infinum_setup/program/brew.rb
|
137
|
+
- lib/infinum_setup/program/cask.rb
|
138
|
+
- lib/infinum_setup/program/gem.rb
|
139
|
+
- lib/infinum_setup/program/helpers.rb
|
140
|
+
- lib/infinum_setup/program/npm.rb
|
141
|
+
- lib/infinum_setup/program/ruby_script.rb
|
142
|
+
- lib/infinum_setup/program/script.rb
|
136
143
|
- lib/infinum_setup/team.rb
|
137
144
|
- lib/infinum_setup/version.rb
|
138
145
|
- programs/android.yml
|
@@ -142,6 +149,7 @@ files:
|
|
142
149
|
- programs/javascript.yml
|
143
150
|
- programs/pm.yml
|
144
151
|
- programs/rails.yml
|
152
|
+
- scripts/git_wizard.rb
|
145
153
|
- scripts/ruby.sh
|
146
154
|
homepage: https://github.com/infinum/infinum_setup
|
147
155
|
licenses:
|
@@ -1,65 +0,0 @@
|
|
1
|
-
module InfinumSetup
|
2
|
-
class Program
|
3
|
-
VALID_KEYS = [
|
4
|
-
:mandatory, :pre_install_comment, :post_install_comment, :type, :program, :script,
|
5
|
-
:install_if_not_interactive, :post_install_command
|
6
|
-
].freeze
|
7
|
-
|
8
|
-
attr_reader :settings, :name, :options, :prompt
|
9
|
-
|
10
|
-
def initialize(name, settings, options, prompt)
|
11
|
-
@name = name
|
12
|
-
@settings = settings
|
13
|
-
@options = options
|
14
|
-
@prompt = prompt
|
15
|
-
end
|
16
|
-
|
17
|
-
def valid?
|
18
|
-
settings.keys.all? { |key| VALID_KEYS.include?(key.to_sym) }
|
19
|
-
end
|
20
|
-
|
21
|
-
def install
|
22
|
-
prompt.ok "#{name} -- Installing"
|
23
|
-
execute_type
|
24
|
-
prompt.say("#{name} -- #{post_install_comment}", color: :cyan) if post_install_comment
|
25
|
-
execute(post_install_command) if post_install_command
|
26
|
-
end
|
27
|
-
|
28
|
-
def mandatory?
|
29
|
-
mandatory
|
30
|
-
end
|
31
|
-
|
32
|
-
def install_if_not_interactive?
|
33
|
-
install_if_not_interactive
|
34
|
-
end
|
35
|
-
|
36
|
-
VALID_KEYS.each do |key|
|
37
|
-
define_method key do
|
38
|
-
settings[key.to_s]
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
def execute_type
|
45
|
-
case type
|
46
|
-
when 'brew' then execute "brew install #{program}"
|
47
|
-
when 'cask' then execute "brew cask install #{program}"
|
48
|
-
when 'gem' then execute %(export PATH="$HOME/.rbenv/bin:$PATH";eval "$(rbenv init -)";gem install #{program} --no-document)
|
49
|
-
when 'npm' then execute "npm -g install #{program}"
|
50
|
-
when 'script' then execute script
|
51
|
-
else
|
52
|
-
raise "Unknown type #{type}"
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def execute(cmd)
|
57
|
-
if options.simulate
|
58
|
-
prompt.warn "#{name} -- #{cmd}"
|
59
|
-
else
|
60
|
-
prompt.warn cmd if options.verbose
|
61
|
-
puts `#{cmd}`
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|