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.
@@ -1,12 +1,31 @@
1
1
  # Changelog
2
2
 
3
- ### Release 0.0.4 - Not Released Yet
3
+ ### Release 0.0.6 - 29th November 2011
4
4
  * 1 major feature
5
- * Using clamp gem
6
- * 1 minor feature
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
- ### Release 0.0.3 - 17th May
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
- ### Release 0.0.2 - 16th May
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 (aka WordPress Bash) provides a Terminal interface to WordPress. It tries to achieve a similar feel to irb and the rails console.
5
- For example working with users you will be able to do something like this
6
- ```ruby
7
- wpb:01> User.find 1
8
- => #<WPB::UserObject:0x0000010087ef78 @name="James Birtles", @username="jamesbirtles">
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)
@@ -7,9 +7,9 @@ class Bash < Clamp::Command
7
7
  exit 0
8
8
  end
9
9
 
10
- # self.default_subcommand = "console"
10
+ self.default_subcommand = "console"
11
11
 
12
- subcommand ["console", "c"], "Start the wpb console" do
12
+ subcommand ["c", "console"], "Start the wpb console" do
13
13
  def execute
14
14
  require "pry"
15
15
  require "wpb"
@@ -48,21 +48,9 @@ class Comment < ActiveRecord::Base
48
48
 
49
49
  validates_presence_of :comment_post_ID
50
50
 
51
- before_create :set_default_values
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
@@ -11,33 +11,8 @@ class PagePost < ActiveRecord::Base
11
11
 
12
12
  has_many :comments, :foreign_key => :comment_post_ID
13
13
 
14
- ##
15
- # Grab the title of the selected page/post
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
@@ -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
- # Grab the name of the selected user
26
+ alias_attribute :name, :display_name
27
+ alias_attribute :username, :user_login
28
+ alias_attribute :email, :user_email
21
29
 
22
- def name
23
- display_name
24
- end
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
@@ -2,5 +2,5 @@ module WPB
2
2
  ##
3
3
  # The version of WPB you are using
4
4
 
5
- VERSION = "0.0.6.pre"
5
+ VERSION = "0.0.6"
6
6
  end
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.pre
5
- prerelease: 6
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-28 00:00:00.000000000Z
12
+ date: 2011-11-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
16
- requirement: &70301384249100 !ruby/object:Gem::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: *70301384249100
24
+ version_requirements: *70159126048220
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: clamp
27
- requirement: &70301384248580 !ruby/object:Gem::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: *70301384248580
35
+ version_requirements: *70159126047340
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: pry
38
- requirement: &70301384248040 !ruby/object:Gem::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: *70301384248040
46
+ version_requirements: *70159126046380
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: mysql
49
- requirement: &70301384247620 !ruby/object:Gem::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: *70301384247620
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: 1.3.1
125
+ version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
128
  rubygems_version: 1.8.10