my_timeline 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5dc41e97ee667d76451c4748063224261192dc19
4
- data.tar.gz: 7e3e7954e8bed1f8954be7ca8a9878f66b7f6627
3
+ metadata.gz: 180963925c947c23df9af5971da60bee552c0a8a
4
+ data.tar.gz: 7c1c93ed23f8eb0042a49fc1980bf0983d8156aa
5
5
  SHA512:
6
- metadata.gz: 0e41fdf3838665cd3fc65e0d062caf1fbae53f36cccadead28932141d8d2ebc2e07fcdc10168471b86dd26556a095d1b4dea27cae58335575ac3a9eb32eca1cd
7
- data.tar.gz: d122dc6617636a46592fb3f35d1ae02adb82d9e962b80d37968034e6c6e4222d065407e72942eb46d6b64ffa6869f88f3ab969d5cc0c7af2c39ebfbfc64bd07b
6
+ metadata.gz: 7772eed0229ad702ca03290f9e86755eb0eee82df4a78463f119f55be92f654b4e7ee9fd9977d809aa627d19bc666714795eec9cdf91a0c0064edb58fb0d5c9e
7
+ data.tar.gz: 3586a2d72d86d44d9dea55a77956db5a7f8d6ef288f5861031a3d9495bf308f3470b18f22a4a29d1debfa0ed2084e2272ff4ef413eadb35a06da48a157cc03ab
data/.travis.yml CHANGED
@@ -4,6 +4,9 @@ rvm:
4
4
  - 2.0.0
5
5
  env:
6
6
  - DB=sqlite
7
+ gemfile:
8
+ - gemfiles/Gemfile.rails-3.x
9
+ - gemfiles/Gemfile.rails-4.x
7
10
  script:
8
11
  - RAILS_ENV=test bundle exec rake db:migrate
9
12
  - bundle exec rake
@@ -0,0 +1,12 @@
1
+ # 0.0.4
2
+ * Added Rails 4 compatibility
3
+ * Added more tests
4
+
5
+ # 0.0.3
6
+ * Fixed external event link
7
+
8
+ # 0.0.2
9
+ * Many, many bugfixes
10
+
11
+ # 0.0.1
12
+ * Initial release
data/README.markdown CHANGED
@@ -1,7 +1,5 @@
1
-
2
-
3
1
  # My Timeline [![Code Climate](https://codeclimate.com/github/JustinAiken/my_timeline.png)](https://codeclimate.com/github/JustinAiken/my_timeline) [![Build Status](https://secure.travis-ci.org/JustinAiken/my_timeline.png?branch=master)](http://travis-ci.org/JustinAiken/my_timeline)
4
- #### A social-media aggregation/display plugin
2
+ #### A social-media aggregation/display plugin
5
3
 
6
4
  This is a Rails Engine to help pull in content from any number of social media sites, services, or websites.
7
5
  The aggregated information is displayed in a unified timeline.
@@ -12,7 +10,8 @@ It is being developed with extensibility in mind - each service will have it's o
12
10
  ![Screenshot](doc/screenshot.png)
13
11
 
14
12
  ### Requirements:
15
- - Rails 3.x - Rails 4 is not currently supported, but it's on the todo..
13
+ - Ruby 1.9.3 or 2.x
14
+ - Rails 3.1.x or 3.2.x or 4.x
16
15
  - Bootstrap (or bootstrap-named classes) - For the markup. Just stuff like `table.table-striped`, no stuctural markup from Bootstrap is needed
17
16
  - Any standard ActiveRecord-compatible database should work
18
17
 
@@ -15,7 +15,7 @@ module MyTimeline
15
15
  end
16
16
 
17
17
  def show
18
-
18
+ #
19
19
  end
20
20
 
21
21
  def edit
@@ -24,7 +24,7 @@ module MyTimeline
24
24
 
25
25
  def update
26
26
  @event = Event.find_by_id(params[:id])
27
- if @event.update_attributes(params[:event])
27
+ if @event.update_attributes(rails4? ? event_params : params[:event])
28
28
  redirect_to root_path, notice: "Edit successful."
29
29
  else
30
30
  render 'edit'
@@ -49,5 +49,11 @@ module MyTimeline
49
49
  end
50
50
  end
51
51
  end
52
+
53
+ if rails4?
54
+ define_method :event_params do
55
+ params.required(:event).permit :description, :happened_on, :public
56
+ end
57
+ end
52
58
  end
53
59
  end
