Class: Octopolo::Scripts::OctopoloSetup
- Inherits:
-
Object
- Object
- Octopolo::Scripts::OctopoloSetup
- Extended by:
- UserConfigWrapper
- Includes:
- Base
- Defined in:
- lib/octopolo/scripts/octopolo_setup.rb
Instance Attribute Summary
Attributes included from UserConfigWrapper
Class Method Summary collapse
- .git_extras_installed? ⇒ Boolean
- .install_git_extras ⇒ Object
- .invoke(*args) ⇒ Object
- .verify_git_extras_setup ⇒ Object
- .verify_user_full_name ⇒ Object
- .verify_user_github_credentials ⇒ Object
- .verify_user_setup ⇒ Object
Methods included from Base
Class Method Details
.git_extras_installed? ⇒ Boolean
19 20 21 22 |
# File 'lib/octopolo/scripts/octopolo_setup.rb', line 19 def self.git_extras_installed? check = cli.perform "which git-extras", false check.include? "git-extras" end |
.install_git_extras ⇒ Object
24 25 26 27 28 29 |
# File 'lib/octopolo/scripts/octopolo_setup.rb', line 24 def self.install_git_extras cli.say "Updating Homebrew to ensure latest git-extras formula." cli.perform "brew update" cli.say "Installing git-extras" cli.perform "brew install git-extras" end |
.invoke(*args) ⇒ Object
10 11 12 13 |
# File 'lib/octopolo/scripts/octopolo_setup.rb', line 10 def self.invoke(*args) verify_git_extras_setup verify_user_setup end |
.verify_git_extras_setup ⇒ Object
15 16 17 |
# File 'lib/octopolo/scripts/octopolo_setup.rb', line 15 def self.verify_git_extras_setup install_git_extras unless git_extras_installed? end |
.verify_user_full_name ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/octopolo/scripts/octopolo_setup.rb', line 36 def self.verify_user_full_name # if it's not set, it uses the USER environment variable if user_config.full_name == ENV["USER"] name = cli.prompt "Your full name:" user_config.full_name = name else cli.say "Full name '#{user_config.full_name}' already configured." end end |
.verify_user_github_credentials ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/octopolo/scripts/octopolo_setup.rb', line 46 def self.verify_user_github_credentials GitHub.check_connection cli.say "Successfully configured API token." rescue GitHub::BadCredentials, GitHub::TryAgain => e # if any error occurs, generate a new token cli.say e. end |
.verify_user_setup ⇒ Object
31 32 33 34 |
# File 'lib/octopolo/scripts/octopolo_setup.rb', line 31 def self.verify_user_setup verify_user_full_name verify_user_github_credentials end |