# For an OO language, this is distinctly procedural. Should probably fix that.
require'json'
details=Hash.new({})
capture_params=[
{:name=>"title",:message=>"Enter project name."},
{:name=>"url",:message=>"Enter the URL of the project repository."},
{:name=>"description",:message=>"Enter the (short) project description."},
{:name=>"license",:message=>"Enter the license this software shared under. (hit enter to skip)\nFor example MIT, BSD, GPL v3.0, Apache 2.0"},
{:name=>"doi",:message=>"Enter the DOI of the archived version of this code. (hit enter to skip)\nFor example http://dx.doi.org/10.6084/m9.figshare.828487"},
{:name=>"keywords",:message=>"Enter keywords that should be associated with this project (hit enter to skip)\nComma-separated, for example: turkey, chicken, pot pie"},
{:name=>"version",:message=>"Enter the version of your software (hit enter to skip)\nSEMVER preferred: http://semver.org e.g. v1.0.0"}
]
puts"I'm going to try and help you prepare some things for your JOSS submission"
puts"If all goes well then we'll have a nice codemeta.json file soon..."
puts""
puts"************************************"
puts"* First, some basic details *"
puts"************************************"
puts""
# Loop through the desired captures and print out for clarity
capture_params.eachdo|param|
putsparam[:message]
print"> "
input=gets
details[param[:name]]=input.chomp
puts""
puts"OK, your project has #{param[:name]}: #{input}"
puts""
end
puts""
puts"************************************"
puts"* Experimental stuff *"
puts"************************************"
puts""
puts"Would you like me to try and build a list of authors for you?"
puts"(You need to be running this script in a git repository for this to work)"
print"> (Y/N)"
answer=gets.chomp
caseanswer.downcase
when"y","yes"
# Use git shortlog to extract a list of author names and commit counts.
# Note we don't extract emails here as there's often different emails for
# each user. Instead we capture emails at the end.