forked from datocms/ruby-datocms-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
44 lines (37 loc) · 999 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'open-uri'
require_relative './build/build_client'
RSpec::Core::RakeTask.new(:spec)
task default: :spec
desc 'Regenerates the client starting from the JSON Hyperschema'
task :regenerate do
BuildClient.new(
open('https://site-api.datocms.com/docs/site-api-hyperschema.json').read,
'site',
%w(session item user#update)
).build
BuildClient.new(
open('https://site-api.datocms.com/docs/account-api-hyperschema.json').read,
'account',
%w(
session
account#create account#reset_password
subscription
portal_session
)
).build
end
desc 'Open an irb (or pry) session preloaded with this gem'
task :console do
begin
require 'pry'
gem_name = File.basename(Dir.pwd)
sh %(pry -I lib -r #{gem_name}.rb)
rescue LoadError => _
sh %(irb -rubygems -I lib -r #{gem_name}.rb)
end
end
require 'rubocop/rake_task'
RuboCop::RakeTask.new