Skip to content

Commit d5c20bf

Browse files
committed
Merged rebirth
2 parents 717533a + f495911 commit d5c20bf

16 files changed

Lines changed: 433 additions & 241 deletions

File tree

.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--require spec_helper

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM ruby:2.5
2+
RUN ruby --version
3+
RUN apt-get update && \
4+
apt-get install cmake -y
5+
WORKDIR /tmp
6+
RUN gem install docopt
7+
RUN gem install rugged
8+
9+
RUN git clone https://github.com/Praqma/PlusBump.git -b rebirth .
10+
RUN gem build plusbump.gemspec
11+
RUN gem install plusbump-2.0.pre.alpha.gem
12+
13+
RUN mkdir -p /repo
14+
WORKDIR /repo
15+
VOLUME /repo
16+
17+
ENTRYPOINT ["plusbump"]
18+
CMD ["--help"]

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source 'https://rubygems.org'
2+
3+
# Specify your gem's dependencies in plusbump.gemspec
4+
gemspec

README.md

Lines changed: 7 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -19,51 +19,6 @@ If no version string was specified bump the version 0.0.0, i.e. return either 1.
1919
### Other features
2020
The tool already supports a few more features:
2121

22-
```
23-
PlusBump 1.3
24-
25-
Usage:
26-
./plusbump.rb --latest=<tag-glob> [<semver_version_string>] [options]
27-
./plusbump.rb <ref> [<semver_version_string>] [options]
28-
./plusbump.rb -h|--help
29-
30-
Options:
31-
-h --help Show this screen.
32-
-t --tag-commit Actually tag HEAD with the version number computed.
33-
34-
-l --latest=<tag-glob>
35-
36-
Specify a glob pattern to search for last matching tag instead of
37-
providing a specific ref.
38-
Will attempt to use everything after <tag-glob> as the version string
39-
so be sure to provide _entire_ prefix.
40-
E.g. use "R_" if your versions are "R_1.2.3"
41-
42-
-p --prefix=<prefix>
43-
44-
Specify a prefix to add before the resulting version string
45-
46-
-s --special=<postfix>
47-
48-
Specify the "special" part of the resulting version string.
49-
This is any part of the version string that comes after the dash,
50-
e.g. in 1.3.4-SNAPSHOT it is the string "SNAPSHOT".
51-
Note this is for the "output" side.
52-
PlusBump will accept any special string on the input and preserve it,
53-
unless you specify `--special=""` or something else.
54-
55-
-a --majorpattern=<major_pattern>
56-
57-
Specify an alternative (regex) pattern that indicates a major version bump.
58-
E.g. --majorpattern='\+major'
59-
60-
-i --minorpattern=<minor_pattern>
61-
62-
Specify an alternative (regex) pattern that indicates a minor version bump.
63-
E.g. --minorpattern='\+minor'
64-
```
65-
66-
6722
### Helping users
6823
If you decide to require bumps on every commit (e.g. instead of assuming +patch as default), then it can be very helpful to users set up a push hook (pre-receive on Git) that rejects commits without a bump.
6924

@@ -78,3 +33,10 @@ It allows the `+bump` message to appear anywhere in the commit message as long a
7833

