shifter 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: c2f9fab716c67b4d8dcdf4e8c18c77d342d21d2a
4
+ data.tar.gz: 5fa3e3e02976ca030e3cea51be06e9d735ec6c20
5
+ SHA512:
6
+ metadata.gz: 5a1daa9f56daaaaffde9066fb11ce4d32f00a74d76af4414f9d0e4b89dad296e1882b51ec86efdac339e6ff882285208480f34a520245577ce70653657244855
7
+ data.tar.gz: a8d6458793a1853acb37fbb50177ae7aee9da7759e7de2fbcac727500ecb0e4ddcf3b7c57398e69f9431b7cdff87fb1ca90f8e9185d5e1486455484eca3a9971
@@ -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
@@ -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.
@@ -0,0 +1,20 @@
1
+ # Shifter
2
+
3
+ $ shifter promote test
4
+ $ shifter promote staging
5
+ $ shifter promote production
6
+
7
+ - if previous env was not tagged before, set warnings
8
+
9
+ $ shifter diff production
10
+ $ shifter 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
+ $ shifter promote -i test
15
+
16
+ - you can interactively select which PRs are going to be.
17
+
18
+ $ shifter rollback test
19
+ $ shifter rollback staging
20
+ $ shifter rollback production
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -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/shifter')
9
+
10
+ Shifter::CLI.start ARGV
@@ -0,0 +1,9 @@
1
+ require 'thor'
2
+
3
+ require 'shifter/version'
4
+ require 'shifter/git'
5
+ require 'shifter/cli'
6
+
7
+ module Shifter
8
+
9
+ end
@@ -0,0 +1,50 @@
1
+ module Shifter
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,10 @@
1
+ require 'shifter/cli/promote'
2
+
3
+ module Shifter
4
+ class CLI < Thor
5
+ class_option :verbose, type: :boolean
6
+
7
+ include Shifter::CLI::Promote
8
+
9
+ end
10
+ end
@@ -0,0 +1,24 @@
1
+ module Shifter
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 Shifter
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
@@ -0,0 +1,32 @@
1
+ module Shifter
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 Shifter
2
+ VERSION = '0.0.1'
3
+ end
@@ -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 'shifter/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'shifter'
8
+ spec.version = Shifter::VERSION
9
+ spec.authors = ['Victor Rodrigues']
10
+ spec.email = ['victorc.rodrigues@gmail.com']
11
+ spec.description = 'Github development workflow'
12
+ spec.summary = 'Shifter is a terminal cli for a easier github dev workflow'
13
+ spec.homepage = 'http://github.com/rodrigues/shifter'
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
metadata ADDED
@@ -0,0 +1,130 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: shifter
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
+ - shifter
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - .gitignore
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - bin/shifter
97
+ - lib/shifter.rb
98
+ - lib/shifter/change.rb
99
+ - lib/shifter/cli.rb
100
+ - lib/shifter/cli/promote.rb
101
+ - lib/shifter/cli/rollback.rb
102
+ - lib/shifter/git.rb
103
+ - lib/shifter/version.rb
104
+ - shifter.gemspec
105
+ homepage: http://github.com/rodrigues/shifter
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: Shifter is a terminal cli for a easier github dev workflow
130
+ test_files: []