Class: SGem
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- SGem
- Defined in:
- lib/sgem.rb,
lib/sgem/version.rb
Overview
SGem is a simple, minimalistic way to build and publish gems using ‘rake`.
SGem is based on the excellent [mg](github.com/sr/mg) (written by [Ryan Tomayko](tomayko.com), extracted by [Simon Rozet](atonie.org)).
Constant Summary collapse
- VERSION =
The semantic version of SGem.
'1.0.0'
Class Attribute Summary collapse
-
.archive_format ⇒ String
The default archive format for SGem to use unless otherwise specified.
-
.package_dir ⇒ String
The default relative directory where SGem will place generated gems and archives unless otherwise specified.
Instance Method Summary collapse
-
#archive_format ⇒ String
The archive format for SGem to use.
-
#initialize(spec) ⇒ SGem
constructor
A new instance of SGem.
-
#name ⇒ String
The name of the gem for this instance of SGem.
-
#package_dir ⇒ String
The relative directory where SGem will place generated gems and archives.
-
#version ⇒ Gem::Version
The version of the gemspec for this instance of SGem.
Constructor Details
#initialize(spec) ⇒ SGem
Returns a new instance of SGem.
28 29 30 31 |
# File 'lib/sgem.rb', line 28 def initialize(spec) @spec = Gem::Specification.load(spec) define_tasks end |
Class Attribute Details
.archive_format ⇒ String
This format must be supported by ‘git-archive`.
Returns the default archive format for SGem to use unless otherwise specified.
24 25 26 |
# File 'lib/sgem.rb', line 24 def archive_format @archive_format end |
.package_dir ⇒ String
Returns the default relative directory where SGem will place generated gems and archives unless otherwise specified.
18 19 20 |
# File 'lib/sgem.rb', line 18 def package_dir @package_dir end |
Instance Method Details
#archive_format ⇒ String
This format must be supported by ‘git-archive`.
Returns the archive format for SGem to use.
54 55 56 |
# File 'lib/sgem.rb', line 54 def archive_format @format ||= ENV['ARCHIVE'] || self.class.archive_format || '.tar.gz' end |
#name ⇒ String
Returns the name of the gem for this instance of SGem.
34 35 36 |
# File 'lib/sgem.rb', line 34 def name @name ||= @spec.name end |
#package_dir ⇒ String
Returns the relative directory where SGem will place generated gems and archives.
46 47 48 49 50 |
# File 'lib/sgem.rb', line 46 def package_dir return @dir if @dir dir = ENV['DEST'] || self.class.package_dir || 'pkg/' @dir = dir.end_with?('/') ? dir : "#{dir}/" end |
#version ⇒ Gem::Version
Returns the version of the gemspec for this instance of SGem.
40 41 42 |
# File 'lib/sgem.rb', line 40 def version @version ||= @spec.version end |