Skip to content

Commit

Permalink
Avoids dublicated mount points.
Browse files Browse the repository at this point in the history
  • Loading branch information
LeFnord committed Aug 25, 2023
1 parent da99932 commit b8c54be
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions bin/grape-starter
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ command :add do |c|
builder_options = global_options.merge(set: set).merge(options)
created_files = Starter::Build.add!(resource, builder_options)

`bundle exec rubocop -a #{created_files.join(' ')}`
`bundle exec rubocop --only Layout -a #{created_files.join(' ')}`
$stdout.puts "added resource: #{resource}"
rescue => e
exit_now! e
Expand Down Expand Up @@ -108,7 +108,7 @@ command :import do |c|

created_files = Starter::Import.do_it!(path)

`bundle exec rubocop -a #{created_files.join(' ')}`
`bundle exec rubocop --only Layout -a #{created_files.join(' ')}`
end
end

Expand Down
2 changes: 0 additions & 2 deletions lib/starter/import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ class Import

class << self
def do_it!(path)
# your code comes here

spec = load_spec(path)
create_files_from(spec)
end
Expand Down
4 changes: 3 additions & 1 deletion lib/starter/shared/base_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ def add_mount_point

# adding mount point to base class
def add_to_base(file)
occurence = file.scan(/(\s+mount\s.*?\n)/).last.first
occurence = file.scan(/(\s+mount\s.*?\n)/).map(&:first).join
return if occurence.include?(@naming.mount_point.strip)

replacement = occurence + @naming.mount_point
file.sub!(occurence, replacement)
end
Expand Down

0 comments on commit b8c54be

Please sign in to comment.