diff options
author | Ryan Davis <ryand@zenspider.com> | 2015-01-27 03:22:49 -0800 |
---|---|---|
committer | Ryan Davis <ryand@zenspider.com> | 2015-01-27 03:22:49 -0800 |
commit | 7755dc2c8894c07fb204ea8c862f00926b729862 (patch) | |
tree | cd25761f6a338991e981cddec6e74b2655265757 | |
parent | 96b443559150088b1ad8b48528b220e3c2b815e3 (diff) | |
download | hoe-7755dc2c8894c07fb204ea8c862f00926b729862.tar.gz |
minor restructuring
[git-p4: depot-paths = "//src/hoe/dev/": change = 9959]
-rwxr-xr-x | bin/sow | 8 | ||||
-rw-r--r-- | lib/hoe.rb | 30 | ||||
-rw-r--r-- | lib/hoe/inline.rb | 50 | ||||
-rw-r--r-- | lib/hoe/package.rb | 13 |
4 files changed, 51 insertions, 50 deletions
@@ -14,10 +14,10 @@ option = { } def check_subdir option - if option[:subdir] then - warn "ERROR: you can't specify multiple subdirs" - abort opts.to_s - end + return unless option[:subdir] + + warn "ERROR: you can't specify multiple subdirs" + abort opts.to_s end def make_sub_modules klass @@ -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 |