my_timeline-github 0.0.1 → 0.0.2

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: 6a69047376412697ed0c61a421156b0b651f7aa2
4
- data.tar.gz: 3f7dc6837b6568e0cf98306aada5cd985d880e5b
3
+ metadata.gz: 459fd302a5a573cadc74fbea8fcd6b679b29b76c
4
+ data.tar.gz: b83b3a73a416886141031e6ad3b78bea71c6ddf0
5
5
  SHA512:
6
- metadata.gz: 22d65b0d13409d271dd6afd27b52ccbaef97d544368255e38c1e10aca44e93aa2649c3121ec78606472f407e620cdf12e0dfe816163ab28b6fe0c4fdd0650f12
7
- data.tar.gz: c90d5d3ad51ed4e435e7e1044e49702820956ca4a39a5241075b4adbf1e91bd6758cb5733ff9a65d93941163845cf247a418b60bd13c56ebf3dd0f29e00e58d8
6
+ metadata.gz: df601e08ac424cfc4f45f6a5d36e9d8abcc393edbb368788ea0523705d83d5292f160ba730a30118e365dd0fa6fb576f41bb81359220aa2caed0b0b284754288
7
+ data.tar.gz: a85e4ccc67be66a9f51107816e5833c3fa20adfc91006f0a6b1134fb8f55cc75ce052af07304a2e994bcd8b2796ed9ac1e9012edb552f3913b62485d6169c3f9
@@ -0,0 +1,6 @@
1
+ # 0.0.2
2
+ * Added Rails 4 compatibility
3
+ * Require my_timeline 0.0.4
4
+
5
+ # 0.0.1
6
+ * Initial release
data/README.markdown CHANGED
@@ -1,14 +1,12 @@
1
- [![Code Climate](https://codeclimate.com/github/JustinAiken/my_timeline-github.png)](https://codeclimate.com/github/JustinAiken/my_timeline-github)
2
-
3
- # My Timeline - Github Plugin
1
+ # My Timeline - Github Plugin [![Code Climate](https://codeclimate.com/github/JustinAiken/my_timeline-github.png)](https://codeclimate.com/github/JustinAiken/my_timeline-github)
4
2
  #### Github Integration with My Timeline
5
3
 
6
- ### Requirements:
4
+ ## Requirements:
7
5
 
8
6
  - [My Timeline](https://github.com/JustinAiken/my_timeline)
9
7
  - [Octokit](https://github.com/octokit/octokit.rb) gem
10
8
 
11
- ### Usage:
9
+ ## Usage:
12
10
 
13
11
  1. Add this gem to your Gemfile:
14
12
  `gem 'my_timeline-github'` and `bundle install`
@@ -29,30 +27,30 @@ end
29
27
 
30
28
  ```
31
29
 
32
- ### Current State
30
+ ## Current State
33
31
 
34
32
  Github provides a wide variety of user activities. This plugin will eventually include them all, but they'll be coming one at a time...
35
33
 
36
- - [ ] [CommitCommentEvent](http://developer.github.com/v3/activity/events/types/#commitcommentevent)
37
- - [ ] [CreateEvent](http://developer.github.com/v3/activity/events/types/#createevent)
38
- - [ ] [DeleteEvent](http://developer.github.com/v3/activity/events/types/#deleteevent)
39
- - [ ] [DownloadEvent](http://developer.github.com/v3/activity/events/types/#downloadevent)
40
- - [ ] [FollowEvent](http://developer.github.com/v3/activity/events/types/#followevent)
41
- - [x] [ForkEvent](http://developer.github.com/v3/activity/events/types/#forkevent)
42
- - [ ] [ForkApplyEvent](http://developer.github.com/v3/activity/events/types/#forkapplyevent)
43
- - [ ] [GistEvent](http://developer.github.com/v3/activity/events/types/#gistevent)
44
- - [ ] [GollumEvent](http://developer.github.com/v3/activity/events/types/#gollumevent)
45
- - [ ] [IssueCommentEvent](http://developer.github.com/v3/activity/events/types/#issuecommentevent)
46
- - [ ] [IssuesEvent](http://developer.github.com/v3/activity/events/types/#issuesevent)
47
- - [ ] [MemberEvent](http://developer.github.com/v3/activity/events/types/#memberevent)
48
- - [ ] [PublicEvent](http://developer.github.com/v3/activity/events/types/#publicevent)
49
- - [ ] [PullRequestEvent](http://developer.github.com/v3/activity/events/types/#pullrequestevent)
50
- - [ ] [PullRequestReviewCommentEvent](http://developer.github.com/v3/activity/events/types/#pullrequestreviewcommentevent)
51
- - [ ] [PushEvent](http://developer.github.com/v3/activity/events/types/#pushevent)
52
- - [ ] [ReleaseEvent](http://developer.github.com/v3/activity/events/types/#releaseevent)
53
- - [ ] [StatusEvent](http://developer.github.com/v3/activity/events/types/#statusevent)
54
- - [ ] [TeamAddEvent](http://developer.github.com/v3/activity/events/types/#teamaddevent)
55
- - [ ] [WatchEvent](http://developer.github.com/v3/activity/events/types/#watchevent)
34
+ `[ ]` [CommitCommentEvent](http://developer.github.com/v3/activity/events/types/#commitcommentevent) <br>
35
+ `[ ]` [CreateEvent](http://developer.github.com/v3/activity/events/types/#createevent) <br>
36
+ `[ ]` [DeleteEvent](http://developer.github.com/v3/activity/events/types/#deleteevent) <br>
37
+ `[ ]` [DownloadEvent](http://developer.github.com/v3/activity/events/types/#downloadevent) <br>
38
+ `[ ]` [FollowEvent](http://developer.github.com/v3/activity/events/types/#followevent) <br>
39
+ `[x]` [ForkEvent](http://developer.github.com/v3/activity/events/types/#forkevent) <br>
40
+ `[ ]` [ForkApplyEvent](http://developer.github.com/v3/activity/events/types/#forkapplyevent) <br>
41
+ `[ ]` [GistEvent](http://developer.github.com/v3/activity/events/types/#gistevent) <br>
42
+ `[ ]` [GollumEvent](http://developer.github.com/v3/activity/events/types/#gollumevent) <br>
43
+ `[ ]` [IssueCommentEvent](http://developer.github.com/v3/activity/events/types/#issuecommentevent) <br>
44
+ `[ ]` [IssuesEvent](http://developer.github.com/v3/activity/events/types/#issuesevent) <br>
45
+ `[ ]` [MemberEvent](http://developer.github.com/v3/activity/events/types/#memberevent) <br>
46
+ `[ ]` [PublicEvent](http://developer.github.com/v3/activity/events/types/#publicevent) <br>
47
+ `[X]` [PullRequestEvent](http://developer.github.com/v3/activity/events/types/#pullrequestevent) <br>
48
+ `[ ]` [PullRequestReviewCommentEvent](http://developer.github.com/v3/activity/events/types/#pullrequestreviewcommentevent) <br>
49
+ `[ ]` [PushEvent](http://developer.github.com/v3/activity/events/types/#pushevent) <br>
50
+ `[ ]` [ReleaseEvent](http://developer.github.com/v3/activity/events/types/#releaseevent) <br>
51
+ `[ ]` [StatusEvent](http://developer.github.com/v3/activity/events/types/#statusevent) <br>
52
+ `[ ]` [TeamAddEvent](http://developer.github.com/v3/activity/events/types/#teamaddevent) <br>
53
+ `[ ]` [WatchEvent](http://developer.github.com/v3/activity/events/types/#watchevent)
56
54
 
57
55
  ## Credits
58
56
 
@@ -4,7 +4,7 @@ module MyTimeline
4
4
  self.table_name = :my_timeline_github_fork_events
5
5
  belongs_to :event #,dependant: :destroy
6
6
 
7
- attr_protected
7
+ attr_protected unless rails4?
8
8
  end
9
9
  end
10
10
  end
@@ -0,0 +1,10 @@
1
+ module MyTimeline
2
+ module Github
3
+ class PullRequestEvent < ActiveRecord::Base
4
+ self.table_name = :my_timeline_github_pull_request_events
5
+ belongs_to :event #,dependant: :destroy
6
+
7
+ attr_protected unless rails4?
8
+ end
9
+ end
10
+ end
@@ -9,7 +9,7 @@ module MyTimeline
9
9
  # StatusEvent TeamAddEvent WatchEvent
10
10
 
11
11
  # IMPLEMENTED EVENTS ONLY:
12
- VALID_EVENTS = %w{ForkEvent}.freeze
12
+ VALID_EVENTS = %w{ForkEvent PullRequestEvent}.freeze
13
13
 
14
14
  attr_accessor :user
15
15
 
@@ -0,0 +1,45 @@
1
+ module MyTimeline
2
+ module Github
3
+ class PullRequestEventBuilder < GithubBuilder
4
+
5
+ def build_event
6
+ return false if already_exists_in_db?
7
+
8
+ event = MyTimeline::Event.create(
9
+ happened_on: github_event.created_at,
10
+ original_id: github_event.id,
11
+ external_link: github_event.payload.pull_request.rels[:html].href,
12
+ icon_name: "github.png",
13
+ importance: 5,
14
+ public: 1,
15
+ description: "#{github_event.payload.action.capitalize} Pull Request #{link_pr} on #{link_user_repo(github_event.repo.name)}: #{github_event.payload.pull_request.title}"
16
+ )
17
+
18
+ pull_request_event = MyTimeline::Github::PullRequestEvent.new(
19
+ happened_on: github_event.created_at,
20
+ title: github_event.payload.pull_request.title,
21
+ body: github_event.payload.pull_request.body,
22
+ url: github_event.payload.pull_request.rels[:html].href,
23
+ commits: github_event.payload.pull_request.commits,
24
+ additions: github_event.payload.pull_request.additions,
25
+ deletions: github_event.payload.pull_request.deletions,
26
+ changed_files: github_event.payload.pull_request.changed_files,
27
+ repo: github_event.repo.name
28
+ )
29
+
30
+ event.linkable = pull_request_event
31
+ event.user = user if MyTimeline.user_class
32
+ event.save
33
+
34
+ pull_request_event.event = event
35
+ pull_request_event.save
36
+ end
37
+
38
+ private
39
+
40
+ def link_pr
41
+ "<a href=#{github_event.payload.pull_request.rels[:html].href}>##{github_event.payload.number}</a>"
42
+ end
43
+ end
44
+ end
45
+ end
data/config/routes.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  MyTimeline::Engine.routes.draw do
2
- match 'github/scrape' => 'github#scrape', as: "github_scrape"
3
- post 'github/new' => 'github#new', as: "new_github"
2
+ get 'github/scrape' => 'github#scrape', as: "github_scrape"
3
+ post 'github/new' => 'github#new', as: "new_github"
4
4
  resources :github
5
5
  end
@@ -0,0 +1,19 @@
1
+ class CreateGithubPullRequestEvents < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_timeline_github_pull_request_events do |t|
4
+ t.datetime :happened_on
5
+
6
+ t.text :title
7
+ t.text :body
8
+ t.string :url
9
+ t.integer :commits
10
+ t.integer :additions
11
+ t.integer :deletions
12
+ t.integer :changed_files
13
+ t.string :repo
14
+
15
+ t.references :event
16
+ t.timestamps
17
+ end
18
+ end
19
+ end
@@ -1,13 +1,23 @@
1
- namespace "my_timeline-twitter" do
1
+ namespace "my_timeline-github" do
2
+
3
+ def already_copied?(migration_file)
4
+ `ls db/migrate/*#{migration_file}.my_timeline.rb` != ""
5
+ end
6
+
7
+ def copy_migration(migration_file)
8
+ return if already_copied? migration_file
9
+ timestamp = Time.now.strftime("%Y%m%d%H%M%S")
10
+ source = File.expand_path "../../../../db/migrate/#{migration_file}.rb", File.dirname(__FILE__)
11
+ dest = File.expand_path "db/migrate/#{timestamp}_#{migration_file}.my_timeline.rb"
12
+ puts "cp #{source} #{dest}"
13
+ `cp #{source} #{dest}`
14
+ end
15
+
2
16
  namespace :install do
3
- desc "Copy migrations from my_timeline-twitter to application"
17
+ desc "Copy migrations from my_timeline-github to application"
4
18
  task :migrations do
5
- timestamp = Time.now.strftime("%Y%m%d%H%M%S")
6
-
7
- source = File.expand_path "../../../../db/migrate//db/migrate/20131222224040_create_github_fork_events.rb", File.dirname(__FILE__)
8
- dest = File.expand_path "db/migrate/#{timestamp}_create_github_fork_events.my_timeline.rb"
9
- puts "cp #{source} #{dest}"
10
- `cp #{source} #{dest}`
19
+ copy_migration "create_github_fork_events"
20
+ copy_migration "create_github_pull_request_events"
11
21
  end
12
22
  end
13
23
  end
@@ -1,5 +1,5 @@
1
1
  module MyTimeline
2
2
  module Github
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -13,6 +13,6 @@ Gem::Specification.new do |s|
13
13
  s.license = 'MIT'
14
14
  s.files = `git ls-files`.split("\n")
15
15
 
16
- s.add_runtime_dependency "my_timeline"
16
+ s.add_runtime_dependency "my_timeline", '>= 0.0.4'
17
17
  s.add_runtime_dependency "octokit"
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_timeline-github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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-22 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: my_timeline
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.0.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.0.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: octokit
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -46,18 +46,22 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - .gitignore
49
+ - CHANGELOG.markdown
49
50
  - Gemfile
50
51
  - LICENSE
51
52
  - README.markdown
52
53
  - app/assets/images/my_timeline/icons/github.png
53
54
  - app/controllers/my_timeline/github_controller.rb
54
55
  - app/models/my_timeline/github/fork_event.rb
56
+ - app/models/my_timeline/github/pull_request_event.rb
55
57
  - app/scrapers/my_timeline/github/fork_event_builder.rb
56
58
  - app/scrapers/my_timeline/github/github_builder.rb
57
59
  - app/scrapers/my_timeline/github/github_scraper.rb
60
+ - app/scrapers/my_timeline/github/pull_request_event_builder.rb
58
61
  - app/views/my_timeline/github/_control_panel.html.erb
59
62
  - config/routes.rb
60
- - db/migrate/20131222224040_create_github_fork_events.rb
63
+ - db/migrate/create_github_fork_events.rb
64
+ - db/migrate/create_github_pull_request_events.rb
61
65
  - lib/my_timeline-github.rb
62
66
  - lib/my_timeline/github/engine.rb
63
67
  - lib/my_timeline/github/railties/github_tasks.rake
@@ -83,9 +87,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
87
  version: '0'
84
88
  requirements: []
85
89
  rubyforge_project:
86
- rubygems_version: 2.0.6
90
+ rubygems_version: 2.0.3
87
91
  signing_key:
88
92
  specification_version: 4
89
93
  summary: Github plugin for MyTimeline
90
94
  test_files: []
91
- has_rdoc: