Merge pull request #1142 from middleman/middleman_cli

Move CLI into middleman-cli
This commit is contained in:
Thomas Reynolds 2014-01-02 17:24:49 -08:00
commit 926ba0036c
156 changed files with 164 additions and 523 deletions

3
.gitmodules vendored
View file

@ -1,3 +0,0 @@
[submodule "middleman-core/lib/middleman-more/templates/smacss"]
path = middleman-core/lib/middleman-more/templates/smacss
url = git@github.com:nsteiner/middleman-smacss.git

View file

@ -1,10 +1,10 @@
middleman-*/lib/**/*.rb middleman-*/lib/**/*.rb
--exclude middleman-core/lib/vendored-middleman-deps/ --exclude middleman-core/lib/vendored-middleman-deps/
--exclude middleman-core/lib/middleman-core/step_definitions --exclude middleman-core/lib/middleman-core/step_definitions
--exclude middleman-core/lib/middleman-core/templates/default/ --exclude middleman-cli/lib/middleman-cli/templates/default/
--exclude middleman-core/lib/middleman-core/templates/html5/ --exclude middleman-cli/lib/middleman-cli/templates/html5/
--exclude middleman-core/lib/middleman-core/templates/mobile/ --exclude middleman-cli/lib/middleman-cli/templates/mobile/
--exclude middleman-core/lib/middleman-core/templates/shared/ --exclude middleman-cli/lib/middleman-cli/templates/shared/
--exclude middleman-core/lib/middleman-core/templates/extension/ --exclude middleman-cli/lib/middleman-cli/templates/extension/
--no-private --no-private
--hide-void-return --hide-void-return

View file

@ -38,5 +38,6 @@ gem 'rubocop', :require => false
# Middleman itself # Middleman itself
gem 'middleman-core', :path => 'middleman-core' gem 'middleman-core', :path => 'middleman-core'
gem 'middleman-cli', :path => 'middleman-cli'
gem 'middleman-sprockets', :github => 'middleman/middleman-sprockets', :require => false gem 'middleman-sprockets', :github => 'middleman/middleman-sprockets', :require => false
gem 'middleman', :path => 'middleman' gem 'middleman', :path => 'middleman'

View file

