t1k 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 52764ce988279c8999475978814120f9fd821f02
4
+ data.tar.gz: f49c1768bd400989d382fc31a43f1b76895ae8ef
5
+ SHA512:
6
+ metadata.gz: 466bd53b2461f61e3289781341cb88a580df55acc200555e36bad3c88bb5fb7533d707863e12a2adad59fb95ee51cf74af752115e2a28ba8f7acc519beb0ef6b
7
+ data.tar.gz: 53666d123dd7a6ec5adf78a75cb1b72185adc5c058929fdba246a5cb7988ce6e0e27d34fc56b347510a8b44c5055382302a944b7b05cb0b1f97c65bc17362f9a
@@ -0,0 +1,20 @@
1
+ Copyright 2015 Rodrigo Maia
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ = T1k
2
+
3
+ This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,37 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'T1k'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
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
+ Bundler::GemHelper.install_tasks
26
+
27
+ require 'rake/testtask'
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'lib'
31
+ t.libs << 'test'
32
+ t.pattern = 'test/**/*_test.rb'
33
+ t.verbose = false
34
+ end
35
+
36
+
37
+ task default: :test
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,4 @@
1
+ module T1k
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module T1k
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>T1k</title>
5
+ <%= stylesheet_link_tag "t1k/application", media: "all" %>
6
+ <%= javascript_include_tag "t1k/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,2 @@
1
+ T1k::Engine.routes.draw do
2
+ end
@@ -0,0 +1,78 @@
1
+ require "t1k/engine"
2
+ require "trello"
3
+ require "github_api"
4
+
5
+ module T1k
6
+ @@config = {}
7
+
8
+ def self.configure &block
9
+ block.call @@config
10
+ config_trello
11
+ config_github
12
+ end
13
+
14
+ def self.hack url_card
15
+ card = get_card url_card
16
+ issue = create_issue card.name
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]
22
+ end
23
+
24
+ private
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?
33
+
34
+ card
35
+ rescue
36
+ raise 'Card not found'
37
+ end
38
+ end
39
+
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
+
47
+ def self.create_issue title
48
+ begin
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
55
+ end
56
+
57
+ def self.get_issue_code issue
58
+ url_issue = issue.html_url
59
+ code = url_issue[url_issue.rindex('/')+1..url_issue.size]
60
+ code_html_issue = {code: code,
61
+ link: "Link to code: [#{code}](#{url_issue})"}
62
+ end
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
77
+ end
78
+ end
@@ -0,0 +1,5 @@
1
+ module T1k
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace T1k
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module T1k
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,12 @@
1
+ require 'rake'
2
+
3
+ #rake t1k:commit['comentario do commit',close]
4
+ namespace :t1k do
5
+ desc "Commita com a info da issue para vincular ao github"
6
+
7
+ task :commit, [:comment, :close] do |t, args|
8
+ closed = args[:close] == 'close' ? "close " : ""
9
+ branch = `git branch | grep '*' | awk '{print $2}'`
10
+ system "git commit -m '[#{closed}##{branch.strip}] #{args[:comment]}'"
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ require 'rake'
2
+
3
+ # rake t1k:hack['uD2GBBMf']
4
+ namespace :t1k do
5
+ desc "Cria issue e atualiza cartão do trello"
6
+
7
+ task :hack, [:path_card_part] do |t, args|
8
+ code_card = T1k::hack args[:path_card_part]
9
+
10
+ system 'git checkout master'
11
+ system 'git pull --rebase origin master'
12
+ system "git checkout -b #{code_card}"
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ require 'rake'
2
+
3
+ #rake t1k:ship
4
+ namespace :t1k do
5
+ desc "Faz merge com o master e pusha"
6
+
7
+ task :ship do |t, args|
8
+ branch = `git branch | grep '*' | awk '{print $2}'`
9
+ system "git checkout master"
10
+ system "git pull --rebase"
11
+ system "git merge #{branch.strip}"
12
+ system "git commit -v"
13
+ system "git push origin master"
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ require 'rake'
2
+
3
+ #rake t1k:sink
4
+ namespace :t1k do
5
+ desc "Sincroniza branch atual com o master"
6
+
7
+ task :sink do |t, args|
8
+ branch = `git branch | grep '*' | awk '{print $2}'`
9
+ system "git checkout master"
10
+ system "git pull --rebase origin master"
11
+ system "git checkout #{branch.strip}"
12
+ system "git rebase master #{branch.strip}"
13
+ end
14
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :t1k do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: t1k
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Rodrigo Maia
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '4.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: ruby-trello
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.2.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: github_api
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '0.12'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '0.12'
55
+ description: Use those scripts to create automatically branchs associated with issues
56
+ and tracked commits.
57
+ email:
58
+ - rodrigomb@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - MIT-LICENSE
64
+ - README.rdoc
65
+ - Rakefile
66
+ - app/assets/javascripts/t1k/application.js
67
+ - app/assets/stylesheets/t1k/application.css
68
+ - app/controllers/t1k/application_controller.rb
69
+ - app/helpers/t1k/application_helper.rb
70
+ - app/views/layouts/t1k/application.html.erb
71
+ - config/routes.rb
72
+ - lib/t1k.rb
73
+ - lib/t1k/engine.rb
74
+ - lib/t1k/version.rb
75
+ - lib/tasks/commit.rake
76
+ - lib/tasks/hack.rake
77
+ - lib/tasks/ship.rake
78
+ - lib/tasks/sink.rake
79
+ - lib/tasks/t1k_tasks.rake
80
+ homepage: https://github.com/fortesinformatica/t1k
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project:
100
+ rubygems_version: 2.2.2
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: T1K - Automated Git and Trello Workflow
104
+ test_files: []