class Cookbooks::CreateRecipe

Constants

DEFAULT_PROGRAM
#

DEFAULT_PROGRAM

#
NAMESPACE
#

NAMESPACE

#
STORE_HERE
#

STORE_HERE

#

Public Class Methods

new( this_program = DEFAULT_PROGRAM, run_already = true ) click to toggle source
#

initialize

#
Calls superclass method
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 45
def initialize(
    this_program = DEFAULT_PROGRAM,
    run_already  = true
  )
  super()
  reset
  set_program(this_program)
  case run_already
  when :dont_run_yet
    run_already = false
  end
  run if run_already
end

Public Instance Methods

binaries?() click to toggle source
#

binaries?

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 159
def binaries?
  dataset?.binaries?
end
configure_options?() click to toggle source
#

configure_options?

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 232
def configure_options?
  if use_cookbook_dataset?
    dataset?.configure_options?.gsub(/--/,N+'    --')
  else
    ''
  end
end
create_the_recipe() click to toggle source
#

#create_the_recipe

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 106
def create_the_recipe
  try_to_initialize_the_dataset_via_sanitize_cookbook_dataset
  file_name = "#{@program}.yml"
  full_recipe_location = store_where?+file_name
  _ = full_recipe_location.dup
  create_directory(store_where?) if !File.exist?(store_where?)
  opnn; e 'Now creating a standalone recipe for '+sfancy(program?)+' at '
  opnn; e sdir(store_where?)+sfile(file_name)
  remove_file(_) # Get rid of the file first.
  create_file(_)
  store_where = _
  _ = "#{input?}:#{N}".dup
  _ << ' program_name: '+input?+N
  _ << ' short_description: '+short_desc?.to_s+N
  unless binaries?.empty?
    _ << ' binaries: '+binaries?.join(',')+N
  end
  _ << ' configure_options: "'+N+
       remove_leading_hyphens(configure_options?)+N+N+' "'+N
  _ << ' description: |'+N
  _ << '  '+word_wrap(description?).chomp+N
  _ << ' extra_information: |'+N
  _ << ' prefix: '+prefix?+N
  if prefix?.include? programs_dir?
    _ << ' symlink_pkgconfig_files: t'+N
  end
  _ << ' # postinstall: '+N
  _ << ' url1: '+url1?.to_s+N
  _ << ' url2: '+url2?.to_s+N
  _ << ' required_deps_on: '+required_deps?+N
  _ << ' last_update: '+today?+N
  append_what_into(_, store_where)
  opnn; e 'Finished creating recipe at '
  opnn; e '  `'+sfile(full_recipe_location)+'`.'
end
dataset?() click to toggle source
#

dataset?

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 99
def dataset?
  @dataset
end
description?() click to toggle source
#

description?

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 166
def description?
  if use_cookbook_dataset?
    dataset?.description?
  else
    ''
  end
end
input?()
Alias for: program?
opnn() click to toggle source
#

opnn

#
Calls superclass method Cookbooks::Base#opnn
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 152
def opnn
  super(NAMESPACE)
end
prefix?() click to toggle source
#

prefix?

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 210
def prefix?
  if use_cookbook_dataset?
    dataset?.prefix?
  else
    ''
  end
end
program?() click to toggle source
#

program?

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 78
def program?
  @program
end
Also aliased as: input?
remove_leading_hyphens(i) click to toggle source
#

#remove_leading_hyphens

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 145
def remove_leading_hyphens(i)
  i.gsub(/ --/,' ')
end
required_deps?() click to toggle source
#

required_deps?

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 221
def required_deps?
  if use_cookbook_dataset?
    dataset?.required_deps?.join(',')
  else
    ''
  end
end
reset() click to toggle source
#

reset

#
Calls superclass method Cookbooks::Base#reset
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 62
def reset
  super()
  @use_sanitize_cookbook_dataset = true # Make use of SanitizeCookbookDataset in this case.
  set_store_where
end
run() click to toggle source
#

run

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 267
def run # run tag
  create_the_recipe
end
set_program(i = DEFAULT_PROGRAM) click to toggle source
#

#set_program

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 254
def set_program(i = DEFAULT_PROGRAM) # sets @program.
  i = DEFAULT_PROGRAM if i.nil?
  @original_input = i
  if i.include? '-'
    i = File.basename(i)
    i = ProgramInformation.return_real_short_name(i) 
  end
  @program = i
end
set_store_where(i = STORE_HERE+'IndividualCookbooks/') click to toggle source
#

#set_store_where

Set the base directory, where to store, here.

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 245
def set_store_where(i = STORE_HERE+'IndividualCookbooks/') # overrule for now
  i = i.dup
  i << '/' unless i.end_with? '/'
  @store_where = i
end
Also aliased as: store_where
short_desc?() click to toggle source
#

short_desc?

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 188
def short_desc?
  if use_cookbook_dataset?
    dataset?.short_desc?
  else
    ''
  end
end
store_where(i = STORE_HERE+'IndividualCookbooks/')
Alias for: set_store_where
store_where?() click to toggle source
#

#store_where?

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 85
def store_where?
  @store_where
end
try_to_initialize_the_dataset_via_sanitize_cookbook_dataset() click to toggle source
#

#try_to_initialize_the_dataset_via_sanitize_cookbook_dataset

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 92
def try_to_initialize_the_dataset_via_sanitize_cookbook_dataset
  @dataset = ::Cookbooks::Cookbook.new(input?)
end
url1?() click to toggle source
#

url1?

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 199
def url1?
  if use_cookbook_dataset?
    dataset?.url1?
  else
    ''
  end
end
url2?() click to toggle source
#

url2?

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 177
def url2?
  if use_cookbook_dataset?
    dataset?.url2?
  else
    ''
  end
end
use_cookbook_dataset?() click to toggle source
#

use_cookbook_dataset?

#
# File lib/cookbooks/utility_scripts/create_recipe.rb, line 71
def use_cookbook_dataset?
  @use_sanitize_cookbook_dataset
end