thor-scmversion 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,21 @@
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
18
+ *~
19
+ \#*
20
+ .DS_Store
21
+ VERSION
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2012, Riot Games, Inc.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # Thor SCMVersion
2
+
3
+ Thor tasks to manage a VERSION file based on SCM tags, for use in continuous delivery
4
+ pipelines.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'thor-scmversion'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install thor-scmversion
19
+
20
+ ## Usage
21
+
22
+ And then get a list of your thor tasks
23
+
24
+ $ thor list
25
+
26
+ version
27
+ -------
28
+ thor version:bump TYPE # Bump version number
29
+
30
+ Type can be major, minor, or patch.
31
+
32
+ ## Contributing
33
+
34
+ 1. Fork it
35
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
36
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
37
+ 4. Push to the branch (`git push origin my-new-feature`)
38
+ 5. Create new Pull Request
39
+
40
+ ## Contributors
41
+
42
+ * Michael Ivey <ivey@gweezlebur.com>
43
+ * Kyle Allan <kallan@riotgames.com>
44
+ * Josiah Kiehl <josiah@skirmisher.net>
45
+ * Based on code developed by Jamie Winsor <jamie@vialstudios.com>
46
+ * Originally derived from some Bundler internals by Yehuda Katz
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require 'rspec/core/rake_task'
4
+ require 'cucumber'
5
+ require 'cucumber/rake/task'
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ Cucumber::Rake::Task.new(:features) do |t|
10
+ t.cucumber_opts = "--format pretty --tags ~wip"
11
+ end
data/Thorfile ADDED
@@ -0,0 +1,6 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+ require 'thor'
3
+ require 'thor-scmversion'
4
+
5
+ class ThorSCMVersion < Thor
6
+ end
@@ -0,0 +1,69 @@
1
+ Feature: Bump
2
+ As a user
3
+ I want to be able to bump the version of a project's with a simple command
4
+ So that I don't have to do it manually
5
+
6
+ Scenario: Bumping a patch version in Git
7
+ Given I have a git project of version '1.0.0'
8
+ When I run `bundle exec thor version:bump patch` from the temp directory
9
+ Then the version should be '1.0.1'
10
+ And the origin version should be '1.0.1'
11
+
12
+ Scenario: Bumping a minor version in Git
13
+ Given I have a git project of version '1.0.0'
14
+ When I run `bundle exec thor version:bump minor` from the temp directory
15
+ Then the version should be '1.1.0'
16
+ And the origin version should be '1.1.0'
17
+
18
+ Scenario: Bumping a major version in Git
19
+ Given I have a git project of version '1.0.0'
20
+ When I run `bundle exec thor version:bump major` from the temp directory
21
+ Then the version should be '2.0.0'
22
+ And the origin version should be '2.0.0'
23
+
24
+ Scenario: Bumping a minor version in Git should reset the patch version
25
+ Given I have a git project of version '1.1.5'
26
+ When I run `bundle exec thor version:bump minor` from the temp directory
27
+ Then the version should be '1.2.0'
28
+ And the origin version should be '1.2.0'
29
+
30
+ Scenario: Bumping a major version in Git should reset the patch and minor versions
31
+ Given I have a git project of version '1.1.5'
32
+ When I run `bundle exec thor version:bump major` from the temp directory
33
+ Then the version should be '2.0.0'
34
+ And the origin version should be '2.0.0'
35
+
36
+ @p4 @wip
37
+ Scenario: Bumping a patch version in Perforce
38
+ Given I have a Perforce project of version '1.0.0'
39
+ When I run `bundle exec thor version:bump patch` from the Perforce project directory
40
+ Then the version should be '1.0.1' in the Perforce project directory
41
+ And the p4 server version should be '1.0.1'
42
+
43
+ @p4
44
+ Scenario: Bumping a minor version in Perforce
45
+ Given I have a Perforce project of version '1.0.0'
46
+ When I run `bundle exec thor version:bump minor` from the Perforce project directory
47
+ Then the version should be '1.1.0' in the Perforce project directory
48
+ And the p4 server version should be '1.1.0'
49
+
50
+ @p4
51
+ Scenario: Bumping a major version in Perforce
52
+ Given I have a Perforce project of version '1.0.0'
53
+ When I run `bundle exec thor version:bump major` from the Perforce project directory
54
+ Then the version should be '2.0.0' in the Perforce project directory
55
+ And the p4 server version should be '2.0.0'
56
+
57
+ @p4
58
+ Scenario: Bumping a minor version in Perforce should reset the patch version
59
+ Given I have a Perforce project of version '1.1.5'
60
+ When I run `bundle exec thor version:bump minor` from the Perforce project directory
61
+ Then the version should be '1.2.0' in the Perforce project directory
62
+ And the p4 server version should be '1.2.0'
63
+
64
+ @p4
65
+ Scenario: Bumping a major version in Perforce should reset the patch and minor versions
66
+ Given I have a Perforce project of version '1.1.5'
67
+ When I run `bundle exec thor version:bump major` from the Perforce project directory
68
+ Then the version should be '2.0.0' in the Perforce project directory
69
+ And the p4 server version should be '2.0.0'
@@ -0,0 +1,7 @@
1
+ $:.push File.expand_path('../../lib', __FILE__)
2
+ require 'thor'
3
+ require 'thor-scmversion'
4
+
5
+ class TestProject < Thor
6
+
7
+ end
@@ -0,0 +1,76 @@
1
+ Given /^I have a git project of version '(.*)'$/ do |version|
2
+ Dir.chdir(origin_dir) do
3
+ `git init`
4
+ end
5
+ Dir.chdir(project_dir) do
6
+ `git init`
7
+ `touch README`
8
+ `git add README`
9
+ `git commit -m "initial commit"`
10
+ `git tag -a -m "Version #{version}" #{version}`
11
+ `git remote add origin file://#{origin_dir}`
12
+ setup_directory
13
+ end
14
+ end
15
+
16
+ Then /^the version should be '(.*)'$/ do |version|
17
+ Dir.chdir(project_dir) {
18
+ ThorSCMVersion.versioner.from_path.to_s.should == version
19
+ }
20
+ end
21
+
22
+ Then /^the version should be '(.+)' in the Perforce project directory$/ do |version|
23
+ Dir.chdir(perforce_project_dir) {
24
+ ThorSCMVersion.versioner.from_path.to_s.should == version
25
+ }
26
+ end
27
+
28
+ Then /^the origin version should be '(.*)'$/ do |version|
29
+ Dir.chdir(origin_dir) {
30
+ ThorSCMVersion.versioner.from_path.to_s.should == version
31
+ }
32
+ end
33
+
34
+ When /^I run `(.*)` from the temp directory$/ do |run|
35
+ Dir.chdir(project_dir) {
36
+ `#{run}`
37
+ }
38
+ end
39
+
40
+ When /^I run `(.*)` from the Perforce project directory$/ do |run|
41
+ Dir.chdir(perforce_project_dir) {
42
+ `#{run}`
43
+ }
44
+ end
45
+
46
+ Given /^I have a Perforce project of version '(.*)'$/ do |version|
47
+ ENV['P4PORT'] = 'p4server.example.com:1666'
48
+ ENV['P4USER'] = 'tester'
49
+ ENV['P4PASSWD'] = 'tester'
50
+ ENV['P4CHARSET'] = ''
51
+ ENV['P4CLIENT'] = 'testers_workspace'
52
+ Dir.chdir(perforce_project_dir) do
53
+ ThorSCMVersion::Perforce.connection do
54
+ `p4 sync -f`
55
+ end
56
+ File.chmod(0666,"VERSION")
57
+ File.open('VERSION', 'w') do |f|
58
+ f.write(version)
59
+ end
60
+ setup_directory
61
+ end
62
+ end
63
+
64
+ Then /^the p4 server version should be '(.*)'$/ do |version|
65
+ ENV['P4PORT'] = 'p4server.example.com:1666'
66
+ ENV['P4USER'] = 'tester'
67
+ ENV['P4PASSWD'] = 'tester'
68
+ ENV['P4CHARSET'] = ''
69
+ ENV['P4CLIENT'] = 'testers_workspace'
70
+ Dir.chdir(perforce_project_dir) do
71
+ ThorSCMVersion::Perforce.connection do
72
+ `p4 print #{File.join(perforce_project_dir,'VERSION')}`
73
+ #p4.run_print(File.join(perforce_project_dir,'VERSION'))[1].should == version
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,70 @@
1
+ require 'aruba/cucumber'
2
+ require 'tmpdir'
3
+
4
+ $:.push "#{File.dirname(__FILE__)}/../../lib/"
5
+ require 'rspec'
6
+ require 'thor-scmversion'
7
+
8
+ def project_dir
9
+ @tmpdir ||= Dir.mktmpdir
10
+ end
11
+
12
+ def perforce_project_dir
13
+ dir = "/temp/p4sandbox/artifact"
14
+ FileUtils.mkdir_p dir
15
+ dir
16
+ end
17
+
18
+ def origin_dir
19
+ @origindir ||= Dir.mktmpdir
20
+ end
21
+
22
+ def fixtures_dir
23
+ File.join(File.dirname(__FILE__), "..", "fixtures")
24
+ end
25
+
26
+ def app_root
27
+ File.join(File.dirname(__FILE__), '..', '..')
28
+ end
29
+
30
+ def setup_directory
31
+ File.open('Gemfile', 'w') do |f|
32
+ f.write "gem 'thor-scmversion', path: '#{app_root}'"
33
+ end
34
+ `bundle`
35
+ Dir.entries(fixtures_dir).each do |entry|
36
+ FileUtils.cp_r(File.join(fixtures_dir, entry), '.')
37
+ end
38
+ end
39
+
40
+ After do |scenario|
41
+ FileUtils.rm_rf(project_dir)
42
+ FileUtils.rm_rf(origin_dir)
43
+ end
44
+
45
+ After('@p4') do |scenario|
46
+ ENV['P4PORT'] = 'p4server.example.com:1666'
47
+ ENV['P4USER'] = 'tester'
48
+ ENV['P4PASSWD'] = 'tester'
49
+ ENV['P4CHARSET'] = ''
50
+ ENV['P4CLIENT'] = 'testers_workspace'
51
+ Dir.chdir(perforce_project_dir) do
52
+ ThorSCMVersion::Perforce.connection do
53
+ #p4.run_sync("-f")
54
+ `p4 sync -f`
55
+ description = "Bump version to #{to_s}."
56
+ `p4 edit -c default #{File.join(perforce_project_dir, "VERSION")}`
57
+ File.open(File.join(perforce_project_dir, "VERSION"), 'w') { |f| f.write '1.0.0' }
58
+ `p4 submit -d \"#{description}\"`
59
+ #new_changelist = p4.fetch_change
60
+ #new_changelist._Description = "Reseting version to 1.0.0 for next test."
61
+ #saved_changelist = p4.save_change(new_changelist)
62
+ #changelist_number = saved_changelist[0].match(/(\d+)/).to_s.strip
63
+ #p4.run_edit("-c", changelist_number, File.join(perforce_project_dir, "VERSION"))
64
+
65
+ #File.open(File.join(perforce_project_dir, "VERSION"), 'w') { |f| f.write '1.0.0' }
66
+ #changelist = p4.fetch_change changelist_number
67
+ #p4.run_submit changelist
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,53 @@
1
+ require 'thor'
2
+ require 'thor-scmversion/scm_version'
3
+ require 'thor-scmversion/git_version'
4
+ require 'thor-scmversion/p4_version'
5
+ require 'thor-scmversion/shell_utils'
6
+
7
+ module ThorSCMVersion
8
+ class Tasks < Thor
9
+ namespace "version"
10
+
11
+ desc "bump TYPE", "Bump version number (type is major, minor or patch)"
12
+ def bump(type)
13
+ current_version.bump! type
14
+ begin
15
+ current_version.tag
16
+ write_version
17
+ say "Tagged: #{current_version}", :green
18
+ rescue => e
19
+ say "Tagging #{current_version} failed due to error", :red
20
+ say e, :red
21
+ exit 1
22
+ end
23
+ end
24
+
25
+ desc "current", "Show current SCM tagged version"
26
+ def current
27
+ say current_version.to_s
28
+ end
29
+
30
+ private
31
+ def current_version
32
+ @current_version ||= ThorSCMVersion.versioner.from_path
33
+ end
34
+
35
+ def write_version
36
+ ver = current_version.to_s
37
+ version_files.each do |ver_file|
38
+ File.open(ver_file, 'w+') do |f|
39
+ f.write ver
40
+ end
41
+ end
42
+
43
+ ver
44
+ end
45
+
46
+ eval "def source_root ; Pathname.new File.dirname(__FILE__) ; end"
47
+ def version_files
48
+ [
49
+ source_root.join('VERSION')
50
+ ]
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,21 @@
1
+ require 'open4'
2
+ require 'open3'
3
+
4
+ module ThorSCMVersion
5
+ class GitVersion < ScmVersion
6
+ class << self
7
+ def all_from_path(path)
8
+ Dir.chdir(path) do
9
+ tags = Open3.popen3("git tag") { |stdin, stdout, stderr| stdout.read }.split(/\n/)
10
+ version_tags = tags.select { |tag| tag.match(ScmVersion::VERSION_FORMAT) }
11
+ version_tags.collect { |tag| new(*tag.split('.')) }.sort.reverse
12
+ end
13
+ end
14
+ end
15
+
16
+ def tag
17
+ ShellUtils.sh "git tag -a -m \"Version #{self}\" #{self}"
18
+ ShellUtils.sh "git push --tags || true"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,80 @@
1
+ module ThorSCMVersion
2
+ class MissingP4ConfigException < StandardError
3
+ def initialize(config_option)
4
+ @config_option = config_option
5
+ end
6
+
7
+ def message
8
+ "#{@config_option} is not set in your environment."
9
+ end
10
+ end
11
+
12
+ module Perforce
13
+ class << self
14
+ def check_environment
15
+ ["P4PORT","P4USER", "P4PASSWD", "P4CLIENT"].each {|config|
16
+ raise MissingP4ConfigException.new(config) if ENV[config].nil? or ENV[config].empty?
17
+ }
18
+ end
19
+
20
+ def set
21
+ ShellUtils.sh "p4 set"
22
+ end
23
+
24
+ def parse_and_set_p4_set
25
+ p4_set = set
26
+ parsed_p4_config = p4_set.split("\n").inject({}) do |p4_config, line|
27
+ key, value = line.split('=')
28
+ value = value.gsub(/\(.*/, '').strip unless value.nil?
29
+ p4_config[key] = value
30
+ p4_config
31
+ end
32
+
33
+ parsed_p4_config.each {|key,value| ENV[key] = value}
34
+ end
35
+
36
+ def connection
37
+ parse_and_set_p4_set
38
+ check_environment
39
+ #p4.connect
40
+ #p4.run_login
41
+ ShellUtils.sh "echo #{ENV["P4PASSWD"]} | p4 login"
42
+ yield
43
+ ensure
44
+ #p4.run_logout
45
+ ShellUtils.sh "p4 logout"
46
+ #p4.disconnect
47
+ end
48
+ end
49
+ end
50
+
51
+ class P4Version < ScmVersion
52
+ class << self
53
+ def all_from_path(path)
54
+ file_path = File.expand_path(File.join(path, 'VERSION'))
55
+ version = new(*File.read(file_path).strip.split("."))
56
+ version.version_file_path = file_path
57
+ [version]
58
+ end
59
+ end
60
+
61
+ attr_accessor :version_file_path
62
+
63
+ def tag
64
+ description = "Bump version to #{to_s}."
65
+ `p4 edit -c default "#{self.version_file_path}"`
66
+ File.open(self.version_file_path, 'w') { |f| f.write to_s }
67
+ `p4 submit -d "#{description}"`
68
+ #Perforce.connection do
69
+ #new_changelist = p4.fetch_change
70
+ #new_changelist._Description = "Bump version to #{to_s}."
71
+ #saved_changelist = p4.save_change(new_changelist)
72
+ #changelist_number = saved_changelist[0].match(/(\d+)/).to_s.strip
73
+ #puts changelist_number
74
+ #p4.run_edit("-c", changelist_number, self.version_file_path)
75
+ #changelist = p4.fetch_change changelist_number
76
+ #p4.run_submit changelist
77
+ #end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,71 @@
1
+ module ThorSCMVersion
2
+
3
+ class << self
4
+ def versioner
5
+ if(File.directory?(".git"))
6
+ return GitVersion
7
+ else
8
+ return P4Version
9
+ end
10
+ end
11
+ end
12
+
13
+ class ScmVersion
14
+ include Comparable
15
+
16
+ VERSION_FORMAT = /^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)$/
17
+ class << self
18
+ def from_path(path = '.')
19
+ all_from_path(path).first || new(0,0,1)
20
+ end
21
+ end
22
+ attr_accessor :major
23
+ attr_accessor :minor
24
+ attr_accessor :patch
25
+
26
+ def initialize(major=0, minor=0, patch=0)
27
+ @major = major.to_i
28
+ @minor = minor.to_i
29
+ @patch = patch.to_i
30
+ end
31
+
32
+ def bump!(type)
33
+ case type.to_sym
34
+ when :major
35
+ self.major += 1
36
+ self.minor = 0
37
+ self.patch = 0
38
+ when :minor
39
+ self.minor += 1
40
+ self.patch = 0
41
+ when :patch
42
+ self.patch += 1
43
+ else
44
+ raise "Invalid release type: #{type}. Valid types are: major, minor, or patch"
45
+ end
46
+ raise "Version: #{self.to_s} is less than or equal to the existing version." if self <= self.class.from_path
47
+ self
48
+ end
49
+
50
+ def tag
51
+ raise NotImplementedError
52
+ end
53
+
54
+ def to_s
55
+ "#{major}.#{minor}.#{patch}"
56
+ end
57
+ alias_method :version, :to_s
58
+
59
+ def <=>(other)
60
+ return unless other.is_a?(self.class)
61
+ return 0 if self.version == other.version
62
+
63
+ [:major, :minor, :patch].each do |segment|
64
+ next if self.send(segment) == other.send(segment)
65
+ return 1 if self.send(segment) > other.send(segment)
66
+ return -1 if self.send(segment) < other.send(segment)
67
+ end
68
+ return 0
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,36 @@
1
+ module ThorSCMVersion
2
+ class ShellUtils
3
+ class << self
4
+ def secure_password
5
+ password = String.new
6
+
7
+ while password.length < 20
8
+ password << ::OpenSSL::Random.random_bytes(1).gsub(/\W/, '')
9
+ end
10
+ password
11
+ end
12
+
13
+ def sh(cmd, dir = '.', &block)
14
+ out, code = sh_with_excode(cmd, dir, &block)
15
+ code == 0 ? out : raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out)
16
+ end
17
+
18
+ def sh_with_excode(cmd, dir = '.', &block)
19
+ cmd << " 2>&1"
20
+ output = ""
21
+ status = nil
22
+ Dir.chdir(dir) {
23
+ stdin, stdout, stderr, wait_thr = Open3::popen3(cmd)
24
+
25
+ status = wait_thr.value
26
+ output = stdout.readlines.join
27
+
28
+ if status.to_i == 0
29
+ block.call(output) if block
30
+ end
31
+ }
32
+ [ output, status ]
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,3 @@
1
+ module ThorSCMVersion
2
+ VERSION = IO.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION')) rescue "0.0.1"
3
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ module ThorSCMVersion
4
+ describe GitVersion do
5
+ it 'should take major minor and patch segments on initialization' do
6
+ -> { described_class.new('1', '2', '3') }.should_not raise_error
7
+ end
8
+ end
9
+
10
+ describe Perforce do
11
+ it 'should set good' do
12
+ described_class.stub(:set) { <<-here }
13
+ P4CHARSET=utf8\nP4CLIENT=kallan_mac (config)
14
+ P4CONFIG=p4config (config '/Users/kallan/src/kallan_mac/p4config')
15
+ P4PORT=perflax01:1666 (config)
16
+ P4USER=kallan
17
+ here
18
+
19
+ described_class.parse_and_set_p4_set
20
+
21
+ ENV["P4CHARSET"].should == "utf8"
22
+ ENV["P4CONFIG"].should == "p4config"
23
+ ENV["P4PORT"].should == "perflax01:1666"
24
+ ENV["P4USER"].should == "kallan"
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,62 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ require 'spork'
4
+ require 'vcr'
5
+
6
+ Spork.prefork do
7
+ require 'rspec'
8
+ require 'simplecov'
9
+ require 'pp'
10
+
11
+ APP_ROOT = File.expand_path('../../', __FILE__)
12
+
13
+ Dir[File.join(APP_ROOT, "spec/support/**/*.rb")].each {|f| require f}
14
+
15
+ VCR.configure do |c|
16
+ c.cassette_library_dir = File.join(File.dirname(__FILE__), 'fixtures', 'vcr_cassettes')
17
+ c.hook_into :webmock
18
+ end
19
+
20
+ RSpec.configure do |config|
21
+ config.mock_with :rspec
22
+ config.treat_symbols_as_metadata_keys_with_true_values = true
23
+ config.filter_run :focus => true
24
+ config.run_all_when_everything_filtered = true
25
+
26
+ config.around do |example|
27
+ # Dynamically create cassettes based on the name of the example
28
+ # being run. This creates a new cassette for every test.
29
+ cur = example.metadata
30
+ identifiers = [example.metadata[:description_args]]
31
+ while cur = cur[:example_group] do
32
+ identifiers << cur[:description_args]
33
+ end
34
+
35
+ VCR.use_cassette(identifiers.reverse.join(' ')) do
36
+ example.run
37
+ end
38
+ end
39
+ end
40
+
41
+ SimpleCov.start do
42
+ add_filter 'spec/'
43
+ end
44
+
45
+ def capture(stream)
46
+ begin
47
+ stream = stream.to_s
48
+ eval "$#{stream} = StringIO.new"
49
+ yield
50
+ result = eval("$#{stream}").string
51
+ ensure
52
+ eval("$#{stream} = #{stream.upcase}")
53
+ end
54
+
55
+ result
56
+ end
57
+
58
+ end
59
+
60
+ Spork.each_run do
61
+ require 'thor-scmversion'
62
+ end
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/thor-scmversion/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Michael Ivey", "Kyle Allan", "Josiah Kiehl"]
6
+ gem.email = ["ivey@gweezlebur.com", "kallan@riotgames.com", "josiah@skirmisher.net"]
7
+ gem.description = %q{Thor tasks to manage a VERSION file based on SCM tags}
8
+ gem.summary = %q{A small set of Thor tasks you can include in your build scripts to manage a VERSION file based on SCM tags. This allows you to keep VERSION out of cource control, allowing your continuous integration system to version each build.}
9
+ gem.homepage = ""
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "thor-scmversion"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = ThorSCMVersion::VERSION
17
+
18
+ gem.add_dependency 'open4'
19
+ gem.add_dependency 'thor'
20
+ gem.add_development_dependency 'webmock'
21
+ gem.add_development_dependency 'geminabox'
22
+ gem.add_development_dependency 'spork'
23
+ gem.add_development_dependency 'simplecov'
24
+ gem.add_development_dependency 'vcr'
25
+ gem.add_development_dependency 'aruba'
26
+ gem.add_development_dependency 'rspec'
27
+ end
metadata ADDED
@@ -0,0 +1,176 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: thor-scmversion
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Michael Ivey
9
+ - Kyle Allan
10
+ - Josiah Kiehl
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2012-06-25 00:00:00.000000000Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: open4
18
+ requirement: &70337182623800 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
23
+ version: '0'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: *70337182623800
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: &70337182623380 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ! '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: *70337182623380
38
+ - !ruby/object:Gem::Dependency
39
+ name: webmock
40
+ requirement: &70337182622960 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ type: :development
47
+ prerelease: false
48
+ version_requirements: *70337182622960
49
+ - !ruby/object:Gem::Dependency
50
+ name: geminabox
51
+ requirement: &70337182622540 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ type: :development
58
+ prerelease: false
59
+ version_requirements: *70337182622540
60
+ - !ruby/object:Gem::Dependency
61
+ name: spork
62
+ requirement: &70337182653080 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: *70337182653080
71
+ - !ruby/object:Gem::Dependency
72
+ name: simplecov
73
+ requirement: &70337182652660 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: *70337182652660
82
+ - !ruby/object:Gem::Dependency
83
+ name: vcr
84
+ requirement: &70337182652240 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: *70337182652240
93
+ - !ruby/object:Gem::Dependency
94
+ name: aruba
95
+ requirement: &70337182651820 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ type: :development
102
+ prerelease: false
103
+ version_requirements: *70337182651820
104
+ - !ruby/object:Gem::Dependency
105
+ name: rspec
106
+ requirement: &70337182651400 !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ type: :development
113
+ prerelease: false
114
+ version_requirements: *70337182651400
115
+ description: Thor tasks to manage a VERSION file based on SCM tags
116
+ email:
117
+ - ivey@gweezlebur.com
118
+ - kallan@riotgames.com
119
+ - josiah@skirmisher.net
120
+ executables: []
121
+ extensions: []
122
+ extra_rdoc_files: []
123
+ files:
124
+ - .gitignore
125
+ - Gemfile
126
+ - LICENSE
127
+ - README.md
128
+ - Rakefile
129
+ - Thorfile
130
+ - features/bump.feature
131
+ - features/fixtures/Thorfile
132
+ - features/step_definitions/bump_steps.rb
133
+ - features/support/env.rb
134
+ - lib/thor-scmversion.rb
135
+ - lib/thor-scmversion/git_version.rb
136
+ - lib/thor-scmversion/p4_version.rb
137
+ - lib/thor-scmversion/scm_version.rb
138
+ - lib/thor-scmversion/shell_utils.rb
139
+ - lib/thor-scmversion/version.rb
140
+ - spec/lib/scm_version_spec.rb
141
+ - spec/spec_helper.rb
142
+ - thor-scmversion.gemspec
143
+ homepage: ''
144
+ licenses: []
145
+ post_install_message:
146
+ rdoc_options: []
147
+ require_paths:
148
+ - lib
149
+ required_ruby_version: !ruby/object:Gem::Requirement
150
+ none: false
151
+ requirements:
152
+ - - ! '>='
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ! '>='
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ requirements: []
162
+ rubyforge_project:
163
+ rubygems_version: 1.8.10
164
+ signing_key:
165
+ specification_version: 3
166
+ summary: A small set of Thor tasks you can include in your build scripts to manage
167
+ a VERSION file based on SCM tags. This allows you to keep VERSION out of cource
168
+ control, allowing your continuous integration system to version each build.
169
+ test_files:
170
+ - features/bump.feature
171
+ - features/fixtures/Thorfile
172
+ - features/step_definitions/bump_steps.rb
173
+ - features/support/env.rb
174
+ - spec/lib/scm_version_spec.rb
175
+ - spec/spec_helper.rb
176
+ has_rdoc: