wpb 0.0.6.pre → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Changelog.md +28 -5
- data/README.md +13 -6
- data/lib/wpb/bash.rb +2 -2
- data/lib/wpb/comment.rb +2 -14
- data/lib/wpb/pagepost.rb +2 -27
- data/lib/wpb/user.rb +13 -40
- data/lib/wpb/version.rb +1 -1
- metadata +13 -13
data/Changelog.md
CHANGED
@@ -1,12 +1,31 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
### Release 0.0.
|
3
|
+
### Release 0.0.6 - 29th November 2011
|
4
4
|
* 1 major feature
|
5
|
-
|
6
|
-
*
|
5
|
+
* Using pry
|
6
|
+
* 3 minor features
|
7
|
+
* Removed local version of clamp
|
8
|
+
* Requires mysql to be installed
|
9
|
+
* Custom inspect messages
|
10
|
+
* 1 major bug fix
|
11
|
+
* Would not connect to database
|
12
|
+
|
13
|
+
***
|
14
|
+
|
15
|
+
### Release 0.0.5 - 20th May 2011
|
16
|
+
* 1 major feature
|
17
|
+
* Using local clamp gem
|
18
|
+
* 2 minor features
|
7
19
|
* Added `-v` and `--version` flags for executable
|
20
|
+
* Added RDoc comments
|
8
21
|
|
9
|
-
|
22
|
+
***
|
23
|
+
|
24
|
+
### Release 0.0.4 - Skipped
|
25
|
+
|
26
|
+
***
|
27
|
+
|
28
|
+
### Release 0.0.3 - 17th May 2011
|
10
29
|
* 1 major feature
|
11
30
|
* Added comments support
|
12
31
|
* 3 minor features
|
@@ -19,12 +38,16 @@
|
|
19
38
|
* 1 depreciated
|
20
39
|
* `body` and `body=` in Page/Post models use `content` and `content=` instead (method removed completeley)
|
21
40
|
|
22
|
-
|
41
|
+
***
|
42
|
+
|
43
|
+
### Release 0.0.2 - 16th May 2011
|
23
44
|
* 1 minor feature
|
24
45
|
* Added connection between the User and the Post/Page
|
25
46
|
* 1 major bug fix
|
26
47
|
* WordPress pages would break with inheritance issue
|
27
48
|
|
49
|
+
***
|
50
|
+
|
28
51
|
### Release 0.0.1 - Not Publicly Released
|
29
52
|
* 1 major feature
|
30
53
|
* Initial release
|
data/README.md
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
# WPB (WordPress Bash)
|
2
2
|
|
3
3
|
## About
|
4
|
-
WPB
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
```
|
4
|
+
WPB allows you to access your wordpress database through the console in a similar way to the rails console.
|
5
|
+
|
6
|
+
## Install
|
7
|
+
```sh
|
8
|
+
gem install wpb
|
9
|
+
```
|
10
|
+
|
11
|
+
## Troubleshooting
|
12
|
+
* Make sure you have mysql installed on your machine for the mysql gem to install, you also need some kind of compiler
|
13
|
+
* For mac, you need xcode and homebrew and you can install mysql as follows. `brew install mysql`
|
14
|
+
|
15
|
+
## Contributing
|
16
|
+
* Fork the [git repo](http://github.com/jamesbirtles/WPB)
|
data/lib/wpb/bash.rb
CHANGED
@@ -7,9 +7,9 @@ class Bash < Clamp::Command
|
|
7
7
|
exit 0
|
8
8
|
end
|
9
9
|
|
10
|
-
|
10
|
+
self.default_subcommand = "console"
|
11
11
|
|
12
|
-
subcommand ["
|
12
|
+
subcommand ["c", "console"], "Start the wpb console" do
|
13
13
|
def execute
|
14
14
|
require "pry"
|
15
15
|
require "wpb"
|
data/lib/wpb/comment.rb
CHANGED
@@ -48,21 +48,9 @@ class Comment < ActiveRecord::Base
|
|
48
48
|
|
49
49
|
validates_presence_of :comment_post_ID
|
50
50
|
|
51
|
-
|
51
|
+
before_save :set_default_values
|
52
52
|
|
53
|
-
|
54
|
-
# Grab the content of the selected comment
|
55
|
-
|
56
|
-
def content
|
57
|
-
comment_content
|
58
|
-
end
|
59
|
-
|
60
|
-
##
|
61
|
-
# Set the content of the selected comment
|
62
|
-
|
63
|
-
def content= new_content
|
64
|
-
self.comment_content = new_content
|
65
|
-
end
|
53
|
+
alias_attribute :content, :comment_content
|
66
54
|
|
67
55
|
private
|
68
56
|
def set_default_values
|
data/lib/wpb/pagepost.rb
CHANGED
@@ -11,33 +11,8 @@ class PagePost < ActiveRecord::Base
|
|
11
11
|
|
12
12
|
has_many :comments, :foreign_key => :comment_post_ID
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
def title
|
18
|
-
post_title
|
19
|
-
end
|
20
|
-
|
21
|
-
##
|
22
|
-
# Set the title of the selected page/post
|
23
|
-
|
24
|
-
def title= new_title
|
25
|
-
self.post_title = new_title
|
26
|
-
end
|
27
|
-
|
28
|
-
##
|
29
|
-
# Grab the content of the selected page/post
|
30
|
-
|
31
|
-
def content
|
32
|
-
post_content
|
33
|
-
end
|
34
|
-
|
35
|
-
##
|
36
|
-
# Set the content of the selected page/post
|
37
|
-
|
38
|
-
def content= new_content
|
39
|
-
self.post_content = new_content
|
40
|
-
end
|
14
|
+
alias_attribute :title, :post_title
|
15
|
+
alias_attribute :content, :post_content
|
41
16
|
|
42
17
|
private
|
43
18
|
def set_default_values
|
data/lib/wpb/user.rb
CHANGED
@@ -8,6 +8,13 @@ require "active_record"
|
|
8
8
|
# The above will find the user with id of 1 and retrieve their display name
|
9
9
|
|
10
10
|
class User < ActiveRecord::Base
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def inspect
|
14
|
+
"User(id: integer, name: string, username: string, email: string)"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
11
18
|
set_table_name :wp_users
|
12
19
|
set_primary_key :ID
|
13
20
|
|
@@ -16,45 +23,11 @@ class User < ActiveRecord::Base
|
|
16
23
|
has_many :posts, :foreign_key => :post_author
|
17
24
|
has_many :comments, :foreign_key => :user_id
|
18
25
|
|
19
|
-
|
20
|
-
|
26
|
+
alias_attribute :name, :display_name
|
27
|
+
alias_attribute :username, :user_login
|
28
|
+
alias_attribute :email, :user_email
|
21
29
|
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
##
|
27
|
-
# Set the name of the selected user
|
28
|
-
|
29
|
-
def name= name
|
30
|
-
self.display_name = name
|
31
|
-
end
|
32
|
-
|
33
|
-
##
|
34
|
-
# Grab the username of the selected user
|
35
|
-
|
36
|
-
def username
|
37
|
-
user_login
|
38
|
-
end
|
39
|
-
|
40
|
-
##
|
41
|
-
# Set the username of the selected user
|
42
|
-
|
43
|
-
def username= username
|
44
|
-
self.user_login = username
|
45
|
-
end
|
46
|
-
|
47
|
-
##
|
48
|
-
# Grab the email of the selected user
|
49
|
-
|
50
|
-
def email
|
51
|
-
user_email
|
52
|
-
end
|
53
|
-
|
54
|
-
##
|
55
|
-
# Set the email of the selected user
|
56
|
-
|
57
|
-
def email= email
|
58
|
-
self.user_email = email
|
59
|
-
end
|
30
|
+
def inspect
|
31
|
+
"#<User id: #{id}, name: \"#{name}\", username: \"#{username}\", email: \"#{email}\">"
|
32
|
+
end
|
60
33
|
end
|
data/lib/wpb/version.rb
CHANGED
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wpb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.6
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.6
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- James Birtles
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-11-
|
12
|
+
date: 2011-11-29 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
16
|
-
requirement: &
|
16
|
+
requirement: &70159126048220 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - =
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70159126048220
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: clamp
|
27
|
-
requirement: &
|
27
|
+
requirement: &70159126047340 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.3.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70159126047340
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: pry
|
38
|
-
requirement: &
|
38
|
+
requirement: &70159126046380 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.9.7
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70159126046380
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: mysql
|
49
|
-
requirement: &
|
49
|
+
requirement: &70159126045420 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70159126045420
|
58
58
|
description: WPB (WordPress Bash) provides a Terminal interface to WordPress. It uses
|
59
59
|
ActiveRecord, which means the sytax is mostly the same
|
60
60
|
email:
|
@@ -120,9 +120,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
120
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
121
|
none: false
|
122
122
|
requirements:
|
123
|
-
- - ! '
|
123
|
+
- - ! '>='
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
125
|
+
version: '0'
|
126
126
|
requirements: []
|
127
127
|
rubyforge_project:
|
128
128
|
rubygems_version: 1.8.10
|