governor_blogger 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +28 -0
  4. data/Gemfile.lock +142 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.rdoc +54 -0
  7. data/Rakefile +50 -0
  8. data/VERSION +1 -0
  9. data/config/locales/en.yml +5 -0
  10. data/governor_blogger.gemspec +194 -0
  11. data/lib/generators/governor/add_blogger_generator.rb +30 -0
  12. data/lib/generators/governor/templates/blogger.rb +3 -0
  13. data/lib/generators/governor/templates/migrations/add_blogger.rb +9 -0
  14. data/lib/governor_blogger/instance_methods.rb +38 -0
  15. data/lib/governor_blogger/rails.rb +5 -0
  16. data/lib/governor_blogger.rb +21 -0
  17. data/spec/governor_blogger_spec.rb +9 -0
  18. data/spec/rails_app/.gitignore +4 -0
  19. data/spec/rails_app/Gemfile +41 -0
  20. data/spec/rails_app/Gemfile.lock +109 -0
  21. data/spec/rails_app/README +256 -0
  22. data/spec/rails_app/Rakefile +7 -0
  23. data/spec/rails_app/app/controllers/application_controller.rb +4 -0
  24. data/spec/rails_app/app/controllers/home_controller.rb +2 -0
  25. data/spec/rails_app/app/helpers/application_helper.rb +2 -0
  26. data/spec/rails_app/app/helpers/home_helper.rb +2 -0
  27. data/spec/rails_app/app/models/article.rb +5 -0
  28. data/spec/rails_app/app/models/user.rb +9 -0
  29. data/spec/rails_app/app/views/governor/articles/index.xml.builder +5 -0
  30. data/spec/rails_app/app/views/home/index.html.erb +0 -0
  31. data/spec/rails_app/app/views/layouts/application.html.erb +23 -0
  32. data/spec/rails_app/config/application.rb +42 -0
  33. data/spec/rails_app/config/boot.rb +14 -0
  34. data/spec/rails_app/config/database.yml +19 -0
  35. data/spec/rails_app/config/environment.rb +5 -0
  36. data/spec/rails_app/config/environments/development.rb +26 -0
  37. data/spec/rails_app/config/environments/production.rb +49 -0
  38. data/spec/rails_app/config/environments/test.rb +35 -0
  39. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  40. data/spec/rails_app/config/initializers/blogger.rb +3 -0
  41. data/spec/rails_app/config/initializers/delayed_job_config.rb +5 -0
  42. data/spec/rails_app/config/initializers/devise.rb +142 -0
  43. data/spec/rails_app/config/initializers/governor.rb +36 -0
  44. data/spec/rails_app/config/initializers/inflections.rb +10 -0
  45. data/spec/rails_app/config/initializers/mime_types.rb +5 -0
  46. data/spec/rails_app/config/initializers/secret_token.rb +7 -0
  47. data/spec/rails_app/config/initializers/session_store.rb +8 -0
  48. data/spec/rails_app/config/locales/devise.en.yml +39 -0
  49. data/spec/rails_app/config/locales/en.yml +5 -0
  50. data/spec/rails_app/config/routes.rb +64 -0
  51. data/spec/rails_app/config.ru +4 -0
  52. data/spec/rails_app/db/migrate/20110329032256_devise_create_users.rb +26 -0
  53. data/spec/rails_app/db/migrate/20110330020108_governor_create_articles.rb +15 -0
  54. data/spec/rails_app/db/migrate/20110421033536_governor_add_blogger.rb +9 -0
  55. data/spec/rails_app/db/migrate/20110421042239_create_delayed_jobs.rb +21 -0
  56. data/spec/rails_app/db/schema.rb +60 -0
  57. data/spec/rails_app/db/seeds.rb +7 -0
  58. data/spec/rails_app/lib/tasks/.gitkeep +0 -0
  59. data/spec/rails_app/public/404.html +26 -0
  60. data/spec/rails_app/public/422.html +26 -0
  61. data/spec/rails_app/public/500.html +26 -0
  62. data/spec/rails_app/public/favicon.ico +0 -0
  63. data/spec/rails_app/public/images/rails.png +0 -0
  64. data/spec/rails_app/public/javascripts/application.js +2 -0
  65. data/spec/rails_app/public/javascripts/controls.js +965 -0
  66. data/spec/rails_app/public/javascripts/dragdrop.js +974 -0
  67. data/spec/rails_app/public/javascripts/effects.js +1123 -0
  68. data/spec/rails_app/public/javascripts/prototype.js +6001 -0
  69. data/spec/rails_app/public/javascripts/rails.js +191 -0
  70. data/spec/rails_app/public/robots.txt +5 -0
  71. data/spec/rails_app/public/stylesheets/.gitkeep +0 -0
  72. data/spec/rails_app/script/delayed_job +5 -0
  73. data/spec/rails_app/script/rails +6 -0
  74. data/spec/rails_app/spec/factories.rb +12 -0
  75. data/spec/rails_app/vendor/plugins/.gitkeep +0 -0
  76. data/spec/spec_helper.rb +36 -0
  77. metadata +405 -0
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,28 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+
9
+ gem 'gdata'
10
+ gem 'nokogiri'
11
+ gem 'governor'
12
+ gem 'governor_background'
13
+
14
+ group :development, :test do
15
+ gem 'jeweler', '~> 1.5.2'
16
+ gem 'sqlite3'
17
+ gem 'rspec-rails'
18
+ gem 'mocha'
19
+ gem 'factory_girl', '~> 2.0.0.beta'
20
+ gem 'factory_girl_rails', '~> 1.1.beta'
21
+ gem 'activerecord-nulldb-adapter'
22
+
23
+ gem 'will_paginate', '~> 3.0.beta'
24
+ gem 'devise'
25
+ gem 'governor_blogger', :path => './'
26
+ gem 'delayed_job'
27
+ gem 'dynamic_form'
28
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,142 @@
1
+ PATH
2
+ remote: ./
3
+ specs:
4
+ governor_blogger (0.1.0)
5
+ gdata
6
+ governor
7
+ governor_background
8
+ nokogiri
9
+
10
+ GEM
11
+ remote: http://rubygems.org/
12
+ specs:
13
+ abstract (1.0.0)
14
+ actionmailer (3.0.7)
15
+ actionpack (= 3.0.7)
16
+ mail (~> 2.2.15)
17
+ actionpack (3.0.7)
18
+ activemodel (= 3.0.7)
19
+ activesupport (= 3.0.7)
20
+ builder (~> 2.1.2)
21
+ erubis (~> 2.6.6)
22
+ i18n (~> 0.5.0)
23
+ rack (~> 1.2.1)
24
+ rack-mount (~> 0.6.14)
25
+ rack-test (~> 0.5.7)
26
+ tzinfo (~> 0.3.23)
27
+ activemodel (3.0.7)
28
+ activesupport (= 3.0.7)
29
+ builder (~> 2.1.2)
30
+ i18n (~> 0.5.0)
31
+ activerecord (3.0.7)
32
+ activemodel (= 3.0.7)
33
+ activesupport (= 3.0.7)
34
+ arel (~> 2.0.2)
35
+ tzinfo (~> 0.3.23)
36
+ activerecord-nulldb-adapter (0.2.1)
37
+ activerecord (>= 2.0.0, < 3.1)
38
+ activeresource (3.0.7)
39
+ activemodel (= 3.0.7)
40
+ activesupport (= 3.0.7)
41
+ activesupport (3.0.7)
42
+ arel (2.0.9)
43
+ bcrypt-ruby (2.1.4)
44
+ builder (2.1.2)
45
+ daemons (1.1.3)
46
+ delayed_job (2.1.4)
47
+ activesupport (~> 3.0)
48
+ daemons
49
+ devise (1.3.3)
50
+ bcrypt-ruby (~> 2.1.2)
51
+ orm_adapter (~> 0.0.3)
52
+ warden (~> 1.0.3)
53
+ diff-lcs (1.1.2)
54
+ dynamic_form (1.1.4)
55
+ erubis (2.6.6)
56
+ abstract (>= 1.0.0)
57
+ factory_girl (2.0.0.beta2)
58
+ factory_girl_rails (1.1.beta1)
59
+ factory_girl (~> 2.0.0.beta)
60
+ rails (>= 3.0.0)
61
+ gdata (1.1.2)
62
+ git (1.2.5)
63
+ governor (0.3.1)
64
+ rails (~> 3.0.5)
65
+ governor_background (0.1.0)
66
+ governor
67
+ i18n (0.5.0)
68
+ jeweler (1.5.2)
69
+ bundler (~> 1.0.0)
70
+ git (>= 1.2.5)
71
+ rake
72
+ mail (2.2.17)
73
+ activesupport (>= 2.3.6)
74
+ i18n (>= 0.4.0)
75
+ mime-types (~> 1.16)
76
+ treetop (~> 1.4.8)
77
+ mime-types (1.16)
78
+ mocha (0.9.12)
79
+ nokogiri (1.4.4)
80
+ orm_adapter (0.0.4)
81
+ polyglot (0.3.1)
82
+ rack (1.2.2)
83
+ rack-mount (0.6.14)
84
+ rack (>= 1.0.0)
85
+ rack-test (0.5.7)
86
+ rack (>= 1.0)
87
+ rails (3.0.7)
88
+ actionmailer (= 3.0.7)
89
+ actionpack (= 3.0.7)
90
+ activerecord (= 3.0.7)
91
+ activeresource (= 3.0.7)
92
+ activesupport (= 3.0.7)
93
+ bundler (~> 1.0)
94
+ railties (= 3.0.7)
95
+ railties (3.0.7)
96
+ actionpack (= 3.0.7)
97
+ activesupport (= 3.0.7)
98
+ rake (>= 0.8.7)
99
+ thor (~> 0.14.4)
100
+ rake (0.8.7)
101
+ rspec (2.5.0)
102
+ rspec-core (~> 2.5.0)
103
+ rspec-expectations (~> 2.5.0)
104
+ rspec-mocks (~> 2.5.0)
105
+ rspec-core (2.5.1)
106
+ rspec-expectations (2.5.0)
107
+ diff-lcs (~> 1.1.2)
108
+ rspec-mocks (2.5.0)
109
+ rspec-rails (2.5.0)
110
+ actionpack (~> 3.0)
111
+ activesupport (~> 3.0)
112
+ railties (~> 3.0)
113
+ rspec (~> 2.5.0)
114
+ sqlite3 (1.3.3)
115
+ thor (0.14.6)
116
+ treetop (1.4.9)
117
+ polyglot (>= 0.3.1)
118
+ tzinfo (0.3.26)
119
+ warden (1.0.3)
120
+ rack (>= 1.0.0)
121
+ will_paginate (3.0.pre2)
122
+
123
+ PLATFORMS
124
+ ruby
125
+
126
+ DEPENDENCIES
127
+ activerecord-nulldb-adapter
128
+ delayed_job
129
+ devise
130
+ dynamic_form
131
+ factory_girl (~> 2.0.0.beta)
132
+ factory_girl_rails (~> 1.1.beta)
133
+ gdata
134
+ governor
135
+ governor_background
136
+ governor_blogger!
137
+ jeweler (~> 1.5.2)
138
+ mocha
139
+ nokogiri
140
+ rspec-rails
141
+ sqlite3
142
+ will_paginate (~> 3.0.beta)
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Liam Morley
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,54 @@
1
+ = governor_blogger
2
+
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_blogger* is a plugin for Governor, allowing you to cross-post your
9
+ articles to Blogger[http://www.blogger.com].
10
+
11
+ == Dependencies
12
+
13
+ * Governor[http://carpeliam.github.com/governor/]
14
+ * GovernorBackground[http://carpeliam.github.com/governor_background/]
15
+ * And because of the GovernorBackground dependency, either
16
+ Delayed_Job[https://github.com/collectiveidea/delayed_job] or
17
+ Resque[https://github.com/defunkt/resque]. If you use Resque, it's highly
18
+ recommended that you use
19
+ resque-status[https://github.com/quirkey/resque-status] as well.
20
+
21
+ == Setting up
22
+
23
+ First, install the above dependencies. Then, in your Gemfile, add the
24
+ following:
25
+
26
+ gem 'governor_blogger'
27
+
28
+ Once you've installed the gem into your app, you need to run the generator:
29
+
30
+ rails generate governor:add_blogger [RESOURCE]
31
+
32
+ This will add a migration for associating articles to blogger posts as well as
33
+ an initializer in which you'll need to set your username and password for
34
+ blogger. (Blogger's API also supports AuthSub authentication, which is similar
35
+ to OAuth, but this is a bit more difficult. Please feel free to add patches
36
+ for better authentication patterns.) Also, because a Google user can have
37
+ multiple blogs, you also need to set your blog ID. Help for this can be found
38
+ at http://www.google.com/support/blogger/bin/answer.py?answer=42191.
39
+
40
+ == Contributing to governor_blogger
41
+
42
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
43
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
44
+ * Fork the project
45
+ * Start a feature/bugfix branch
46
+ * Commit and push until you are happy with your contribution
47
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
48
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
49
+
50
+ == Copyright
51
+
52
+ Copyright (c) 2011 Liam Morley. See LICENSE.txt for
53
+ further details.
54
+
data/Rakefile ADDED
@@ -0,0 +1,50 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "governor_blogger"
16
+ gem.homepage = "http://github.com/carpeliam/governor_blogger"
17
+ gem.license = "MIT"
18
+ gem.summary = %Q{A plugin that connects Governor with a Blogger account.}
19
+ gem.description = %Q{A plugin for the Rails 3-based Governor blogging system that posts and updates articles to Blogger.com.}
20
+ gem.email = "liam@carpeliam.com"
21
+ gem.authors = ["Liam Morley"]
22
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
23
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
25
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rspec/core'
30
+ require 'rspec/core/rake_task'
31
+ RSpec::Core::RakeTask.new(:spec) do |spec|
32
+ spec.pattern = FileList['spec/**/*_spec.rb']
33
+ end
34
+
35
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
36
+ spec.pattern = 'spec/**/*_spec.rb'
37
+ spec.rcov = true
38
+ end
39
+
40
+ task :default => :spec
41
+
42
+ require 'rake/rdoctask'
43
+ Rake::RDocTask.new do |rdoc|
44
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
45
+
46
+ rdoc.rdoc_dir = 'rdoc'
47
+ rdoc.title = "governor_blogger #{version}"
48
+ rdoc.rdoc_files.include('README*')
49
+ rdoc.rdoc_files.include('lib/**/*.rb')
50
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,5 @@
1
+ en:
2
+ governor_background:
3
+ post_to_blogger_completed: '"%{resource}" was completed successfully.'
4
+ post_to_blogger_failed: '"%{resource}" could not be created: %{message}.'
5
+ post_to_blogger_killed: '"%{resource}" was interrupted: %{message}.'
@@ -0,0 +1,194 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{governor_blogger}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Liam Morley"]
12
+ s.date = %q{2011-04-24}
13
+ s.description = %q{A plugin for the Rails 3-based Governor blogging system that posts and updates articles to Blogger.com.}
14
+ s.email = %q{liam@carpeliam.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "config/locales/en.yml",
29
+ "governor_blogger.gemspec",
30
+ "lib/generators/governor/add_blogger_generator.rb",
31
+ "lib/generators/governor/templates/blogger.rb",
32
+ "lib/generators/governor/templates/migrations/add_blogger.rb",
33
+ "lib/governor_blogger.rb",
34
+ "lib/governor_blogger/instance_methods.rb",
35
+ "lib/governor_blogger/rails.rb",
36
+ "spec/governor_blogger_spec.rb",
37
+ "spec/rails_app/.gitignore",
38
+ "spec/rails_app/Gemfile",
39
+ "spec/rails_app/Gemfile.lock",
40
+ "spec/rails_app/README",
41
+ "spec/rails_app/Rakefile",
42
+ "spec/rails_app/app/controllers/application_controller.rb",
43
+ "spec/rails_app/app/controllers/home_controller.rb",
44
+ "spec/rails_app/app/helpers/application_helper.rb",
45
+ "spec/rails_app/app/helpers/home_helper.rb",
46
+ "spec/rails_app/app/models/article.rb",
47
+ "spec/rails_app/app/models/user.rb",
48
+ "spec/rails_app/app/views/governor/articles/index.xml.builder",
49
+ "spec/rails_app/app/views/home/index.html.erb",
50
+ "spec/rails_app/app/views/layouts/application.html.erb",
51
+ "spec/rails_app/config.ru",
52
+ "spec/rails_app/config/application.rb",
53
+ "spec/rails_app/config/boot.rb",
54
+ "spec/rails_app/config/database.yml",
55
+ "spec/rails_app/config/environment.rb",
56
+ "spec/rails_app/config/environments/development.rb",
57
+ "spec/rails_app/config/environments/production.rb",
58
+ "spec/rails_app/config/environments/test.rb",
59
+ "spec/rails_app/config/initializers/backtrace_silencers.rb",
60
+ "spec/rails_app/config/initializers/blogger.rb",
61
+ "spec/rails_app/config/initializers/delayed_job_config.rb",
62
+ "spec/rails_app/config/initializers/devise.rb",
63
+ "spec/rails_app/config/initializers/governor.rb",
64
+ "spec/rails_app/config/initializers/inflections.rb",
65
+ "spec/rails_app/config/initializers/mime_types.rb",
66
+ "spec/rails_app/config/initializers/secret_token.rb",
67
+ "spec/rails_app/config/initializers/session_store.rb",
68
+ "spec/rails_app/config/locales/devise.en.yml",
69
+ "spec/rails_app/config/locales/en.yml",
70
+ "spec/rails_app/config/routes.rb",
71
+ "spec/rails_app/db/migrate/20110329032256_devise_create_users.rb",
72
+ "spec/rails_app/db/migrate/20110330020108_governor_create_articles.rb",
73
+ "spec/rails_app/db/migrate/20110421033536_governor_add_blogger.rb",
74
+ "spec/rails_app/db/migrate/20110421042239_create_delayed_jobs.rb",
75
+ "spec/rails_app/db/schema.rb",
76
+ "spec/rails_app/db/seeds.rb",
77
+ "spec/rails_app/lib/tasks/.gitkeep",
78
+ "spec/rails_app/public/404.html",
79
+ "spec/rails_app/public/422.html",
80
+ "spec/rails_app/public/500.html",
81
+ "spec/rails_app/public/favicon.ico",
82
+ "spec/rails_app/public/images/rails.png",
83
+ "spec/rails_app/public/javascripts/application.js",
84
+ "spec/rails_app/public/javascripts/controls.js",
85
+ "spec/rails_app/public/javascripts/dragdrop.js",
86
+ "spec/rails_app/public/javascripts/effects.js",
87
+ "spec/rails_app/public/javascripts/prototype.js",
88
+ "spec/rails_app/public/javascripts/rails.js",
89
+ "spec/rails_app/public/robots.txt",
90
+ "spec/rails_app/public/stylesheets/.gitkeep",
91
+ "spec/rails_app/script/delayed_job",
92
+ "spec/rails_app/script/rails",
93
+ "spec/rails_app/spec/factories.rb",
94
+ "spec/rails_app/vendor/plugins/.gitkeep",
95
+ "spec/spec_helper.rb"
96
+ ]
97
+ s.homepage = %q{http://github.com/carpeliam/governor_blogger}
98
+ s.licenses = ["MIT"]
99
+ s.require_paths = ["lib"]
100
+ s.rubygems_version = %q{1.3.7}
101
+ s.summary = %q{A plugin that connects Governor with a Blogger account.}
102
+ s.test_files = [
103
+ "spec/governor_blogger_spec.rb",
104
+ "spec/rails_app/app/controllers/application_controller.rb",
105
+ "spec/rails_app/app/controllers/home_controller.rb",
106
+ "spec/rails_app/app/helpers/application_helper.rb",
107
+ "spec/rails_app/app/helpers/home_helper.rb",
108
+ "spec/rails_app/app/models/article.rb",
109
+ "spec/rails_app/app/models/user.rb",
110
+ "spec/rails_app/config/application.rb",
111
+ "spec/rails_app/config/boot.rb",
112
+ "spec/rails_app/config/environment.rb",
113
+ "spec/rails_app/config/environments/development.rb",
114
+ "spec/rails_app/config/environments/production.rb",
115
+ "spec/rails_app/config/environments/test.rb",
116
+ "spec/rails_app/config/initializers/backtrace_silencers.rb",
117
+ "spec/rails_app/config/initializers/blogger.rb",
118
+ "spec/rails_app/config/initializers/delayed_job_config.rb",
119
+ "spec/rails_app/config/initializers/devise.rb",
120
+ "spec/rails_app/config/initializers/governor.rb",
121
+ "spec/rails_app/config/initializers/inflections.rb",
122
+ "spec/rails_app/config/initializers/mime_types.rb",
123
+ "spec/rails_app/config/initializers/secret_token.rb",
124
+ "spec/rails_app/config/initializers/session_store.rb",
125
+ "spec/rails_app/config/routes.rb",
126
+ "spec/rails_app/db/migrate/20110329032256_devise_create_users.rb",
127
+ "spec/rails_app/db/migrate/20110330020108_governor_create_articles.rb",
128
+ "spec/rails_app/db/migrate/20110421033536_governor_add_blogger.rb",
129
+ "spec/rails_app/db/migrate/20110421042239_create_delayed_jobs.rb",
130
+ "spec/rails_app/db/schema.rb",
131
+ "spec/rails_app/db/seeds.rb",
132
+ "spec/rails_app/spec/factories.rb",
133
+ "spec/spec_helper.rb"
134
+ ]
135
+
136
+ if s.respond_to? :specification_version then
137
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
138
+ s.specification_version = 3
139
+
140
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
141
+ s.add_runtime_dependency(%q<gdata>, [">= 0"])
142
+ s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
143
+ s.add_runtime_dependency(%q<governor>, [">= 0"])
144
+ s.add_runtime_dependency(%q<governor_background>, [">= 0"])
145
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
146
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
147
+ s.add_development_dependency(%q<rspec-rails>, [">= 0"])
148
+ s.add_development_dependency(%q<mocha>, [">= 0"])
149
+ s.add_development_dependency(%q<factory_girl>, ["~> 2.0.0.beta"])
150
+ s.add_development_dependency(%q<factory_girl_rails>, ["~> 1.1.beta"])
151
+ s.add_development_dependency(%q<activerecord-nulldb-adapter>, [">= 0"])
152
+ s.add_development_dependency(%q<will_paginate>, ["~> 3.0.beta"])
153
+ s.add_development_dependency(%q<devise>, [">= 0"])
154
+ s.add_development_dependency(%q<governor_blogger>, [">= 0"])
155
+ s.add_development_dependency(%q<delayed_job>, [">= 0"])
156
+ s.add_development_dependency(%q<dynamic_form>, [">= 0"])
157
+ else
158
+ s.add_dependency(%q<gdata>, [">= 0"])
159
+ s.add_dependency(%q<nokogiri>, [">= 0"])
160
+ s.add_dependency(%q<governor>, [">= 0"])
161
+ s.add_dependency(%q<governor_background>, [">= 0"])
162
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
163
+ s.add_dependency(%q<sqlite3>, [">= 0"])
164
+ s.add_dependency(%q<rspec-rails>, [">= 0"])
165
+ s.add_dependency(%q<mocha>, [">= 0"])
166
+ s.add_dependency(%q<factory_girl>, ["~> 2.0.0.beta"])
167
+ s.add_dependency(%q<factory_girl_rails>, ["~> 1.1.beta"])
168
+ s.add_dependency(%q<activerecord-nulldb-adapter>, [">= 0"])
169
+ s.add_dependency(%q<will_paginate>, ["~> 3.0.beta"])
170
+ s.add_dependency(%q<devise>, [">= 0"])
171
+ s.add_dependency(%q<governor_blogger>, [">= 0"])
172
+ s.add_dependency(%q<delayed_job>, [">= 0"])
173
+ s.add_dependency(%q<dynamic_form>, [">= 0"])
174
+ end
175
+ else
176
+ s.add_dependency(%q<gdata>, [">= 0"])
177
+ s.add_dependency(%q<nokogiri>, [">= 0"])
178
+ s.add_dependency(%q<governor>, [">= 0"])
179
+ s.add_dependency(%q<governor_background>, [">= 0"])
180
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
181
+ s.add_dependency(%q<sqlite3>, [">= 0"])
182
+ s.add_dependency(%q<rspec-rails>, [">= 0"])
183
+ s.add_dependency(%q<mocha>, [">= 0"])
184
+ s.add_dependency(%q<factory_girl>, ["~> 2.0.0.beta"])
185
+ s.add_dependency(%q<factory_girl_rails>, ["~> 1.1.beta"])
186
+ s.add_dependency(%q<activerecord-nulldb-adapter>, [">= 0"])
187
+ s.add_dependency(%q<will_paginate>, ["~> 3.0.beta"])
188
+ s.add_dependency(%q<devise>, [">= 0"])
189
+ s.add_dependency(%q<governor_blogger>, [">= 0"])
190
+ s.add_dependency(%q<delayed_job>, [">= 0"])
191
+ s.add_dependency(%q<dynamic_form>, [">= 0"])
192
+ end
193
+ end
194
+
@@ -0,0 +1,30 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+ module Governor
4
+ class AddBloggerGenerator < Rails::Generators::Base
5
+ include Rails::Generators::Migration
6
+ source_root File.expand_path('../templates', __FILE__)
7
+ argument :resource, :type => :string, :default => Governor.default_resource.plural.to_s
8
+
9
+ def self.next_migration_number(dirname)
10
+ if ActiveRecord::Base.timestamped_migrations
11
+ Time.new.utc.strftime("%Y%m%d%H%M%S")
12
+ else
13
+ "%.3d" % (current_migration_number(dirname) + 1)
14
+ end
15
+ end
16
+
17
+ def create_migration_file
18
+ migration_template 'migrations/add_blogger.rb', "db/migrate/governor_add_blogger.rb", :skip => true
19
+ end
20
+
21
+ def copy_initializer
22
+ template 'blogger.rb', 'config/initializers/blogger.rb'
23
+ end
24
+
25
+ private
26
+ def mapping
27
+ Governor.resources[resource.pluralize.to_sym]
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,3 @@
1
+ GovernorBlogger.config.username = ''
2
+ GovernorBlogger.config.password = ''
3
+ GovernorBlogger.config.blog_id = ''
@@ -0,0 +1,9 @@
1
+ class GovernorAddBlogger < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :<%= mapping.plural %>, :blogger_id, :string
4
+ end
5
+
6
+ def self.down
7
+ remove_column :<%= mapping.plural %>, :blogger_id
8
+ end
9
+ end
@@ -0,0 +1,38 @@
1
+ module GovernorBlogger
2
+ module InstanceMethods
3
+ def post_to_blogger
4
+ b = GData::Client::Blogger.new
5
+ body = Nokogiri::XML.fragment(Governor::Formatters.format_article self).to_s
6
+ page = "http://www.blogger.com/feeds/#{GovernorBlogger.config.blog_id}/posts/default/#{blogger_id}".chomp '/'
7
+ # log in
8
+ b.clientlogin(GovernorBlogger.config.username, GovernorBlogger.config.password)
9
+
10
+ if blogger_id.blank?
11
+ # construct post
12
+ entry = Nokogiri::XML::Builder.new do |xml|
13
+ xml.entry(:xmlns => 'http://www.w3.org/2005/Atom') do
14
+ xml.title self.title, :type => 'text'
15
+ xml.content(:type => 'xhtml') { |content| content << body }
16
+ end
17
+ end.to_xml
18
+ # post to page, retrieve blogger_id
19
+ response = b.post(page, entry)
20
+ post_id = response.headers['location'].match(%r{posts/default/(\d+)})[1]
21
+ # update entry with blogger_id
22
+ self.update_attribute :blogger_id, post_id
23
+ else
24
+ # retrieve post
25
+ xml = b.get(page).to_xml
26
+ # transform XML
27
+ xml.children.detect{|e| e.name == 'title' }.text = self.title
28
+ xml.children.detect{|e| e.name == 'content' }.text = body
29
+ # post back to page
30
+ b.put(page, xml)
31
+ end
32
+ end
33
+
34
+ def post_to_blogger_in_background
35
+ run_in_background :post_to_blogger
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,5 @@
1
+ module GovernorBlogger
2
+ class Engine < ::Rails::Engine
3
+
4
+ end
5
+ end
@@ -0,0 +1,21 @@
1
+ require 'governor_blogger/rails'
2
+ require 'governor_blogger/instance_methods'
3
+
4
+ blogger = Governor::Plugin.new('blogger')
5
+
6
+ blogger.register_model_callback do |base|
7
+ base.send :include, GovernorBlogger::InstanceMethods
8
+ base.after_save :post_to_blogger_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 }
10
+ }
11
+ end
12
+
13
+ Governor::PluginManager.register blogger
14
+
15
+ module GovernorBlogger
16
+ class Configuration
17
+ cattr_accessor :username, :password, :blog_id
18
+ end
19
+ @@config = Configuration.new
20
+ mattr_reader :config
21
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ module Governor
4
+ describe GovernorBlogger do
5
+ it "registers the plugin" do
6
+ Governor::PluginManager.plugins.size == 1
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ .bundle
2
+ db/*.sqlite3
3
+ log/*.log
4
+ tmp/