got_skillz 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 154e26a565a4dcd8a3c12c3e34b429fac961ebb5
4
+ data.tar.gz: 412515be694a4e6cd1468aed9834b5495465758c
5
+ SHA512:
6
+ metadata.gz: 95edf9865936acc135a920fd5095884b227e251b750b6540020ec0616f4d7da262b659a07fbcad26f4112e0b7b5f1f10c89ef617e873ee04b7b6894f28bf7052
7
+ data.tar.gz: 01e99dbfce8976581bd9badb44313f57de53a1b6fe7ae3c91880cc03a77a9bea0ff7b81ba4be273b8eaabea1fc807ed5378747859af1fbbe59dc6d58c00c41db
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in skillz.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 mrodrigues
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # GotSkillz
2
+
3
+ ![](https://raw.github.com/mrodrigues/got_skillz/master/img/skillz.jpg)
4
+
5
+ Track your skillz with GitHub commit messages, and list where and when your learned them.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'got_skillz'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install got_skillz
20
+
21
+ ## Usage
22
+
23
+ Get your skillz:
24
+
25
+ ```ruby
26
+ require 'got_skillz'
27
+
28
+ my_skillz = GotSkillz.skillz_for('login', 'password')
29
+ some_skill = my_skillz.first
30
+
31
+ some_skill.original_message
32
+ # => "Did something awesome <3 Learned to sing </3"
33
+ some_skill.skill
34
+ # => "Learned to sing"
35
+ some_skill.url
36
+ # => "http://github.com/:user/:repo/commit/:sha"
37
+ ```
38
+
39
+ Wanna change the tags to something boring?
40
+
41
+ ```ruby
42
+ GotSkillz.config do |c|
43
+ c.skill_begin = "<skill>"
44
+ c.skill_end = "</skill>"
45
+ end
46
+
47
+ my_skillz = GotSkillz.skillz_for('login', 'password')
48
+ some_skill = my_skillz.first
49
+
50
+ some_skill.original_message
51
+ # => "Did something boring <skill> Learned to
52
+ # fold laundry in a new exciting fashion </skill>"
53
+ ```
54
+
55
+ ## Contributing
56
+
57
+ 1. Fork it
58
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
59
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
60
+ 4. Push to the branch (`git push origin my-new-feature`)
61
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'got_skillz/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "got_skillz"
8
+ spec.version = GotSkillz::VERSION
9
+ spec.authors = ["mrodrigues"]
10
+ spec.email = ["mrodrigues.uff@gmail.com"]
11
+ spec.description = %q{Track your skillz with GitHub commit messages, and list where and when your learned them.}
12
+ spec.summary = %q{Got skillz? Track them with this!}
13
+ spec.homepage = "https://github.com/mrodrigues/got_skillz"
14
+ spec.license = "MIT"
15
+
16
+ spec.add_runtime_dependency "octokit"
17
+
18
+ spec.files = `git ls-files`.split($/) - ['img/skillz.jpg']
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ end
data/lib/got_skillz.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'got_skillz/version'
2
+ require 'got_skillz/client'
3
+ require 'got_skillz/skill'
4
+ require 'got_skillz/config'
5
+
6
+ module GotSkillz
7
+
8
+ def self.skillz_for(login, password = nil)
9
+ GotSkillz::Client.new(login, password).skillz
10
+ end
11
+
12
+ def self.config
13
+ @@config ||= GotSkillz::Config.new
14
+ yield(@@config) if block_given?
15
+ @@config
16
+ end
17
+
18
+ end
@@ -0,0 +1,26 @@
1
+ require 'octokit'
2
+ module GotSkillz
3
+ class Client
4
+
5
+ attr_accessor :skillz
6
+
7
+ def initialize(login, password = nil)
8
+ user = Octokit::Client.new(:login => login, :password => password).user # :login => ENV['OCTOKIT_LOGIN'], :password => ENV['OCTOKIT_PASSWORD']
9
+
10
+ @skillz = []
11
+
12
+ config = GotSkillz.config
13
+ user.rels[:events].get.data.each do |event|
14
+ if event.type == "PushEvent"
15
+ repo = event.repo.name
16
+ event.payload.commits.each do |commit|
17
+ if commit.author.email == user.email &&
18
+ commit.message =~ /#{config.skill_begin}(.*)#{config.skill_end}/
19
+ @skillz << Skill.new(repo: repo, commit: commit.sha, original_message: commit.message, skill: $1)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,19 @@
1
+ module GotSkillz
2
+ class Config
3
+ DELIMITERS = [:skill_begin, :skill_end, :tag_begin, :tag_end]
4
+ attr_accessor *DELIMITERS
5
+
6
+ def initialize
7
+ @skill_begin = '<3'
8
+ @skill_end = '</3'
9
+ @tag_begin = ':3'
10
+ @tag_end = '>:3'
11
+ end
12
+
13
+ DELIMITERS.each do |delimiter|
14
+ define_method "#{delimiter}=" do |value|
15
+ instance_variable_set "@#{delimiter}", Regexp.escape(value)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ module GotSkillz
2
+ class Skill
3
+ attr_accessor :repo, :commit, :original_message, :skill, :tags
4
+
5
+ def initialize(options)
6
+ options.each { |attribute, value| send("#{attribute}=", value.strip) }
7
+ @tags ||= []
8
+ end
9
+
10
+ def url
11
+ "http://github.com/#{repo}/commit/#{commit}"
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ module GotSkillz
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: got_skillz
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - mrodrigues
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: octokit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Track your skillz with GitHub commit messages, and list where and when
56
+ your learned them.
57
+ email:
58
+ - mrodrigues.uff@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - got_skillz.gemspec
69
+ - lib/got_skillz.rb
70
+ - lib/got_skillz/client.rb
71
+ - lib/got_skillz/config.rb
72
+ - lib/got_skillz/skill.rb
73
+ - lib/got_skillz/version.rb
74
+ homepage: https://github.com/mrodrigues/got_skillz
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.0.3
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Got skillz? Track them with this!
98
+ test_files: []