Module: Easycompile

Includes:
Constants
Defined in:
lib/easycompile/base/gem.rb,
lib/easycompile/base/opn.rb,
lib/easycompile/base/run.rb,
lib/easycompile/base/help.rb,
lib/easycompile/base/menu.rb,
lib/easycompile/base/misc.rb,
lib/easycompile/base/cmake.rb,
lib/easycompile/base/reset.rb,
lib/easycompile/base/remove.rb,
lib/easycompile/base/colours.rb,
lib/easycompile/base/esystem.rb,
lib/easycompile/base/constants.rb,
lib/easycompile/constants/misc.rb,
lib/easycompile/base/initialize.rb,
lib/easycompile/project/project.rb,
lib/easycompile/version/version.rb,
lib/easycompile/constants/constants.rb,
lib/easycompile/constants/namespace.rb,
lib/easycompile/base/meson_and_ninja.rb,
lib/easycompile/base/change_directory.rb,
lib/easycompile/toplevel_methods/misc.rb,
lib/easycompile/base/process_the_input.rb,
lib/easycompile/easycompile/easycompile.rb,
lib/easycompile/base/commandline_arguments.rb,
lib/easycompile/toplevel_methods/copy_file.rb,
lib/easycompile/toplevel_methods/rinstall2.rb,
lib/easycompile/constants/programs_directory.rb,
lib/easycompile/constants/array_possible_archives.rb,
lib/easycompile/compile_as_appdir/compile_as_appdir.rb,
lib/easycompile/constants/file_and_directory_constants.rb

Overview

Easycompile

Defined Under Namespace

Modules: Constants Classes: Base, CompileAsAppdir, Easycompile

Constant Summary collapse

PROJECT_BASE_DIRECTORY =
#

Easycompile::PROJECT_BASE_DIRECTORY

#
File.absolute_path("#{__dir__}/..")+'/'
PROJECT_BASE_DIR =
#

Easycompile::PROJECT_BASE_DIR

This is simply an “alias” to the above constant.

#
PROJECT_BASE_DIRECTORY
VERSION =
#

VERSION

#
'1.0.9'
LAST_UPDATE =
#

LAST_UPDATE

#
'02.05.2022'

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

Methods included from Constants

#ruby_src?, #source_dir?

Class Method Details

.can_we_use_colours?Boolean

#

Easycompile.can_we_use_colours?

#

Returns:

  • (Boolean)


29
30
31
# File 'lib/easycompile/base/colours.rb', line 29

def self.can_we_use_colours?
  @can_we_use_colours
end

.compile(i = nil, optional_compile_as_appdir = false) ⇒ Object

#

Easycompile.compile

This method must be able to tap into CompileAsAppdir, as well as invoke Easycompile, so both .rb files are required here.

If no input is given then a random entry will be fetched.

Invocation example:

Easycompile.compile('wv.yml', :appdir)
#


33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/easycompile/toplevel_methods/misc.rb', line 33

def self.compile(
    i = nil, optional_compile_as_appdir = false
  )
  if i.nil?
    i = try_to_randomly_fetch_an_archive_from_the_current_directory
  end
  case optional_compile_as_appdir
  when :appdir
    # ===================================================================== #
    # Make it more explicit in this case.
    # ===================================================================== #
    optional_compile_as_appdir = true
  end
  if optional_compile_as_appdir
    ::Easycompile::CompileAsAppdir[i]
  else
    ::Easycompile::Easycompile.new(i)
  end
end

.copy_file(from, to = Dir.pwd) ⇒ Object

#

Easycompile.copy_file

The second argument to this method specifies the target-location where the file should be copied onto.

#


17
18
19
20
21
# File 'lib/easycompile/toplevel_methods/copy_file.rb', line 17

def self.copy_file(
    from, to = Dir.pwd
  )
  FileUtils.cp(from, to)
end

.is_an_archive?(i) ⇒ Boolean

#

Easycompile.is_an_archive?

