diff --git a/Gemfile b/Gemfile index 08de2a54..2c8a8e9e 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/Rakefile b/Rakefile index 78c26691..89546ff3 100644 --- a/Rakefile +++ b/Rakefile @@ -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' diff --git a/gem_rake_helper.rb b/gem_rake_helper.rb index 0fdd80bb..4e5bd75b 100644 --- a/gem_rake_helper.rb +++ b/gem_rake_helper.rb @@ -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'}" 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' desc 'Run RSpec' RSpec::Core::RakeTask.new do |spec| @@ -38,8 +30,12 @@ RSpec::Core::RakeTask.new do |spec| spec.rspec_opts = ['--color', '--format documentation'] end +test_tasks = [] +test_tasks << :spec if Dir.exists? 'spec' +test_tasks << :cucumber if Dir.exists? 'features' + desc 'Run tests, both RSpec and Cucumber' -task test: [:spec, :cucumber] +task test: test_tasks YARD::Rake::YardocTask.new diff --git a/middleman-core/.gemtest b/middleman-core/.gemtest deleted file mode 100644 index e69de29b..00000000 diff --git a/middleman-core/.rspec b/middleman-core/.rspec deleted file mode 100644 index 4e1e0d2f..00000000 --- a/middleman-core/.rspec +++ /dev/null @@ -1 +0,0 @@ ---color diff --git a/middleman-core/Rakefile b/middleman-core/Rakefile index 5cbeb120..a093ee44 100644 --- a/middleman-core/Rakefile +++ b/middleman-core/Rakefile @@ -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' diff --git a/middleman-core/lib/middleman-core.rb b/middleman-core/lib/middleman-core.rb index 8170fefb..5a1e7294 100644 --- a/middleman-core/lib/middleman-core.rb +++ b/middleman-core/lib/middleman-core.rb @@ -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 diff --git a/middleman-core/middleman-core.gemspec b/middleman-core/middleman-core.gemspec index 844e6de9..7c5d6d0b 100644 --- a/middleman-core/middleman-core.gemspec +++ b/middleman-core/middleman-core.gemspec @@ -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" diff --git a/middleman/.gemtest b/middleman/.gemtest deleted file mode 100644 index e69de29b..00000000 diff --git a/middleman/Rakefile b/middleman/Rakefile index 120b9c7c..a093ee44 100644 --- a/middleman/Rakefile +++ b/middleman/Rakefile @@ -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' diff --git a/middleman/features/.gitkeep b/middleman/features/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/middleman/fixtures/.gitkeep b/middleman/fixtures/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/middleman/middleman.gemspec b/middleman/middleman.gemspec index 11e4e871..b34ebfbb 100644 --- a/middleman/middleman.gemspec +++ b/middleman/middleman.gemspec @@ -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' diff --git a/middleman/spec/middleman/future_spec.rb b/middleman/spec/middleman/future_spec.rb deleted file mode 100644 index e69de29b..00000000 diff --git a/middleman/spec/spec_helper.rb b/middleman/spec/spec_helper.rb deleted file mode 100644 index e69de29b..00000000