diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..deec4bd --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tasks/release"] + path = tasks/release + url = https://github.com/aws/aws-sdk-ruby-release-tools.git diff --git a/CHANGELOG.md b/CHANGELOG.md index 96a2ef6..141bb2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ Unreleased Changes ------------------ +* Support implicitly convertible objects/duck-type values responding to `to_hash` and `to_ary`. + + [See related GitHub pull request #51](https://github.com/jmespath/jmespath.rb/pull/51). + 1.4.0 (2018-04-04) ------------------ diff --git a/tasks/changelog.rake b/tasks/changelog.rake deleted file mode 100644 index aa3afff..0000000 --- a/tasks/changelog.rake +++ /dev/null @@ -1,36 +0,0 @@ -task 'changelog:version' do - # replaces "Next Release (TBD)" in the CHANGELOG with a version and date - changelog = File.open('CHANGELOG.md', 'r', encoding: 'UTF-8') { |f| f.read } - changelog = changelog.lines - changelog[0] = "#{$VERSION} (#{Time.now.strftime('%Y-%m-%d')})\n" - changelog = changelog.join - File.open('CHANGELOG.md', 'w', encoding: 'UTF-8') { |f| f.write(changelog) } - sh("git add CHANGELOG.md") -end - -task 'changelog:next_release' do - # inserts a "Next Release (TDB)" section at the top of the CHANGELOG - lines = [] - lines << "Unreleased Changes\n" - lines << "------------------\n" - lines << "\n" - changelog = File.open('CHANGELOG.md', 'r', encoding: 'UTF-8') { |f| f.read } - changelog = lines.join + changelog - File.open('CHANGELOG.md', 'w', encoding: 'UTF-8') { |f| f.write(changelog) } - sh("git add CHANGELOG.md") - sh("git commit -m 'Added next release section to the changelog.'") -end - -task 'changelog:latest' do - # Returns the contents of the most recent CHANGELOG section - changelog = File.open('CHANGELOG.md', 'r', encoding: 'UTF-8') { |f| f.read } - lines = [] - changelog.lines[3..-1].each do |line| - if line.match(/^\d+\.\d+\.\d+/) - break - else - lines << line - end - end - puts lines[0..-2].join -end diff --git a/tasks/docs.rake b/tasks/docs.rake deleted file mode 100644 index 522ca2d..0000000 --- a/tasks/docs.rake +++ /dev/null @@ -1,14 +0,0 @@ -task 'docs:clobber' do - rm_rf ".yardoc" - rm_rf "docs" -end - -desc "Generates docs.zip" -task 'docs:zip' => :docs do - sh("zip -9 -r -q docs.zip docs/") -end - -desc "Generate the API documentation." -task :docs => ['docs:clobber'] do - sh({"SOURCE" => "1"}, "bundle exec yard") -end diff --git a/tasks/gem.rake b/tasks/gem.rake deleted file mode 100644 index 0c3129c..0000000 --- a/tasks/gem.rake +++ /dev/null @@ -1,8 +0,0 @@ -desc 'Builds the gem' -task 'gem:build' do - sh("gem build jmespath.gemspec") -end - -task 'gem:push' do - sh("gem push jmespath-#{$VERSION}.gem") -end diff --git a/tasks/github.rake b/tasks/github.rake deleted file mode 100644 index eaba366..0000000 --- a/tasks/github.rake +++ /dev/null @@ -1,29 +0,0 @@ -task 'github:require-access-token' do - unless $GITHUB_ACCESS_TOKEN - warn("you must export JMESPATH_GITHUB_ACCESS_TOKEN") - exit - end -end - -task 'github:release' do - require 'octokit' - - gh = Octokit::Client.new(access_token: $GITHUB_ACCESS_TOKEN) - - repo = 'trevorrowe/jmespath.rb' - tag_ref_sha = `git show-ref v#{$VERSION}`.split(' ').first - tag = gh.tag(repo, tag_ref_sha) - - release = gh.create_release(repo, "v#{$VERSION}", { - name: 'Release v' + $VERSION + ' - ' + tag.tagger.date.strftime('%Y-%m-%d'), - body: tag.message.lines[2..-1].join, - prerelease: $VERSION.match('rc') ? true : false, - }) - - gh.upload_asset(release.url, 'docs.zip', - :content_type => 'application/octet-stream') - - gh.upload_asset(release.url, "jmespath-#{$VERSION}.gem", - :content_type => 'application/octet-stream') - -end diff --git a/tasks/release b/tasks/release new file mode 160000 index 0000000..bcf3a74 --- /dev/null +++ b/tasks/release @@ -0,0 +1 @@ +Subproject commit bcf3a7470dd7b39af5a35a2e6ac99fc6587d1a00 diff --git a/tasks/release.rake b/tasks/release.rake deleted file mode 100644 index d3c1f61..0000000 --- a/tasks/release.rake +++ /dev/null @@ -1,42 +0,0 @@ -task 'release:require-version' do - unless ENV['VERSION'] - warn("usage: VERSION=x.y.z rake release") - exit - end -end - -task 'release:bump-version' do - sh("echo '#{$VERSION}' > VERSION") - path = 'lib/jmespath/version.rb' - file = File.read(path) - file = file.gsub(/VERSION = '.+?'/, "VERSION = '#{$VERSION}'") - File.open(path, 'w') { |f| f.write(file) } - sh("git add #{path}") - sh("git add VERSION") -end - -task 'release:stage' => [ - 'release:require-version', - 'github:require-access-token', - 'git:require-clean-workspace', - 'test:unit', - 'test:compliance', - 'changelog:version', - 'release:bump-version', - 'git:tag', - 'gem:build', - 'docs:zip', -] - -task 'release:publish' => [ - 'git:push', - 'gem:push', - 'github:release', -] - -task 'release:cleanup' => [ - 'changelog:next_release', -] - -desc "Public release" -task :release => ['release:stage', 'release:publish', 'release:cleanup']