my_timeline-github 0.0.2 → 0.1.0

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: 459fd302a5a573cadc74fbea8fcd6b679b29b76c
4
- data.tar.gz: b83b3a73a416886141031e6ad3b78bea71c6ddf0
3
+ metadata.gz: 181521b70e1f562f7fa401a58369f5c2718e7020
4
+ data.tar.gz: e147aca2b3a1682fe3243532e7dd694919c2a9a2
5
5
  SHA512:
6
- metadata.gz: df601e08ac424cfc4f45f6a5d36e9d8abcc393edbb368788ea0523705d83d5292f160ba730a30118e365dd0fa6fb576f41bb81359220aa2caed0b0b284754288
7
- data.tar.gz: a85e4ccc67be66a9f51107816e5833c3fa20adfc91006f0a6b1134fb8f55cc75ce052af07304a2e994bcd8b2796ed9ac1e9012edb552f3913b62485d6169c3f9
6
+ metadata.gz: c5affa4a61418c5511d01fcfe5663f9aca81bb4b9f9af354e7bce0dc696eb7b6285c67e63c54f8a68dfa7ce1cdf5bfca5cb6038f2b132d4c82fc5c0acd12516a
7
+ data.tar.gz: ed19824ba501615e572796614b80ad3814fa4f9c69b94fcdf05dcf63909f24a6b157d978a297fca2daad6421190205d4a80f0afd21dd2e0d83adff90a4c3f3d8
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.1.0
2
+ * Register settings through plugin registry
3
+ * Require my_timeline 0.1.0
4
+ * Slight refactoring
5
+
1
6
  # 0.0.2
2
7
  * Added Rails 4 compatibility
3
8
  * Require my_timeline 0.0.4
@@ -5,7 +5,18 @@ module MyTimeline
5
5
  def build_event
6
6
  return false if already_exists_in_db?
7
7
 
8
- event = MyTimeline::Event.create(
8
+ event.linkable = fork_event
9
+ event.user = user if MyTimeline.user_class
10
+ event.save
11
+
12
+ fork_event.event = event
13
+ fork_event.save
14
+ end
15
+
16
+ private
17
+
18
+ def event
19
+ @event ||= MyTimeline::Event.create(
9
20
  happened_on: github_event.created_at,
10
21
  original_id: github_event.id,
11
22
  external_link: "https://www.github.com/#{user.settings(:github).user_name}/#{github_event.repo.name}",
@@ -14,19 +25,14 @@ module MyTimeline
14
25
  public: 1,
15
26
  description: "Forked #{link_user_repo(github_event.repo.name)}"
16
27
  )
28
+ end
17
29
 
18
- fork_event = MyTimeline::Github::ForkEvent.new(
30
+ def fork_event
31
+ @fork_event ||= MyTimeline::Github::ForkEvent.new(
19
32
  happened_on: github_event.created_at,
20
33
  original_id: github_event.id,
21
34
  repo: github_event.repo.name
22
35
  )
23
-
24
- event.linkable = fork_event
25
- event.user = user if MyTimeline.user_class
26
- event.save
27
-
28
- fork_event.event = event
29
- fork_event.save
30
36
  end
31
37
  end
32
38
  end
@@ -5,8 +5,19 @@ module MyTimeline
5
5
  def build_event
6
6
  return false if already_exists_in_db?
7
7
 
8
- event = MyTimeline::Event.create(
9
- happened_on: github_event.created_at,
8
+ event.linkable = pull_request_event
9
+ event.user = user if MyTimeline.user_class
10
+ event.save
11
+
12
+ pull_request_event.event = event
13
+ pull_request_event.save
14
+ end
15
+
16
+ private
17
+
18
+ def event
19
+ @event ||= MyTimeline::Event.create(
20
+ happened_on: happened_on,
10
21
  original_id: github_event.id,
11
22
  external_link: github_event.payload.pull_request.rels[:html].href,
12
23
  icon_name: "github.png",
@@ -14,9 +25,11 @@ module MyTimeline
14
25
  public: 1,
15
26
  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
27
  )
28
+ end
17
29
 
18
- pull_request_event = MyTimeline::Github::PullRequestEvent.new(
19
- happened_on: github_event.created_at,
30
+ def pull_request_event
31
+ @pull_request_event ||= MyTimeline::Github::PullRequestEvent.new(
32
+ happened_on: happened_on,
20
33
  title: github_event.payload.pull_request.title,
21
34
  body: github_event.payload.pull_request.body,
22
35
  url: github_event.payload.pull_request.rels[:html].href,
@@ -26,16 +39,11 @@ module MyTimeline
26
39
  changed_files: github_event.payload.pull_request.changed_files,
27
40
  repo: github_event.repo.name
28
41
  )
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
42
  end
37
43
 
38
- private
44
+ def happened_on
45
+ github_event.created_at
46
+ end
39
47
 
40
48
  def link_pr
41
49
  "<a href=#{github_event.payload.pull_request.rels[:html].href}>##{github_event.payload.number}</a>"
@@ -14,8 +14,7 @@ module MyTimeline
14
14
  end
15
15
 
16
16
  config.after_initialize do |app|
17
- MyTimeline.config_object.key :github, defaults: {user_token: nil}
18
- MyTimeline.register_plugin :github
17
+ MyTimeline.register_plugin :github, defaults: {user_token: nil}
19
18
  end
20
19
 
21
20
  rake_tasks do
@@ -1,5 +1,5 @@
1
1
  module MyTimeline
2
2
  module Github
3
- VERSION = "0.0.2"
3
+ VERSION = "0.1.0"
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", '>= 0.0.4'
16
+ s.add_runtime_dependency "my_timeline", '>= 0.1.0'
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.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Aiken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-10 00:00:00.000000000 Z
11
+ date: 2014-01-22 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.0.4
19
+ version: 0.1.0
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.0.4
26
+ version: 0.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: octokit
29
29
  requirement: !ruby/object:Gem::Requirement