Skip to content

Commit

Permalink
Support for release candidates in the version.json file; propagates u…
Browse files Browse the repository at this point in the history
…p through the version string everywhere: filenames, ZIP, source code
  • Loading branch information
Davis W. Frank committed Jun 16, 2011
1 parent 6b2e45e commit ae24e00
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 18 deletions.
8 changes: 4 additions & 4 deletions example/SpecRunner.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<head>
<title>Jasmine Spec Runner</title>

<link rel="shortcut icon" type="image/png" href="lib/jasmine-1.1.0/jasmine_favicon.png">
<link rel="shortcut icon" type="image/png" href="lib/jasmine-1.1.0.rc1/jasmine_favicon.png">

<link rel="stylesheet" type="text/css" href="lib/jasmine-1.1.0/jasmine.css">
<script type="text/javascript" src="lib/jasmine-1.1.0/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-1.1.0/jasmine-html.js"></script>
<link rel="stylesheet" type="text/css" href="lib/jasmine-1.1.0.rc1/jasmine.css">
<script type="text/javascript" src="lib/jasmine-1.1.0.rc1/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-1.1.0.rc1/jasmine-html.js"></script>

<!-- include source files here... -->
<script type="text/javascript" src="spec/SpecHelper.js"></script>
Expand Down
15 changes: 10 additions & 5 deletions lib/jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -735,12 +735,16 @@ jasmine.Env.prototype.version = function () {
* @returns string containing jasmine version build info, if set.
*/
jasmine.Env.prototype.versionString = function() {
if (jasmine.version_) {
var version = this.version();
return version.major + "." + version.minor + "." + version.build + " revision " + version.revision;
} else {
if (!jasmine.version_) {
return "version unknown";
}

var version = this.version();
var dotted_version = version.major + "." + version.minor + "." + version.build;
if (version.rc) {
dotted_version += ".rc" + version.rc;
}
return dotted_version + " revision " + version.revision;
};

/**
Expand Down Expand Up @@ -2467,5 +2471,6 @@ jasmine.version_= {
"major": 1,
"minor": 1,
"build": 0,
"revision": 1308154429
"revision": 1308187385,
"rc": 1
}
12 changes: 8 additions & 4 deletions src/core/Env.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@ jasmine.Env.prototype.version = function () {
* @returns string containing jasmine version build info, if set.
*/
jasmine.Env.prototype.versionString = function() {
if (jasmine.version_) {
var version = this.version();
return version.major + "." + version.minor + "." + version.build + " revision " + version.revision;
} else {
if (!jasmine.version_) {
return "version unknown";
}

var version = this.version();
var dotted_version = version.major + "." + version.minor + "." + version.build;
if (version.rc) {
dotted_version += ".rc" + version.rc;
}
return dotted_version + " revision " + version.revision;
};

/**
Expand Down
4 changes: 2 additions & 2 deletions src/templates/version.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ jasmine.version_= {
"major": <%= major %>,
"minor": <%= minor %>,
"build": <%= build %>,
"revision": <%= revision %>
}
"revision": <%= revision %><%= %Q{,\n "rc": #{rc}} if rc %>
};
3 changes: 2 additions & 1 deletion src/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ jasmine.version_= {
"major": 1,
"minor": 1,
"build": 0,
"revision": 1308154429
"revision": 1308187385,
"rc": 1
}
3 changes: 2 additions & 1 deletion src/version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"major": 1,
"minor": 1,
"build": 0
"build": 0,
"rc": 1
}
1 change: 1 addition & 0 deletions tasks/build_dist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def concat_into(output_file, &block)
scope = OpenStruct.new(:major => version_hash["major"],
:minor => version_hash["minor"],
:build => version_hash["build"],
:rc => version_hash["rc"],
:revision => Time.now.to_i)

File.open('src/version.js', 'w+') do |f|
Expand Down
4 changes: 3 additions & 1 deletion tasks/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ def console_specfiles
end

def version_string
"#{version_hash['major']}.#{version_hash['minor']}.#{version_hash['build']}"
version = "#{version_hash['major']}.#{version_hash['minor']}.#{version_hash['build']}"
version += ".rc#{version_hash['rc']}" if version_hash['rc']
version
end

def version_hash
Expand Down

0 comments on commit ae24e00

Please sign in to comment.