Il vient de `whois cogent.fr`.
000002:
name: Sylvain Dufier
- address: |
- ORANGE FRANCE
- 13, rue de Javel
- 75015 Paris
email: sylvain.dufier@orange-ftgroup.com
joined_on: 2013-05-20
membership_fee_paid_on: 2013-05-29
MEMBER_FILE_TEMPLATE = <<'END_OF_TEMPLATE'
---
name: <%= name %>
+<% unless address.nil? -%>
address: |
<%= address.gsub(/^/, ' ').rstrip %>
+<% end -%>
email: <%= email %>
joined_on: <%= joined_on %>
membership_fee_paid_on: <%= membership_fee_paid_on %>
END_OF_TEMPLATE
def member_filename_for_id(id)
- "Membres/%06d.mdwn" % id
+ expand_path("Membres/%06d.mdwn" % id)
end
def render_member_file(locals)
- ERB.new(MEMBER_FILE_TEMPLATE).result(OpenStruct.new(locals).instance_eval { binding })
+ ERB.new(MEMBER_FILE_TEMPLATE, nil, '-').result(OpenStruct.new(locals).instance_eval { binding })
end
def new_id
- max_id = Dir.glob("#{current_dir}/Membres/*.mdwn").
+ max_id = Dir.glob("#{expand_path('Membres')}/*.mdwn").
collect { |f| File.basename(f).gsub(/\.mdwn$/, '').to_i }.max || 0
max_id + 1
end