wpcli 0.2.8 → 0.2.9

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69416214e0ff7cc602e0bce7e95bf466ada7b378
4
- data.tar.gz: 498a6a9fa64b8f550384f5c488ef4771cbfeab6d
3
+ metadata.gz: 6048ce6f7e41dcac491c48864ea902995321ad3b
4
+ data.tar.gz: 124e7adc200763a4ea2e0a75732dc7bc7903d8bd
5
5
  SHA512:
6
- metadata.gz: 326243e1b545cad05f97b6b53cbef0d61811d72639586535abd666774275b779a5d40638361b3562486e0b132e995bf8ae62e6cde4f53565fd20afc15defdbb0
7
- data.tar.gz: f79a71435c9ebed8ac0c95b0179186995ade6cee8f278b1011156620dd3400e87fd36d3b4f0bd2662e4cd704e4b68ae005e49cb878fce24167a3eccdbc15582f
6
+ metadata.gz: 05cb227811e819929b1b40d0311ffc6cb8751875c81174888190f34314bb7c7af616ae755e5ba913929c7d36ff5b78b667ef722f1864f634a5b515766a78430b
7
+ data.tar.gz: 54287f3c5e3e90003b1e62bf10fd4614083c50f7bd0860e20fbf17525ede31322bda1bb8f06bc449a75ca8a0d8c9fc063cbf4964eca74f9103faf76bb6b72801
@@ -0,0 +1,15 @@
1
+ FROM conetix/wordpress-with-wp-cli
2
+
3
+ RUN apt-get update && apt-get install -y ruby2.1 git
4
+
5
+ COPY templates/wp-cli.yml .
6
+
7
+ ENV WPCLI_HOME /wpcli
8
+ RUN mkdir $WPCLI_HOME
9
+ WORKDIR $WPCLI_HOME
10
+
11
+ RUN gem2.1 install bundler
12
+ ADD . $WPCLI_HOME
13
+ RUN bundle install
14
+
15
+ WORKDIR /var/www/html
data/README.md CHANGED
@@ -8,7 +8,7 @@ Just pass commands (http://wp-cli.org/commands/) to run method and use returned
8
8
 
9
9
  Add this line to your application's Gemfile:
10
10
 
11
- gem 'wpcli', "~> 0.2.8"
11
+ gem 'wpcli', "~> 0.2.9"
12
12
 
13
13
  And then execute:
14
14
 
@@ -52,6 +52,22 @@ If you like to use client for example in command line, you can create instance w
52
52
  @wpcli = Wpcli::Client.new "path/to/wp"
53
53
  users = @wpcli.run "user list"
54
54
 
55
+ ## Docker
56
+
57
+ Easiest way to test the gem is to use Docker.
58
+
59
+ First build image with
60
+
61
+ docker-compose build
62
+
63
+ Then start the containers
64
+
65
+ docker-compose up -d
66
+
67
+ And access to irb
68
+
69
+ docker exec -it wpcli_wpcli_1 /wpcli/bin/irb
70
+
55
71
  ## Contributing
56
72
 
57
73
  1. Fork it
data/bin/irb ADDED
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ irb2.1 -I /wpcli/lib -r wpcli
@@ -0,0 +1,11 @@
1
+ wpcli:
2
+ build: .
3
+ links:
4
+ - db:mysql
5
+ ports:
6
+ - 8080:80
7
+
8
+ db:
9
+ image: mariadb
10
+ environment:
11
+ MYSQL_ROOT_PASSWORD: password
@@ -11,10 +11,13 @@ module Wpcli
11
11
  private
12
12
 
13
13
  def parse text
14
+ lines = text.split("\n")
15
+ return text.strip if lines.size == 1
16
+
14
17
  single_value = false
15
18
  first_data_row = starts_with_plus?(text) ? 3 : 1
16
19
  rows = []
17
- text.split("\n").each_with_index do |line, index|
20
+ lines.each_with_index do |line, index|
18
21
  unless is_blank?(line) || starts_with_plus?(line)
19
22
  separator = line.include?('|') ? '|' : "\t"
20
23
  if index < first_data_row
@@ -67,4 +70,4 @@ module Wpcli
67
70
  false
68
71
  end
69
72
  end
70
- end
73
+ end
@@ -1,3 +1,3 @@
1
1
  module Wpcli
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.9"
3
3
  end
@@ -1,6 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Wpcli::Client do
4
+ let(:wp_option_get_siteurl) do <<EOF
5
+ http://localhost:8080
6
+ EOF
7
+ end
8
+
4
9
  let(:wp_user_list) do <<EOF
5
10
  +----+--------------------------+----------------+------------------------------+---------------------+------------------------------------+
6
11
  | ID | user_login | display_name | user_email | user_registered | roles |
@@ -229,5 +234,16 @@ EOF
229
234
  end
230
235
  end
231
236
  end
237
+
238
+ context "get option" do
239
+ before :each do
240
+ @wpcli.stub(:`).with("wp option get siteurl").and_return(wp_option_get_siteurl)
241
+ @response = @wpcli.run "option get siteurl"
242
+ end
243
+
244
+ it "returns url" do
245
+ expect(@response).to eq("http://localhost:8080")
246
+ end
247
+ end
232
248
  end
233
249
  end
@@ -0,0 +1 @@
1
+ path: /var/www/html
@@ -1,6 +1,5 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
2
+ $:.push File.expand_path("../lib", __FILE__)
4
3
  require 'wpcli/version'
5
4
 
6
5
  Gem::Specification.new do |spec|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wpcli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joni Hasanen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-18 00:00:00.000000000 Z
11
+ date: 2016-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -69,17 +69,21 @@ dependencies:
69
69
  description: Simple wrapper for wp-cli (http://wp-cli.org/)
70
70
  email:
71
71
  - joni.hasanen@pieceofcode.net
72
- executables: []
72
+ executables:
73
+ - irb
73
74
  extensions: []
74
75
  extra_rdoc_files: []
75
76
  files:
76
77
  - ".gitignore"
77
78
  - ".rspec"
78
79
  - ".travis.yml"
80
+ - Dockerfile
79
81
  - Gemfile
80
82
  - LICENSE.txt
81
83
  - README.md
82
84
  - Rakefile
85
+ - bin/irb
86
+ - docker-compose.yml
83
87
  - lib/rails/generators/wpcli/config/config_generator.rb
84
88
  - lib/rails/generators/wpcli/config/templates/config_example.yml
85
89
  - lib/wpcli.rb
@@ -88,6 +92,7 @@ files:
88
92
  - lib/wpcli/version.rb
89
93
  - spec/spec_helper.rb
90
94
  - spec/wpcli/client_spec.rb
95
+ - templates/wp-cli.yml
91
96
  - wpcli.gemspec
92
97
  homepage: http://wpcli.pieceofcode.net
93
98
  licenses:
@@ -109,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
114
  version: '0'
110
115
  requirements: []
111
116
  rubyforge_project:
112
- rubygems_version: 2.2.2
117
+ rubygems_version: 2.4.8
113
118
  signing_key:
114
119
  specification_version: 4
115
120
  summary: Simple wrapper for wp-cli (http://wp-cli.org/)