governor_twitter 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +28 -0
  4. data/Gemfile.lock +165 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.rdoc +42 -0
  7. data/Rakefile +50 -0
  8. data/VERSION +1 -0
  9. data/app/views/governor/articles/_twitter_form.html.erb +5 -0
  10. data/governor_twitter.gemspec +189 -0
  11. data/lib/governor_twitter/controllers/methods.rb +15 -0
  12. data/lib/governor_twitter/models/methods.rb +15 -0
  13. data/lib/governor_twitter/rails.rb +5 -0
  14. data/lib/governor_twitter.rb +16 -0
  15. data/spec/governor_twitter_spec.rb +7 -0
  16. data/spec/models/article_spec.rb +15 -0
  17. data/spec/rails_app/.gitignore +4 -0
  18. data/spec/rails_app/Gemfile +41 -0
  19. data/spec/rails_app/Gemfile.lock +132 -0
  20. data/spec/rails_app/README +256 -0
  21. data/spec/rails_app/Rakefile +7 -0
  22. data/spec/rails_app/app/controllers/application_controller.rb +4 -0
  23. data/spec/rails_app/app/controllers/home_controller.rb +2 -0
  24. data/spec/rails_app/app/helpers/application_helper.rb +2 -0
  25. data/spec/rails_app/app/helpers/home_helper.rb +2 -0
  26. data/spec/rails_app/app/models/article.rb +5 -0
  27. data/spec/rails_app/app/models/user.rb +9 -0
  28. data/spec/rails_app/app/views/home/index.html.erb +0 -0
  29. data/spec/rails_app/app/views/layouts/application.html.erb +23 -0
  30. data/spec/rails_app/config/application.rb +44 -0
  31. data/spec/rails_app/config/boot.rb +14 -0
  32. data/spec/rails_app/config/database.yml +19 -0
  33. data/spec/rails_app/config/environment.rb +5 -0
  34. data/spec/rails_app/config/environments/development.rb +26 -0
  35. data/spec/rails_app/config/environments/production.rb +49 -0
  36. data/spec/rails_app/config/environments/test.rb +35 -0
  37. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  38. data/spec/rails_app/config/initializers/delayed_job_config.rb +5 -0
  39. data/spec/rails_app/config/initializers/devise.rb +142 -0
  40. data/spec/rails_app/config/initializers/inflections.rb +10 -0
  41. data/spec/rails_app/config/initializers/mime_types.rb +5 -0
  42. data/spec/rails_app/config/initializers/secret_token.rb +7 -0
  43. data/spec/rails_app/config/initializers/session_store.rb +8 -0
  44. data/spec/rails_app/config/initializers/twitter.rb +6 -0
  45. data/spec/rails_app/config/locales/devise.en.yml +39 -0
  46. data/spec/rails_app/config/locales/en.yml +5 -0
  47. data/spec/rails_app/config/routes.rb +64 -0
  48. data/spec/rails_app/config.ru +4 -0
  49. data/spec/rails_app/db/migrate/20110329032256_devise_create_users.rb +26 -0
  50. data/spec/rails_app/db/migrate/20110330020108_governor_create_articles.rb +15 -0
  51. data/spec/rails_app/db/migrate/20110421042239_create_delayed_jobs.rb +21 -0
  52. data/spec/rails_app/db/schema.rb +59 -0
  53. data/spec/rails_app/db/seeds.rb +7 -0
  54. data/spec/rails_app/lib/tasks/.gitkeep +0 -0
  55. data/spec/rails_app/public/404.html +26 -0
  56. data/spec/rails_app/public/422.html +26 -0
  57. data/spec/rails_app/public/500.html +26 -0
  58. data/spec/rails_app/public/favicon.ico +0 -0
  59. data/spec/rails_app/public/images/rails.png +0 -0
  60. data/spec/rails_app/public/javascripts/application.js +2 -0
  61. data/spec/rails_app/public/javascripts/controls.js +965 -0
  62. data/spec/rails_app/public/javascripts/dragdrop.js +974 -0
  63. data/spec/rails_app/public/javascripts/effects.js +1123 -0
  64. data/spec/rails_app/public/javascripts/prototype.js +6001 -0
  65. data/spec/rails_app/public/javascripts/rails.js +191 -0
  66. data/spec/rails_app/public/robots.txt +5 -0
  67. data/spec/rails_app/public/stylesheets/.gitkeep +0 -0
  68. data/spec/rails_app/script/delayed_job +5 -0
  69. data/spec/rails_app/script/rails +6 -0
  70. data/spec/rails_app/spec/factories.rb +12 -0
  71. data/spec/rails_app/vendor/plugins/.gitkeep +0 -0
  72. data/spec/spec_helper.rb +36 -0
  73. 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 'twitter', '>= 1.1'
