-
-
Save sixtyfive/2180574730f3f2f28ee1532639c9a9f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :add_exercises do | |
require Config.lib+'server' | |
include Wordcabin | |
Exercise.connection | |
loop do | |
print "name ('DONE' to end input): " | |
name = STDIN.gets.chomp | |
p(name) | |
break if name.include? "DONE" | |
print "html ('NEXT' for next item, precede with 'DONE' to end input): " | |
html = STDIN.gets("NEXT").chomp | |
break if html.include? "DONE" | |
x = Exercise.new( | |
type: Wordcabin::ExerciseTypes::Fake.to_s, | |
name: name, | |
html: html.gsub(/NEXT/, '') | |
) | |
x.save; puts "Saved #{x.id}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rake wordcabin:add_exercises | |
Configuring database /home/fub/wordcabin/data/aop/databases/all_books.sqlite3 | |
name ('DONE' to end input): joifwjfoiew | |
"joifwjfoiew" | |
html ('NEXT' for next item, precede with 'DONE' to end input): oijewjfoioif | |
NEXT | |
Saved 118 | |
name ('DONE' to end input): "" | |
html ('NEXT' for next item, precede with 'DONE' to end input): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment