Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

relish rake task #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
48 changes: 48 additions & 0 deletions lib/relish/rake/tasks.rb
@@ -0,0 +1,48 @@
require 'relish/command'
begin
require 'rake/dsl_definition'
rescue LoadError
end

module Relish
module Rake

# Usage (in Rakefile):
#
# require 'relish/rake/tasks'
# namespace :relish do
# Relish::Rake::PushTask.new(:push) do |t|
# t.project_name = 'gemname'
# t.version = Gemname::VERSION
# end
# end
#
class PushTask
include ::Rake::DSL if defined?(::Rake::DSL)

attr_accessor :project_name, :version

def initialize task_name=:relish_push
raise 'you should specify a block with configuration' unless block_given?

@task_name = task_name

yield self

define_task!
end

def define_task!
desc "Push #{project_name}:#{version} documentation to relishapp"
task @task_name do
begin
Relish::Command.run('versions:add', ["#{project_name}:#{version}"])
rescue SystemExit
# version exists
end
Relish::Command.run('push', ["#{project_name}:#{version}"])
end
end
end
end
end