7934
## CodeScene analysis
8035
[![](https://codescene.io/projects/2928/status.svg) Get more details at **codescene.io**.](https://codescene.io/projects/2928/jobs/latest-successful/results)
36+
=======
37+
### Developer guide
38+
39+
#### How to test
40+
41+
Simply run `rake` for the simple test without output, and `rake doc` for the more verbose output. Test are located in the `spec` folder.
42+

Rakefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require "bundler/gem_tasks"
2+
require "rspec/core/rake_task"
3+
4+
RSpec::Core::RakeTask.new(:spec)
5+
6+
task :default => :spec
7+
8+
desc "Verbose test output"
9+
task :doc do
10+
puts `rspec --format doc`
11+
end

bin/console

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env ruby
2+
3+
require "bundler/setup"
4+
require "plusbump"
5+
6+
# You can add fixtures and/or initialization code here to make experimenting
7+
# with your gem easier. You can also use a different console, if you like.
8+
9+
# (If you use this, don't forget to add pry to your Gemfile!)
10+
# require "pry"
11+
# Pry.start
12+
13+
require "irb"
14+
IRB.start(__FILE__)

bin/plusbump

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env ruby
2+
#encoding: utf-8
3+
require 'docopt'
4+
require 'plusbump'
5+
6+
doc = <<DOCOPT
7+
Usage:
8+
plusbump -h|--help
9+
plusbump <ref> [options]
10+
plusbump --latest=<tag-glob> [options]
11+
plusbump --version
12+
13+
Arguments:
14+
<ref> A git reference. If specified, PlusBump will search for bumps from HEAD back to this <ref> instead of searching for a tag.
15+
16+
Options:
17+
-h --help Show this screen.
18+
19+
-l --latest=<tag-glob>
20+
21+
Specify a glob pattern to search for last matching tag instead of
22+
providing a specific ref.
23+
Will attempt to use everything after <tag-glob> as the version string
24+
so be sure to provide _entire_ prefix.
25+
E.g. use "R_" if your versions are "R_1.2.3"
26+
27+
--version Shows current version of PlusBump
28+
--debug Debug flag
29+
30+
DOCOPT
31+
32+
# Note: If you are reading the above usage in the source code and not using --help,
33+
# then ignore the double escapes in the usage examples.
34+
# On the command line you have to write --majorpattern='\+major'
35+
# The extra escape is to make it print that way in the usage message.
36+
37+
begin
38+
# Parse Commandline Arguments
39+
input = Docopt::docopt(doc, version: PlusBump::VERSION)
40+
puts input if input['--debug']
41+
rescue Docopt::Exit => e
42+
puts e.message
43+
exit
44+
end
45+
46+
#TODO: input['--latest'].flatten[0]
47+
puts PlusBump.bump(input['<ref>'], input['--latest'], debug: input['--debug'])
48+
49+

bin/setup

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
IFS=$'\n\t'
4+
set -vx
5+
6+
bundle install
7+
8+
# Do any other automated setup that you need to do here

jenkins-pipeline/Jenkinsfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
properties([parameters([booleanParam(defaultValue: false, description: '', name: 'isRelease')])])
2+
3+
node("dockerhost1") {
4+
5+
stage("checkout") {
6+
checkout scm
7+
}
8+
9+
stage("build") {
10+
//Let's just use PAC container, it has ll the necessary tools installed
11+
docker.image("praqma/pac").inside() {
12+
sh 'bundler exec rake'
13+
}
14+
}
15+
16+
stage("changelog") {
17+
pac()
18+
}
19+
20+
stage("release") {
21+
try {
22+
if(params?.isRelease) {
23+
echo "Building release"
24+
} else {
25+
echo "Not building release"
26+
}
27+
28+
} finally {
29+
echo "Done with release"
30+
}
31+
}
32+
33+
}

jenkins-pipeline/pipeline.groovy

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
multibranchPipelineJob("PlusBump") {
2+
factory {
3+
workflowBranchProjectFactory {
4+
scriptPath('jenkins-pipeline/Jenkinsfile')
5+
}
6+
}
7+
branchSources {
8+
git {
9+
credentialsId("github")
10+
remote("https://github.com/Praqma/PlusBump.git")
11+
}
12+
}
13+
14+
configure {
15+
def traitBlock = it / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'source' / 'traits'
16+
traitBlock << 'jenkins.plugins.git.traits.CloneOptionTrait' {
17+
extension(class: 'hudson.plugins.git.extensions.impl.CloneOption') {
18+
shallow(false)
19+
noTag(false)
20+
reference()
21+
depth(0)
22+
honorRefspec(false)
23+
}
24+
}
25+
26+
traitBlock << 'jenkins.plugins.git.traits.BranchDiscoveryTrait' { }
27+
}
28+
29+
}

0 commit comments

Comments
 (0)