Class: Phpmyadmin::Backup
- Inherits:
-
Object
- Object
- Phpmyadmin::Backup
- Defined in:
- lib/phpmyadmin/backup.rb,
lib/phpmyadmin/backup/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Instance Attribute Summary collapse
-
#agent ⇒ Object
readonly
Returns the value of attribute agent.
-
#last_page ⇒ Object
readonly
Returns the value of attribute last_page.
Instance Method Summary collapse
- #export(database_names = []) ⇒ Object
-
#initialize(host, username, password) ⇒ Backup
constructor
A new instance of Backup.
Constructor Details
#initialize(host, username, password) ⇒ Backup
Returns a new instance of Backup.
9 10 11 12 13 14 |
# File 'lib/phpmyadmin/backup.rb', line 9 def initialize(host, username, password) @host = host @agent = create_agent @last_page = nil login(username, password) end |
Instance Attribute Details
#agent ⇒ Object (readonly)
Returns the value of attribute agent.
7 8 9 |
# File 'lib/phpmyadmin/backup.rb', line 7 def agent @agent end |
#last_page ⇒ Object (readonly)
Returns the value of attribute last_page.
7 8 9 |
# File 'lib/phpmyadmin/backup.rb', line 7 def last_page @last_page end |
Instance Method Details
#export(database_names = []) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/phpmyadmin/backup.rb', line 16 def export(database_names=[]) export_url = last_page.search("#li_export a").first['href'] get export_url do |page| dump_form = page.form_with :name => 'dump' if database_names.empty? database_names = dump_form.field_with(:name => 'db_select[]'). end database_names.each do |database_name| filename = export_single(export_url, database_name) yield filename if block_given? end end end |