make install also install a gemfile if you don't have one
This commit is contained in:
parent
b7626a1107
commit
5cdbdd4ffc
37
bin/penchant
37
bin/penchant
@ -23,6 +23,16 @@ class PenchantCLI < Thor
|
||||
else
|
||||
puts "No git repository detected here. Skipping git hook installation..."
|
||||
end
|
||||
|
||||
if !File.file?('Gemfile') && !File.file?('Gemfile.penchant')
|
||||
FileUtils.touch('Gemfile.penchant')
|
||||
|
||||
prepend_to_file 'Gemfile.penchant', <<-RB
|
||||
source :rubygems
|
||||
RB
|
||||
|
||||
install_gemfile_penchant
|
||||
end
|
||||
end
|
||||
|
||||
desc "update", "Update the installed scripts"
|
||||
@ -36,18 +46,7 @@ class PenchantCLI < Thor
|
||||
def convert
|
||||
install
|
||||
FileUtils.mv 'Gemfile', 'Gemfile.penchant'
|
||||
prepend_to_file 'Gemfile.penchant', <<-RB
|
||||
# ensure git hooks are always installed
|
||||
ensure_git_hooks!
|
||||
|
||||
# everything in the :local env is assumed to be a sibling directory of this one
|
||||
defaults_for env(:local), :path => '../%s'
|
||||
|
||||
# reference a github repository with gem 'my-gem', :github => 'username'
|
||||
property :github, :git => 'git://github.com/$1/%s.git'
|
||||
|
||||
RB
|
||||
gemfile(:remote)
|
||||
install_gemfile_penchant
|
||||
end
|
||||
|
||||
method_options :deployment => false
|
||||
@ -118,6 +117,20 @@ property :github, :git => 'git://github.com/$1/%s.git'
|
||||
puts
|
||||
end
|
||||
end
|
||||
|
||||
def install_gemfile_penchant
|
||||
prepend_to_file 'Gemfile.penchant', <<-RB
|
||||
# ensure git hooks are always installed
|
||||
ensure_git_hooks!
|
||||
|
||||
# everything in the :local env is assumed to be a sibling directory of this one
|
||||
defaults_for env(:local), :path => '../%s'
|
||||
|
||||
# reference a github repository with gem 'my-gem', :github => 'username'
|
||||
property :github, :git => 'git://github.com/$1/%s.git'
|
||||
RB
|
||||
gemfile(:remote)
|
||||
end
|
||||
end
|
||||
|
||||
default_task :gemfile
|
||||
|
@ -61,3 +61,18 @@ Feature: CLI
|
||||
Given I have the symlink "tmp/.git/hooks/pre-commit" which points to "tmp/script/hooks/pre-commit"
|
||||
When I run "bin/penchant gemfile remote" in the "tmp" directory
|
||||
Then the output should not include "git hooks not installed"
|
||||
|
||||
@wip
|
||||
Scenario: Install Penchant into a directory with no Gemfile
|
||||
Given I have the directory "tmp"
|
||||
When I run "bin/penchant install" in the "tmp" directory
|
||||
Then the file "tmp/Gemfile.penchant" should include the following content:
|
||||
"""
|
||||
source :rubygems
|
||||
"""
|
||||
Then the file "tmp/Gemfile" should include the following content:
|
||||
"""
|
||||
source :rubygems
|
||||
"""
|
||||
And the output should include "No git"
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
module Penchant
|
||||
VERSION = "0.2.18"
|
||||
VERSION = "0.2.19"
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user