Merge pull request #1614 from poporul/v3-stable

Little bit cleaned up. Dry in rake tasks. Fix $LOAD_PATH
This commit is contained in:
Thomas Reynolds 2015-10-22 19:56:24 -07:00
commit 5f69431a74
15 changed files with 27 additions and 52 deletions

View file

@ -35,6 +35,6 @@ gem 'simplecov', '~> 0.10', require: false
gem 'coveralls', '~> 0.8', require: false gem 'coveralls', '~> 0.8', require: false
# Middleman itself # Middleman itself
gem 'middleman', path: 'middleman'
gem 'middleman-core', path: 'middleman-core' gem 'middleman-core', path: 'middleman-core'
gem 'middleman', path: 'middleman'
gem 'middleman-sprockets', github: 'middleman/middleman-sprockets', branch: 'v3-stable-real' gem 'middleman-sprockets', github: 'middleman/middleman-sprockets', branch: 'v3-stable-real'

View file

@ -1,17 +1,17 @@
require 'rake' require 'rake'
require File.expand_path('../middleman-core/lib/middleman-core/version.rb', __FILE__) require 'middleman-core/version'
ROOT = File.expand_path(File.dirname(__FILE__))
GEM_NAME = 'middleman'
middleman_gems = %w(middleman-core middleman)
GEM_PATHS = middleman_gems.freeze
def sh_rake(command) def sh_rake(command)
sh "#{Gem.ruby} -S rake #{command}", verbose: true sh "#{Gem.ruby} -S rake #{command}", verbose: true
end end
def within_each_gem(&block)
%w(middleman-core middleman).each do |dir|
Dir.chdir(dir) { block.call }
end
end
desc 'Displays the current version' desc 'Displays the current version'
task :version do task :version do
puts "Current version: #{Middleman::VERSION}" puts "Current version: #{Middleman::VERSION}"
@ -28,32 +28,23 @@ end
desc 'Release all middleman gems' desc 'Release all middleman gems'
task publish: :push do task publish: :push do
puts 'Pushing to rubygems...' puts 'Pushing to rubygems...'
GEM_PATHS.each do |dir| within_each_gem { sh_rake('release') }
Dir.chdir(dir) { sh_rake('release') }
end
end end
desc 'Generate documentation for all middleman gems' desc 'Generate documentation for all middleman gems'
task :doc do task :doc do
GEM_PATHS.each do |g| within_each_gem { sh_rake('yard') }
Dir.chdir("#{File.join(ROOT, g)}") { sh "#{Gem.ruby} -S rake yard" }
end
end end
desc 'Run tests for all middleman gems' desc 'Run tests for all middleman gems'
task :test do task :test do
Rake::Task['rubocop'].invoke Rake::Task['rubocop'].invoke
within_each_gem { sh_rake('test') }
GEM_PATHS.each do |g|
Dir.chdir("#{File.join(ROOT, g)}") { sh "#{Gem.ruby} -S rake test" }
end
end end
desc 'Run specs for all middleman gems' desc 'Run specs for all middleman gems'
task :spec do task :spec do
GEM_PATHS.each do |g| within_each_gem { sh_rake('spec') }
Dir.chdir("#{File.join(ROOT, g)}") { sh "#{Gem.ruby} -S rake spec" }
end
end end
require 'rubocop/rake_task' require 'rubocop/rake_task'

View file

@ -23,14 +23,6 @@ Cucumber::Rake::Task.new do |t|
t.cucumber_opts = "--require features --color #{exempt_tags.join(' ')} --strict"# --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}" t.cucumber_opts = "--require features --color #{exempt_tags.join(' ')} --strict"# --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}"
end end
Cucumber::Rake::Task.new(:cucumber_wip) do |t|
exempt_tags = ['--tags @wip']
exempt_tags << '--tags ~@nojava' if RUBY_PLATFORM == 'java'
exempt_tags << '--tags ~@encoding' unless Object.const_defined?(:Encoding)
exempt_tags << '--tags ~@nowindows' if Gem.win_platform?
t.cucumber_opts = "--color #{exempt_tags.join(' ')} --strict"# --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}"
end
require 'rspec/core/rake_task' require 'rspec/core/rake_task'
desc 'Run RSpec' desc 'Run RSpec'
RSpec::Core::RakeTask.new do |spec| RSpec::Core::RakeTask.new do |spec|
@ -38,8 +30,12 @@ RSpec::Core::RakeTask.new do |spec|
spec.rspec_opts = ['--color', '--format documentation'] spec.rspec_opts = ['--color', '--format documentation']
end end
test_tasks = []
test_tasks << :spec if Dir.exists? 'spec'
test_tasks << :cucumber if Dir.exists? 'features'
desc 'Run tests, both RSpec and Cucumber' desc 'Run tests, both RSpec and Cucumber'
task test: [:spec, :cucumber] task test: test_tasks
YARD::Rake::YardocTask.new YARD::Rake::YardocTask.new

View file

@ -1 +0,0 @@
--color

View file

@ -1,6 +1 @@
# coding:utf-8 require_relative '../gem_rake_helper'
RAKE_ROOT = __FILE__
GEM_NAME = ENV['NAME'] || 'middleman-core'
require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper')

View file

@ -1,9 +1,5 @@
# rubocop:disable FileName # rubocop:disable FileName
# Setup our load paths
libdir = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
# Top-level Middleman namespace # Top-level Middleman namespace
module Middleman module Middleman
# Backwards compatibility namespace # Backwards compatibility namespace

View file

@ -1,5 +1,7 @@
# -*- encoding: utf-8 -*- lib = File.expand_path("../lib", __FILE__)
require File.expand_path("../lib/middleman-core/version", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "middleman-core/version"
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = "middleman-core" s.name = "middleman-core"

View file

View file

@ -1,5 +1 @@
# coding:utf-8 require_relative '../gem_rake_helper'
RAKE_ROOT = __FILE__
GEM_NAME = 'middleman'
require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper')

View file

@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__)
$:.push File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require File.expand_path("../../middleman-core/lib/middleman-core/version.rb", __FILE__)
require "middleman-core/version"
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = "middleman" s.name = "middleman"
@ -14,7 +15,6 @@ Gem::Specification.new do |s|
s.description = "A static site generator. Provides dozens of templating languages (Haml, Sass, Compass, Slim, CoffeeScript, and more). Makes minification, compression, cache busting, Yaml data (and more) an easy part of your development cycle." s.description = "A static site generator. Provides dozens of templating languages (Haml, Sass, Compass, Slim, CoffeeScript, and more). Makes minification, compression, cache busting, Yaml data (and more) an easy part of your development cycle."
s.files = `git ls-files -z`.split("\0") s.files = `git ls-files -z`.split("\0")
s.test_files = `git ls-files -z -- {fixtures,features}/*`.split("\0")
s.require_paths = ["lib"] s.require_paths = ["lib"]
s.required_ruby_version = '>= 1.9.3' s.required_ruby_version = '>= 1.9.3'