employ 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aeadbb4732872f3d7dc5ed43a7bc9f0b2b285067
4
- data.tar.gz: a8a167ae6f01ead9c865ab92663ac34b98ae9b62
3
+ metadata.gz: 3dc87824621c83b35500def738b1fab0388c7dc5
4
+ data.tar.gz: 09dfe2abe2f44b5ca2af3131d0c6abfd8514a23d
5
5
  SHA512:
6
- metadata.gz: 3b98277258da300930df1836900b8e78bd9a72a87e120b70e2cdea9dd8243e8d4cd7cb627e7280c1df22d9b116dbb543b282c9cfc97c84253edf6197600401b2
7
- data.tar.gz: c040f1c054009bb13bad29d2ee93cd04250fe2950c1ad1401bf5f66970ce237664665a2eeab686bfb304a74d07d2a421d0aeda088dc1bbc44c4d9ea25ab956ea
6
+ metadata.gz: 6ac3735f0a50a051101de246eb3cdb59662a3cf417f9dd8cab8a89e59a01c774cabec921951852778109fa89687ff6707d675997b758b7159c1edc7388f5064b
7
+ data.tar.gz: e34c62bf62fc1299bf002bb5758467f4579ab3c661d29f4e457d0c42528d08f221aaeec0a62351a603b62ac5a306f8a95260799354c4d5ce190d8b43cfe0fd81
data/bin/employ CHANGED
@@ -5,6 +5,4 @@ require 'rubygems' unless defined?(Gem)
5
5
  require 'bundler/setup'
6
6
  Bundler.require
7
7
 
8
- require File.join(File.expand_path(__FILE__), '../lib/employ')
9
-
10
8
  Employ::CLI.start ARGV
@@ -24,4 +24,5 @@ Gem::Specification.new do |spec|
24
24
  spec.add_dependency 'octokit'
25
25
  spec.add_dependency 'colorize'
26
26
  spec.add_dependency 'thor'
27
+ spec.add_dependency 'pry'
27
28
  end
@@ -1,4 +1,7 @@
1
1
  require 'thor'
2
+ require 'colorize'
3
+ require 'octokit'
4
+ require 'pry'
2
5
 
3
6
  require 'employ/version'
4
7
  require 'employ/git'
@@ -1,10 +1,35 @@
1
- require 'employ/cli/promote'
2
-
3
1
  module Employ
4
2
  class CLI < Thor
5
- class_option :verbose, type: :boolean
3
+ class_option :verbose, type: :boolean, aliases: :v
4
+
5
+ class_option 'assume-yes', type: :boolean, aliases: %w(y yes),
6
+ desc: 'Automatic yes to prompts'
7
+
8
+ desc 'promote <env>', 'promotes commit to <env>'
9
+ long_desc "TODO"
10
+ option :interactive, type: :boolean, aliases: :i
11
+ def promote(env)
12
+ unless options['assume-yes'] || yes?('Are you sure?')
13
+ puts 'Nothing done. Bye!'
14
+ exit 1
15
+ end
16
+
17
+ if options[:interactive]
18
+ last_tag = Git.last_tag(env)
19
+ puts "last tag: #{last_tag}" if options[:verbose]
20
+ # TODO
21
+ else
22
+ name = Git.tag!(env)
23
+ puts "New tag promoted: #{name}" if options[:verbose]
24
+ end
25
+ end
6
26
 
7
- include Employ::CLI::Promote
27
+ desc 'rollback <env>', 'rollbacks <env> tag to the penultimate one'
28
+ long_desc "TODO"
29
+ def rollback(env)
30
+ penultimate_tag = Git.penultimate_tag(env)
31
+ Git.retag! env, penultimate_tag
32
+ end
8
33
 
9
34
  end
10
35
  end
@@ -3,8 +3,10 @@ module Employ
3
3
  extend self
4
4
 
5
5
  def tag!(env, tag = nil)
6
- name = "#{env}-#{Time.now.to_i}"
7
- `git tag #{name} #{tag} && git push --tags`
6
+ name = "#{env}-#{Time.now.strftime('%Y%m%dT%H%M%S')}"
7
+ `git tag #{name} #{tag}`
8
+ `git push --tags`
9
+ name
8
10
  end
9
11
 
10
12
  def retag!(env, tag)
@@ -1,3 +1,3 @@
1
1
  module Employ
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: employ
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Rodrigues
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  description: Github development workflow
84
98
  email:
85
99
  - victorc.rodrigues@gmail.com
@@ -98,8 +112,6 @@ files:
98
112
  - lib/employ.rb
99
113
  - lib/employ/change.rb
100
114
  - lib/employ/cli.rb
101
- - lib/employ/cli/promote.rb
102
- - lib/employ/cli/rollback.rb
103
115
  - lib/employ/git.rb
104
116
  - lib/employ/version.rb
105
117
  homepage: http://github.com/rodrigues/employ
@@ -1,24 +0,0 @@
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
@@ -1,18 +0,0 @@
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