Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up rubocop offenses #522

Merged
merged 10 commits into from
Feb 21, 2019
104 changes: 0 additions & 104 deletions .rubocop_todo.yml

This file was deleted.

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
### Bugfixes

* Your contribution here!
* [#522](https://github.com/bootstrap-ruby/bootstrap_form/pull/522): Clean up rubocop offences - [@simmerz](https://github.com/simmerz)

## [4.1.0][] (2019-01-19)

Expand Down
10 changes: 5 additions & 5 deletions Dangerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ end
# Have you updated CHANGELOG.md?
# ------------------------------------------------------------------------------
if !has_changelog_changes && has_lib_changes
markdown <<-MARKDOWN
Here's an example of a CHANGELOG.md entry (place it immediately under the `* Your contribution here!` line):
markdown <<-MARKDOWN.strip_heredoc
Here's an example of a CHANGELOG.md entry (place it immediately under the `* Your contribution here!` line):

```markdown
* [##{pr_number}](#{pr_url}): #{github.pr_title} - [@#{github.pr_author}](https://github.com/#{github.pr_author}).
```
```markdown
* [##{pr_number}](#{pr_url}): #{github.pr_title} - [@#{github.pr_author}](https://github.com/#{github.pr_author}).
```
MARKDOWN
warn("Please update CHANGELOG.md with a description of your changes. "\
"If this PR is not a user-facing change (e.g. just refactoring), "\
Expand Down
6 changes: 2 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ task "release:rubygem_push" do
Rake.application.invoke_task("chandler:push")
end

desc 'Run RuboCop checks -- see .rubocop_todo.yml for outstanding offenses'
RuboCop::RakeTask.new(:rubocop) do |task|
task.options = %w[--config .rubocop_todo.yml]
end
desc 'Run RuboCop checks'
RuboCop::RakeTask.new(:rubocop)

task default: %i[test rubocop]
15 changes: 0 additions & 15 deletions bootstrap_deferred_builder_test.rb

This file was deleted.

141 changes: 0 additions & 141 deletions bootstrap_error_rendering_test.rb

This file was deleted.

26 changes: 16 additions & 10 deletions demo/app/helpers/bootstrap_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@ def form_with_source(&block)
form_html = capture(&block)

content_tag(:div, class: "example") do
codemirror = content_tag(:div, class: "code", style: "display: none") do
content_tag(:textarea, class: "codemirror") do
HtmlBeautifier.beautify(form_html.strip.gsub(">", ">\n").gsub("<", "\n<"))
end
end

toggle = content_tag(:button, class: "toggle btn btn-sm btn-info") do
"Show Source Code"
end

concat(form_html)
concat(toggle)
concat(codemirror)
end
end

lcreid marked this conversation as resolved.
Show resolved Hide resolved
private

def codemirror(form_html)
content_tag(:div, class: "code", style: "display: none") do
content_tag(:textarea, class: "codemirror") do
HtmlBeautifier.beautify(form_html.strip.gsub(">", ">\n").gsub("<", "\n<"))
end
end
end

def toggle
content_tag(:button, class: "toggle btn btn-sm btn-info") do
"Show Source Code"
end
end
end
5 changes: 2 additions & 3 deletions demo/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ module Dummy
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.

if config.respond_to?(:load_defaults)
config.load_defaults [Rails::VERSION::MAJOR, Rails::VERSION::MINOR].join(".")
end
config.respond_to?(:load_defaults) &&
config.load_defaults([Rails::VERSION::MAJOR, Rails::VERSION::MINOR].join("."))

config.secret_key_base = "ignore" if config.respond_to?(:secret_key_base)

Expand Down
2 changes: 1 addition & 1 deletion demo/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join("tmp/caching-dev.txt").exist?
if Rails.root.join("tmp", "caching-dev.txt").exist?
config.action_controller.perform_caching = true

config.cache_store = :memory_store
Expand Down
4 changes: 4 additions & 0 deletions lib/bootstrap_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ module BootstrapForm

eager_autoload do
autoload :FormBuilder
autoload :FormGroupBuilder
autoload :FormGroup
autoload :Components
autoload :Inputs
autoload :Helpers
end

def self.eager_load!
super
BootstrapForm::Components.eager_load!
BootstrapForm::Helpers.eager_load!
BootstrapForm::Inputs.eager_load!
end
Expand Down
17 changes: 17 additions & 0 deletions lib/bootstrap_form/components.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

module BootstrapForm
module Components
extend ActiveSupport::Autoload

autoload :Hints
autoload :Labels
autoload :Layout
autoload :Validation

include Hints
include Labels
include Layout
include Validation
end
end
Loading