Class: EASYFPM::PkgChangelog
- Inherits:
-
Object
- Object
- EASYFPM::PkgChangelog
- Defined in:
- lib/easyfpm/pkgchangelog.rb
Constant Summary collapse
- @@easyfpmCLRegExp =
{}
Instance Attribute Summary collapse
-
#defaultDate ⇒ Object
Returns the value of attribute defaultDate.
-
#distribution ⇒ Object
Returns the value of attribute distribution.
-
#pkgname ⇒ Object
Returns the value of attribute pkgname.
-
#urgency ⇒ Object
Returns the value of attribute urgency.
Instance Method Summary collapse
-
#initialize(changelogFile) ⇒ PkgChangelog
constructor
A new instance of PkgChangelog.
-
#print(format, io_obj = $stdout) ⇒ Object
write.
- #write(format, fileToWrite) ⇒ Object
Constructor Details
#initialize(changelogFile) ⇒ PkgChangelog
Returns a new instance of PkgChangelog.
24 25 26 27 28 29 30 31 32 |
# File 'lib/easyfpm/pkgchangelog.rb', line 24 def initialize(changelogFile) raise ArgumentError, 'the argument "changelogFile" must be a String' unless changelogFile.is_a? String raise Errno::EACCES, "Can't read #{changelogFile}" unless File.readable?(changelogFile) @changelog=changelogFile self.defaultDate = Time.now self.pkgname = File.basename(File.dirname(changelogFile)) self.distribution = "stable" self.urgency = "low" end |
Instance Attribute Details
#defaultDate ⇒ Object
Returns the value of attribute defaultDate.
19 20 21 |
# File 'lib/easyfpm/pkgchangelog.rb', line 19 def defaultDate @defaultDate end |
#distribution ⇒ Object
Returns the value of attribute distribution.
21 22 23 |
# File 'lib/easyfpm/pkgchangelog.rb', line 21 def distribution @distribution end |
#pkgname ⇒ Object
Returns the value of attribute pkgname.
20 21 22 |
# File 'lib/easyfpm/pkgchangelog.rb', line 20 def pkgname @pkgname end |
#urgency ⇒ Object
Returns the value of attribute urgency.
22 23 24 |
# File 'lib/easyfpm/pkgchangelog.rb', line 22 def urgency @urgency end |
Instance Method Details
#print(format, io_obj = $stdout) ⇒ Object
write
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/easyfpm/pkgchangelog.rb', line 48 def print (format, io_obj=$stdout) raise ArgumentError, 'the argument "format" must be a String' unless format.is_a? String raise ArgumentError, 'the argument "io_obj" must be an IO class or an IO inherited class' unless io_obj.is_a? IO case format.downcase when "deb" return printDEB(io_obj) when "rpm" return printRPM(io_obj) else raise EASYFPM::InvalidChangelogFormat, "The format #{format} is not implemented" end end |
#write(format, fileToWrite) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/easyfpm/pkgchangelog.rb', line 34 def write (format, fileToWrite) raise ArgumentError, 'the argument "format" must be a String' unless format.is_a? String raise ArgumentError, 'the argument "fileToWrite" must be a String' unless fileToWrite.is_a? String File.open(fileToWrite,'w') do |file| case format.downcase when "deb", "rpm" return self.print(format,file) else raise EASYFPM::InvalidChangelogFormat, "The format #{format} is not (yet) implemented" end end end |