Class: EasyCreds::ThorCLI
- Inherits:
-
Thor
- Object
- Thor
- EasyCreds::ThorCLI
- Defined in:
- lib/easy_creds/thor_cli.rb
Class Method Summary collapse
- .exit_on_failure? ⇒ Boolean
-
.start(given_args = ARGV, config = {}) ⇒ Object
No-args invocation → styled welcome instead of plain Thor help.
Instance Method Summary collapse
- #doctor ⇒ Object
- #init ⇒ Object
- #install ⇒ Object
- #onboard ⇒ Object
- #projects ⇒ Object
- #settings ⇒ Object
- #sync(env = nil) ⇒ Object
- #templates ⇒ Object
- #tree ⇒ Object
- #version ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
10 |
# File 'lib/easy_creds/thor_cli.rb', line 10 def self.exit_on_failure? = true |
.start(given_args = ARGV, config = {}) ⇒ Object
No-args invocation → styled welcome instead of plain Thor help.
13 14 15 |
# File 'lib/easy_creds/thor_cli.rb', line 13 def self.start(given_args = ARGV, config = {}) given_args.empty? ? new.send(:welcome) : super end |
Instance Method Details
#doctor ⇒ Object
67 68 69 70 71 |
# File 'lib/easy_creds/thor_cli.rb', line 67 def doctor EasyCreds.load_global_config! ok = EasyCreds::Doctor.new(verbose: [:verbose]).run exit 1 unless ok end |
#init ⇒ Object
50 51 52 53 54 |
# File 'lib/easy_creds/thor_cli.rb', line 50 def init EasyCreds.configure { |c| c.global_dir = [:'global-dir'] } if [:'global-dir'] prompt = build_prompt EasyCreds::Onboarding::GemSetup.run(prompt: prompt) end |
#install ⇒ Object
74 75 76 77 78 79 80 81 |
# File 'lib/easy_creds/thor_cli.rb', line 74 def install project = EasyCreds::Project.detect(Dir.pwd) unless project.is_a?(EasyCreds::Project::Rails) puts EasyCreds::Theme.warn('Not a Rails project — nothing to install.') exit 3 end EasyCreds::Installer.new(project.root).run end |
#onboard ⇒ Object
59 60 61 62 63 |
# File 'lib/easy_creds/thor_cli.rb', line 59 def onboard EasyCreds.load_global_config! project = EasyCreds::Project.detect(Dir.pwd) EasyCreds::Onboarding::Runner.start(project: project, template: [:template], force: [:force]) end |
#projects ⇒ Object
84 85 86 87 88 |
# File 'lib/easy_creds/thor_cli.rb', line 84 def projects EasyCreds.load_global_config! registry = Projects::Registry.load outside_picker_loop(registry) end |
#settings ⇒ Object
97 98 99 100 |
# File 'lib/easy_creds/thor_cli.rb', line 97 def settings EasyCreds.load_global_config! Views::SettingsMenu.run(build_prompt) end |
#sync(env = nil) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/easy_creds/thor_cli.rb', line 21 def sync(env = nil) EasyCreds.load_global_config! EasyCreds.ensure_default_template! check_first_run! EasyCreds.configure { |c| c.default_vault = [:vault] } if [:vault] registry = Projects::Registry.load project = EasyCreds::Project.detect(Dir.pwd) if (known = registry.find_by_path(project.root)) registry.touch(known) return EasyCreds::CLI.start(project: project, default_env: env) end if looks_like_project?(project) && !skip_register? result = Onboarding::RegisterPrompt.run( prompt: build_prompt, project: project, registry: registry ) return if result == :quit return EasyCreds::CLI.start(project: project, default_env: env) end outside_picker_loop(registry) end |
#templates ⇒ Object
91 92 93 94 |
# File 'lib/easy_creds/thor_cli.rb', line 91 def templates EasyCreds.load_global_config! Views::TemplatesMenu.run(build_prompt) end |
#tree ⇒ Object
103 104 105 |
# File 'lib/easy_creds/thor_cli.rb', line 103 def tree render_command_tree end |
#version ⇒ Object
108 109 110 |
# File 'lib/easy_creds/thor_cli.rb', line 108 def version beastmode_version end |