Module: Xezat
- Included in:
- Command::Announce, Command::Bump, Command::Dist, Command::Doctor, Command::Init, Command::Port, Command::Prep, Command::Validate, Debugger::Linguist, Debugger::Variable, Generator::CMake, Generator::Pkgconfig
- Defined in:
- lib/xezat.rb,
lib/xezat/main.rb,
lib/xezat/config.rb,
lib/xezat/bashvar.rb,
lib/xezat/version.rb,
lib/xezat/packages.rb,
lib/xezat/detectors.rb,
lib/xezat/generator.rb,
lib/xezat/variables.rb,
lib/xezat/cygclasses.rb,
lib/xezat/cygversion.rb,
lib/xezat/command/bump.rb,
lib/xezat/command/dist.rb,
lib/xezat/command/init.rb,
lib/xezat/command/port.rb,
lib/xezat/command/prep.rb,
lib/xezat/cygchangelog.rb,
lib/xezat/detector/waf.rb,
lib/xezat/command/debug.rb,
lib/xezat/detector/make.rb,
lib/xezat/detector/nasm.rb,
lib/xezat/command/doctor.rb,
lib/xezat/detector/cmake.rb,
lib/xezat/detector/meson.rb,
lib/xezat/detector/ninja.rb,
lib/xezat/detector/gnulib.rb,
lib/xezat/generator/cmake.rb,
lib/xezat/command/announce.rb,
lib/xezat/command/generate.rb,
lib/xezat/command/validate.rb,
lib/xezat/detector/halibut.rb,
lib/xezat/detector/libtool.rb,
lib/xezat/detector/roundup.rb,
lib/xezat/command/bump/file.rb,
lib/xezat/command/bump/tool.rb,
lib/xezat/debugger/linguist.rb,
lib/xezat/debugger/variable.rb,
lib/xezat/detector/asciidoc.rb,
lib/xezat/detector/autoconf.rb,
lib/xezat/detector/automake.rb,
lib/xezat/detector/boost.m4.rb,
lib/xezat/detector/python27.rb,
lib/xezat/detector/python36.rb,
lib/xezat/detector/python37.rb,
lib/xezat/detector/python38.rb,
lib/xezat/detector/python39.rb,
lib/xezat/detector/docbook2X.rb,
lib/xezat/detector/font-util.rb,
lib/xezat/detector/gengetopt.rb,
lib/xezat/generator/pkgconfig.rb,
lib/xezat/command/bump/src_uri.rb,
lib/xezat/command/bump/compiler.rb,
lib/xezat/command/bump/language.rb,
lib/xezat/detector/gnome-common.rb,
lib/xezat/command/bump/changelog.rb,
lib/xezat/detector/gettext-devel.rb,
lib/xezat/ext/linguist/file_blob.rb,
lib/xezat/command/validate/config.rb,
lib/xezat/command/bump/cygport_dep.rb,
lib/xezat/command/validate/license.rb,
lib/xezat/detector/autoconf-archive.rb,
lib/xezat/detector/libQt5Core-devel.rb,
lib/xezat/detector/xorg-util-macros.rb,
lib/xezat/command/validate/appstream.rb,
lib/xezat/command/validate/pkgconfig.rb,
lib/xezat/detector/python39-docutils.rb,
lib/xezat/command/bump/runtime_package.rb,
lib/xezat/detector/gobject-introspection.rb,
lib/xezat/command/bump/development_package.rb
Defined Under Namespace
Modules: Command, Debugger, Detector, Generator, Linguist
Classes: AutotoolsFileNotFoundError, Cygchangelog, CygclassConflictError, CygclassManager, CygportProcessError, Cygversion, DetectorManager, FilePermissionError, IllegalStateError, Main, NoDistDirectoryError, NoPortDirectoryError, NoSuchCygclassError, NoSuchRepositoryError, ReadmeSyntaxError, UnoverwritableCygportError, UnregeneratableConfigurationError
Constant Summary
collapse
- ROOT_DIR =
File.expand_path(File.join(File.dirname(__FILE__), '..'))
- DATA_DIR =
File.expand_path(File.join(ROOT_DIR, 'share', 'xezat'))
- REPOSITORY_DIR =
File.expand_path(File.join(DATA_DIR, 'repository'))
- TEMPLATE_DIR =
File.expand_path(File.join(DATA_DIR, 'template'))
- CONFIG_FILE =
File.expand_path(File.join(Dir.home, '.xezat', 'config.yml'))
- VERSION =
'0.5.0'
Class Attribute Summary collapse
Instance Method Summary
collapse
Class Attribute Details
.logger ⇒ Object
Returns the value of attribute logger.
14
15
16
|
# File 'lib/xezat.rb', line 14
def logger
@logger
end
|
Instance Method Details
#bashvar(cygport) ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/xezat/bashvar.rb', line 8
def bashvar(cygport)
command = ['bash', File.expand_path(File.join(DATA_DIR, 'bashvar.sh')), cygport]
result, error, status = Open3.capture3(command.join(' '))
raise CygportProcessError, error unless status.success?
BashVar.parse(result, symbolize_names: true)
end
|
#config(filepath = nil) ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'lib/xezat/config.rb', line 6
def config(filepath = nil)
config = {}
config['cygwin'] = {
'cygclassdir' => '/usr/share/cygport/cygclass'
}
config['xezat'] = {}
config.merge!(YAML.load_file(filepath)) if filepath
config
end
|
#packages(db_path = '/etc/setup/installed.db') ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/xezat/packages.rb', line 6
def packages(db_path = '/etc/setup/installed.db')
Xezat.logger.debug(" Collect installed packages from #{db_path}")
raise ArgumentError, "#{db_path} not found" unless File.exist?(db_path)
packages = {}
File.read(db_path).lines do |line|
record = line.split(/\s+/)
next unless record.size == 3
packages[record[0].intern] = record[1].gsub(/\.tar\.bz2$/, '')
end
packages
end
|
#variables(cygport) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/xezat/variables.rb', line 11
def variables(cygport)
cygport_dir = File.dirname(File.absolute_path(cygport))
cache_file = File.expand_path(File.join(cygport_dir, "#{File.basename(cygport, '.cygport')}.#{Etc.uname[:machine]}.yml"))
Xezat.logger.debug(' Extract variables')
if File.exist?(cache_file) && File.ctime(cache_file) > File.ctime(cygport)
Xezat.logger.debug(' Read cache for variables')
return YAML.safe_load(File.open(cache_file), symbolize_names: true, permitted_classes: [Symbol]).each do |k, v|
v.strip! if v.respond_to?(:strip) && k != :DESCRIPTION
end
end
vars = bashvar(cygport)
File.atomic_write(cache_file) do |f|
Xezat.logger.debug(' Write cache for variables')
f.write(YAML.dump(vars))
end
vars
end
|