Sha256: 847477b47241850ce8e9ed846ef1b620f0da15b211bb0142f4f8bfc1732264e9

Contents?: true

Size: 1.23 KB

Versions: 46

Compression:

Stored size: 1.23 KB

Contents

##
#
# Copyright 2019 Ken Spencer / IotaSpencer
#
# 
# File: prompt_project.rb
# Created: 2/15/19
#
# License is in project root, MIT License is in use.
##

require 'highline'
require 'site_hook/prompt'
module SiteHook
  module Prompts
    class Project < ::SiteHook::Prompt
      runnable [:prompt_name, :prompt_src_path]
      @@hl = HighLine.new($stdin, $stdout, 0, 0, 0, 0)
      desc 'Prompts for project details'
      def prompt_name
        @@hl.say(<<~STATEMENT)
          What's the name of the project?
        STATEMENT
        @@hl.choose do |menu|
          menu.confirm   = 'Are you sure? '
          menu.select_by = :index_or_name
          menu.index     = '*'
          menu.prompt    = '> '
          menu.flow      = :rows
          menu.default   = Pathname.new(`pwd`).basename.to_s.chomp!
          menu.choice(Pathname.new(`pwd`).basename.to_s.chomp!) do |answer|
            @project_name = answer
          end
          menu.choice('Custom / Input your own?') do
            @project_name = @@hl.ask('> ', String) do |q|
              q.confirm = true
            end
          end
        end
      end
      def prompt_src_path
        @@hl.say(<<~STATEMENT)
        What's the src path?
        STATEMENT
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
site_hook-0.9.8 lib/site_hook/prompts/prompt_project.rb
site_hook-0.9.7 lib/site_hook/prompts/prompt_project.rb
site_hook-0.9.6 lib/site_hook/prompts/prompt_project.rb
site_hook-0.9.5 lib/site_hook/prompts/prompt_project.rb
site_hook-0.9.4 lib/site_hook/prompts/prompt_project.rb
site_hook-0.9.3 lib/site_hook/prompts/prompt_project.rb