mirror of
https://github.com/middleman/middleman.git
synced 2022-11-09 12:20:27 -05:00
allow the generating and installation of a Gemfile
This commit is contained in:
parent
36a55abf1b
commit
8d7de527cd
7 changed files with 28 additions and 5 deletions
|
@ -161,3 +161,5 @@ module Middleman
|
|||
sandbox
|
||||
end
|
||||
end
|
||||
|
||||
require "middleman/version"
|
||||
|
|
|
@ -19,6 +19,7 @@ module Middleman
|
|||
method_option "js_dir", :default => "javascripts", :desc => 'The path to the javascript files'
|
||||
method_option "images_dir", :default => "images", :desc => 'The path to the image files'
|
||||
method_option "rack", :type => :boolean, :default => false, :desc => 'Include a config.ru file'
|
||||
method_option "bundler", :type => :boolean, :default => false, :desc => 'Create a Gemfile and use Bundler to manage gems'
|
||||
def init(name)
|
||||
key = options[:template].to_sym
|
||||
unless Middleman::Templates.registered_templates.has_key?(key)
|
||||
|
|
|
@ -23,6 +23,23 @@ module Middleman::Templates
|
|||
class_option :css_dir, :default => "stylesheets"
|
||||
class_option :js_dir, :default => "javascripts"
|
||||
class_option :images_dir, :default => "images"
|
||||
class_option :rack, :type => :boolean, :default => false
|
||||
class_option :bundler, :type => :boolean, :default => false
|
||||
|
||||
def generate_rack
|
||||
if options[:rack]
|
||||
template "shared/config.ru", File.join(location, "config.ru")
|
||||
end
|
||||
end
|
||||
|
||||
def generate_bundler
|
||||
if options[:bundler]
|
||||
template "shared/Gemfile.tt", File.join(location, "Gemfile")
|
||||
|
||||
say_status :run, "bundle install"
|
||||
print `cd #{location} && "#{Gem.ruby}" -rubygems "#{Gem.bin_path('bundler', 'bundle')}" install`
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -5,13 +5,16 @@ class Middleman::Templates::Blog < Middleman::Templates::Base
|
|||
|
||||
def build_scaffold
|
||||
template "blog/config.tt", File.join(location, "config.rb")
|
||||
template "blog/config.ru", File.join(location, "config.ru")
|
||||
directory "blog/source", File.join(location, "source")
|
||||
|
||||
empty_directory File.join(location, "source", options[:css_dir])
|
||||
empty_directory File.join(location, "source", options[:js_dir])
|
||||
empty_directory File.join(location, "source", options[:images_dir])
|
||||
end
|
||||
|
||||
def generate_rack
|
||||
template "blog/config.ru", File.join(location, "config.ru")
|
||||
end
|
||||
end
|
||||
|
||||
Middleman::Templates.register(:blog, Middleman::Templates::Blog)
|
|
@ -5,9 +5,6 @@ class Middleman::Templates::Default < Middleman::Templates::Base
|
|||
|
||||
def build_scaffold
|
||||
template "shared/config.tt", File.join(location, "config.rb")
|
||||
if options[:rack]
|
||||
template "shared/config.ru", File.join(location, "config.ru")
|
||||
end
|
||||
copy_file "default/source/index.html.erb", File.join(location, "source/index.html.erb")
|
||||
copy_file "default/source/layout.erb", File.join(location, "source/layout.erb")
|
||||
empty_directory File.join(location, "source", options[:css_dir])
|
||||
|
|
3
lib/middleman/templates/shared/Gemfile.tt
Normal file
3
lib/middleman/templates/shared/Gemfile.tt
Normal file
|
@ -0,0 +1,3 @@
|
|||
source "http://rubygems.org"
|
||||
|
||||
gem "middleman", "~><%= Middleman::VERSION %>"
|
|
@ -1,3 +1,3 @@
|
|||
module Middleman
|
||||
VERSION = "2.0.0.rc99"
|
||||
VERSION = "2.0.0"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue