scm-workflow 0.3.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 90dcda5f4c926d3ddaa88dbe0a7641289f8699ea
4
+ data.tar.gz: 1f82b0d71688152be73377a23d65bbd6c35338e1
5
+ SHA512:
6
+ metadata.gz: 0b4de49ea52fd388fa1670e96cd3a9a1a6a133faa1ed1be72fc6a4ec50fb688424269a900adf48c9e4edabb3519353920f104a3fb4b97429c038b3ae682528f3
7
+ data.tar.gz: 6a1e2f6afe58f6278768835b95d3863a8ddace9e4cf1f891463397ebba6bef63524076a5c30e3f9bba3601f542231f915f4457a61e4070829e0a20f437724c27
@@ -0,0 +1,3 @@
1
+ .*.swp
2
+ .DS_Store
3
+ *.lock
@@ -0,0 +1,4 @@
1
+ rvm:
2
+ - "1.9.3"
3
+ - "1.9.2"
4
+ - "2.0.0"
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in scm-workflow.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem 'rake'
8
+ end
9
+
10
+
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Bone Crusher
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,29 @@
1
+ # Scm::Workflow
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'scm-workflow'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install scm-workflow
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'rspec/core'
15
+ require 'rspec/core/rake_task'
16
+ RSpec::Core::RakeTask.new(:spec) do |spec|
17
+ spec.pattern = FileList['spec/**/*_spec.rb']
18
+ spec.rspec_opts = Dir.glob("[0-9][0-9][0-9]_*").collect { |x| "-I#{x}" }
19
+ spec.rspec_opts << '--color -f d'
20
+ end
21
+
22
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
23
+ spec.pattern = 'spec/**/*_spec.rb'
24
+ spec.rcov = true
25
+ end
26
+
27
+ RSpec::Core::RakeTask.new(:coverage) do |spec|
28
+ # add simplecov
29
+ ENV["COVERAGE"] = 'yes'
30
+
31
+ # run the specs
32
+ Rake::Task['spec'].execute
33
+ end
34
+
35
+ require 'cucumber/rake/task'
36
+ Cucumber::Rake::Task.new(:features)
37
+
38
+ task :default => :spec
39
+
40
+ require 'rdoc/task'
41
+ Rake::RDocTask.new do |rdoc|
42
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
43
+
44
+ rdoc.rdoc_dir = 'rdoc'
45
+ rdoc.title = "gitit #{version}"
46
+ rdoc.rdoc_files.include('README*')
47
+ rdoc.rdoc_files.include('lib/**/*.rb')
48
+ end
49
+
50
+ Dir.glob('lib/tasks/*.rake').each {|r| import r}
51
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.3.0
data/bin/scw ADDED
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ Bundler.require(:default)
5
+
6
+ require "utils/command-dispatcher.rb"
7
+
8
+ # -----------------------------------------------------------------------------
9
+ # This program is meant to be used as an extention to the git scm program. It
10
+ # provides a set of development workflows such as retrieving task information
11
+ # from the rallydev application, automatically generating code review for the
12
+ # smartbear software, automatically kick a build...
13
+ #
14
+ # Never call the scripts directly, always use git scw <command> instead of
15
+ # git-scw-<command>
16
+ #
17
+ # Author:: Pat Laplante (mailto:junk@covenofchaos.com)
18
+ # Copyright:: Copyright (c) 2012 CovenOfChaos
19
+ # License:: ???
20
+ # -----------------------------------------------------------------------------
21
+
22
+ $scriptPath = File.expand_path(File.dirname(__FILE__))
23
+ $scriptName = File.basename(__FILE__)
24
+ $command = ARGV.shift
25
+
26
+ dispatcher = Scm::Workflow::Utils::CommandDispatcher.new(
27
+ $scriptPath, $scriptName )
28
+
29
+ # -----------------------------------------------------------------------------
30
+ # -----------------------------------------------------------------------------
31
+ begin
32
+ dispatcher.dispatchCommand($command, *ARGV)
33
+ rescue ArgumentError => ex
34
+ $stderr.puts "Error: " + ex.to_s + ". Please specify a valid command."
35
+ dispatcher.usage
36
+ exit -1
37
+ ensure
38
+ end
39
+
40
+ # -----------------------------------------------------------------------------
41
+ # set filetype=ruby
42
+ # -----------------------------------------------------------------------------
@@ -0,0 +1,132 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ Bundler.require(:default)
5
+
6
+ require 'highline/import'
7
+ require "scm-workflow"
8
+ require "kruptos"
9
+ require "base64"
10
+
11
+ #-----------------------------------------------------------------------------
12
+ #-----------------------------------------------------------------------------
13
+ def usage()
14
+ puts "Commands for initialization of a local repo."
15
+ exit 0
16
+ end
17
+
18
+ #-----------------------------------------------------------------------------
19
+ # ................ A R G U M E N T S .. P R O C E S S I N G .................
20
+ #-----------------------------------------------------------------------------
21
+
22
+ #-----------------------------------------------------------------------------
23
+ # This hash will hold all of the options parsed from the command-line by
24
+ # OptionParser.
25
+ #-----------------------------------------------------------------------------
26
+ options = {}
27
+ loglevels = [:debug, :info, :warn, :error, :fatal]
28
+
29
+ optparse = OptionParser.new do|opts|
30
+ # Set a banner, displayed at the top of the help screen.
31
+ opts.banner = "Usage: optparse1.rb [options] file1 file2 ..."
32
+
33
+ # Define the options, and what they do
34
+ options[:quick] = false
35
+ opts.on( '-q', '--quick', 'Perform the task quickly' ) do
36
+ options[:quick] = true
37
+ end
38
+
39
+ options[:logfile] = nil
40
+ opts.on( '-l', '--logfile FILE', 'Write log to FILE' ) do |file|
41
+ options[:logfile] = file
42
+ end
43
+
44
+ options[:usage] = nil
45
+ opts.on( '-u', '--usage', 'Print one liner about this script' ) do
46
+ options[:usage] = true
47
+ end
48
+
49
+ options[:list] = []
50
+ opts.on( '-a', '--list a,b,c', Array, "List of parameters" ) do |l|
51
+ options[:list] = l
52
+ end
53
+
54
+ options[:loglevel] = nil
55
+ opts.on( '-v', '--loglevel OPT', loglevels, "Log level" ) do |s|
56
+ options[:loglevel] = s
57
+ end
58
+
59
+ # This displays the help screen, all programs are assumed to have this
60
+ # option.
61
+ opts.on( '-h', '--help', 'Display this screen' ) do
62
+ puts opts
63
+ exit
64
+ end
65
+ end
66
+
67
+ #-----------------------------------------------------------------------------
68
+ # Parse the command-line. Remember there are two forms of the parse method.
69
+ # The 'parse' method simply parses ARGV, while the 'parse!' method parses
70
+ # ARGV and removes any options found there, as well as any parameters for the
71
+ # the options. What's left is the list of files to resize.
72
+ #-----------------------------------------------------------------------------
73
+ begin
74
+ optparse.parse!
75
+ rescue => ex
76
+ puts ex.to_s
77
+ exit 1
78
+ end
79
+ usage if options[:usage]
80
+
81
+ puts "Being quick" if options[:quick]
82
+ puts "Logging to file #{options[:logfile]}" if options[:logfile]
83
+
84
+ loglevel = options[:loglevel]
85
+ logsettings = Scm::Workflow::Utils::LogSettings.instance
86
+ logsettings.level = loglevels.index(loglevel) if options[:loglevel]
87
+ logsettings.output = options[:logfile] if options[:logfile]
88
+
89
+ #-----------------------------------------------------------------------------
90
+ # ..................... E X E C U T I O N .. G U T S ........................
91
+ #-----------------------------------------------------------------------------
92
+ git = Gitit::Git.new(Dir.pwd)
93
+ #Test it is a valid repo, if not create it.
94
+ config = git.config
95
+
96
+ #-----------------------------------------------------------------------------
97
+ #-----------------------------------------------------------------------------
98
+ begin
99
+
100
+ configBlocks = Array.new
101
+ configBlocks << Scm::Workflow::Flow.new
102
+ configBlocks << Scm::Workflow::CodeCollab.new
103
+ configBlocks << Scm::Workflow::Rally.new
104
+
105
+ initRepo = Scm::Workflow::InitializeRepo.new(git, configBlocks)
106
+
107
+ initRepo.execute { |configuration|
108
+ configuration.each do |v|
109
+ globalEntry = v
110
+
111
+ puts
112
+ puts " > " + globalEntry.to_s
113
+ globalEntry.instance_variables.each do |sv|
114
+ entry = globalEntry.instance_variable_get(sv)
115
+ info = entry.info;
116
+ hideInput = entry.hideinput;
117
+ question = "\tEnter the " + info + ": "
118
+ value = ask(question) { |q| q.echo = "*" } if hideInput
119
+ value = ask(question) { |q| q.default = entry.value } if !hideInput
120
+ entry.value = value
121
+ end
122
+ end
123
+ }
124
+
125
+
126
+ rescue Interrupt => e
127
+ puts "\ninterupted"
128
+ end
129
+
130
+ exit initRepo.wasSuccessfull? ? 0 : 1
131
+
132
+
@@ -0,0 +1,55 @@
1
+ require "bundler/setup"
2
+ require "kruptos"
3
+ require "base64"
4
+
5
+ Bundler.require(:default)
6
+
7
+ class String
8
+
9
+ def encrypt(key = "Some random key")
10
+ blowfish = Kruptos::Blowfish.new(key)
11
+
12
+ String val = self
13
+
14
+ # pad the value to be 8 bytes aligned.
15
+ (8-(val.length % 8)).times { val += "\012" }
16
+ encodedString = Base64.encode64(val)
17
+
18
+ encryptedValue = ""
19
+ (
20
+ chunk = val.slice!(0,8)
21
+ encryptedValue += blowfish.encrypt_block(chunk)
22
+ ) until val.empty?
23
+
24
+ return ::Base64.encode64(encryptedValue);
25
+ end
26
+
27
+ def decrypt(key = "Some random key")
28
+ blowfish = Kruptos::Blowfish.new(key)
29
+ value = ::Base64.decode64(self)
30
+
31
+ decryptedValue = ""
32
+ (
33
+ chunk = value.slice!(0,8)
34
+ decryptedValue += blowfish.decrypt_block(chunk)
35
+ ) until value.empty?
36
+
37
+ (
38
+ decryptedValue = decryptedValue.chomp("\012")
39
+ ) until (decryptedValue[decryptedValue.length-1] != "\012")
40
+
41
+ return decryptedValue
42
+ end
43
+
44
+ end
45
+
46
+ # String foo = "This is cool".encrypt("blablabla")
47
+ # puts foo => "WuwcAFdNWrtdn4SANiTxgg=="
48
+ # puts foo.decrypt("blablabla") => "This is cool"
49
+ # puts foo.decrypt("blablabla").length => 12
50
+
51
+ # String foo = "This is cool".encrypt
52
+ # puts foo
53
+ # puts foo.decrypt
54
+ # puts foo.decrypt.length
55
+
@@ -0,0 +1,21 @@
1
+ require "bundler/setup"
2
+ require "scm-workflow"
3
+ require "utils/logging"
4
+
5
+ require "kruptos"
6
+ require "base64"
7
+ require "ext/string"
8
+
9
+ require "gitit"
10
+ require "workflow"
11
+
12
+ require "scm-workflow/configuration"
13
+ Dir[File.dirname(__FILE__) + "/scm-workflow/workflow-*.rb"].each do |file|
14
+ require file
15
+ end
16
+
17
+ module Scm
18
+ module Workflow
19
+ # Your code goes here...
20
+ end
21
+ end
@@ -0,0 +1,81 @@
1
+ require "bundler/setup"
2
+ Bundler.require(:default)
3
+
4
+ module Scm
5
+ module Workflow
6
+ end
7
+ end
8
+
9
+ module Scm::Workflow
10
+
11
+ class ConfigElement
12
+ attr_reader :info;
13
+ attr_accessor :value;
14
+ attr_reader :hideinput;
15
+
16
+ def initialize (info, hideinput, default)
17
+ @info = info;
18
+ @hideinput = hideinput;
19
+ @value = default;
20
+ end
21
+ end
22
+
23
+ class Flow
24
+ attr_accessor :develop;
25
+ attr_accessor :feature;
26
+
27
+ def initialize
28
+ @develop = ConfigElement.new("Develop branch name", false, "develop")
29
+ @feature = ConfigElement.new("Feature branch name", false, "feature")
30
+ end
31
+
32
+ def to_s
33
+ return "Specify branch related information: "
34
+ end
35
+
36
+ end
37
+
38
+ class CodeCollab
39
+ attr_accessor :app_exec_path;
40
+ attr_accessor :username;
41
+ attr_accessor :serverurl;
42
+ attr_accessor :reviewers;
43
+ attr_accessor :observers;
44
+
45
+ def initialize
46
+ @execpath = ConfigElement.new("Path to code collab executable", false, "/Applications/ccollab_client/ccollab")
47
+ @serverurl = ConfigElement.new("Code collab server url", false, "https://development-us:8443")
48
+ @username = ConfigElement.new("Code collab username", false, "")
49
+ @reviewers = ConfigElement.new("List of reviewers id, coma separated", false, "")
50
+ @observers = ConfigElement.new("List of observers id, coma separated", false, "")
51
+ end
52
+
53
+ def to_s
54
+ return "Specify code collab related information: "
55
+ end
56
+
57
+ end
58
+
59
+
60
+ class Rally
61
+ attr_accessor :username;
62
+ attr_accessor :password;
63
+ attr_accessor :serverurl;
64
+ attr_accessor :workspace;
65
+ attr_accessor :project;
66
+
67
+ def initialize
68
+ @serverurl = ConfigElement.new("Rally server url", false, "https://rally1.rallydev.com/")
69
+ @username = ConfigElement.new("Rally username", false, "")
70
+ @password = ConfigElement.new("Rally password", true, "")
71
+ @workspace = ConfigElement.new("Rally workspace", false, "")
72
+ @project = ConfigElement.new("Rally project", false, "")
73
+ end
74
+
75
+ def to_s
76
+ return "Specify Rallydev related information: "
77
+ end
78
+
79
+ end
80
+
81
+ end
@@ -0,0 +1,5 @@
1
+ module Scm
2
+ module Workflow
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,138 @@
1
+ require 'cli-colorize'
2
+
3
+ def valid? version
4
+ pattern = /^\d+\.\d+\.\d+(\-(dev|beta|rc\d+))?$/
5
+ raise "Tried to set invalid version: #{version}".red unless version =~ pattern
6
+ end
7
+
8
+ def correct_version version
9
+ ver, flag = version.split '-'
10
+ v = ver.split '.'
11
+ (0..2).each do |n|
12
+ v[n] = v[n].to_i
13
+ end
14
+ [v.join('.'), flag].compact.join '-'
15
+ end
16
+
17
+ def read_version
18
+ begin
19
+ File.read 'VERSION'
20
+ rescue
21
+ raise "VERSION file not found or unreadable.".red
22
+ end
23
+ end
24
+
25
+ def write_version version
26
+ valid? version
27
+ begin
28
+ File.open 'VERSION', 'w' do |file|
29
+ file.write correct_version(version)
30
+ end
31
+ rescue
32
+ raise "VERSION file not found or unwritable.".red
33
+ end
34
+ end
35
+
36
+ def reset current, which
37
+ version, flag = current.split '-'
38
+ v = version.split '.'
39
+ which.each do |part|
40
+ v[part] = 0
41
+ end
42
+ [v.join('.'), flag].compact.join '-'
43
+ end
44
+
45
+ def increment current, which
46
+ version, flag = current.split '-'
47
+ v = version.split '.'
48
+ v[which] = v[which].to_i + 1
49
+ [v.join('.'), flag].compact.join '-'
50
+ end
51
+
52
+ desc "Prints the current application version"
53
+ version = read_version
54
+ task :version do
55
+ puts <<HELP
56
+ Available commands are:
57
+ -----------------------
58
+ rake version:write[version] # set custom version in the x.x.x-? format
59
+ rake version:patch # increment the patch x.x.x+1 (keeps any flags on)
60
+ rake version:minor # increment minor and reset patch x.x+1.0 (keeps any flags on)
61
+ rake version:major # increment major and reset others x+1.0.0 (keeps any flags on)
62
+ rake version:dev # set the dev flag on x.x.x-dev
63
+ rake version:beta # set the beta flag on x.x.x-beta
64
+ rake version:rc # set or increment the rc flag x.x.x-rcX
65
+ rake version:release # removes any flags from the current version
66
+
67
+ HELP
68
+ puts "Current version is: #{version.green}"
69
+ end
70
+
71
+ namespace :version do
72
+
73
+ desc "Write version explicitly by specifying version number as a parameter"
74
+ task :write, [:version] do |task, args|
75
+ write_version args[:version].strip
76
+ puts "Version explicitly written: #{read_version.green}"
77
+ end
78
+
79
+ desc "Increments the patch version"
80
+ task :patch do
81
+ new_version = increment read_version, 2
82
+ write_version new_version
83
+ puts "Application patched: #{new_version.green}"
84
+ end
85
+
86
+ desc "Increments the minor version and resets the patch"
87
+ task :minor do
88
+ incremented = increment read_version, 1
89
+ new_version = reset incremented, [2]
90
+ write_version new_version
91
+ puts "New version released: #{new_version.green}"
92
+ end
93
+
94
+ desc "Increments the major version and resets both minor and patch"
95
+ task :major do
96
+ incremented = increment read_version, 0
97
+ new_version = reset incremented, [1, 2]
98
+ write_version new_version
99
+ puts "Major application version change: #{new_version.green}. Congratulations!"
100
+ end
101
+
102
+ desc "Sets the development flag on"
103
+ task :dev do
104
+ version, flag = read_version.split '-'
105
+ new_version = [version, 'dev'].join '-'
106
+ write_version new_version
107
+ puts "Version in development: #{new_version.green}"
108
+ end
109
+
110
+ desc "Sets the beta flag on"
111
+ task :beta do
112
+ version, flag = read_version.split '-'
113
+ new_version = [version, 'beta'].join '-'
114
+ write_version new_version
115
+ puts "Version in beta: #{new_version.green}"
116
+ end
117
+
118
+ desc "Sets or increments the rc flag"
119
+ task :rc do
120
+ version, flag = read_version.split '-'
121
+ rc = /^rc(\d+)$/.match flag
122
+ if rc
123
+ new_version = [version, "rc#{rc[1].to_i+1}"].join '-'
124
+ else
125
+ new_version = [version, 'rc1'].join '-'
126
+ end
127
+ write_version new_version
128
+ puts "New version release candidate: #{new_version.green}"
129
+ end
130
+
131
+ desc "Removes any version flags"
132
+ task :release do
133
+ version, flag = read_version.split '-'
134
+ write_version version
135
+ puts "Released stable version: #{version.green}"
136
+ end
137
+
138
+ end
@@ -0,0 +1,26 @@
1
+ module Test
2
+ module Unit
3
+ end
4
+ end
5
+
6
+ module Test::Unit
7
+ # Used to fix a minor minitest/unit incompatibility in flexmock
8
+ #AssertionFailedError = Class.new(StandardError)
9
+
10
+ class TestCase
11
+
12
+ def self.must(name, &block)
13
+ test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
14
+ defined = instance_method(test_name) rescue false
15
+ raise "#{test_name} is already defined in #{self}" if defined
16
+ if block_given?
17
+ define_method(test_name, &block)
18
+ else
19
+ define_method(test_name) do
20
+ flunk "No implementation provided for #{name}"
21
+ end
22
+ end
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,54 @@
1
+ module Scm
2
+ module Workflow
3
+ module Utils
4
+ end
5
+ end
6
+ end
7
+
8
+ module Scm::Workflow::Utils
9
+
10
+ # ---------------------------------------------------------------------------
11
+ # ---------------------------------------------------------------------------
12
+ class CommandDispatcher
13
+
14
+ EX_NOCMD="No command specified"
15
+ EX_INVALCMD="is not a valid command"
16
+
17
+ # -------------------------------------------------------------------------
18
+ # -------------------------------------------------------------------------
19
+ def initialize(rootScriptAbsLocation, rootScriptName)
20
+ @rootScriptAbsLocation = rootScriptAbsLocation
21
+ @rootScriptName = rootScriptName
22
+ @commandPrefix = rootScriptAbsLocation + '/' + rootScriptName + '-';
23
+ end
24
+
25
+ # -------------------------------------------------------------------------
26
+ # -------------------------------------------------------------------------
27
+ def usage()
28
+ Dir.glob(@commandPrefix + '*').each do |f|
29
+ help = `#{f} --usage`
30
+ command = File.basename(f).gsub!( "-", " " )
31
+ $stdout.puts command.ljust(25) + " : " + help
32
+ end
33
+ end
34
+
35
+ # -------------------------------------------------------------------------
36
+ # -------------------------------------------------------------------------
37
+ def dispatchCommand(cmd, *arguments)
38
+
39
+ raise ArgumentError.new(EX_NOCMD) if cmd == nil
40
+ raise ArgumentError.new("#{cmd} " + EX_INVALCMD) unless isValid?(cmd)
41
+
42
+ exec(@commandPrefix + cmd, *arguments)
43
+ end
44
+
45
+ # -------------------------------------------------------------------------
46
+ # -------------------------------------------------------------------------
47
+ def isValid?(command)
48
+ return false if (!File.exists?(@commandPrefix + command))
49
+ return true
50
+ end
51
+
52
+ end
53
+
54
+ end
@@ -0,0 +1,62 @@
1
+ module Scm
2
+ module Workflow
3
+ module Utils
4
+ end
5
+ end
6
+ end
7
+
8
+ require 'singleton'
9
+ require 'logger'
10
+
11
+ module Scm::Workflow::Utils
12
+ class LogSettings
13
+ include Singleton
14
+ attr_accessor :level
15
+ attr_accessor :output
16
+ def initialize
17
+ @level = Logger::FATAL
18
+ @output = STDOUT
19
+ end
20
+ end
21
+
22
+ class Logging
23
+ include Singleton
24
+
25
+ attr_reader :logger
26
+ def initialize
27
+ logsettings = Scm::Workflow::Utils::LogSettings.instance
28
+ @logger = Logger.new(logsettings.output)
29
+ @logger.level = logsettings.level
30
+ end
31
+ end
32
+ end
33
+
34
+ module Logging
35
+
36
+ # ---------------------------------------------------------------------------
37
+ # ---------------------------------------------------------------------------
38
+ def logger
39
+ @logger ||= Logging.logger_for(self.class.name)
40
+ end
41
+
42
+ # Use a hash class-ivar to cache a unique Logger per class:
43
+ @loggers = {}
44
+
45
+ # ---------------------------------------------------------------------------
46
+ # ---------------------------------------------------------------------------
47
+ class << self
48
+
49
+ def logger_for(classname)
50
+ @loggers[classname] ||= configure_logger_for(classname)
51
+ end
52
+
53
+ def configure_logger_for(classname)
54
+ logsettings = Scm::Workflow::Utils::LogSettings.instance
55
+ logger = Logger.new(logsettings.output)
56
+ logger.progname = classname
57
+ logger.level = logsettings.level
58
+ logger
59
+ end
60
+ end
61
+
62
+ end
@@ -0,0 +1,37 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'scm-workflow/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+
8
+ gem.name = "scm-workflow"
9
+ gem.version = File.exist?('VERSION') ? File.read('VERSION') : Scm::Workflow::VERSION
10
+ gem.authors = ["Pat Laplante"]
11
+ gem.email = ["pat@covenofchaos.com"]
12
+ gem.description = %q{""}
13
+ gem.summary = %q{""}
14
+ gem.homepage = ""
15
+
16
+ gem.files = `git ls-files`.split($/)
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.require_paths = ["lib"]
20
+ gem.licenses = ["MIT"]
21
+
22
+ gem.add_development_dependency 'rspec'
23
+ gem.add_development_dependency 'cli-colorize'
24
+ gem.add_development_dependency 'rdoc', '>= 3.12'
25
+ gem.add_development_dependency 'cucumber', '>= 1.0'
26
+ gem.add_development_dependency 'bundler', '>= 1.0.0'
27
+ gem.add_development_dependency 'simplecov'
28
+
29
+ gem.add_dependency 'ruby'
30
+ gem.add_dependency 'gitit', '>= 0.4.0'
31
+ gem.add_dependency 'highline'
32
+ gem.add_dependency 'builder'
33
+ gem.add_dependency 'kruptos', '>= 0.2.0'
34
+ gem.add_dependency 'inflector'
35
+ gem.add_dependency 'workflow'
36
+
37
+ end
@@ -0,0 +1,17 @@
1
+ if ENV["COVERAGE"] == 'yes'
2
+ require 'simplecov'
3
+ SimpleCov.start
4
+ end
5
+
6
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
8
+ require 'rspec'
9
+ require 'scm-workflow'
10
+
11
+ # Requires supporting files with custom matchers and macros, etc,
12
+ # in ./support/ and its subdirectories.
13
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
14
+
15
+ RSpec.configure do |config|
16
+
17
+ end
@@ -0,0 +1,35 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe String do
4
+
5
+ # -------------------------------------------------------------------------
6
+ # -------------------------------------------------------------------------
7
+ describe "#testStringEncrypt" do
8
+
9
+ before(:each) do
10
+ end
11
+
12
+ it "will successfully encrypt a string" do
13
+ encrypted = "abcd".encrypt
14
+ encrypted.encrypt.should_not eq "abcd"
15
+ end
16
+
17
+ it "will successfully decrypt an encrypted string" do
18
+ encrypted = "abcd".encrypt
19
+ encrypted.decrypt.should eq "abcd"
20
+ end
21
+
22
+ it "will successfully encrypt and decrypt a string when using a custom key" do
23
+ encrypted = "abcd".encrypt("My custom key")
24
+ encrypted.encrypt.should_not eq "abcd"
25
+ encrypted.decrypt.should_not eq "abcd"
26
+ encrypted.decrypt("My custom key").should eq "abcd"
27
+ end
28
+
29
+ after(:each) do
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+
@@ -0,0 +1,69 @@
1
+ require "test/unit"
2
+ require "json"
3
+ require 'json/add/core'
4
+ #require "./test_unit_extensions.rb"
5
+ #require "./rally/rally.rb"
6
+ require "test_unit_extensions"
7
+
8
+ class RallyConfig
9
+ attr_accessor :username;
10
+ attr_accessor :password;
11
+ attr_accessor :serverurl;
12
+ attr_accessor :workspace;
13
+ attr_accessor :project;
14
+
15
+ def initialize()
16
+ @serverurl = "https://rally1.rallydev.com/"
17
+ @username = "plaplante@pharos.com"
18
+ @password = "Gr0sVag1n69"
19
+ @workspace = "Pharos"
20
+ @project = "MPS / Web Client"
21
+ end
22
+ end
23
+
24
+ class RallyTest < Test::Unit::TestCase
25
+ def setup
26
+ @rallyConfig = RallyConfig.new
27
+ @rally = Pharos::Utils::Rally::Rally.new(@rallyConfig)
28
+ end
29
+
30
+ must "connect to rally successfully" do
31
+ @rally.openConnection
32
+ iteration = @rally.getCurrentIteration
33
+ puts "Iteration: " + iteration.name
34
+
35
+ stories = @rally.getCurrentIterationStories iteration
36
+ stories.each { |story|
37
+ puts "(" + story.formatted_i_d + ") - " + story.name
38
+ unless story.tasks.nil?
39
+ story.tasks.each { |task|
40
+ puts "\t" + task.formatted_i_d + ": " + task.name
41
+ }
42
+ end
43
+ }
44
+ # tasks.each { |task| puts "(" + task.work_product.formatted_i_d + ") - " + task.work_product.name + ": " + task.inspect }
45
+
46
+ defects = @rally.getAllOpenDefectsForIteration @rallyConfig.project, iteration
47
+ defects.each { |defect| puts defect.state; puts defect.priority; puts defect.project.body; }
48
+ end
49
+
50
+ # %w[y Y YeS YES yes].each do |yes|
51
+ # must "return true when yes_or_no parses #{yes}" do
52
+ # assert @questioner.yes_or_no(yes), "#{yes.inspect} expected to parse as true"
53
+ # end
54
+ # end
55
+
56
+ # %w[n N no nO].each do |no|
57
+ # must "return false when yes_or_no parses #{no}" do
58
+ # assert ! @questioner.yes_or_no(no), "#{no.inspect} expected to parse as false"
59
+ # end
60
+ # end
61
+
62
+ # %w[Note Yesterday xyzaty].each do |mu|
63
+ # must "return nil because #{mu} is not a variant of 'yes' or 'no'" do
64
+ # assert_nil @questioner.yes_or_no(mu), "#{mu.inspect} expected to parse as nil"
65
+ # end
66
+ # end
67
+
68
+
69
+ end
metadata ADDED
@@ -0,0 +1,252 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scm-workflow
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Pat Laplante
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: cli-colorize
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: rdoc
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '3.12'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '3.12'
55
+ - !ruby/object:Gem::Dependency
56
+ name: cucumber
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: 1.0.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: 1.0.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: ruby
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: gitit
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: 0.4.0
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: 0.4.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: highline
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: builder
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: kruptos
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '>='
158
+ - !ruby/object:Gem::Version
159
+ version: 0.2.0
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '>='
165
+ - !ruby/object:Gem::Version
166
+ version: 0.2.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: inflector
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: workflow
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - '>='
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - '>='
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ description: '""'
196
+ email:
197
+ - pat@covenofchaos.com
198
+ executables:
199
+ - scw
200
+ - scw-init
201
+ extensions: []
202
+ extra_rdoc_files: []
203
+ files:
204
+ - .gitignore
205
+ - .travis.yml
206
+ - Gemfile
207
+ - LICENSE.txt
208
+ - README.md
209
+ - Rakefile
210
+ - VERSION
211
+ - bin/scw
212
+ - bin/scw-init
213
+ - lib/ext/string.rb
214
+ - lib/scm-workflow.rb
215
+ - lib/scm-workflow/configuration.rb
216
+ - lib/scm-workflow/version.rb
217
+ - lib/tasks/version.rake
218
+ - lib/test_unit_extensions.rb
219
+ - lib/utils/command-dispatcher.rb
220
+ - lib/utils/logging.rb
221
+ - scm-workflow.gemspec
222
+ - spec/spec_helper.rb
223
+ - spec/stringext_spec.rb
224
+ - test/test_rally.rb
225
+ homepage: ''
226
+ licenses:
227
+ - MIT
228
+ metadata: {}
229
+ post_install_message:
230
+ rdoc_options: []
231
+ require_paths:
232
+ - lib
233
+ required_ruby_version: !ruby/object:Gem::Requirement
234
+ requirements:
235
+ - - '>='
236
+ - !ruby/object:Gem::Version
237
+ version: '0'
238
+ required_rubygems_version: !ruby/object:Gem::Requirement
239
+ requirements:
240
+ - - '>='
241
+ - !ruby/object:Gem::Version
242
+ version: '0'
243
+ requirements: []
244
+ rubyforge_project:
245
+ rubygems_version: 2.0.3
246
+ signing_key:
247
+ specification_version: 4
248
+ summary: '""'
249
+ test_files:
250
+ - spec/spec_helper.rb
251
+ - spec/stringext_spec.rb
252
+ - test/test_rally.rb