-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
63 lines (52 loc) · 1.88 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "open-uri"
### Configurables
files = {
Gemfile: 'https://gist.githubusercontent.com/erniebrodeur/5a5518f5051210f1828a0712bf623dc8/raw',
Rakefile: 'https://gist.githubusercontent.com/erniebrodeur/afc92b72158413aa1f85d8d1facd267a/raw',
Rubocop: 'https://gist.githubusercontent.com/erniebrodeur/f7f63996ef1e017aee9bf9d8e680a1df/raw',
Tasks: 'https://gist.githubusercontent.com/erniebrodeur/03573fecf4f274101c14f6802abdbe83/raw',
BinAdd: 'https://gist.githubusercontent.com/erniebrodeur/a815ee4d8bd9ccc54d91025a5543ebb8/raw',
VsCodeFormatter: 'https://gist.githubusercontent.com/erniebrodeur/b24d757c0c625d108019eaceff2234cc/raw'
}
# spec
RSpec::Core::RakeTask.new(:spec)
task default: :spec
# automagical updating
desc "updates for various bits of the development environment."
namespace :update do
desc "update everything (multitasked)"
multitask(all: %i[gemfile rakefile rubocop tasks vscode_formatter])
desc 'Update Gemfile from gist'
task :gemfile do
grab_file 'Gemfile', files[:Gemfile]
end
desc 'Update Rakefile from gist'
task :rakefile do
grab_file 'Rakefile', files[:Rakefile]
end
desc 'Update .rubocop.yml from gist'
task :rubocop do
grab_file '.rubocop.yml', files[:Rubocop]
end
desc 'Update .vscode/tasks.json from gist'
task :tasks do
mkdir_p '.vscode'
grab_file '.vscode/tasks.json', files[:Tasks]
end
desc 'Update vscode_formatter.rb in spec_helper'
task :vscode_formatter do
mkdir_p 'spec'
grab_file 'spec/vscode_formatter.rb', files[:VsCodeFormatter]
end
desc 'Add a new lib and spec file (binary)'
task :binadd do
mkdir_p 'bin'
grab_file 'bin/add', files[:BinAdd]
end
end
def grab_file(filename, uri)
File.write filename, OpenURI.open_uri(uri).read
puts "Updated #{filename} from: #{uri}"
end