Class: Source::Base
- Includes:
- HasOptionMethods
- Defined in:
- lib/gpm/source.rb
Defined Under Namespace
Classes: Factory
Constant Summary collapse
- DEFAULTS =
{ # Default version is 1.0 in case nobody told us a specific version. :version => "1.0", :build_number => nil, :epoch => nil, # If architecture is nil, the target package should provide a default. # Special 'architecture' values include "all" (aka rpm's noarch, debian's all) # Another special includes "native" which will be the current platform's arch. :architecture => nil, :dependencies => [], :provides => [], :replaces => [], :conflicts => [], :scripts => [], :config_files => [], :settings => {}, :url => "http://nourlgiven.example.com/no/url/given", :category => "default", :license => "unknown", :maintainer => nil, :description => "no description given" }
Instance Attribute Summary collapse
-
#files_provider ⇒ Object
readonly
Returns the value of attribute files_provider.
Attributes included from HasOptionMethods
Class Method Summary collapse
Instance Method Summary collapse
- #contains_file?(file_name) ⇒ Boolean
- #file_contents ⇒ Object
- #files ⇒ Object
-
#initialize(files_provider, options = {}) ⇒ Base
constructor
A new instance of Base.
- #maintainer ⇒ Object
Methods included from HasOptionMethods
Constructor Details
#initialize(files_provider, options = {}) ⇒ Base
Returns a new instance of Base.
70 71 72 73 |
# File 'lib/gpm/source.rb', line 70 def initialize(files_provider,={}) @options= @files_provider=files_provider end |
Instance Attribute Details
#files_provider ⇒ Object (readonly)
Returns the value of attribute files_provider.
68 69 70 |
# File 'lib/gpm/source.rb', line 68 def files_provider @files_provider end |
Class Method Details
.constant_field(name, value) ⇒ Object
35 36 37 38 39 |
# File 'lib/gpm/source.rb', line 35 def self.constant_field(name,value) define_method(name) do value end end |
Instance Method Details
#contains_file?(file_name) ⇒ Boolean
101 102 103 104 |
# File 'lib/gpm/source.rb', line 101 def contains_file?(file_name) file_name = FilePathAndPermissions.new(file_name) unless file_name.kind_of? FilePathAndPermissions file_contents.include? file_name end |
#file_contents ⇒ Object
106 107 108 |
# File 'lib/gpm/source.rb', line 106 def file_contents files_provider.nil? ? {} : files_provider.file_contents end |
#files ⇒ Object
110 111 112 |
# File 'lib/gpm/source.rb', line 110 def files files_provider.files end |
#maintainer ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/gpm/source.rb', line 80 def maintainer # Default maintainer if none given. if @maintainer.nil? or @maintainer.empty? # Reference # http://www.debian.org/doc/manuals/maint-guide/first.en.html # http://wiki.debian.org/DeveloperConfiguration # https://github.com/jordansissel/fpm/issues/37 if ENV.include?("DEBEMAIL") and ENV.include?("DEBFULLNAME") # Use DEBEMAIL and DEBFULLNAME as the default maintainer if available. @maintainer = "#{ENV["DEBFULLNAME"]} <#{ENV["DEBEMAIL"]}>" else # TODO(sissel): Maybe support using 'git config' for a default as well? # git config --get user.name, etc can be useful. # Maybe use 'whoami', in case we are not in a git repository? # # Otherwise default to user@currenthost @maintainer = "<#{ENV["USER"]}@#{Socket.gethostname}>" end end end |