Sha256: 6e3399bd42bbae1cbbd0ab3f1e08593e9fc6941e186e38e40c1c96f62786674a

Contents?: true

Size: 1.45 KB

Versions: 2

Compression:

Stored size: 1.45 KB

Contents

module SiteHook
  class GenConfig
    # @param [HighLine]
    def initialize(hl)
      @hl = hl

    end
    def prompt_project
      @hl.say "First What's the name of the project?"
      project_name = @hl.ask('> ')

      @hl.say "What's the source path? e.g. /home/#{ENV['USER']}/sites/site.tld"
      source_path = @hl.ask('> ')

      @hl.say 'Where is the web root? e.g. /var/www/sites/site.tld'
      dest_path = @hl.ask('> ')

      @hl.say 'The next things are for the public webhook list.'
      @hl.say "\n"
      @hl.say "\n"
      @hl.say "What's the hostname of the git service? e.g. github.com,"
      @hl.say "gitlab.com, git.domain.tld"
      git_host = @hl.ask('> ')

      @hl.say "What's the repo path? e.g. UserName/SiteName, UserName/site, etc."
      repo_path = @hl.ask('> ')

      @hl.say 'Is this repo allowed to be shown publically?'
      is_private = @hl.agree('> ', true) ? true : false

      @hl.say "Generating a hook password for you. If this one isn't wanted"
      @hl.say "then just change it afterwards using '#{exe_name} config mkpass'."
      hook_pass = RandomPassword.new(length: 20, symbols: 0).generate
      @hl.say 'Done.'
      @hl.say 'Outputting...'
      [
          "  #{project_name}:",
          "    src: #{source_path}",
          "    dst: #{dest_path}",
          "    hookpass: #{hook_pass}",
          "    host: #{git_host}",
          "    repo: #{repo_path}",
          "    private: #{is_private}"
      ]

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
site_hook-0.8.2 lib/site_hook/prompts/gen_config.rb
site_hook-0.8.1 lib/site_hook/prompts/gen_config.rb