From 1f72e3d90a1e8678de4a4b658b6675d2597d857c Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 25 Apr 2011 13:43:14 +1200 Subject: Made version code more accessible and fixed up lib/gemspec.rb --- lib/gemspec.rb | 8 ++++++-- lib/refinery/blog/version.rb | 17 +++++++++++++++++ lib/refinerycms-blog.rb | 13 +++++++------ 3 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 lib/refinery/blog/version.rb (limited to 'lib') diff --git a/lib/gemspec.rb b/lib/gemspec.rb index d112795..dfd4213 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path('../refinerycms-blog.rb', __FILE__) -version = ::Refinery::Blog.version +require File.expand_path('../refinery/blog/version', __FILE__) +version = ::Refinery::Blog::Version.to_s raise "Could not get version so gemspec can not be built" if version.nil? files = Dir.glob("**/*").flatten.reject do |file| file =~ /\.gem(spec)?$/ @@ -18,10 +18,14 @@ Gem::Specification.new do |s| s.authors = ['Resolve Digital', 'Neoteric Design'] s.require_paths = %w(lib) + # Runtime dependencies s.add_dependency 'refinerycms-core', '>= 0.9.9.1' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' + # Development dependencies + s.add_development_dependency 'factory_girl' + s.files = %w( #{files.join("\n ")} ) diff --git a/lib/refinery/blog/version.rb b/lib/refinery/blog/version.rb new file mode 100644 index 0000000..6365f94 --- /dev/null +++ b/lib/refinery/blog/version.rb @@ -0,0 +1,17 @@ +module Refinery + module Blog + class Version + @major = 1 + @minor = 4 + @tiny = 0 + + class << self + attr_reader :major, :minor, :tiny + + def to_s + [@major, @minor, @tiny].compact.join('.') + end + end + end + end +end \ No newline at end of file diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index 60c9bfa..312ee9b 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -3,6 +3,13 @@ require 'filters_spam' module Refinery module Blog + autoload :Version, File.expand_path('../refinery/blog/version', __FILE__) + class << self + def version + ::Refinery::Blog::Version.to_s + end + end + class Engine < Rails::Engine initializer 'blog serves assets' do |app| app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public" @@ -35,11 +42,5 @@ module Refinery end end end if defined?(Rails::Engine) - - class << self - def version - %q{1.4} - end - end end end -- cgit v1.2.3