Skip to content

Commit f2f2b45

Browse files
authored
Merge pull request #347 from wasabigeek/skip-patch
Add env var to skip patching
2 parents ec33b0b + 54f457b commit f2f2b45

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,9 @@ The broad steps are:
8989
##### Resolving Patch Errors
9090
9191
The auto-generated method files may drift overtime e.g. new arguments may be added or descriptions changed. Since previous patches were based on the older auto-generated files, git may be unable to apply them to the new files. Resolving them requires some good ol' splicing:
92-
1. Comment out the patching code in `lib/tasks/web.rake`:
93-
```ruby
94-
# Dir.glob("lib/slack/web/api/patches/#{group}*.patch").sort.each do |patch|
95-
# puts "- patching #{patch}"
96-
# system("git apply #{patch}") || raise('failed to apply patch')
97-
# end
98-
```
99-
2. Run `rake slack:api:update` to create the raw auto-generated files. Commit the files that you are updating, so we can run `git diff` later.
100-
3. Go through the old patches for the files (e.g. in `lib/slack/web/api/patches/chat.1.patch`), copying code into the new files.
101-
4. Continue with Step 2 [above](#patching-slack-web-api).
92+
1. Run `rake slack:api:update SKIP_PATCH=true` to create the raw auto-generated files. Commit the files that you are updating, so we can run `git diff` later.
93+
2. Go through the old patches for the files (e.g. in `lib/slack/web/api/patches/chat.1.patch`), copying code into the new files.
94+
3. Continue with Step 2 [above](#patching-slack-web-api).
10295
10396
10497
### Write Documentation

lib/tasks/web.rake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,14 @@ namespace :slack do
5151
rendered_method_spec = method_spec_template.result(group: group, names: names)
5252
File.write "spec/slack/web/api/endpoints/#{snaked_group}_spec.rb", rendered_method_spec
5353
end
54-
Dir.glob("lib/slack/web/api/patches/#{group}*.patch").sort.each do |patch|
55-
puts "- patching #{patch}"
56-
system("git apply #{patch}") || raise('failed to apply patch')
54+
55+
unless ENV.key?('SKIP_PATCH')
56+
Dir.glob("lib/slack/web/api/patches/#{group}*.patch").sort.each do |patch|
57+
puts "- patching #{patch}"
58+
system("git apply #{patch}") || raise('failed to apply patch')
59+
end
5760
end
61+
5862
# command
5963
raise "Missing group #{group}" unless groups.key?(group)
6064

0 commit comments

Comments
 (0)