Ruby/WordPress
Access your WordPress database with Ruby.
Read more: http://keita.flagship.cc/2013/06/ruby-wordpress/
Installation
Add this line to your application's Gemfile:
gem 'ruby-wordpress', :require => 'wordpress'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ruby-wordpress
Usage
require 'wordpress'
wp = WordPress.new options
Initialization options
A symbol hash.
See the mysql2 connection options.
Additional options:
- 
:wordpress_prefix(default: 'wp_')
- 
:wordpress_wp_content(used for uploading attachments)
Changelog
0.0.4
Bug fixes
- 
WordPress#query:post_typeaccepts an Array parameter now.
- MySQL 5.6 "strict mode" error complaining about the format of dates is now fixed.
Notes
- 1.8.7 is no longer supported.
0.0.3
Bug fixes
- 
WordPress::Post#set_post_termswill now respect theappendparameter, when true.
- 
WordPress::Post#set_post_termsnow accepts an empty array as thetermsargument.
- 
WordPress#query:meta_querynow correctly queries for multiple meta query statements. OnlyANDis supported at this point.
- 
WordPress#query:meta_query:typeis now respected correctly
- 
WordPress#query:meta_queryBETWEEN,NOT BETWEEN,IN,NOT INworks as expected.
New features
- PHP serialization for Ruby arrays and hashes in WordPress::Options
- 1.8.7 syntax support
- Added WordPress::Post#==. Comparison is performed only with IDs now.
0.0.2
- Bug fixes
- Post meta
- Taxonomy functions
- Adds post meta queries
0.0.1
- Initial public release
- Basic SQL functions (WordPress::Base)
- 
wp_optionsaccessor
Hacking
Hack away! Just make sure you have your test_configuration.yml file set up correctly. There's an example in test_configuration.example.yml; you can copy this and tailor it to your environment.
Please do not use a real database for testing - it is wiped clean before the suite runs, and loads the attached WordPress default schema.
The default rake task will run the entire test suite.
Contributing
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request