Skip to content

Commit cfb4a3c

Browse files
committed
Extract unreleased changes to their own file
Now the Changelog file is completely generated.
1 parent 171a6e4 commit cfb4a3c

File tree

4 files changed

+158
-30
lines changed

4 files changed

+158
-30
lines changed

CHANGELOG.md

+8-9
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@ Changes are grouped as follows:
1111
- **Fixed** for any bug fixes.
1212
- **Security** to invite users to upgrade in case of vulnerabilities.
1313

14+
15+
16+
17+
18+
## [Unreleased](https://github.com/opal/opal/compare/v0.11.4...HEAD) - unreleased
19+
20+
1421
<!--
1522
Whitespace conventions:
1623
- 4 spaces before ## titles
1724
- 2 spaces before ### titles
1825
- 1 spaces before normal text
19-
-->
20-
21-
22-
23-
24-
## [1.0.0] - Unreleased
26+
-->
2527

2628
### Added
2729

@@ -111,9 +113,6 @@ Whitespace conventions:
111113
- `Kernel#exit` was using status 0 when a number or a generic object was provided, now accepts numbers and tries to convert objects with `#to_int` (#1898).
112114

113115

114-
<!-- generated-content-beyond-this-comment -->
115-
116-
117116

118117

119118
## [0.11.4](https://github.com/opal/opal/compare/v0.11.3...v0.11.4) - 2018-11-07

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ What follows is a quick checklist you can before sending issues or pull-requests
3333

3434
3. Make sure to have updated all the relevant documentation, both for API (using _yardoc_ syntax) and the Guides
3535

36-
4. Add a Changelog entry at the top of `CHANGELOG.md`
36+
4. Add a Changelog entry at the top of `UNRELEASED.md`
3737

3838

3939
### A note on commits in PRs

UNRELEASED.md

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<!--
2+
Whitespace conventions:
3+
- 4 spaces before ## titles
4+
- 2 spaces before ### titles
5+
- 1 spaces before normal text
6+
-->
7+
8+
### Added
9+
10+
- Added `Date#to_n` that returns the JavaScript Date object (in native.rb). (#1779)
11+
- Added `Array#pack` (supports only `C, S, L, Q, c, s, l, q, A, a` formats). (#1723)
12+
- Added `String#unpack` (supports only `C, S, L, Q, S>, L>, Q>, c, s, l, q, n, N, v, V, U, w, A, a, Z, B, b, H, h, u, M, m` formats). (#1723)
13+
- Added `File#symlink?` for Node.js. (#1725)
14+
- Added `Dir#glob` for Node.js (does not support flags). (#1727)
15+
- Added support for a static folder in the "server" CLI runner via the `OPAL_CLI_RUNNERS_SERVER_STATIC_FOLDER` env var
16+
- Added the CLI option `--runner-options` that allows passing arbitrary options to the selected runner, currently the only runner making use of them is `server` accepting `port` and `static_folder`
17+
- Added a short helper to navigate constants manually: E.g. `Opal.$$.Regexp.$$.IGNORECASE` (see docs for "Compiled Ruby")
18+
- Added initial support for OpenURI module (using XMLHttpRequest on browser and [xmlhttprequest](https://www.npmjs.com/package/xmlhttprequest) on Node). (#1735)
19+
- Added `String#prepend` to the list of unsupported methods (because String are immutable in JavaScript)
20+
- Added 2.4/2.5 methods (#1757):
21+
* `Array#prepend`
22+
* `Array#append`
23+
* `Array#max`
24+
* `Array#min`
25+
* `Complex#finite?`
26+
* `Complex#infinite?`
27+
* `Complex#infinite?`
28+
* `Date#to_time`
29+
* `Hash#slice`
30+
* `Hash#transform_keys`
31+
* `Hash#transform_keys!`
32+
* `Numeric#finite?`
33+
* `Numeric#infinite?`
34+
* `Numeric#infinite?`
35+
* `Integer#allbits?`
36+
* `Integer#anybits?`
37+
* `Integer#digits`
38+
* `Integer#nobits?`
39+
* `Integer#pow`
40+
* `Integer#remainder`
41+
* `Integer.sqrt`
42+
* `Random.urandom`
43+
* `String#delete_prefix`
44+
* `String#delete_suffix`
45+
* `String#casecmp?`
46+
* `Kernel#yield_self`
47+
* `String#unpack1`
48+
- Added support of the `pattern` argument for `Enumerable#all?`, `Enumerable#any?`, `Enumerable#none?`. (#1757)
49+
- Added `ndigits` option support to `Number#floor`, `Number#ceil`, `Number#truncate`. (#1757)
50+
- Added `key` and `receiver` attributes to the `KeyError`. (#1757)
51+
- Extended `Struct.new` to support `keyword_init` option. (#1757)
52+
- Added a new `Opal::Config.missing_require_severity` option and relative `--missing-require` CLI flag. This option will command how the builder will behave when a required file is missing. Previously the behavior was undefined and partly controlled by `dynamic_require_severity`. Not to be confused with the runtime config option `Opal.config.missing_require_severity;` which controls the runtime behavior.
53+
- Added `Matrix` (along with the internal MRI utility `E2MM`)
54+
- Use shorter helpers for constant lookups, `$$` for relative (nesting) lookups and `$$$` for absolute (qualified) lookups
55+
- Add support for the Mersenne Twister random generator, the same used by CRuby/MRI (#657 & #1891)
56+
57+
58+
### Changed
59+
60+
- **BREAKING** The dot (`.`) character is no longer replaced with [\s\S] in a multiline regexp passed to Regexp#match and Regexp#match?
61+
* You're advised to always use [\s\S] instead of . in a multiline regexp, which is portable between Ruby and JavaScript
62+
- The internal API for CLI runners has changed, now it's just a callable object
63+
- The `--map` CLI option now works only in conjunction with `--compile` (or `--runner compiler`)
64+
- The `node` CLI runner now adds its `NODE_PATH` entry instead of replacing the ENV var altogether
65+
- Added `--disable-web-security` option flag to the Chrome headless runner to be able to do `XMLHttpRequest`
66+
- Migrated parser to 2.5. Bump RUBY_VERSION to 2.5.0.
67+
- Exceptions raised during the compilation now add to the backtrace the current location of the opal file if available (#1814).
68+
69+
70+
### Deprecated
71+
72+
- The CLI `--server-port 1234` option is now deprecated in favor of using `--runner-options='{"port": 1234}'`
73+
- Including `::Native` is now deprecated because it generates conflicts with core classes in constant lookups (both `Native::Object` and `Native::Array` exist). Instead `Native::Werapper` should be used.
74+
- Using `node_require 'my_module'` to access the native `require()` function in Node.js is deprecated in favor of <code>\`require('my_module')\`</code> because static builders need to parse the call in order to function (#1886).
75+
76+
77+
### Removed
78+
79+
- The `node` CLI runner no longer supports passing extra node options via the `NODE_OPT` env var, instead Node.js natively supports the `NODE_OPTIONS` env var.
80+
- The gem "hike" is no longer an external dependency and is now an internal dependency available as `Opal::Hike`
81+
82+
83+
### Fixed
84+
85+
- Fix handling of trailing semicolons and JavaScript returns inside x-strings, the behavior is now well defined and covered by proper specs (#1776)
86+
- Fixed singleton method definition to return method name. (#1757)
87+
- Allow passing number of months to `Date#next_month` and `Date#prev_month`. (#1757)
88+
- Fixed `pattern` argument handling for `Enumerable#grep` and `Enumerable#grep_v`. (#1757)
89+
- Raise `ArgumentError` instead of `TypeError` from `Numeric#step` when step is not a number. (#1757)
90+
- At run-time `LoadError` wasn't being raised even with `Opal.config.missing_require_severity;` set to `'error'`.
91+
- Fixed `Kernel#public_methods` to return instance methods if the argument is set to false.
92+
- Fixed an issue in `String#gsub` that made it start an infinite loop when used recursively. (#1879)
93+
- `Kernel#exit` was using status 0 when a number or a generic object was provided, now accepts numbers and tries to convert objects with `#to_int` (#1898).

tasks/releasing.rake

+56-20
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,79 @@
1+
# frozen_string_literal: true
2+
13
require 'bundler'
24
Bundler.require
35
Bundler::GemHelper.install_tasks
46

57
# Let the release process update the changelog from github
68
task :release => :changelog
79

8-
desc "Update CHANGELOG.md usign info from published GitHub releases (the first unreleased section is preserved)"
9-
task :changelog do
10-
changelog_path = "#{__dir__}/../CHANGELOG.md"
11-
splitter = '<!-- generated-content-beyond-this-comment -->'
12-
changelog_entries = []
13-
10+
github_releases = -> do
1411
require 'date'
1512
require 'octokit'
1613
Octokit.auto_paginate = true
1714

18-
releases = Octokit.releases('opal/opal').sort_by do |r|
15+
Octokit.releases('opal/opal').sort_by do |r|
1916
Gem::Version.new(r[:tag_name][1..-1])
2017
end.select do |release|
2118
release[:tag_name] =~ /^v(\d+)(\.\d+)*$/
2219
end
20+
end
21+
22+
changelog_entry = -> (
23+
tag_name:,
24+
release_date:,
25+
previous_tag_name:,
26+
body:
27+
) do
28+
compare_url = "https://github.com/opal/opal/compare/#{previous_tag_name}...#{tag_name}"
29+
version_name = tag_name == 'HEAD' ? 'Unreleased' : tag_name.sub(/^v/, '')
30+
[
31+
"## [#{version_name}](#{compare_url}) - #{release_date}\n\n\n",
32+
body.gsub("\r\n", "\n").strip,
33+
].join('')
34+
end
2335

36+
CHANGELOG_HEADING = <<~MARKDOWN
37+
# Change Log
38+
39+
All notable changes to this project will be documented in this file.
40+
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
41+
42+
Changes are grouped as follows:
43+
- **Added** for new features.
44+
- **Changed** for changes in existing functionality.
45+
- **Deprecated** for once-stable features removed in upcoming releases.
46+
- **Removed** for deprecated features removed in this release.
47+
- **Fixed** for any bug fixes.
48+
- **Security** to invite users to upgrade in case of vulnerabilities.
49+
MARKDOWN
50+
51+
desc "Update CHANGELOG.md usign info from published GitHub releases (the first unreleased section is preserved)"
52+
task :changelog do
53+
changelog_path = "#{__dir__}/../CHANGELOG.md"
54+
unreleased_path = "#{__dir__}/../UNRELEASED.md"
55+
changelog_entries = []
2456
previous_tag_name = '000000'
25-
releases.each do |release|
26-
tag_name = release[:tag_name]
27-
release_date = release[:created_at].to_date.iso8601 # YYYY-MM-DD
28-
compare_url = "https://github.com/opal/opal/compare/#{previous_tag_name}...#{tag_name}"
29-
changelog_entry = [
30-
"## [#{tag_name[1..-1]}](#{compare_url}) - #{release_date}\n\n\n",
31-
release[:body].gsub("\r\n", "\n").strip,
32-
].join('')
33-
34-
changelog_entries.unshift changelog_entry
35-
previous_tag_name = tag_name
57+
58+
github_releases.call.each do |release|
59+
changelog_entries.unshift changelog_entry.call(
60+
tag_name: release[:tag_name],
61+
release_date: release[:created_at].to_date.iso8601, # YYYY-MM-DD
62+
previous_tag_name: previous_tag_name,
63+
body: release[:body],
64+
)
65+
previous_tag_name = release[:tag_name]
3666
end
3767

38-
heading_and_unreleased = File.read(changelog_path).split(splitter, 2).first.strip
68+
changelog_entries.unshift changelog_entry.call(
69+
tag_name: 'HEAD',
70+
release_date: 'unreleased',
71+
previous_tag_name: previous_tag_name,
72+
body: File.read(unreleased_path),
73+
)
74+
75+
changelog_entries.unshift CHANGELOG_HEADING
3976

40-
changelog_entries.unshift heading_and_unreleased+"\n\n\n"+splitter
4177
changelog_entries << nil # for the final newlines
4278

4379
File.write changelog_path, changelog_entries.join("\n\n\n\n\n")

0 commit comments

Comments
 (0)