@ -7,7 +7,7 @@ require File.expand_path('../middleman-core/lib/middleman-core/version.rb', __FI
ROOT = File.expand_path(File.dirname(__FILE__)) ROOT = File.expand_path(File.dirname(__FILE__))
GEM_NAME = 'middleman' GEM_NAME = 'middleman'
middleman_gems = %w(middleman-core middleman) middleman_gems = %w(middleman-core middleman-cli middleman)
GEM_PATHS = middleman_gems.freeze GEM_PATHS = middleman_gems.freeze
def sh_rake(command) def sh_rake(command)

7
middleman-cli/.simplecov Normal file
View file

@ -0,0 +1,7 @@
SimpleCov.start do
add_filter '/fixtures/'
add_filter '/features/'
add_filter '/spec/'
add_filter '/step_definitions/'
add_filter '/lib/vendored-middleman-deps/'
end

8
middleman-cli/.yardopts Normal file
View file

@ -0,0 +1,8 @@
lib/**/*.rb
--exclude lib/middleman-cli/templates/default/
--exclude lib/middleman-cli/templates/html5/
--exclude lib/middleman-cli/templates/mobile/
--exclude lib/middleman-cli/templates/shared/
--exclude lib/middleman-cli/templates/extension/
--no-private
--hide-void-return

5
middleman-cli/Rakefile Normal file
View file

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

View file

@ -9,7 +9,7 @@ Middleman::Profiling.start
require "middleman-core/load_paths" require "middleman-core/load_paths"
Middleman.setup_load_paths Middleman.setup_load_paths
require "middleman-core/cli" require "middleman-cli"
# Change directory to the root # Change directory to the root
Dir.chdir(ENV["MM_ROOT"]) if ENV["MM_ROOT"] Dir.chdir(ENV["MM_ROOT"]) if ENV["MM_ROOT"]

View file

View file

@ -1,3 +1,7 @@
# Setup our load paths
libdir = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
# Require thor since that's what the who CLI is built around # Require thor since that's what the who CLI is built around
require 'thor' require 'thor'
require 'thor/group' require 'thor/group'
@ -82,9 +86,9 @@ module Middleman
end end
# Include the core CLI items # Include the core CLI items
require 'middleman-core/cli/init' require 'middleman-cli/init'
require 'middleman-core/cli/bundler' require 'middleman-cli/bundler'
require 'middleman-core/cli/extension' require 'middleman-cli/extension'
require 'middleman-core/cli/server' require 'middleman-cli/server'
require 'middleman-core/cli/build' require 'middleman-cli/build'
require 'middleman-core/cli/console' require 'middleman-cli/console'

View file

@ -15,21 +15,25 @@ module Middleman::Cli
# Template files are relative to this file # Template files are relative to this file
# @return [String] # @return [String]
def self.source_root def self.source_root
File.join(File.dirname(__FILE__), '..', 'templates', 'extension') File.join(File.dirname(__FILE__), 'templates')
end end
desc 'extension [options]', 'Create Middleman extension scaffold NAME' desc 'extension [options]', 'Create Middleman extension scaffold NAME'
method_option 'skip-git',
:type => :boolean,
:default => false,
:desc => 'Skip Git ignores and keeps'
# The extension task # The extension task
# @param [String] name # @param [String] name
def extension def extension
generate_gitignore! generate_gitignore!
template 'Rakefile', File.join(name, 'Rakefile') template 'extension/Rakefile', File.join(name, 'Rakefile')
template 'gemspec', File.join(name, "#{name}.gemspec") template 'extension/gemspec', File.join(name, "#{name}.gemspec")
template 'Gemfile', File.join(name, 'Gemfile') template 'extension/Gemfile', File.join(name, 'Gemfile')
template 'lib/middleman_extension.rb', File.join(name, 'lib', 'middleman_extension.rb') template 'extension/lib/middleman_extension.rb', File.join(name, 'lib', 'middleman_extension.rb')
template 'lib/lib.rb', File.join(name, 'lib', "#{name}.rb") template 'extension/lib/lib.rb', File.join(name, 'lib', "#{name}.rb")
template 'features/support/env.rb', File.join(name, 'features', 'support', 'env.rb') template 'extension/features/support/env.rb', File.join(name, 'features', 'support', 'env.rb')
empty_directory File.join(name, 'fixtures') empty_directory File.join(name, 'fixtures')
end end
@ -40,8 +44,8 @@ module Middleman::Cli
# Write a .gitignore file for project # Write a .gitignore file for project
# @return [void] # @return [void]
def generate_gitignore! def generate_gitignore!
return unless options[:git] return if options[:'skip-git']
copy_file 'gitignore', File.join(name, '.gitignore') copy_file 'shared/gitignore', File.join(name, '.gitignore')
end end
} }

View file

@ -1,4 +1,4 @@
require 'middleman-core/templates' require 'middleman-cli/templates'
# CLI Module # CLI Module
module Middleman::Cli module Middleman::Cli

View file

@ -84,19 +84,16 @@ module Middleman::Templates
end end
# Default template # Default template
require 'middleman-core/templates/default' require 'middleman-cli/templates/default'
# HTML5 template # HTML5 template
require 'middleman-core/templates/html5' require 'middleman-cli/templates/html5'
# HTML5 Mobile template # HTML5 Mobile template
require 'middleman-core/templates/mobile' require 'middleman-cli/templates/mobile'
# SMACSS templates
require 'middleman-more/templates/smacss'
# Local templates # Local templates
require 'middleman-core/templates/local' require 'middleman-cli/templates/local'
# Barebones template # Barebones template
require 'middleman-core/templates/empty' require 'middleman-cli/templates/empty'

View file

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 318 B

Some files were not shown because too many files have changed in this diff Show more