@@ -7,7 +7,7 @@ module MyTimeline
7
7
  end
8
8
 
9
9
  def create
10
- @post = Post.new(params[:post])
10
+ @post = Post.new(rails4? ? post_params : params[:post])
11
11
 
12
12
  @post.event.happened_on = @post.happened_on
13
13
  @post.event.user_id = @user.id
@@ -22,5 +22,13 @@ module MyTimeline
22
22
  render :new
23
23
  end
24
24
  end
25
+
26
+ private
27
+
28
+ if rails4?
29
+ define_method :post_params do
30
+ params.required(:post).permit :happened_on, :full_text, event_attributes: [:description, :public]
31
+ end
32
+ end
25
33
  end
26
34
  end
@@ -1,9 +1,12 @@
1
1
  module MyTimeline
2
2
  class Event < ActiveRecord::Base
3
- attr_accessible :description, :happened_on, :icon_name, :external_link, :original_id, :public, :importance
4
- attr_accessible :user, :linkable, :user_id, :linkable_type, :linkable_id
5
3
 
6
- belongs_to :linkable, polymorphic: true, dependent: :destroy
4
+ unless rails4?
5
+ attr_accessible :description, :happened_on, :icon_name, :external_link, :original_id, :public, :importance
6
+ attr_accessible :user, :linkable, :user_id, :linkable_type, :linkable_id
7
+ end
8
+
9
+ belongs_to :linkable, polymorphic: true, dependent: :delete
7
10
  belongs_to :user, class_name: MyTimeline.user_class.to_s
8
11
 
9
12
  validates :description, presence: true
@@ -1,7 +1,10 @@
1
1
  module MyTimeline
2
2
  class Post < ActiveRecord::Base
3
- attr_accessible :happened_on, :full_text
4
- attr_accessible :event, :event_id, :event_attributes
3
+
4
+ unless rails4?
5
+ attr_accessible :happened_on, :full_text
6
+ attr_accessible :event, :event_id, :event_attributes
7
+ end
5
8
 
6
9
  belongs_to :event, dependent: :destroy
7
10
 
data/config/routes.rb CHANGED
@@ -4,5 +4,5 @@ MyTimeline::Engine.routes.draw do
4
4
  resources :events
5
5
  resources :posts
6
6
 
7
- match "control_panel" => "control_panel#index", as: "control_panel"
7
+ get "control_panel" => "control_panel#index", as: "control_panel"
8
8
  end
@@ -9,6 +9,6 @@ class CreateMyTimelineSettings < ActiveRecord::Migration
9
9
  t.timestamps
10
10
  end
11
11
 
12
- add_index :my_timeline_settings, [ :target_type, :target_id, :var ], :unique => true
12
+ add_index :my_timeline_settings, [ :target_type, :target_id, :var ], :unique => true, :name => "index_my_timeline_settings_on_user"
13
13
  end
14
14
  end
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec :path => '..'
4
+
5
+ gem "jquery-rails"
6
+ gem "rails", "~>3.2"
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec :path => '..'
4
+
5
+ gem "jquery-rails"
6
+ gem "rails", ">4.0"
@@ -0,0 +1,5 @@
1
+ module Kernel
2
+ define_method :rails4? do
3
+ Rails::VERSION::MAJOR >= 4
4
+ end
5
+ end
@@ -1,4 +1,5 @@
1
1
  require 'my_timeline/settings_ext'
2
+ require 'my_timeline/core_ext/rails4'
2
3
 
3
4
  module MyTimeline
4
5
  class Engine < ::Rails::Engine
@@ -1,3 +1,3 @@
1
1
  module MyTimeline
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/my_timeline.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.files = `git ls-files`.split("\n")
17
17
  s.test_files = `git ls-files -- {spec}/*`.split("\n")
18
18
 
19
- s.add_runtime_dependency "rails", ['>= 3.2', '< 4.0']
19
+ s.add_runtime_dependency "rails", ['> 2.0']
20
20
  s.add_runtime_dependency "kaminari"
21
21
  s.add_runtime_dependency 'ledermann-rails-settings'
