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