employ 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: aeadbb4732872f3d7dc5ed43a7bc9f0b2b285067
4
+ data.tar.gz: a8a167ae6f01ead9c865ab92663ac34b98ae9b62
5
+ SHA512:
6
+ metadata.gz: 3b98277258da300930df1836900b8e78bd9a72a87e120b70e2cdea9dd8243e8d4cd7cb627e7280c1df22d9b116dbb543b282c9cfc97c84253edf6197600401b2
7
+ data.tar.gz: c040f1c054009bb13bad29d2ee93cd04250fe2950c1ad1401bf5f66970ce237664665a2eeab686bfb304a74d07d2a421d0aeda088dc1bbc44c4d9ea25ab956ea
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,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Victor Rodrigues
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,20 @@
1
+ # Employ
2
+
3
+ $ employ promote test
4
+ $ employ promote staging
5
+ $ employ promote production
6
+
7
+ - if previous env was not tagged before, set warnings
8
+
9
+ $ employ diff production
10
+ $ employ diff production --reverse
11
+
12
+ - current tree against other tag/branch, using merged PRs description metadata to build a meaningful and colourful CHANGELOG.
13
+
14
+ $ employ promote -i test
15
+
16
+ - you can interactively select which PRs are going to be.
17
+
18
+ $ employ rollback test
19
+ $ employ rollback staging
20
+ $ employ rollback production
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/bin/employ ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems' unless defined?(Gem)
4
+
5
+ require 'bundler/setup'
6
+ Bundler.require
7
+
8
+ require File.join(File.expand_path(__FILE__), '../lib/employ')
9
+
10
+ Employ::CLI.start ARGV
data/employ.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'employ/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'employ'
8
+ spec.version = Employ::VERSION
9
+ spec.authors = ['Victor Rodrigues']
10
+ spec.email = ['victorc.rodrigues@gmail.com']
11
+ spec.description = 'Github development workflow'
12
+ spec.summary = 'Employ is a terminal cli for a easier github dev workflow'
13
+ spec.homepage = 'http://github.com/rodrigues/employ'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}, &File.method(:basename))
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = %w(bin lib)
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ spec.add_development_dependency 'rake'
23
+
24
+ spec.add_dependency 'octokit'
25
+ spec.add_dependency 'colorize'
26
+ spec.add_dependency 'thor'
27
+ end
@@ -0,0 +1,50 @@
1
+ module Employ
2
+ class Change
3
+
4
+ attr_writer :id,
5
+ :url,
6
+ :title,
7
+ :description,
8
+ :author,
9
+ :merger,
10
+ :copied_team_members,
11
+ :referenced_issues,
12
+ :merged_at
13
+
14
+ def self.fetch(id)
15
+ source = Github::PullRequest.get(id)
16
+
17
+ url, title = source.values_at('url', 'title')
18
+ author = source['user']['login']
19
+ merger = source['merged_by']['login']
20
+ description = source['body']
21
+ merged_at = source['merged_at']
22
+
23
+ referenced_issues = body.scan(/((\S*)#(\S*))/).map(&:first)
24
+ copied_team_members = body.scan(/@(\S*)/).map(&:first)
25
+
26
+ new.tap do |c|
27
+ c.id = id
28
+ c.url = url
29
+ c.title = title
30
+
31
+ c.description = description
32
+ c.author = author
33
+ c.merger = merger
34
+ c.merged_at = merged_at
35
+
36
+ c.copied_team_members = copied_team_members
37
+ c.referenced_issues = referenced_issues
38
+ end
39
+ end
40
+
41
+ # options:
42
+ # - verbose: overrides all to true
43
+ # - url
44
+ # - description
45
+ def to_s(options = {})
46
+
47
+ end
48
+
49
+ end
50
+ end
@@ -0,0 +1,24 @@
1
+ module Employ
2
+ class CLI < Thor
3
+ module Promote
4
+
5
+ desc 'promote <env>', 'promotes commit to <env>'
6
+
7
+ long_desc <<-DESC
8
+
9
+ DESC
10
+
11
+ option :interactive, type: :boolean, aliases: :i
12
+
13
+ def promote(env)
14
+ if options[:interactive]
15
+ last_tag = Git.last_tag(env)
16
+
17
+ else
18
+ Git.tag! env
19
+ end
20
+ end
21
+
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,18 @@
1
+ module Employ
2
+ class CLI < Thor
3
+ module Rollback
4
+
5
+ desc 'rollback <env>', 'rollbacks <env> tag to the penultimate one'
6
+
7
+ long_desc <<-DESC
8
+
9
+ DESC
10
+
11
+ def rollback(env)
12
+ penultimate_tag = Git.penultimate_tag(env)
13
+ Git.retag! env, penultimate_tag
14
+ end
15
+
16
+ end
17
+ end
18
+ end
data/lib/employ/cli.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'employ/cli/promote'
2
+
3
+ module Employ
4
+ class CLI < Thor
5
+ class_option :verbose, type: :boolean
6
+
7
+ include Employ::CLI::Promote
8
+
9
+ end
10
+ end
data/lib/employ/git.rb ADDED
@@ -0,0 +1,32 @@
1
+ module Employ
2
+ module Git
3
+ extend self
4
+
5
+ def tag!(env, tag = nil)
6
+ name = "#{env}-#{Time.now.to_i}"
7
+ `git tag #{name} #{tag} && git push --tags`
8
+ end
9
+
10
+ def retag!(env, tag)
11
+ Git.tag! env, tag
12
+ end
13
+
14
+ def tags(env)
15
+ `git fetch --tags`
16
+ `git tag | grep ^#{env}-`.lines
17
+ end
18
+
19
+ def last_tag(env)
20
+ tags(env).max
21
+ end
22
+
23
+ def penultimate_tag(env)
24
+ tags(env).sort.tap(&:pop).last
25
+ end
26
+
27
+ def tag_sha(tag)
28
+ `git show #{tag} --format="%H"`.lines.last
29
+ end
30
+
31
+ end
32
+ end
@@ -0,0 +1,3 @@
1
+ module Employ
2
+ VERSION = '0.0.1'
3
+ end
data/lib/employ.rb ADDED
@@ -0,0 +1,9 @@
1
+ require 'thor'
2
+
3
+ require 'employ/version'
4
+ require 'employ/git'
5
+ require 'employ/cli'
6
+
7
+ module Employ
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,130 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: employ
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Victor Rodrigues
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: octokit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: colorize
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: thor
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Github development workflow
84
+ email:
85
+ - victorc.rodrigues@gmail.com
86
+ executables:
87
+ - employ
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - .gitignore
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - bin/employ
97
+ - employ.gemspec
98
+ - lib/employ.rb
99
+ - lib/employ/change.rb
100
+ - lib/employ/cli.rb
101
+ - lib/employ/cli/promote.rb
102
+ - lib/employ/cli/rollback.rb
103
+ - lib/employ/git.rb
104
+ - lib/employ/version.rb
105
+ homepage: http://github.com/rodrigues/employ
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - bin
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ requirements: []
125
+ rubyforge_project:
126
+ rubygems_version: 2.0.3
127
+ signing_key:
128
+ specification_version: 4
129
+ summary: Employ is a terminal cli for a easier github dev workflow
130
+ test_files: []