Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove allure-ruby gemspec, update rake version task #90

Merged
merged 6 commits into from
Feb 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name-template: '$NEXT_MINOR_VERSION'
tag-template: '$NEXT_MINOR_VERSION'
name-template: '$NEXT_PATCH_VERSION'
tag-template: '$NEXT_PATCH_VERSION'
categories:
- title: '🚀 New Features'
label: 'type:new feature'
Expand Down
23 changes: 22 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,25 @@

source "https://rubygems.org"

gemspec
gem "bundler", "~> 2.1.2"

gem "allure-cucumber", path: "allure-cucumber"
gem "allure-rspec", path: "allure-rspec"
gem "allure-ruby-commons", path: "allure-ruby-commons"

group :development do
gem "colorize", "~> 0.8.1"
gem "lefthook", "~> 0.7.0"
gem "pry", "~> 0.12.2"
gem "rake", "~> 13.0.1"
gem "semantic", "~> 1.6.1"
gem "solargraph", "~> 0.38.5"
end

group :test do
gem "rspec", "~> 3.9.0"
gem "rubocop", "~> 0.80.0"
gem "rubocop-performance", "~> 1.5.2"
gem "simplecov", "~> 0.17.1"
gem "simplecov-console", "~> 0.6.0"
end
18 changes: 12 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
PATH
remote: .
remote: allure-cucumber
specs:
allure-cucumber (2.13.4)
allure-ruby-commons (= 2.13.4)
cucumber (~> 3.1)

PATH
remote: allure-rspec
specs:
allure-rspec (2.13.4)
allure-ruby-commons (= 2.13.4)
rspec-core (~> 3.8)
ruby2_keywords (~> 0.0.2)
allure-ruby (2.13.4)
allure-cucumber (= 2.13.4)
allure-rspec (= 2.13.4)
allure-ruby-commons (= 2.13.4)

PATH
remote: allure-ruby-commons
specs:
allure-ruby-commons (2.13.4)
json (>= 1.8, < 3)
mime-types (~> 3.3)
Expand Down Expand Up @@ -139,7 +143,9 @@ PLATFORMS
ruby

DEPENDENCIES
allure-ruby!
allure-cucumber!
allure-rspec!
allure-ruby-commons!
bundler (~> 2.1.2)
colorize (~> 0.8.1)
lefthook (~> 0.7.0)
Expand Down
35 changes: 0 additions & 35 deletions allure.gemspec

This file was deleted.

44 changes: 44 additions & 0 deletions lib/task_helpers/release_util.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# frozen_string_literal: true

require "semantic"

require_relative "util"

class VersionUpdater
extend TaskUtil
extend Rake::DSL

class << self
def update(increment, push)
@version = Semantic::Version.new(File.read("#{root}/ALLURE_VERSION").strip)
@new_version = @version.increment!(increment || "patch")

update_allure_version
update_lock
commit
push_to_origin if push
end

private

def update_allure_version
File.write("#{root}/ALLURE_VERSION", @new_version, mode: "w")
end

def update_lock
lockfile = "#{root}/Gemfile.lock"
File.write(lockfile, File.read(lockfile).gsub(/#{@version}/, @new_version.to_s), mode: "w")
end

def commit
puts "Updating version to #{@new_version}".yellow
sh("git commit ALLURE_VERSION Gemfile.lock -m 'Update allure to v#{@new_version}'")
sh("git tag #{@new_version}")
end

def push_to_origin
puts "Pushing changes to repository".yellow
sh("git push origin HEAD && git push origin #{@new_version}")
end
end
end
6 changes: 0 additions & 6 deletions lib/task_helpers/util.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# frozen_string_literal: true

require "colorize"
require "rake"
require "semantic"

module TaskUtil
def root
Expand All @@ -12,8 +10,4 @@ def root
def adaptors
@adaptors ||= Dir.glob("allure-*").select { |f| File.directory?(f) }
end

def version
Semantic::Version.new(File.read("#{root}/ALLURE_VERSION").strip)
end
end
21 changes: 5 additions & 16 deletions lib/tasks/release.rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# frozen_string_literal: true

require_relative "../task_helpers/util"
require "rake"

require_relative "../task_helpers/util.rb"
require_relative "../task_helpers/release_util.rb"

class ReleaseTasks
include Rake::DSL
Expand All @@ -19,10 +22,7 @@ class ReleaseTasks
def add_version_bump_task
desc "Update allure version"
task :version, [:increment, :push] do |_task, args|
File.write("#{root}/ALLURE_VERSION", version.increment!(args[:increment] || "patch"), mode: "w")

commit
push if args[:push]
VersionUpdater.update(args[:increment], args[:push])
end
end

Expand Down Expand Up @@ -59,17 +59,6 @@ class ReleaseTasks
task release: adaptors.map { |adaptor| "#{adaptor}:release" }
end
end

def commit
puts "Updating version to #{version}".yellow
sh("git commit ALLURE_VERSION -m 'Update allure to v#{version}'")
sh("git tag #{version}")
end

def push
puts "Pushing changes to repository".yellow
sh("git push origin HEAD && git push origin #{version}")
end
end

ReleaseTasks.new