Sha256: 00cf8736d8c989295468debc8ba6c001f90d0b647cf97e91d21a2307c1bc71d1

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true
require 'rake/testtask'

task default: :spec

namespace :credentials do
  require 'yaml'

  desc 'generate YOUTUBE_API_KEY to STDOUT'
  task :get_youtube_api_key do
    credentials = YAML.load(File.read('config/credentials.yml'))
    require_relative 'lib/YPBT/youtube_api'
    ENV['YOUTUBE_API_KEY'] = credentials[:YOUTUBE_API_KEY]

    puts "YOUTUBE_API_KEY: #{YoutubeVideo::YtApi.api_key}"
  end

  desc 'Export sample credentials from file to bash'
  task :export do
    credentials = YAML.load(File.read('config/credentials.yml'))
    puts 'Please run the following in bash:'
    puts "export YOUTUBE_API_KEY=#{credentials[:YOUTUBE_API_KEY]}"
  end
end

desc 'run tests'
Rake::TestTask.new(:spec) do |t|
  t.pattern = 'spec/*_spec.rb'
  t.warning = false
end

desc 'delete cassette fixtures'
task :wipe do
  sh 'rm spec/fixtures/cassettes/*.yml' do |ok, _|
    puts(ok ? 'Cassettes deleted' : 'No casseettes found')
  end
end

desc 'quality checks'

namespace :quality do
  desc 'run all quality checks'
  task all: [:rubocop, :flog, :flay]

  task :rubocop do
    sh 'rubocop'
  end

  task :flog do
    sh 'flog lib/*.rb'
    sh 'flog spec/*.rb'
  end

  task :flay do
    sh 'flay lib/*.rb'
    sh 'flay spec/*.rb'
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
YPBT-0.2.9 Rakefile
YPBT-0.2.8 Rakefile
YPBT-0.2.6 Rakefile
YPBT-0.2.5 Rakefile