mirror of
https://github.com/middleman/middleman.git
synced 2022-11-09 12:20:27 -05:00
fix interactive init test
This commit is contained in:
parent
96e05128a1
commit
8e743aea94
3 changed files with 18 additions and 12 deletions
|
@ -11,6 +11,9 @@ rvm:
|
|||
- 2.1
|
||||
- 2.0
|
||||
- 1.9.3
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
matrix:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
|
|
|
@ -22,6 +22,7 @@ module Middleman::Cli
|
|||
|
||||
# The init task
|
||||
def init
|
||||
require 'fileutils'
|
||||
require 'tmpdir'
|
||||
|
||||
repo_path, repo_branch = if shortname?(options[:template])
|
||||
|
@ -45,10 +46,12 @@ module Middleman::Cli
|
|||
[repository_path(repo_name), repo_branch]
|
||||
end
|
||||
|
||||
Dir.mktmpdir do |dir|
|
||||
cmd = repo_branch ? "clone -b #{repo_branch}" : 'clone'
|
||||
dir = Dir.mktmpdir
|
||||
|
||||
begin
|
||||
branch_cmd = repo_branch ? "-b #{repo_branch} " : ''
|
||||
|
||||
run("git #{cmd} #{repo_path} #{dir}")
|
||||
run("git clone --depth 1 #{branch_cmd}#{repo_path} #{dir}")
|
||||
|
||||
inside(target) do
|
||||
thorfile = File.join(dir, 'Thorfile')
|
||||
|
@ -64,6 +67,8 @@ module Middleman::Cli
|
|||
|
||||
run('bundle install') unless ENV['TEST'] || options[:'skip-bundle']
|
||||
end
|
||||
ensure
|
||||
FileUtils.remove_entry(dir)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Feature: Middleman CLI
|
||||
|
||||
Scenario: Create a new project
|
||||
Given I run `middleman init MY_PROJECT`
|
||||
Given I run `middleman init --default MY_PROJECT`
|
||||
Then the exit status should be 0
|
||||
When I cd to "MY_PROJECT"
|
||||
Then the following files should exist:
|
||||
|
@ -9,17 +9,15 @@ Feature: Middleman CLI
|
|||
| .gitignore |
|
||||
| config.rb |
|
||||
| source/index.html.erb |
|
||||
| source/images/background.png |
|
||||
| source/images/middleman.png |
|
||||
| source/layouts/layout.erb |
|
||||
| source/javascripts/all.js |
|
||||
| source/stylesheets/all.css |
|
||||
| source/stylesheets/normalize.css |
|
||||
| source/stylesheets/site.css.scss |
|
||||
| source/stylesheets/_normalize.scss |
|
||||
|
||||
Scenario: Create a new project in the current directory
|
||||
Given a directory named "MY_PROJECT"
|
||||
When I cd to "MY_PROJECT"
|
||||
And I run `middleman init`
|
||||
And I run `middleman init --default`
|
||||
Then the exit status should be 0
|
||||
And the following files should exist:
|
||||
| Gemfile |
|
||||
|
@ -27,13 +25,13 @@ Feature: Middleman CLI
|
|||
| source/index.html.erb |
|
||||
|
||||
Scenario: Create a new project (alias i)
|
||||
When I run `middleman i MY_PROJECT`
|
||||
When I run `middleman i --default MY_PROJECT`
|
||||
Then a directory named "MY_PROJECT" should exist
|
||||
|
||||
Scenario: Create a new project (alias new)
|
||||
When I run `middleman new MY_PROJECT`
|
||||
When I run `middleman new --default MY_PROJECT`
|
||||
Then a directory named "MY_PROJECT" should exist
|
||||
|
||||
Scenario: Create a new project (alias n)
|
||||
When I run `middleman n MY_PROJECT`
|
||||
When I run `middleman n --default MY_PROJECT`
|
||||
Then a directory named "MY_PROJECT" should exist
|
||||
|
|
Loading…
Reference in a new issue