Access your WordPress database with Ruby.
Read more: http://keita.flagship.cc/2013/06/ruby-wordpress/
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
require 'wordpress'
wp = WordPress.new options
A symbol hash.
See the mysql2 connection options.
Additional options:
:wordpress_prefix
(default: 'wp_'):wordpress_wp_content
(used for uploading attachments)
Bug fixes
WordPress#query
:post_type
accepts 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.
Bug fixes
WordPress::Post#set_post_terms
will now respect theappend
parameter, when true.WordPress::Post#set_post_terms
now accepts an empty array as theterms
argument.WordPress#query
:meta_query
now correctly queries for multiple meta query statements. OnlyAND
is supported at this point.WordPress#query
:meta_query
:type
is now respected correctlyWordPress#query
:meta_query
BETWEEN
,NOT BETWEEN
,IN
,NOT IN
works 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.
- Bug fixes
- Post meta
- Taxonomy functions
- Adds post meta queries
- Initial public release
- Basic SQL functions (WordPress::Base)
wp_options
accessor
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.
- 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