summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRyan Davis <ryand@zenspider.com>2015-01-27 03:22:49 -0800
committerRyan Davis <ryand@zenspider.com>2015-01-27 03:22:49 -0800
commit7755dc2c8894c07fb204ea8c862f00926b729862 (patch)
treecd25761f6a338991e981cddec6e74b2655265757 /lib
parent96b443559150088b1ad8b48528b220e3c2b815e3 (diff)
downloadhoe-7755dc2c8894c07fb204ea8c862f00926b729862.tar.gz
minor restructuring
[git-p4: depot-paths = "//src/hoe/dev/": change = 9959]
Diffstat (limited to 'lib')
-rw-r--r--lib/hoe.rb30
-rw-r--r--lib/hoe/inline.rb50
-rw-r--r--lib/hoe/package.rb13
3 files changed, 47 insertions, 46 deletions
diff --git a/lib/hoe.rb b/lib/hoe.rb
index 4db933c..aaef015 100644
--- a/lib/hoe.rb
+++ b/lib/hoe.rb
@@ -566,24 +566,24 @@ class Hoe
end
def check_for_version # :nodoc:
- unless self.version then
- version = nil
- version_re = /VERSION += +([\"\'])([\d][\w\.]+)\1/
+ return if self.version
- spec.files.each do |file|
- next unless File.exist? file
- version = File.read_utf(file)[version_re, 2] rescue nil
- break if version
- end
+ version = nil
+ version_re = /VERSION += +([\"\'])([\d][\w\.]+)\1/
+
+ spec.files.each do |file|
+ next unless File.exist? file
+ version = File.read_utf(file)[version_re, 2] rescue nil
+ break if version
+ end
- spec.version = self.version = version if version
+ spec.version = self.version = version if version
- unless self.version then
- spec.version = self.version = "0.borked"
- warn "** Add 'VERSION = \"x.y.z\"' to your code,"
- warn " add a version to your hoe spec,"
- warn " or fix your Manifest.txt"
- end
+ unless self.version then
+ spec.version = self.version = "0.borked"
+ warn "** Add 'VERSION = \"x.y.z\"' to your code,"
+ warn " add a version to your hoe spec,"
+ warn " or fix your Manifest.txt"
end
end
diff --git a/lib/hoe/inline.rb b/lib/hoe/inline.rb
index 45b5f3c..800f87e 100644
--- a/lib/hoe/inline.rb
+++ b/lib/hoe/inline.rb
@@ -35,36 +35,36 @@ module Hoe::Inline
def define_inline_tasks
task :test => :clean
- if ENV["INLINE"] then
- s.platform = ENV["FORCE_PLATFORM"] || Gem::Platform::CURRENT
+ return unless ENV["INLINE"]
- # Try collecting Inline extensions for +name+
- if defined?(Inline) then
- directory "lib/inline"
+ s.platform = ENV["FORCE_PLATFORM"] || Gem::Platform::CURRENT
- dlext = RbConfig::CONFIG["DLEXT"]
+ return unless defined? Inline
- Inline.registered_inline_classes.each do |cls|
- name = cls.name.gsub(/::/, "")
- # name of the extension is CamelCase
- alternate_name = if name =~ /[A-Z]/ then
- name.gsub(/([A-Z])/, '_\1').downcase.sub(/^_/, "")
- elsif name =~ /_/ then
- name.capitalize.gsub(/_([a-z])/) { $1.upcase }
- end
- extensions = Dir.chdir(Inline.directory) {
- Dir["Inline_{#{name},#{alternate_name}}_*.#{dlext}"]
- }
+ # Try collecting Inline extensions for +name+
+ directory "lib/inline"
- extensions.each do |ext|
- # add the inlined extension to the spec files
- s.files += ["lib/inline/#{ext}"]
+ dlext = RbConfig::CONFIG["DLEXT"]
- # include the file in the tasks
- file "lib/inline/#{ext}" => ["lib/inline"] do
- cp File.join(Inline.directory, ext), "lib/inline"
- end
- end
+ Inline.registered_inline_classes.each do |cls|
+ name = cls.name.gsub(/::/, "")
+ # name of the extension is CamelCase
+ alternate_name = if name =~ /[A-Z]/ then
+ name.gsub(/([A-Z])/, '_\1').downcase.sub(/^_/, "")
+ elsif name =~ /_/ then
+ name.capitalize.gsub(/_([a-z])/) { $1.upcase }
+ end
+ extensions = Dir.chdir(Inline.directory) {
+ Dir["Inline_{#{name},#{alternate_name}}_*.#{dlext}"]
+ }
+
+ extensions.each do |ext|
+ # add the inlined extension to the spec files
+ s.files += ["lib/inline/#{ext}"]
+
+ # include the file in the tasks
+ file "lib/inline/#{ext}" => ["lib/inline"] do
+ cp File.join(Inline.directory, ext), "lib/inline"
end
end
end
diff --git a/lib/hoe/package.rb b/lib/hoe/package.rb
index 652abd0..58657f0 100644
--- a/lib/hoe/package.rb
+++ b/lib/hoe/package.rb
@@ -106,12 +106,13 @@ module Hoe::Package
def prerelease_version # :nodoc:
pre = ENV["PRERELEASE"] || ENV["PRE"]
- if pre then
- spec.version.version << "." << pre if pre
- abort "ERROR: You should format PRE like pre or alpha.1 or something" if
- (Gem::VERSION < "1.4" and pre !~ /^[a-z]+(\.\d+)?$/) or
- (Gem::VERSION >= "1.4" and pre !~ /^[a-z]+(\.?\d+)?$/)
- end
+ return unless pre
+
+ spec.version.version << "." << pre if pre
+
+ abort "ERROR: You should format PRE like pre or alpha.1 or something" if
+ (Gem::VERSION < "1.4" and pre !~ /^[a-z]+(\.\d+)?$/) or
+ (Gem::VERSION >= "1.4" and pre !~ /^[a-z]+(\.?\d+)?$/)
end
end