Class: Easycompile::Easycompile

Inherits:
Base
  • Object
show all
Defined in:
lib/easycompile/easycompile/easycompile.rb

Constant Summary

Constants inherited from Base

Base::THIS_FILE

Constants included from Constants

Constants::ARRAY_POSSIBLE_ARCHIVES, Constants::CMAKE_FILE, Constants::ERROR_LINE, Constants::FILE_NAME_OF_THE_BUILD_DIRECTORY, Constants::INDIVIDUAL_COOKBOOKS, Constants::LAST_DOWNLOADED_FILE, Constants::LOCATION_OF_SETUP_RB, Constants::MESON_BUILD_FILE, Constants::NAMESPACE, Constants::PROGRAMS_DIRECTORY, Constants::RUBY_SRC, Constants::SHALL_WE_CREATE_A_BUILD_DIRECTORY, Constants::SRC_DIR, Constants::TEMP_DIR

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#add_this_archive, #are_we_on_gobolinux?, #attempt_to_find_a_valid_file, #base_dir?, #can_not_continue, #change_directory, #check_for_dependencies, #cmake_file?, #commandline_arguments?, #compile_as_meson_based_project, #compile_these_programs?, #consider_creating_a_build_directory, #consider_removing_the_archive, #consider_symlinking_appdir, #continue_after_extracting?, #continue_past_configure_stage?, #copy_setup_rb, #cparser_is_available?, #determine_which_programs_to_compile, #do_compile_with_dependencies, #do_make_use_of_a_build_directory, #do_not_compile, #do_not_continue, #do_not_create_a_build_directory, #do_remove_all_after_compile, #does_a_meson_build_file_exist?, #e_colourize, #ecomment, #empty_dir?, #enable_skip_make_install, #enter_extracted_directory, #esystem, #extract_to_this_directory?, #filename, #find_partial_match_for, #find_this_program?, #get_dataset_from, #get_program_name, #install_this_gem, #internal_system, #is_a_gem?, #is_an_appdir?, #is_archive?, #is_the_cookbook_class_available?, #make_distclean, #menu, #mkdir, #name_of_build_directory?, #ninjait, #open_this_file, #opn_namespace, #original_input?, #prefix?, #process_the_input, #program_name?, #program_version?, #rds, #remove_all_after_compile?, #remove_directory, #remove_extension_from, #remove_this_archive, #remove_this_file, #replace_all_yaml_files, #reset, #return_all_arguments_with_hyphens, #return_pwd, #return_to_start_directory_again, #return_yaml_file, #rev, #run, #run_build_sh, #run_cmake_command, #run_configure, #run_configure_make_and_make_install, #run_make_command_or_equivalent, #run_make_install_command, #run_make_then_make_install, #run_perl_installation, #run_python_installation, #run_rinstall2, #set_base_dir, #set_commandline_arguments, #set_compile_these_programs, #set_extract_to_this_directory, #set_find_this_program, #set_hash, #set_name_of_build_directory, #set_original_input, #set_prefix, #set_program_name, #set_program_version, #set_start_dir, #set_this_build_dir, #shall_we_create_a_build_directory?, #show_help, #show_namespace, #simply_run_the_configure_command, #skip_extracting, #skip_extracting?, #skip_make_install?, #start_dir?, #temp_dir?, #temp_directory?, #try_to_compile_or_install_this_program, #try_to_extract, #use_colours?, #use_the_home_directory_as_prefix, version?

Methods included from Constants

#ruby_src?, #source_dir?, temp_dir?

Constructor Details

#initialize(i = nil, run_already = true, &block) ⇒ Easycompile

#

initialize

We can use more advanced compile instructions such as:

Easycompile::Easycompile.new(i, extract_to: EXTRACT_TO)

The first argument is the name of the program in question.

#


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/easycompile/easycompile/easycompile.rb', line 25

def initialize(
    i           = nil,
    run_already = true,
    &block
  )
  set_prefix '/usr' # This is the default prefix anyway.
  super(i, :dont_run_yet)
  if run_already.is_a? Hash
    set_hash(run_already) # Here the prefix can be overruled.
    run_already = true
  end
  if i.is_a? Array
    i = i.first
  end
  if i.end_with? '.yml'
    i = return_yaml_file(i)
    set_original_input(i)
  end
  # ======================================================================= #
  # === Handle blocks next
  # ======================================================================= #
  if block_given?
    yielded = yield
    # ===================================================================== #
    # === Handle Hashes next
    # ===================================================================== #
    if yielded.is_a? Hash
      # =================================================================== #
      # === { :prefix => :appdir }
      #
      # This is the default entry point for programs that are compiled
      # via an AppDir prefix.
      # =================================================================== #
      if yielded.has_key? :prefix
        set_prefix(
          yielded[:prefix]
        )
      end
    end
  end
  set_original_input(i)
  run if run_already # Call the parent method.
end

Class Method Details

.[](i) ⇒ Object

#

Easycompile[]

#


72
73
74
# File 'lib/easycompile/easycompile/easycompile.rb', line 72

def self.[](i)
  new(i)
end