t1k 0.0.1 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +0 -8
- data/lib/t1k.rb +21 -64
- data/lib/t1k/engine.rb +2 -2
- data/lib/t1k/repositories/bitbucket.rb +23 -0
- data/lib/t1k/repositories/github.rb +46 -0
- data/lib/t1k/repository.rb +20 -0
- data/lib/t1k/tracker.rb +20 -0
- data/lib/t1k/trackers/pivotal.rb +23 -0
- data/lib/t1k/trackers/trello.rb +54 -0
- data/lib/t1k/version.rb +2 -2
- data/lib/tasks/commit.rake +1 -1
- data/lib/tasks/hack.rake +1 -1
- data/lib/tasks/ship.rake +1 -1
- data/lib/tasks/sink.rake +1 -1
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/{app/assets/javascripts/t1k → test/dummy/app/assets/javascripts}/application.js +0 -0
- data/{app/assets/stylesheets/t1k → test/dummy/app/assets/stylesheets}/application.css +0 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/test_helper.rb +19 -0
- data/test/tk1_test.rb +36 -0
- metadata +99 -13
- data/app/controllers/t1k/application_controller.rb +0 -4
- data/app/helpers/t1k/application_helper.rb +0 -4
- data/app/views/layouts/t1k/application.html.erb +0 -14
- data/config/routes.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e0106184b19bc3354aaa110c345d1697e83cae3
|
4
|
+
data.tar.gz: 5617aa9c735bbf65344e7a0db88a9a8e4588930b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d6185418e175014deb8a1d489a82c9975d61d60ba511359314f9828efe85c4aef3e9baf4928a080841e185b83a9820b016d9cefadc7b11ff090e5fbc6fb64cd
|
7
|
+
data.tar.gz: 20b78b6644732410b078c3f3e5a1c163c843c41fa79d9d289aa9306149a2cc29687f16ad0985494c0f3f291f3fbe57aa36213313519b9e1a415d2b2099b92154
|
data/Rakefile
CHANGED
@@ -14,14 +14,6 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
14
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
15
|
end
|
16
16
|
|
17
|
-
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
-
load 'rails/tasks/engine.rake'
|
19
|
-
|
20
|
-
|
21
|
-
load 'rails/tasks/statistics.rake'
|
22
|
-
|
23
|
-
|
24
|
-
|
25
17
|
Bundler::GemHelper.install_tasks
|
26
18
|
|
27
19
|
require 'rake/testtask'
|
data/lib/t1k.rb
CHANGED
@@ -1,78 +1,35 @@
|
|
1
|
-
require
|
2
|
-
require "trello"
|
3
|
-
require "github_api"
|
1
|
+
require 't1k/engine'
|
4
2
|
|
5
3
|
module T1k
|
6
|
-
|
4
|
+
autoload :Repository, 't1k/repository'
|
5
|
+
autoload :Tracker, 't1k/tracker'
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
config_github
|
7
|
+
module Repositories
|
8
|
+
autoload :Github, 't1k/repositories/github'
|
9
|
+
autoload :Bitbucket, 't1k/repositories/bitbucket'
|
12
10
|
end
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
code_issue = get_issue_code issue
|
18
|
-
|
19
|
-
update_card card, code_issue
|
20
|
-
puts "Card ##{code_issue[:code]} created and tracked"
|
21
|
-
code_issue[:code]
|
12
|
+
module Trackers
|
13
|
+
autoload :Trello, 't1k/trackers/trello'
|
14
|
+
autoload :Pivotal, 't1k/trackers/pivotal'
|
22
15
|
end
|
23
16
|
|
24
|
-
|
25
|
-
|
26
|
-
def self.get_card url_card
|
27
|
-
begin
|
28
|
-
puts "Catching card"
|
29
|
-
me = Trello::Member.find(@@config[:trello_user_name])
|
30
|
-
board = me.boards.select{|x| x.name.upcase == @@config[:trello_board_name].upcase}.first
|
31
|
-
card = board.cards.select{|x| x.url.index(url_card)}.first
|
32
|
-
raise if card.nil?
|
17
|
+
mattr_accessor :repository
|
18
|
+
@@repository = T1k::Repository
|
33
19
|
|
34
|
-
|
35
|
-
|
36
|
-
raise 'Card not found'
|
37
|
-
end
|
38
|
-
end
|
20
|
+
mattr_accessor :tracker
|
21
|
+
@@tracker = T1k::Tracker
|
39
22
|
|
40
|
-
def self.update_card card, issue_code
|
41
|
-
puts "Updating card"
|
42
|
-
card.name = "[##{issue_code[:code]}] #{card.name}"
|
43
|
-
card.desc = "#{issue_code[:link]} #{card.desc}"
|
44
|
-
card.save
|
45
|
-
end
|
46
23
|
|
47
|
-
def self.
|
48
|
-
|
49
|
-
puts "Creating issue"
|
50
|
-
github_auth = Github.new :oauth_token => @@config[:github_oauth_token]
|
51
|
-
github_auth.issues.create user: @@config[:github_user], repo: @@config[:github_repo], title: title
|
52
|
-
rescue
|
53
|
-
raise 'Issue not created'
|
54
|
-
end
|
24
|
+
def self.setup &block
|
25
|
+
yield(self) if block_given?
|
55
26
|
end
|
56
27
|
|
57
|
-
def self.
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
def self.config_trello
|
65
|
-
# API key generated by visiting https://trello.com/1/appKey/generate
|
66
|
-
# https://trello.com/app-key
|
67
|
-
# https://trello.com/1/connect?key=YOUR_KEY&name=BOARD_NAME&expiration=never&response_type=token&scope=read,write
|
68
|
-
Trello.configure do |config|
|
69
|
-
config.developer_public_key = @@config[:trello_developer_public_key]
|
70
|
-
config.member_token = @@config[:trello_member_token]
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def self.config_github
|
75
|
-
# https://github.com/settings/applications
|
76
|
-
# Personal access tokens
|
28
|
+
def self.hack url_card
|
29
|
+
card = tracker.get_card(url_card)
|
30
|
+
issue = repository.get_issue(repository.create_issue(card.name).html_url)
|
31
|
+
tracker.update_card(card, issue)
|
32
|
+
puts "Card ##{issue.code} created and tracked"
|
33
|
+
issue.code
|
77
34
|
end
|
78
35
|
end
|
data/lib/t1k/engine.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
# bitbucket requirements
|
2
|
+
|
3
|
+
module T1k
|
4
|
+
module Repositories
|
5
|
+
class Bitbucket
|
6
|
+
|
7
|
+
# bitbucket configurations
|
8
|
+
# cattr_accessor :config_name
|
9
|
+
# @@config_name = "default value"
|
10
|
+
|
11
|
+
# implement setup method
|
12
|
+
# def self.setup &block
|
13
|
+
# yield(self) if block_given?
|
14
|
+
# end
|
15
|
+
|
16
|
+
# implement create_issue method
|
17
|
+
# def self.create_issue(title); end
|
18
|
+
|
19
|
+
# implement create_issue method
|
20
|
+
# def self.get_issue(html_url); end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require "github_api"
|
2
|
+
|
3
|
+
module T1k
|
4
|
+
module Repositories
|
5
|
+
class Github
|
6
|
+
|
7
|
+
cattr_accessor :oauth_token
|
8
|
+
@@oauth_token = ""
|
9
|
+
|
10
|
+
cattr_accessor :user
|
11
|
+
@@user = ""
|
12
|
+
|
13
|
+
cattr_accessor :repo
|
14
|
+
@@repo = ""
|
15
|
+
|
16
|
+
Issue = Struct.new(:code, :link)
|
17
|
+
|
18
|
+
def self.setup &block
|
19
|
+
yield(self) if block_given?
|
20
|
+
self.config_keys
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.config_keys
|
24
|
+
# ::Github.configure do |config|
|
25
|
+
# your keys
|
26
|
+
# end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.create_issue title
|
30
|
+
begin
|
31
|
+
puts "Creating issue"
|
32
|
+
github_auth = ::Github.new(oauth_token: self.oauth_token)
|
33
|
+
issue = github_auth.issues.create(user: self.user, repo: self.repo, title: title)
|
34
|
+
issue
|
35
|
+
rescue
|
36
|
+
raise 'Issue not created'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.get_issue html_url
|
41
|
+
code = html_url[html_url.rindex('/')+1..html_url.size]
|
42
|
+
Issue.new(code, "Link to code: [#{code}](#{html_url})")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module T1k
|
2
|
+
class Repository
|
3
|
+
|
4
|
+
cattr_accessor :adapter
|
5
|
+
@@adapter = T1k::Repositories::Github # default adapter
|
6
|
+
|
7
|
+
class << self
|
8
|
+
delegate :create_issue, :get_issue, to: @@adapter
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.setup &block
|
12
|
+
self.adapter.setup(&block) if block_given?
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.adapter=(adapter_name)
|
16
|
+
raise "Invalid adapter name. Adapter name must be a Symbol." unless adapter_name.class.eql?(Symbol)
|
17
|
+
@@adapter = "T1k::Repositories::#{adapter_name.to_s.classify}".constantize
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/t1k/tracker.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module T1k
|
2
|
+
class Tracker
|
3
|
+
|
4
|
+
cattr_accessor :adapter
|
5
|
+
@@adapter = T1k::Trackers::Trello # default adapter
|
6
|
+
|
7
|
+
class << self
|
8
|
+
delegate :get_card, :update_card, to: @@adapter
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.setup &block
|
12
|
+
self.adapter.setup(&block) if block_given?
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.adapter=(adapter_name)
|
16
|
+
raise "Invalid adapter name. Adapter name must be a Symbol." unless adapter_name.class.eql?(Symbol)
|
17
|
+
@@adapter = "T1k::Trackers::#{adapter_name.to_s.classify}".constantize
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# pivotal requirements
|
2
|
+
|
3
|
+
module T1k
|
4
|
+
module Trackers
|
5
|
+
class Pivotal
|
6
|
+
|
7
|
+
# pivotal configurations
|
8
|
+
# cattr_accessor :config_name
|
9
|
+
# @@config_name = "default value"
|
10
|
+
|
11
|
+
# implement setup method
|
12
|
+
# def self.setup &block
|
13
|
+
# yield(self) if block_given?
|
14
|
+
# end
|
15
|
+
|
16
|
+
# implement get_card method
|
17
|
+
# def self.get_card(url_card); end
|
18
|
+
|
19
|
+
# implement get_card method
|
20
|
+
# def self.update_card(card, issue); end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require "trello"
|
2
|
+
|
3
|
+
module T1k
|
4
|
+
module Trackers
|
5
|
+
class Trello
|
6
|
+
|
7
|
+
cattr_accessor :developer_public_key
|
8
|
+
@@developer_public_key = ""
|
9
|
+
|
10
|
+
cattr_accessor :member_token
|
11
|
+
@@member_token = ""
|
12
|
+
|
13
|
+
cattr_accessor :user_name
|
14
|
+
@@user_name = ""
|
15
|
+
|
16
|
+
cattr_accessor :board_name
|
17
|
+
@@board_name = ""
|
18
|
+
|
19
|
+
def self.setup &block
|
20
|
+
yield(self) if block_given?
|
21
|
+
self.config_keys
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.config_keys
|
25
|
+
::Trello.configure do |config|
|
26
|
+
config.developer_public_key = self.developer_public_key
|
27
|
+
config.member_token = self.member_token
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.get_card url_card
|
32
|
+
begin
|
33
|
+
puts "Catching card"
|
34
|
+
|
35
|
+
me = ::Trello::Member.find(self.user_name)
|
36
|
+
board = me.boards.select{|x| x.name.upcase == self.board_name.upcase}.first
|
37
|
+
card = board.cards.select{|x| x.url.index(url_card)}.first
|
38
|
+
raise if card.nil?
|
39
|
+
|
40
|
+
card
|
41
|
+
rescue
|
42
|
+
raise 'Card not found'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.update_card card, issue
|
47
|
+
puts "Updating card"
|
48
|
+
card.name = "[##{issue.code}] #{card.name}"
|
49
|
+
card.desc = "#{issue.link} #{card.desc}"
|
50
|
+
card.save
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/t1k/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module T1k
|
2
|
-
VERSION = "
|
3
|
-
end
|
2
|
+
VERSION = "1.0.1"
|
3
|
+
end
|
data/lib/tasks/commit.rake
CHANGED
@@ -2,7 +2,7 @@ require 'rake'
|
|
2
2
|
|
3
3
|
#rake t1k:commit['comentario do commit',close]
|
4
4
|
namespace :t1k do
|
5
|
-
desc "
|
5
|
+
desc "Commit using issue's info to track it down with github"
|
6
6
|
|
7
7
|
task :commit, [:comment, :close] do |t, args|
|
8
8
|
closed = args[:close] == 'close' ? "close " : ""
|
data/lib/tasks/hack.rake
CHANGED
data/lib/tasks/ship.rake
CHANGED
data/lib/tasks/sink.rake
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/test/dummy/Rakefile
ADDED
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|