Class: Magica::PackageConfig
Overview
:nodoc:
Constant Summary collapse
- LIBRARY_PATH_RULE =
/-L([^\s]+)/- LIBRARY_RULE =
/-l([^\s]+)/- LIBRARY_FLAG_RULE =
/-[^lL][^\s]+/- INCLUDE_RULE =
/-I([^\s]+)/- DEFINE_RULE =
/-D([^\s]+)/- FLAG_RULE =
/-[^ID][^\s]+/
Instance Attribute Summary collapse
-
#defines ⇒ Object
readonly
Returns the value of attribute defines.
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
-
#include_paths ⇒ Object
readonly
Returns the value of attribute include_paths.
-
#libraries ⇒ Object
readonly
Returns the value of attribute libraries.
-
#library_flags ⇒ Object
readonly
Returns the value of attribute library_flags.
-
#library_paths ⇒ Object
readonly
Returns the value of attribute library_paths.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ PackageConfig
constructor
A new instance of PackageConfig.
- #package_exist?(name) ⇒ Boolean
Constructor Details
#initialize(name) ⇒ PackageConfig
Returns a new instance of PackageConfig.
23 24 25 26 27 28 29 30 31 |
# File 'lib/magica/package_config.rb', line 23 def initialize(name) raise "Cannot found library #{name}" unless package_exist?(name) @name = name @package_libraries = `pkg-config --libs #{@name}`.strip @package_cflags = `pkg-config --cflags #{@name}`.strip @version = `pkg-config --modversion #{@name}`.strip end |
Instance Attribute Details
#defines ⇒ Object (readonly)
Returns the value of attribute defines.
20 21 22 |
# File 'lib/magica/package_config.rb', line 20 def defines @defines end |
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
20 21 22 |
# File 'lib/magica/package_config.rb', line 20 def flags @flags end |
#include_paths ⇒ Object (readonly)
Returns the value of attribute include_paths.
20 21 22 |
# File 'lib/magica/package_config.rb', line 20 def include_paths @include_paths end |
#libraries ⇒ Object (readonly)
Returns the value of attribute libraries.
20 21 22 |
# File 'lib/magica/package_config.rb', line 20 def libraries @libraries end |
#library_flags ⇒ Object (readonly)
Returns the value of attribute library_flags.
20 21 22 |
# File 'lib/magica/package_config.rb', line 20 def library_flags @library_flags end |
#library_paths ⇒ Object (readonly)
Returns the value of attribute library_paths.
20 21 22 |
# File 'lib/magica/package_config.rb', line 20 def library_paths @library_paths end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
20 21 22 |
# File 'lib/magica/package_config.rb', line 20 def version @version end |
Class Method Details
.[](name) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/magica/package_config.rb', line 5 def [](name) @packages ||= {} config = @packages[name.to_s] config = @packages[name.to_s] = PackageConfig.new(name) if config.nil? config end |
Instance Method Details
#package_exist?(name) ⇒ Boolean
33 34 35 |
# File 'lib/magica/package_config.rb', line 33 def package_exist?(name) system "pkg-config --exists #{name}" end |