zilkey-auto_tagger 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/bin/autotag +24 -10
  2. data/recipes/release_tagger.rb +2 -1
  3. metadata +1 -1
data/bin/autotag CHANGED
@@ -1,24 +1,38 @@
1
1
  #!/usr/bin/env ruby
2
2
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "auto_tagger"))
3
+ require 'getoptlong'
4
+
5
+ opts = GetoptLong.new(
6
+ ['--help', '-h', '-?', GetoptLong::NO_ARGUMENT]
7
+ )
3
8
 
4
9
  def usage
5
10
  puts
6
- puts "USAGE: #{File.basename($0)} [-h] [<stage> <repository>]"
11
+ puts "USAGE: #{File.basename($0)} <stage> [<repository>]"
12
+ puts
13
+ puts ' where: stage sets the tag prefix'
14
+ puts ' repository sets the repository to act on - defualts to the current directory'
7
15
  puts
8
- puts ' where: -h displays this help message'
9
- puts ' stage sets the tag prefix'
10
- puts ' repository sets the repository to act on'
16
+ puts ' examples: autotag'
17
+ puts ' autotag .'
18
+ puts ' autotag ../'
19
+ puts ' autotag /data/myrepo'
20
+ puts ' autotag demo'
11
21
  puts
12
- puts ' example: autotag demo'
13
22
  puts
14
- exit 1
23
+ exit 0
15
24
  end
16
25
 
17
- if ARGV[0] && ["-h", "--help"].include?(ARGV[0])
18
- usage
19
- elsif ARGV[0]
26
+ opts.each do |opt, arg|
27
+ case opt
28
+ when "--help"
29
+ usage
30
+ end
31
+ end
32
+
33
+ if ARGV[0]
20
34
  AutoTagger.new(ARGV[0], ARGV[1]).create_tag
21
- exit 1
35
+ exit 0
22
36
  else
23
37
  usage
24
38
  end
@@ -47,7 +47,8 @@ Capistrano::Configuration.instance(:must_exist).load do
47
47
  tag_name = AutoTagger.new(variables[:stage], variables[:working_directory]).create_tag(previous_tag)
48
48
  logger.info "AUTO TAGGER created tag #{tag_name} from #{previous_tag.inspect}"
49
49
  else
50
- logger.info "AUTO TAGGER WARNING: skipping auto-creation of tag. Please specify :stage to enable auto-creation of tags (like set :stage, :ci)."
50
+ tag_name = AutoTagger.new(:production, variables[:working_directory]).create_tag
51
+ logger.info "AUTO TAGGER created tag #{tag_name}"
51
52
  end
52
53
  end
53
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zilkey-auto_tagger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Dean