22
22
 
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe MyTimeline::ApplicationController do
4
+ describe "#find_user" do
5
+
6
+ before { subject.params = {user_id: "7"} }
7
+ after do
8
+ subject.params.should == {}
9
+ end
10
+
11
+ context "when the user exists" do
12
+ it "sets some variables" do
13
+ MyTimeline::UserStub.should_receive(:find_by_id).with("7").and_return "foo"
14
+ subject.stub(:current_user).and_return "foo"
15
+ subject.send :find_user
16
+ subject.instance_variable_get(:@owner_viewing).should be_true
17
+ subject.instance_variable_get(:@show_hidden).should be_true
18
+ end
19
+ end
20
+
21
+ context "when the user is not found" do
22
+ it "doesn't do much" do
23
+ subject.stub(:current_user).and_return nil
24
+ subject.send :find_user
25
+ subject.instance_variable_get(:@owner_viewing).should be_false
26
+ subject.instance_variable_get(:@show_hidden).should be_false
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe MyTimeline::ControlPanelController do
4
+ routes { MyTimeline::Engine.routes }
5
+
6
+ before { ApplicationController.any_instance.stub :current_user }
7
+
8
+ describe "GET #index" do
9
+ it "gets okay" do
10
+ get "index"
11
+ response.code.should == "200"
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe MyTimeline::EventsController do
4
+ routes { MyTimeline::Engine.routes }
5
+
6
+ before { ApplicationController.any_instance.stub :current_user }
7
+
8
+ describe "GET #index" do
9
+ it "gets okay" do
10
+ get "index"
11
+ response.code.should == "200"
12
+ end
13
+ end
14
+
15
+ describe "GET #show" do
16
+ xit "shows stuff" do
17
+ end
18
+ end
19
+
20
+ describe "GET #edit" do
21
+ xit "edits" do
22
+ get "edit"
23
+ end
24
+ end
25
+
26
+ describe "#update" do
27
+ xit "updates" do
28
+ end
29
+ end
30
+
31
+ describe "#destroy" do
32
+ xit "kills it"
33
+ end
34
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe MyTimeline::PostsController do
4
+ routes { MyTimeline::Engine.routes }
5
+
6
+ before { ApplicationController.any_instance.stub :current_user }
7
+
8
+ describe "GET #new" do
9
+ it "news" do
10
+ get "new"
11
+ subject.instance_variable_get(:@post).should be_a MyTimeline::Post
12
+ subject.instance_variable_get(:@event).should be_a MyTimeline::Event
13
+ end
14
+ end
15
+
16
+ describe "POST #create" do
17
+ it "creates the event/post" do
18
+ post "create", post: {happened_on: Time.now, full_text: "foo", event_attributes: {description: "bar", public: "true"}}
19
+ MyTimeline::Post.last.should_not be_nil
20
+ response.should redirect_to root_path
21
+ end
22
+ end
23
+ end
@@ -3,9 +3,13 @@ require File.expand_path('../boot', __FILE__)
3
3
  require "active_record/railtie"
4
4
  require "action_controller/railtie"
5
5
  require "action_mailer/railtie"
6
- require "active_resource/railtie"
7
6
  require "sprockets/railtie"
8
7
 
8
+ begin
9
+ require "active_resource/railtie"
10
+ rescue LoadError
11
+ end
12
+
9
13
  Bundler.require(*Rails.groups)
10
14
  require "my_timeline"
11
15
 
@@ -14,7 +18,7 @@ module Dummy
14
18
  config.encoding = "utf-8"
15
19
  config.filter_parameters += [:password]
16
20
  config.active_support.escape_html_entities_in_json = true
17
- config.active_record.whitelist_attributes = true
21
+ config.active_record.whitelist_attributes = true unless rails4?
18
22
  config.assets.enabled = true
19
23
  config.assets.version = '1.0'
20
24
  end
@@ -7,7 +7,7 @@ Dummy::Application.configure do
7
7
  config.cache_classes = false
8
8
 
9
9
  # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
10
+ config.whiny_nils = true unless rails4?
11
11
 
12
12
  # Show full error reports and disable caching
13
13
  config.consider_all_requests_local = true
@@ -23,11 +23,11 @@ Dummy::Application.configure do
23
23
  config.action_dispatch.best_standards_support = :builtin
24
24
 
25
25
  # Raise exception on mass assignment protection for Active Record models
26
- config.active_record.mass_assignment_sanitizer = :strict
26
+ config.active_record.mass_assignment_sanitizer = :strict unless rails4?
27
27
 
28
28
  # Log the query plan for queries taking more than this (works
29
29
  # with SQLite, MySQL, and PostgreSQL)
30
- config.active_record.auto_explain_threshold_in_seconds = 0.5
30
+ config.active_record.auto_explain_threshold_in_seconds = 0.5 unless rails4?
31
31
 