#

Returns:

  • (Boolean)


31
32
33
34
# File 'lib/easycompile/constants/array_possible_archives.rb', line 31

def self.is_an_archive?(i)
  extname = File.extname(File.basename(i)).delete('.')
  Constants::ARRAY_POSSIBLE_ARCHIVES.include? extname
end

.new(i = ARGV) ⇒ Object

#

Easycompile.new

#


81
82
83
# File 'lib/easycompile/easycompile/easycompile.rb', line 81

def self.new(i = ARGV)
  ::Easycompile::Easycompile.new(i)
end

.programs_directory?Boolean

#

Easycompile.programs_directory?

#

Returns:

  • (Boolean)


42
43
44
# File 'lib/easycompile/constants/programs_directory.rb', line 42

def self.programs_directory?
  @programs_directory
end

.project_base_dir?Boolean

#

Easycompile.project_base_dir?

#

Returns:

  • (Boolean)


25
26
27
# File 'lib/easycompile/project/project.rb', line 25

def self.project_base_dir?
  PROJECT_BASE_DIRECTORY
end

.rinstall2Object

#

Easycompile.rinstall2

How to install ruby-stuff without gems, by using good oldschool setup.rb.

#


18
19
20
21
22
23
24
25
26
27
# File 'lib/easycompile/toplevel_methods/rinstall2.rb', line 18

def self.rinstall2
  copy_file ::Easycompile::Constants::LOCATION_OF_SETUP_RB,
            Dir.pwd
  esystem 'ruby setup.rb --quiet config'
  esystem 'ruby setup.rb --quiet setup'
  esystem 'ruby setup.rb --quiet install'
  File.delete('setup.rb')       if File.exist? 'setup.rb'
  File.delete('InstalledFiles') if File.exist? 'InstalledFiles'
  File.delete('.config')        if File.exist? '.config'
end

.ruby_src_dir?Boolean

#

Easycompile.ruby_src_dir?

#

Returns:

  • (Boolean)


133
134
135
# File 'lib/easycompile/constants/file_and_directory_constants.rb', line 133

def self.ruby_src_dir?
  Constants::RUBY_SRC
end

.set_can_we_use_colours(i = true) ⇒ Object

#

Easycompile.set_can_we_use_colours

#


22
23
24
# File 'lib/easycompile/base/colours.rb', line 22

def self.set_can_we_use_colours(i = true)
  @can_we_use_colours = i
end

.set_programs_directory(i) ⇒ Object

#

Easycompile.set_programs_directory

#


33
34
35
36
37
# File 'lib/easycompile/constants/programs_directory.rb', line 33

def self.set_programs_directory(i)
  i = i.dup if i.frozen?
  i << '/' unless i.end_with? '/'
  @programs_directory = i
end

.source_dir?Boolean

#

Easycompile.source_dir?

#

Returns:

  • (Boolean)


126
127
128
# File 'lib/easycompile/constants/file_and_directory_constants.rb', line 126

def self.source_dir?
  Constants::SRC_DIR
end

.temp_dir?Boolean

#

Easycompile.temp_dir?

#

Returns:

  • (Boolean)


119
120
121
# File 'lib/easycompile/constants/file_and_directory_constants.rb', line 119

def self.temp_dir?
  Constants::TEMP_DIR
end

.try_to_randomly_fetch_an_archive_from_the_current_directoryObject

#

Easycompile.try_to_randomly_fetch_an_archive_from_the_current_directory

#


39
40
41
42
43
# File 'lib/easycompile/constants/array_possible_archives.rb', line 39

def self.try_to_randomly_fetch_an_archive_from_the_current_directory
  _ = Dir['*']
  _.select! {|entry| is_archive? entry }
  _
end

.version?Boolean

#

version?

#

Returns:

  • (Boolean)


22
23
24
# File 'lib/easycompile/version/version.rb', line 22

def self.version?
  Easycompile::VERSION
end