10
+ gem 'shortie'
11
+ gem 'governor', '>= 0.5.3'
12
+ gem 'governor_background', '~> 0.2.2'
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_twitter', :path => './'
26
+ gem 'delayed_job'
27
+ gem 'dynamic_form'
28
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,165 @@
1
+ PATH
2
+ remote: ./
3
+ specs:
4
+ governor_twitter (0.1.0)
5
+ governor (>= 0.5.3)
6
+ governor_background (~> 0.2.2)
7
+ shortie
8
+ twitter (>= 1.1)
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
+ addressable (2.2.6)
43
+ arel (2.0.9)
44
+ bcrypt-ruby (2.1.4)
45
+ builder (2.1.2)
46
+ daemons (1.1.3)
47
+ delayed_job (2.1.4)
48
+ activesupport (~> 3.0)
49
+ daemons
50
+ devise (1.3.4)
51
+ bcrypt-ruby (~> 2.1.2)
52
+ orm_adapter (~> 0.0.3)
53
+ warden (~> 1.0.3)
54
+ diff-lcs (1.1.2)
55
+ dynamic_form (1.1.4)
56
+ erubis (2.6.6)
57
+ abstract (>= 1.0.0)
58
+ factory_girl (2.0.0.beta2)
59
+ factory_girl_rails (1.1.beta1)
60
+ factory_girl (~> 2.0.0.beta)
61
+ rails (>= 3.0.0)
62
+ faraday (0.6.1)
63
+ addressable (~> 2.2.4)
64
+ multipart-post (~> 1.1.0)
65
+ rack (>= 1.1.0, < 2)
66
+ faraday_middleware (0.6.3)
67
+ faraday (~> 0.6.0)
68
+ git (1.2.5)
69
+ governor (0.5.3)
70
+ rails (~> 3.0.5)
71
+ governor_background (0.2.2)
72
+ governor
73
+ hashie (1.0.0)
74
+ i18n (0.5.0)
75
+ jeweler (1.5.2)
76
+ bundler (~> 1.0.0)
77
+ git (>= 1.2.5)
78
+ rake
79
+ mail (2.2.19)
80
+ activesupport (>= 2.3.6)
81
+ i18n (>= 0.4.0)
82
+ mime-types (~> 1.16)
83
+ treetop (~> 1.4.8)
84
+ mime-types (1.16)
85
+ mocha (0.9.12)
86
+ multi_json (1.0.2)
87
+ multi_xml (0.2.2)
88
+ multipart-post (1.1.0)
89
+ orm_adapter (0.0.5)
90
+ polyglot (0.3.1)
91
+ rack (1.2.2)
92
+ rack-mount (0.6.14)
93
+ rack (>= 1.0.0)
94
+ rack-test (0.5.7)
95
+ rack (>= 1.0)
96
+ rails (3.0.7)
97
+ actionmailer (= 3.0.7)
98
+ actionpack (= 3.0.7)
99
+ activerecord (= 3.0.7)
100
+ activeresource (= 3.0.7)
101
+ activesupport (= 3.0.7)
102
+ bundler (~> 1.0)
103
+ railties (= 3.0.7)
104
+ railties (3.0.7)
105
+ actionpack (= 3.0.7)
106
+ activesupport (= 3.0.7)
107
+ rake (>= 0.8.7)
108
+ thor (~> 0.14.4)
109
+ rake (0.8.7)
110
+ rash (0.3.0)
111
+ hashie (~> 1.0.0)
112
+ rspec (2.5.0)
113
+ rspec-core (~> 2.5.0)
114
+ rspec-expectations (~> 2.5.0)
115
+ rspec-mocks (~> 2.5.0)
116
+ rspec-core (2.5.2)
117
+ rspec-expectations (2.5.0)
118
+ diff-lcs (~> 1.1.2)
119
+ rspec-mocks (2.5.0)
120
+ rspec-rails (2.5.0)
121
+ actionpack (~> 3.0)
122
+ activesupport (~> 3.0)
123
+ railties (~> 3.0)
124
+ rspec (~> 2.5.0)
125
+ shortie (1.0.0)
126
+ simplehttp (>= 0.1.3)
127
+ simple_oauth (0.1.5)
128
+ simplehttp (0.1.3)
129
+ sqlite3 (1.3.3)
130
+ thor (0.14.6)
131
+ treetop (1.4.9)
132
+ polyglot (>= 0.3.1)
133
+ twitter (1.4.1)
134
+ faraday (~> 0.6.1)
135
+ faraday_middleware (~> 0.6.3)
136
+ hashie (~> 1.0.0)
137
+ multi_json (~> 1.0.0)
138
+ multi_xml (~> 0.2.0)
139
+ rash (~> 0.3.0)
140
+ simple_oauth (~> 0.1.4)
141
+ tzinfo (0.3.27)
142
+ warden (1.0.4)
143
+ rack (>= 1.0)
144
+ will_paginate (3.0.pre2)
145
+
146
+ PLATFORMS
147
+ ruby
148
+
149
+ DEPENDENCIES
150
+ activerecord-nulldb-adapter
151
+ delayed_job
152
+ devise
153
+ dynamic_form
154
+ factory_girl (~> 2.0.0.beta)
155
+ factory_girl_rails (~> 1.1.beta)
156
+ governor (>= 0.5.3)
157
+ governor_background (~> 0.2.2)
158
+ governor_twitter!
159
+ jeweler (~> 1.5.2)
160
+ mocha
161
+ rspec-rails
162
+ shortie
163
+ sqlite3
164
+ twitter (>= 1.1)
165
+ 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,42 @@
1
+ = governor_twitter
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_twitter* is a plugin for Governor, allowing you to automatically
9
+ post to twitter whenever you post or update an article.
10
+
11
+ == Dependencies
12
+
13
+ * Governor[http://carpeliam.github.com/governor/]
14
+ * twitter[https://github.com/jnunemaker/twitter] gem
15
+ * shortie[https://github.com/lassebunk/shortie] gem, for URL shortening
16
+ * GovernorBackground[https://github.com/carpeliam/governor_background]
17
+ * And because of the GovernorBackground dependency, either
18
+ Delayed_Job[https://github.com/collectiveidea/delayed_job] or
19
+ Resque[https://github.com/defunkt/resque]. If you use Resque, it's highly
20
+ recommended that you use
21
+ resque-status[https://github.com/quirkey/resque-status] as well.
22
+
23
+ == Setting up
24
+
25
+ First, install the above dependencies. Then, make sure you follow instructions
26
+ for configuring Twitter, namely adding an initializer with your keys/secrets.
27
+
28
+ == Contributing to governor_twitter
29
+
30
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
31
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
32
+ * Fork the project
33
+ * Start a feature/bugfix branch
34
+ * Commit and push until you are happy with your contribution
35
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
36
+ * 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.
37
+
38
+ == Copyright
39
+
40
+ Copyright (c) 2011 Liam Morley. See LICENSE.txt for
41
+ further details.
42
+
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_twitter"
16
+ gem.homepage = "http://github.com/carpeliam/governor_twitter"
17
+ gem.license = "MIT"
18
+ gem.summary = %Q{A plugin that connects Governor with a Twitter account.}
19
+ gem.description = %Q{A plugin for the Rails 3-based Governor blogging system that posts your blog entries to Twitter for you.}
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_twitter #{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
+ <p>
2
+ <%= label_tag :post_to_twitter, 'Post to Twitter?' %>
3
+ <%= check_box_tag :post_to_twitter %><br>
4
+ <%= text_area_tag :twitter_content %>
5
+ </p>
@@ -0,0 +1,189 @@
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_twitter}
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-05-13}
13
+ s.description = %q{A plugin for the Rails 3-based Governor blogging system that posts your blog entries to Twitter for you.}
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
+ "app/views/governor/articles/_twitter_form.html.erb",
29
+ "governor_twitter.gemspec",
30
+ "lib/governor_twitter.rb",
31
+ "lib/governor_twitter/controllers/methods.rb",
32
+ "lib/governor_twitter/models/methods.rb",
33
+ "lib/governor_twitter/rails.rb",
34
+ "spec/governor_twitter_spec.rb",
35
+ "spec/models/article_spec.rb",
36
+ "spec/rails_app/.gitignore",
37
+ "spec/rails_app/Gemfile",
38
+ "spec/rails_app/Gemfile.lock",
39
+ "spec/rails_app/README",
40
+ "spec/rails_app/Rakefile",
41
+ "spec/rails_app/app/controllers/application_controller.rb",
42
+ "spec/rails_app/app/controllers/home_controller.rb",
43
+ "spec/rails_app/app/helpers/application_helper.rb",
44
+ "spec/rails_app/app/helpers/home_helper.rb",
45
+ "spec/rails_app/app/models/article.rb",
46
+ "spec/rails_app/app/models/user.rb",
47
+ "spec/rails_app/app/views/home/index.html.erb",
48
+ "spec/rails_app/app/views/layouts/application.html.erb",
49
+ "spec/rails_app/config.ru",
50
+ "spec/rails_app/config/application.rb",
51
+ "spec/rails_app/config/boot.rb",
52
+ "spec/rails_app/config/database.yml",
53
+ "spec/rails_app/config/environment.rb",
54
+ "spec/rails_app/config/environments/development.rb",
55
+ "spec/rails_app/config/environments/production.rb",
56
+ "spec/rails_app/config/environments/test.rb",
57
+ "spec/rails_app/config/initializers/backtrace_silencers.rb",
58
+ "spec/rails_app/config/initializers/delayed_job_config.rb",
59
+ "spec/rails_app/config/initializers/devise.rb",
60
+ "spec/rails_app/config/initializers/inflections.rb",
61
+ "spec/rails_app/config/initializers/mime_types.rb",
62
+ "spec/rails_app/config/initializers/secret_token.rb",
63
+ "spec/rails_app/config/initializers/session_store.rb",
64
+ "spec/rails_app/config/initializers/twitter.rb",
65
+ "spec/rails_app/config/locales/devise.en.yml",
66
+ "spec/rails_app/config/locales/en.yml",
67
+ "spec/rails_app/config/routes.rb",
68
+ "spec/rails_app/db/migrate/20110329032256_devise_create_users.rb",
69
+ "spec/rails_app/db/migrate/20110330020108_governor_create_articles.rb",
70
+ "spec/rails_app/db/migrate/20110421042239_create_delayed_jobs.rb",
71
+ "spec/rails_app/db/schema.rb",
72
+ "spec/rails_app/db/seeds.rb",
73
+ "spec/rails_app/lib/tasks/.gitkeep",
74
+ "spec/rails_app/public/404.html",
75
+ "spec/rails_app/public/422.html",
76
+ "spec/rails_app/public/500.html",
77
+ "spec/rails_app/public/favicon.ico",
78
+ "spec/rails_app/public/images/rails.png",
79
+ "spec/rails_app/public/javascripts/application.js",
80
+ "spec/rails_app/public/javascripts/controls.js",
81
+ "spec/rails_app/public/javascripts/dragdrop.js",
82
+ "spec/rails_app/public/javascripts/effects.js",
83
+ "spec/rails_app/public/javascripts/prototype.js",
84
+ "spec/rails_app/public/javascripts/rails.js",
85
+ "spec/rails_app/public/robots.txt",
86
+ "spec/rails_app/public/stylesheets/.gitkeep",
87
+ "spec/rails_app/script/delayed_job",
88
+ "spec/rails_app/script/rails",
89
+ "spec/rails_app/spec/factories.rb",
90
+ "spec/rails_app/vendor/plugins/.gitkeep",
91
+ "spec/spec_helper.rb"
92
+ ]
93
+ s.homepage = %q{http://github.com/carpeliam/governor_twitter}
94
+ s.licenses = ["MIT"]
95
+ s.require_paths = ["lib"]
96
+ s.rubygems_version = %q{1.3.7}
97
+ s.summary = %q{A plugin that connects Governor with a Twitter account.}
98
+ s.test_files = [
99
+ "spec/governor_twitter_spec.rb",
100
+ "spec/models/article_spec.rb",
101
+ "spec/rails_app/app/controllers/application_controller.rb",
102
+ "spec/rails_app/app/controllers/home_controller.rb",
103
+ "spec/rails_app/app/helpers/application_helper.rb",
104
+ "spec/rails_app/app/helpers/home_helper.rb",
105
+ "spec/rails_app/app/models/article.rb",
106
+ "spec/rails_app/app/models/user.rb",
107
+ "spec/rails_app/config/application.rb",
108
+ "spec/rails_app/config/boot.rb",
109
+ "spec/rails_app/config/environment.rb",
110
+ "spec/rails_app/config/environments/development.rb",
111
+ "spec/rails_app/config/environments/production.rb",
112
+ "spec/rails_app/config/environments/test.rb",
113
+ "spec/rails_app/config/initializers/backtrace_silencers.rb",
114
+ "spec/rails_app/config/initializers/delayed_job_config.rb",
115
+ "spec/rails_app/config/initializers/devise.rb",
116
+ "spec/rails_app/config/initializers/inflections.rb",
117
+ "spec/rails_app/config/initializers/mime_types.rb",
118
+ "spec/rails_app/config/initializers/secret_token.rb",
119
+ "spec/rails_app/config/initializers/session_store.rb",
120
+ "spec/rails_app/config/initializers/twitter.rb",
121
+ "spec/rails_app/config/routes.rb",
122
+ "spec/rails_app/db/migrate/20110329032256_devise_create_users.rb",
123
+ "spec/rails_app/db/migrate/20110330020108_governor_create_articles.rb",
124
+ "spec/rails_app/db/migrate/20110421042239_create_delayed_jobs.rb",
125
+ "spec/rails_app/db/schema.rb",
126
+ "spec/rails_app/db/seeds.rb",
127
+ "spec/rails_app/spec/factories.rb",
128
+ "spec/spec_helper.rb"
129
+ ]
130
+
131
+ if s.respond_to? :specification_version then
132
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
133
+ s.specification_version = 3
134
+
135
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
136
+ s.add_runtime_dependency(%q<twitter>, [">= 1.1"])
137
+ s.add_runtime_dependency(%q<shortie>, [">= 0"])
138
+ s.add_runtime_dependency(%q<governor>, [">= 0.5.3"])
139
+ s.add_runtime_dependency(%q<governor_background>, ["~> 0.2.2"])
140
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
141
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
142
+ s.add_development_dependency(%q<rspec-rails>, [">= 0"])
143
+ s.add_development_dependency(%q<mocha>, [">= 0"])
144
+ s.add_development_dependency(%q<factory_girl>, ["~> 2.0.0.beta"])
145
+ s.add_development_dependency(%q<factory_girl_rails>, ["~> 1.1.beta"])
146
+ s.add_development_dependency(%q<activerecord-nulldb-adapter>, [">= 0"])
147
+ s.add_development_dependency(%q<will_paginate>, ["~> 3.0.beta"])
148
+ s.add_development_dependency(%q<devise>, [">= 0"])
149
+ s.add_development_dependency(%q<governor_twitter>, [">= 0"])
150
+ s.add_development_dependency(%q<delayed_job>, [">= 0"])
151
+ s.add_development_dependency(%q<dynamic_form>, [">= 0"])
152
+ else
153
+ s.add_dependency(%q<twitter>, [">= 1.1"])
154
+ s.add_dependency(%q<shortie>, [">= 0"])
155
+ s.add_dependency(%q<governor>, [">= 0.5.3"])
156
+ s.add_dependency(%q<governor_background>, ["~> 0.2.2"])
157
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
158
+ s.add_dependency(%q<sqlite3>, [">= 0"])
159
+ s.add_dependency(%q<rspec-rails>, [">= 0"])
160
+ s.add_dependency(%q<mocha>, [">= 0"])
161
+ s.add_dependency(%q<factory_girl>, ["~> 2.0.0.beta"])
162
+ s.add_dependency(%q<factory_girl_rails>, ["~> 1.1.beta"])
163
+ s.add_dependency(%q<activerecord-nulldb-adapter>, [">= 0"])
164
+ s.add_dependency(%q<will_paginate>, ["~> 3.0.beta"])
165
+ s.add_dependency(%q<devise>, [">= 0"])
166
+ s.add_dependency(%q<governor_twitter>, [">= 0"])
167
+ s.add_dependency(%q<delayed_job>, [">= 0"])
168
+ s.add_dependency(%q<dynamic_form>, [">= 0"])
169
+ end
170
+ else
171
+ s.add_dependency(%q<twitter>, [">= 1.1"])
172
+ s.add_dependency(%q<shortie>, [">= 0"])
173
+ s.add_dependency(%q<governor>, [">= 0.5.3"])
174
+ s.add_dependency(%q<governor_background>, ["~> 0.2.2"])
175
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
176
+ s.add_dependency(%q<sqlite3>, [">= 0"])
177
+ s.add_dependency(%q<rspec-rails>, [">= 0"])
178
+ s.add_dependency(%q<mocha>, [">= 0"])
179
+ s.add_dependency(%q<factory_girl>, ["~> 2.0.0.beta"])
180
+ s.add_dependency(%q<factory_girl_rails>, ["~> 1.1.beta"])
181
+ s.add_dependency(%q<activerecord-nulldb-adapter>, [">= 0"])
182
+ s.add_dependency(%q<will_paginate>, ["~> 3.0.beta"])
183
+ s.add_dependency(%q<devise>, [">= 0"])
184
+ s.add_dependency(%q<governor_twitter>, [">= 0"])
185
+ s.add_dependency(%q<delayed_job>, [">= 0"])
186
+ s.add_dependency(%q<dynamic_form>, [">= 0"])
187
+ end
188
+ end
189
+
@@ -0,0 +1,15 @@
1
+ module GovernorTwitter
2
+ module Controllers
3
+ module Methods
4
+ def self.included(c)
5
+ c.after_filter :send_to_twitter, :only => [:create, :update]
6
+ end
7
+
8
+ def send_to_twitter
9
+ if params[:post_to_twitter] && resource.errors.blank?
10
+ resource.post_to_twitter_in_background(params[:twitter_content], polymorphic_url(resource))
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ require 'twitter'
2
+ module GovernorTwitter
3
+ module Models
4
+ module Methods
5
+ def post_to_twitter(content, url)
6
+ shortened_url = Shortie::Service.find_by_key("bitly").shorten(url)
7
+ Twitter.update("#{truncate(content, :length => 139 - shortened_url.size)} #{shortened_url}")
8
+ end
9
+
10
+ def post_to_twitter_in_background(content, url)
11
+ run_in_background :post_to_twitter, content, url
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ module GovernorTwitter
2
+ class Engine < ::Rails::Engine
3
+
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ require 'governor_twitter/rails'
2
+ require 'governor_twitter/models/methods'
3
+ require 'governor_twitter/controllers/methods'
4
+
5
+ twitter = Governor::Plugin.new('twitter')
6
+
7
+ twitter.register_model_callback do |base|
8
+ base.send :include, GovernorTwitter::Models::Methods
9
+ base.send :include, ActionView::Helpers::TextHelper
10
+ end
11
+ twitter.register_controller_callback do |controller|
12
+ controller.send :include, GovernorTwitter::Controllers::Methods
13
+ end
14
+ twitter.register_partial :bottom_of_form, 'articles/twitter_form'
15
+
16
+ Governor::PluginManager.register twitter
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe GovernorTwitter do
4
+ it "registers the plugin" do
5
+ Governor::PluginManager.plugins.size == 1
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe Article do
4
+ before do
5
+ @content = "Visit my site!"
6
+ @url = 'http://blago.gov/money_please'
7
+ @shortened_url = 'http://bit.ly/short'
8
+ @article = Factory(:article, :author => Factory(:user))
9
+ end
10
+ it "can post to twitter" do
11
+ Shortie::Service.find_by_key("bitly").expects(:shorten).with(@url).returns(@shortened_url)
12
+ Twitter.expects(:update).with("#{@content} #{@shortened_url}")
13
+ @article.post_to_twitter @content, @url
14
+ end
15
+ end
@@ -0,0 +1,4 @@
1
+ .bundle
2
+ db/*.sqlite3
3
+ log/*.log
4
+ tmp/
@@ -0,0 +1,41 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rails', '3.0.5'
4
+
5
+ # Bundle edge Rails instead:
6
+ # gem 'rails', :git => 'git://github.com/rails/rails.git'
7
+
8
+ gem 'sqlite3'
9
+
10
+ gem 'devise'
11
+ gem 'delayed_job'
12
+ gem 'governor'
13
+ gem 'governor_background'
14
+ gem 'governor_twitter', :path => '../..'
15
+
16
+ gem 'dynamic_form'
17
+
18
+ gem 'will_paginate', '~> 3.0.beta'
19
+
20
+ # Use unicorn as the web server
21
+ # gem 'unicorn'
22
+
23
+ # Deploy with Capistrano
24
+ # gem 'capistrano'
25
+
26
+ # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
27
+ # gem 'ruby-debug'
28
+ # gem 'ruby-debug19', :require => 'ruby-debug'
29
+
30
+ # Bundle the extra gems:
31
+ # gem 'bj'
32
+ # gem 'nokogiri'
33
+ # gem 'sqlite3-ruby', :require => 'sqlite3'
34
+ # gem 'aws-s3', :require => 'aws/s3'
35
+
36
+ # Bundle gems for the local environment. Make sure to
37
+ # put test-only gems in this group so their generators
38
+ # and rake tasks are available in development mode:
39
+ # group :development, :test do
40
+ # gem 'webrat'
41
+ # end