another_brick 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/bin/brick CHANGED
@@ -6,13 +6,13 @@ options = Slop.parse help: true do
6
6
  banner 'Another Brick'
7
7
 
8
8
  on :v, :verbose, "Verbose mode"
9
- on :b, :bricklayer, "Bricklayer host", required: true, argument: true
10
- on :n, :name, "Project name", required: true, argument: true
11
- on :s, :server, "Deploy server", required: true, argument: true
12
- on :u, :user, "Deploy user", required: true, argument: true
13
- on :m, :max_tries, "Max tries to waiting ssh", optional: true, argument: true, default: 480, as: Fixnum
14
- on :t, :bricklayer_tries, "Max tries to waiting bricklayer", optional: true, argument: true, default: 480, as: Fixnum
15
- on :tag, :tag, "Tag (unstable|testing|stable)", optional: true, argument: true, default: "testing", match: /(unstable|testing|stable)/
9
+ on :b, :bricklayer, "Bricklayer host", optional: true, argument: true
10
+ on :n, :name, "Project name", optional: true, argument: true
11
+ on :s, :server, "Deploy server", optional: true, argument: true
12
+ on :u, :user, "Deploy user", optional: true, argument: true
13
+ on :m, :max_tries, "Max tries to waiting ssh", optional: true, argument: true, default: 480, as: Fixnum
14
+ on :t, :bricklayer_tries, "Max tries to waiting bricklayer", optional: true, argument: true, default: 480, as: Fixnum
15
+ on :tag, :tag, "Tag (unstable|testing|stable)[_$version]", optional: true, argument: true, default: "testing", match: AnotherBrick::Tag::TAG_RE
16
16
  end
17
17
 
18
18
  AnotherBrick.run!(options.to_hash)
@@ -3,16 +3,27 @@ module AnotherBrick
3
3
  extend self
4
4
 
5
5
  PREFIXES = %w(unstable stable testing)
6
+ TAG_RE = /^(#{PREFIXES.map {|p| "#{p}"}.join("|") })(?:_(\d+.\d+.\d+))?$/
6
7
 
7
- def create(prefix)
8
- major, minor, build = last_tag ? strip_version(last_tag) : [0, 0, 0]
9
-
10
- "#{prefix}_#{major}.#{minor}.#{build.to_i + 1}".tap do |next_tag|
8
+ def create(tag)
9
+ build_tag(tag).tap do |next_tag|
11
10
  `git tag #{next_tag}`
12
11
  `git push --tags`
13
12
  end
14
13
  end
15
14
 
15
+ def build_tag(tag)
16
+ captures = TAG_RE.match(tag).captures
17
+
18
+ if captures[1]
19
+ tag
20
+ else
21
+ major, minor, build = last_tag ? strip_version(last_tag) : [0, 0, 0]
22
+
23
+ "#{captures[0]}_#{major}.#{minor}.#{build.to_i + 1}"
24
+ end
25
+ end
26
+
16
27
  def version_sorter
17
28
  proc do |v1, v2|
18
29
  Gem::Version.new(v1) <=> Gem::Version.new(v2)
@@ -1,3 +1,3 @@
1
1
  module AnotherBrick
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/another_brick.rb CHANGED
@@ -17,8 +17,8 @@ module AnotherBrick
17
17
  load_configuration(options)
18
18
 
19
19
  Tag.create(tag).tap do |new_tag|
20
- Bricklayer.wait_build(new_tag)
21
- Server.deploy(new_tag)
20
+ Bricklayer.wait_build(new_tag) if bricklayer_server && package_name
21
+ Server.deploy(new_tag) if deploy_server && deploy_user
22
22
  end
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: another_brick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-08-21 00:00:00.000000000 Z
14
+ date: 2014-04-05 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -130,7 +130,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
130
130
  version: '0'
131
131
  segments:
132
132
  - 0
133
- hash: -2471127953251273313
133
+ hash: -3156948374797029341
134
134
  required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  none: false
136
136
  requirements:
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  version: '0'
140
140
  segments:
141
141
  - 0
142
- hash: -2471127953251273313
142
+ hash: -3156948374797029341
143
143
  requirements: []
144
144
  rubyforge_project:
145
145
  rubygems_version: 1.8.23