diff --git a/examples/demo/app.rb b/examples/demo/app.rb index 0d64866..966efe9 100644 --- a/examples/demo/app.rb +++ b/examples/demo/app.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'prubot' on 'test-event', 'say howdy' do diff --git a/examples/register/app.rb b/examples/register/app.rb index 0d64866..966efe9 100644 --- a/examples/register/app.rb +++ b/examples/register/app.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'prubot' on 'test-event', 'say howdy' do diff --git a/lib/prubot.rb b/lib/prubot.rb index 1d15b0f..ed2c3a7 100644 --- a/lib/prubot.rb +++ b/lib/prubot.rb @@ -37,7 +37,7 @@ def run! end def run? - $0 == 'app.rb' # HACK HACK HACK need to decide how we want to handle this. + $PROGRAM_NAME == 'app.rb' # HACK: HACK HACK need to decide how we want to handle this. end def register_event(name, event, action = nil, &block) @@ -56,8 +56,10 @@ def setup_routing end end + ## + # Prubot DSL module DSL - @@app = Prubot::Application.new + @@app = Prubot::Application.new # rubocop:disable Style/ClassVars ## # Supports both +on 'event' 'description' do...+ and +on 'action', 'event', 'description' do...+ @@ -70,7 +72,8 @@ def on(*args, &block) when 3 @@app.register_event(args[2], args[1], args[0], &block) else - raise Prubot::Error 'on supports either "on do..." or "on do..."' + raise Prubot::Error 'on supports either "on do..." or '\ + '"on do..."' end end @@ -78,4 +81,4 @@ def on(*args, &block) end end -extend Prubot::DSL +extend Prubot::DSL # rubocop:disable Style/MixinUsage diff --git a/lib/prubot/dispatcher.rb b/lib/prubot/dispatcher.rb index f1f9100..fb28532 100644 --- a/lib/prubot/dispatcher.rb +++ b/lib/prubot/dispatcher.rb @@ -23,7 +23,7 @@ def call(env) private - def register_app(request) + def register_app(_request) [200, { 'Content-Type' => 'text/html' }, ['howdy']] end @@ -35,7 +35,6 @@ def handle_event(request) generate_response event, action, result end - def skip_verify? @config.secret == false end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 690cd4a..5eb9267 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,7 +4,7 @@ require 'prubot' RSpec.configure do |config| - # HACK HACK HACK clean up environment after every test (sigh) + # HACK: HACK HACK clean up environment after every test (sigh) config.after { ENV.delete_if { |k, _v| k.start_with?('PRUBOT') } } # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = '.rspec_status'