]> nos-oignons.net Git - gestion-adh.git/blob - features/step_definitions/git.rb
Silence git commands in cucumber step definitions
[gestion-adh.git] / features / step_definitions / git.rb
1 require 'fileutils'
2
3 Given /^un clone du Git contenant les adhésions$/ do
4   # Create main repository
5   create_dir 'main'
6   cd 'main'
7   @main_repository_path = current_dir
8   run_simple 'git init --quiet --bare'
9   cd '..'
10
11   # Clone it now
12   run_simple 'git clone --quiet main clone'
13   cd 'clone'
14   create_dir 'Membres'
15   BASE_SUBSCRIPTIONS.each_pair do |number, data|
16     file = subscription_filename_for_id(number)
17     write_file file, render_subscription_file(data)
18     run_simple "git add #{file}"
19   end
20   run_simple 'git commit --quiet -m "Initial data set from fixtures"'
21   run_simple 'git push --quiet origin master'
22 end
23
24 Given /^le « pre-commit hook » correctement configuré$/ do
25   FileUtils.ln_s File.expand_path('../../../bin/pre-commit-hook', __FILE__),
26                  "#{current_dir}/.git/hooks/pre-commit"
27 end
28
29 Given /^le « pre-receive hook » configuré sur le dépôt principal$/ do
30   FileUtils.ln_s File.expand_path('../../../bin/pre-receive-hook', __FILE__),
31                  "#{@main_repository_path}/hooks/pre-receive"
32 end
33
34 When /je fais un `commit` du nouveau fichier$/ do
35   run_simple "git add #{@file}"
36   run_simple "git commit #{@file} -m 'new file'", false # do not fail on error
37 end
38
39 When /^que je pousse la modification$/ do
40   run_simple "git add #{@file}"
41   run_simple "git commit #{@file} -m 'new file'"
42   run_simple 'git push origin master', false # do not fail on error
43 end