3 # Système de gestion des adhésions de Nos oignons
4 # Copyright © 2013-2014 Nos oignons <contact@nos-oignons.net>
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as
8 # published by the Free Software Foundation, either version 3 of the
9 # License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Affero General Public License for more details.
16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 Given /^un clone du Git contenant les adhésions$/ do
22 # Create main repository
23 @main_repository_path = expand_path('main')
24 create_directory 'main'
26 run_command_and_stop 'git init --quiet --bare'
30 run_command_and_stop "git clone --quiet --local file://#{expand_path('.')}/main clone"
32 create_directory 'Membres'
33 BASE_MEMBERS.each_pair do |number, data|
34 file = member_filename_for_id(number)
35 File.write file, render_member_file(data)
36 run_command_and_stop "git add #{file}"
38 run_command_and_stop 'git commit -m "Initial data set from fixtures"'
39 run_command_and_stop 'git push --quiet origin master'
42 Given /^le « pre-commit hook » correctement configuré$/ do
43 FileUtils.ln_s File.expand_path('../../../bin/pre-commit-hook', __FILE__),
44 "#{expand_path('.')}/.git/hooks/pre-commit"
47 Given /^le « pre-receive hook » configuré sur le dépôt principal$/ do
48 FileUtils.ln_s File.expand_path('../../../bin/pre-receive-hook', __FILE__),
49 "#{@main_repository_path}/hooks/pre-receive"
52 When /je fais un `commit` du nouveau fichier$/ do
53 run_command_and_stop "git add #{@file}"
54 run_command_and_stop "git commit #{@file} -m 'new file'", :fail_on_error => false # do not fail on error
57 When /je pousse la modification$/ do
58 run_command_and_stop "git add #{@file}"
59 run_command_and_stop "git commit #{@file} -m 'new file'"
60 run_command_and_stop 'git push origin master', :fail_on_error => false # do not fail on error