Skip to content

Commit

Permalink
style: apply rubocop fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gildesmarais committed Aug 16, 2024
1 parent 00f958c commit fb79e7f
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion lib/html2rss/generator/channel_question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'faraday'

require_relative './question'
require_relative 'question'

module Html2rss
module Generator
Expand Down
6 changes: 3 additions & 3 deletions lib/html2rss/generator/collector.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

require_relative './channel_question'
require_relative './items_selector_question'
require_relative './selector_question'
require_relative 'channel_question'
require_relative 'items_selector_question'
require_relative 'selector_question'

module Html2rss
module Generator
Expand Down
42 changes: 21 additions & 21 deletions lib/html2rss/generator/file_create_question.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require 'fileutils'
require_relative './files_and_paths'
require_relative 'files_and_paths'

module Html2rss
module Generator
Expand All @@ -19,6 +19,26 @@ class FileCreateQuestion

attr_reader :prompt, :feed_config, :channel_url

def self.print_files(relative_yml_path, relative_spec_path)
PrintHelper.markdown <<~MARKDOWN
Created YAML file at:
`#{relative_yml_path}`
Created spec file at:
`#{relative_spec_path}`
Use this config to generate RSS with:
`bundle exec html2rss feed #{relative_yml_path}`
MARKDOWN
end

def self.create_file(file_path, content)
raise 'file exists already' if File.exist? file_path

FileUtils.mkdir_p File.dirname(file_path)
File.write(file_path, content)
end

def initialize(prompt, state, **_options)
@prompt = prompt
@state = state
Expand All @@ -40,26 +60,6 @@ def ask
create(fps)
end

def self.print_files(relative_yml_path, relative_spec_path)
PrintHelper.markdown <<~MARKDOWN
Created YAML file at:
`#{relative_yml_path}`
Created spec file at:
`#{relative_spec_path}`
Use this config to generate RSS with:
`bundle exec html2rss feed #{relative_yml_path}`
MARKDOWN
end

def self.create_file(file_path, content)
raise 'file exists already' if File.exist? file_path

FileUtils.mkdir_p File.dirname(file_path)
File.write(file_path, content)
end

private

def print_feed_config
Expand Down
12 changes: 6 additions & 6 deletions lib/html2rss/generator/files_and_paths.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ module Generator
class FilesAndPaths
attr_reader :config_name, :config_dir

##
# @return [String]
def self.gem_root
File.expand_path(File.join(__dir__, '../../../..'))
end

def initialize(config_name, config_dir)
raise 'config_name is required' if config_name.to_s == ''
raise 'config_dir is required' if config_dir.to_s == ''
Expand All @@ -15,12 +21,6 @@ def initialize(config_name, config_dir)
@config_dir = config_dir
end

##
# @return [String]
def self.gem_root
File.expand_path(File.join(__dir__, '../../../..'))
end

##
# @return [String]
def yml_dir
Expand Down
2 changes: 1 addition & 1 deletion lib/html2rss/generator/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require 'nokogiri'
require 'yaml'

require_relative './print_helper'
require_relative 'print_helper'

module Html2rss
module Generator
Expand Down
2 changes: 1 addition & 1 deletion lib/html2rss/generator/items_selector_question.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative './selector_question'
require_relative 'selector_question'

module Html2rss
module Generator
Expand Down
8 changes: 4 additions & 4 deletions lib/html2rss/generator/question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ module Generator
class Question
attr_reader :state, :prompt_options, :prompt

def self.validate(input:, **_opts)
input.to_s != ''
end

def initialize(prompt, state, **options)
@prompt = prompt
@state = state
Expand All @@ -28,10 +32,6 @@ def ask
state.store(path, processed_input) if path
end

def self.validate(input:, **_opts)
input.to_s != ''
end

private

def process(input)
Expand Down
4 changes: 2 additions & 2 deletions lib/html2rss/generator/selector_question.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require_relative './question'
require_relative './item_extractor_question'
require_relative 'question'
require_relative 'item_extractor_question'

module Html2rss
module Generator
Expand Down

0 comments on commit fb79e7f

Please sign in to comment.