32
32
  # Do not compress assets
33
33
  config.assets.compress = false
@@ -12,7 +12,7 @@ Dummy::Application.configure do
12
12
  config.static_cache_control = "public, max-age=3600"
13
13
 
14
14
  # Log error messages when you accidentally call methods on nil
15
- config.whiny_nils = true
15
+ config.whiny_nils = true unless rails4?
16
16
 
17
17
  # Show full error reports and disable caching
18
18
  config.consider_all_requests_local = true
@@ -30,7 +30,7 @@ Dummy::Application.configure do
30
30
  config.action_mailer.delivery_method = :test
31
31
 
32
32
  # Raise exception on mass assignment protection for Active Record models
33
- config.active_record.mass_assignment_sanitizer = :strict
33
+ config.active_record.mass_assignment_sanitizer = :strict unless rails4?
34
34
 
35
35
  # Print deprecation notices to the stderr
36
36
  config.active_support.deprecation = :stderr
@@ -51,6 +51,5 @@ ActiveRecord::Schema.define(:version => 20131103135539) do
51
51
  t.datetime "updated_at", :null => false
52
52
  end
53
53
 
54
- add_index "my_timeline_settings", ["target_type", "target_id", "var"], :name => "index_my_timeline_settings_on_target_type_and_target_id_and_var", :unique => true
55
-
54
+ add_index "my_timeline_settings", ["target_type", "target_id", "var"], :name => "index_my_timeline_settings_on_user", :unique => true
56
55
  end
metadata CHANGED
@@ -1,35 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_timeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Aiken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-29 00:00:00.000000000 Z
11
+ date: 2014-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '3.2'
20
- - - <
17
+ - - '>'
21
18
  - !ruby/object:Gem::Version
22
- version: '4.0'
19
+ version: '2.0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - '>='
28
- - !ruby/object:Gem::Version
29
- version: '3.2'
30
- - - <
24
+ - - '>'
31
25
  - !ruby/object:Gem::Version
32
- version: '4.0'
26
+ version: '2.0'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: kaminari
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -137,6 +131,7 @@ extra_rdoc_files: []
137
131
  files:
138
132
  - .gitignore
139
133
  - .travis.yml
134
+ - CHANGELOG.markdown
140
135
  - Gemfile
141
136
  - Guardfile
142
137
  - LICENSE
@@ -170,10 +165,13 @@ files:
170
165
  - db/migrate/20131103135539_create_my_timeline_posts.rb
171
166
  - doc/screenshot.png
172
167
  - engine_plan.rb
168
+ - gemfiles/Gemfile.rails-3.x
169
+ - gemfiles/Gemfile.rails-4.x
173
170
  - lib/generators/my_timeline/install_generator.rb
174
171
  - lib/generators/templates/README
175
172
  - lib/generators/templates/my_timeline.rb
176
173
  - lib/my_timeline.rb
174
+ - lib/my_timeline/core_ext/rails4.rb
177
175
  - lib/my_timeline/engine.rb
178
176
  - lib/my_timeline/settings_ext.rb
179
177
  - lib/my_timeline/user_stub.rb
@@ -181,6 +179,10 @@ files:
181
179
  - lib/tasks/my_timeline_tasks.rake
182
180
  - my_timeline.gemspec
183
181
  - script/rails
182
+ - spec/controllers/my_timeline/application_controller_spec.rb
183
+ - spec/controllers/my_timeline/control_panel_controller_spec.rb
184
+ - spec/controllers/my_timeline/events_controller_spec.rb
185
+ - spec/controllers/my_timeline/posts_controller_spec.rb
184
186
  - spec/dummy/Rakefile
185
187
  - spec/dummy/app/assets/javascripts/application.js
186
188
  - spec/dummy/app/assets/stylesheets/application.css
@@ -202,7 +204,6 @@ files:
202
204
  - spec/dummy/config/initializers/secret_token.rb
203
205
  - spec/dummy/config/initializers/session_store.rb
204
206
  - spec/dummy/config/initializers/wrap_parameters.rb
205
- - spec/dummy/config/locales/en.yml
206
207
  - spec/dummy/config/routes.rb
207
208
  - spec/dummy/db/schema.rb
208
209
  - spec/dummy/lib/assets/.gitkeep
@@ -1,5 +0,0 @@
1
- # Sample localization file for English. Add more files in this directory for other locales.
2
- # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
-
4
- en:
5
- hello: "Hello world"