Wpcli
Simple wrapper for wp-cli (http://wp-cli.org/).
Just pass commands (http://wp-cli.org/commands/) to run method and use returned hash as you wish.
Installation
Add this line to your application's Gemfile:
gem 'wpcli', "~> 0.2.5"
And then execute:
$ bundle
Or install it yourself as:
$ gem install wpcli
Rails
Simplest way to use in rails is to create config file and use methods from module.
Generate example config
rails g wpcli:config
Generated file (config/wpcli.yml)
apps:
key_for_installation: /absolute/path/for/my/wp-installation
In controller include module
class MyController < ApplicationController
include Wpcli
And then you can use client with key:
users = wpcli(:key_for_installation).run "user list"
You can check if there is any apps in config with
wp_apps?
Alternative way
If you like to use client for example in command line, you can create instance with path of wordpress installation
@wpcli = Wpcli::Client.new "path/to/wp"
users = @wpcli.run "user list"
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