Module: BuckKnife::KnifeHelper

Defined in:
lib/buckknife/knife_helper.rb

Instance Method Summary collapse

Instance Method Details

#project_from_arg_or_askObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/buckknife/knife_helper.rb', line 3

def project_from_arg_or_ask
  project_name = @name_args[0]

  if project_name.nil?
    show_usage
    ui.fatal("You must specify a project name")
    exit 1
  end

  begin
    project = Project.find(project_name)
  rescue BuckKnife::UnknownProjectError
    ui.fatal("A project data file '#{project_name}.json' was not found in #{Project.root}")
    exit 1
  end

  return project
end