Skip to content
Browse files

Finishing touches

  • Loading branch information...
1 parent 322b248 commit 65d322c7363a992a153a37aded230a8307818f68 @stewart stewart committed Dec 17, 2012
Showing with 17 additions and 11 deletions.
  1. +13 −9 lib/gitnesse.rb
  2. +4 −2 lib/gitnesse/hooks.rb
View
22 lib/gitnesse.rb
@@ -1,6 +1,7 @@
require 'bundler/setup'
require 'gollum'
require 'fileutils'
+require 'pathname'
require 'tmpdir'
require 'gitnesse/configuration'
require 'gitnesse/git_config'
@@ -31,15 +32,15 @@ def self.configure
def run
if pull
Hooks.create
- puts "Now going to run cucumber..."
+ puts "\n Now going to run Cucumber."
exec("cucumber #{Gitnesse.configuration.target_directory}/*.feature")
end
end
def push_results
if push
Hooks.create
- puts "Now going to run cucumber..."
+ puts "\n Now going to run Cucumber."
exec("cucumber #{Gitnesse.configuration.target_directory}/*.feature")
end
end
@@ -48,7 +49,9 @@ def push_results
def pull
Dependencies.check
- puts "Pulling features into #{Gitnesse.configuration.target_directory} from #{Gitnesse.configuration.repository_url}..."
+ relative_path = Pathname.new(Gitnesse.configuration.target_directory).relative_path_from(Pathname.new(Dir.pwd))
+
+ puts " Pulling features into ./#{relative_path} from #{Gitnesse.configuration.repository_url}."
Dir.mktmpdir do |tmp_dir|
if clone_feature_repo(tmp_dir)
FileUtils.mkdir(Gitnesse.configuration.target_directory) unless File.exists?(Gitnesse.configuration.target_directory)
@@ -62,7 +65,7 @@ def pull
end
end
end
- puts " Done pulling features."
+ puts " \e[32mDone pulling features.\e[0m"
true
end
@@ -71,25 +74,26 @@ def push
Dependencies.check
generate_commit_info
- puts "Pushing features from #{Gitnesse.configuration.target_directory} to #{Gitnesse.configuration.repository_url}..."
+ relative_path = Pathname.new(Gitnesse.configuration.target_directory).relative_path_from(Pathname.new(Dir.pwd))
+
+ puts " Pushing features from ./#{relative_path} to #{Gitnesse.configuration.repository_url}."
Dir.mktmpdir do |tmp_dir|
if clone_feature_repo(tmp_dir)
feature_files = Dir.glob("#{Gitnesse.configuration.target_directory}/*.feature")
Wiki.new(tmp_dir).load_feature_files(feature_files)
# push the changes to the remote git
Dir.chdir(tmp_dir) do
- puts `git push origin master`
+ `git push origin master &> /dev/null`
end
end
end
- puts " Done pushing features."
+ puts " \e[32mDone pushing features.\e[0m"
true
end
def clone_feature_repo(dir)
- output = `git clone #{Gitnesse.configuration.repository_url} #{dir} 2>&1`
- puts output
+ output = `git clone #{Gitnesse.configuration.repository_url} #{dir} &> /dev/null`
$?.success?
end
View
6 lib/gitnesse/hooks.rb
@@ -9,20 +9,22 @@ def self.setup
Gitnesse::Configuration.load_using_search
FileUtils.rm_rf(@dir) if File.directory?(@dir)
Dir.mkdir(@dir)
- `git clone #{Gitnesse.configuration.repository_url} #{@dir}`
+ `git clone #{Gitnesse.configuration.repository_url} #{@dir} &> /dev/null`
Wiki.new(@dir).remove_past_results
end
# Public: Removes ~/.gitnesse after all cukes are run
#
# Returns nothing
def self.teardown
+ puts " Pushing Cucumber results to wiki."
Dir.chdir(@dir) do
- `git push origin master`
+ `git push origin master &> /dev/null`
end
FileUtils.rm_rf(@dir)
FileUtils.rm(File.absolute_path("#{Gitnesse.configuration.target_directory}/support/gitnesse_hooks.rb"))
+ puts " Done."
end
# Public: Adds hooks into Cucumber

0 comments on commit 65d322c

Please sign in to comment.
Something went wrong with that request. Please try again.