governor_livejournal 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ./
3
3
  specs:
4
- governor_livejournal (0.1.0)
4
+ governor_livejournal (0.2.0)
5
5
  governor
6
6
  governor_background
7
7
  livejournal
@@ -67,7 +67,7 @@ GEM
67
67
  bundler (~> 1.0.0)
68
68
  git (>= 1.2.5)
69
69
  rake
70
- livejournal (0.3.3)
70
+ livejournal (0.3.4)
71
71
  mail (2.2.17)
72
72
  activesupport (>= 2.3.6)
73
73
  i18n (>= 0.4.0)
data/README.rdoc CHANGED
@@ -1,6 +1,38 @@
1
1
  = governor_livejournal
2
2
 
3
- Description goes here.
3
+ <b>Governor[http://carpeliam.github.com/governor/]</b> (named after Rod
4
+ Blagojevich) is the pluggable blogging platform for Rails, built for people
5
+ who want to build their blog into their website, not build their website into
6
+ their blog.
7
+
8
+ *governor_livejournal* is a plugin for Governor, allowing you to cross-post your
9
+ articles to LiveJournal[http://www.livejournal.com].
10
+
11
+ == Dependencies
12
+
13
+ * Governor[http://carpeliam.github.com/governor/]
14
+ * GovernorBackground[https://github.com/carpeliam/governor_background]
15
+ * The livejournal[https://github.com/carpeliam/livejournal] gem
16
+ * And because of the GovernorBackground dependency, either
17
+ Delayed_Job[https://github.com/collectiveidea/delayed_job] or
18
+ Resque[https://github.com/defunkt/resque]. If you use Resque, it's highly
19
+ recommended that you use
20
+ resque-status[https://github.com/quirkey/resque-status] as well.
21
+
22
+ == Setting up
23
+
24
+ First, install the above dependencies. Then, in your Gemfile, add the
25
+ following:
26
+
27
+ gem 'governor_livejournal'
28
+
29
+ Once you've installed the gem into your app, you need to run the generator:
30
+
31
+ rails generate governor:add_livejournal [RESOURCE]
32
+
33
+ This will add a migration for associating articles to livejournal posts as
34
+ well as an initializer in which you'll need to set your username and password
35
+ for livejournal.
4
36
 
5
37
  == Contributing to governor_livejournal
6
38
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -0,0 +1,9 @@
1
+ <p>
2
+ <b>Include in LiveJournal?</b>
3
+ <%= f.check_box :is_livejournal %>
4
+ </p>
5
+
6
+ <p>
7
+ <b>Security level</b><br/>
8
+ <%= f.select :livejournal_security, %w(public friends private) %>
9
+ </p>
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{governor_livejournal}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Liam Morley"]
12
- s.date = %q{2011-04-24}
12
+ s.date = %q{2011-04-25}
13
13
  s.description = %q{A plugin for the Rails 3-based Governor blogging system that posts and updates articles to LiveJournal.com.}
14
14
  s.email = %q{liam@carpeliam.com}
15
15
  s.extra_rdoc_files = [
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
25
25
  "README.rdoc",
26
26
  "Rakefile",
27
27
  "VERSION",
28
+ "app/views/governor/articles/_livejournal_form.html.erb",
28
29
  "config/locales/en.yml",
29
30
  "governor_livejournal.gemspec",
30
31
  "lib/generators/governor/add_livejournal_generator.rb",
@@ -1,9 +1,17 @@
1
1
  class GovernorAddLivejournal < ActiveRecord::Migration
2
2
  def self.up
3
- add_column :<%= mapping.plural %>, :livejournal_id, :integer
3
+ change_table :<%= mapping.plural %> do |t|
4
+ t.boolean :is_livejournal
5
+ t.string :livejournal_security, :default => 'public'
6
+ t.references :livejournal
7
+ end
4
8
  end
5
9
 
6
10
  def self.down
7
- remove_column :<%= mapping.plural %>, :livejournal_id
11
+ change_table :<%= mapping.plural %> do |t|
12
+ t.remove :is_livejournal
13
+ t.remove :livejournal_security
14
+ t.remove :livejournal_id
15
+ end
8
16
  end
9
17
  end
@@ -1,3 +1,4 @@
1
+ require 'livejournal'
1
2
  module GovernorLivejournal
2
3
  module InstanceMethods
3
4
  def post_to_livejournal
@@ -45,7 +46,7 @@ module GovernorLivejournal
45
46
  entry.event = Governor::Formatters.format_article self
46
47
  entry.time = LiveJournal::coerce_gmt(self.created_at.present? ? self.created_at : Time.now)
47
48
  entry.preformatted = false
48
- # entry.security = @@security[article.lj_security]
49
+ entry.security = livejournal_security.to_sym
49
50
  entry
50
51
  end
51
52
  end
@@ -5,11 +5,15 @@ livejournal = Governor::Plugin.new('livejournal')
5
5
 
6
6
  livejournal.register_model_callback do |base|
7
7
  base.send :include, GovernorLivejournal::InstanceMethods
8
- base.after_save :post_to_livejournal_in_background, :unless => Proc.new { |article|
9
- article.changed.any?{|attribute| !%w(id title description post author_id author_type created_at updated_at).include? attribute }
8
+ base.after_save :post_to_livejournal_in_background, :if => Proc.new { |article|
9
+ article_properties = %w(title description post)
10
+ livejournal_properties = %w(is_livejournal livejournal_security)
11
+ article.is_livejournal &&
12
+ article.changed.any?{|attribute| (article_properties + livejournal_properties).include? attribute }
10
13
  }
11
14
  base.after_destroy :remove_from_livejournal_in_background
12
15
  end
16
+ livejournal.register_partial :bottom_of_form, 'articles/livejournal_form'
13
17
 
14
18
  Governor::PluginManager.register livejournal
15
19
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- governor_livejournal (0.1.0)
4
+ governor_livejournal (0.2.0)
5
5
  governor
6
6
  governor_background
7
7
  livejournal
@@ -55,7 +55,7 @@ GEM
55
55
  governor_background (0.1.0)
56
56
  governor
57
57
  i18n (0.5.0)
58
- livejournal (0.3.3)
58
+ livejournal (0.3.4)
59
59
  mail (2.2.17)
60
60
  activesupport (>= 2.3.6)
61
61
  i18n (>= 0.4.0)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: governor_livejournal
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Liam Morley
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-24 00:00:00 -04:00
18
+ date: 2011-04-25 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -255,6 +255,7 @@ files:
255
255
  - README.rdoc
256
256
  - Rakefile
257
257
  - VERSION
258
+ - app/views/governor/articles/_livejournal_form.html.erb
258
259
  - config/locales/en.yml
259
260
  - governor_livejournal.gemspec
260
261
  - lib/generators/governor/add_livejournal_generator.rb