Little bit cleaned up. Dry in rake tasks. Fix $LOAD_PATH

v3-stable
Alexey Pokhozhaev 2015-10-02 15:12:13 +03:00
parent 8292bc9899
commit 3a7848da9e
14 changed files with 22 additions and 43 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -1,9 +1,5 @@
# 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
module Middleman
# Backwards compatibility namespace

View File

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

View File

View File

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

View File

@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require File.expand_path("../../middleman-core/lib/middleman-core/version.rb", __FILE__)
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "middleman-core/version"
Gem::Specification.new do |s|
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.files = `git ls-files -z`.split("\0")
s.test_files = `git ls-files -z -- {fixtures,features}/*`.split("\0")
s.require_paths = ["lib"]
s.required_ruby_version = '>= 1.9.3'