Skip to content

Commit

Permalink
Move previews into to root
Browse files Browse the repository at this point in the history
  • Loading branch information
steves committed Sep 27, 2022
1 parent 47cfeb7 commit 8e29027
Show file tree
Hide file tree
Showing 87 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion component_generator.thor
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ComponentGenerator < Thor::Group
end

def create_preview
template("templates/preview.tt", "test/previews/primer/#{status_path}#{underscore_name}_preview.rb")
template("templates/preview.tt", "previews/primer/#{status_path}#{underscore_name}_preview.rb")
end

def add_to_css_file
Expand Down
2 changes: 1 addition & 1 deletion demo/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Application < Rails::Application
config.view_component.default_preview_layout = "component_preview"
config.view_component.show_previews = true
config.view_component.preview_controller = "PreviewController"
config.view_component.preview_paths << Rails.root.join("../test/previews")
config.view_component.preview_paths << Rails.root.join("../previews")

config.autoload_paths << Rails.root.join("../test/forms")

Expand Down
2 changes: 1 addition & 1 deletion demo/kuby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
app/
package.json
yarn.lock
test/previews
previews
test/forms
]

Expand Down
8 changes: 4 additions & 4 deletions lib/tasks/docs.rake
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ namespace :docs do
task :preview do
registry = generate_yard_registry

FileUtils.rm_rf("test/previews/primer/docs/")
FileUtils.rm_rf("previews/primer/docs/")

components = Primer::Component.descendants

Expand All @@ -371,7 +371,7 @@ namespace :docs do

yard_example_tags = initialize_method.tags(:example)

path = Pathname.new("test/previews/docs/#{short_name.underscore}_preview.rb")
path = Pathname.new("previews/docs/#{short_name.underscore}_preview.rb")
path.dirname.mkdir unless path.dirname.exist?

File.open(path, "w") do |f|
Expand All @@ -383,7 +383,7 @@ namespace :docs do
method_name = name.split("|").first.downcase.parameterize.underscore
f.puts(" def #{method_name}; end")
f.puts unless index == yard_example_tags.size - 1
path = Pathname.new("test/previews/docs/#{short_name.underscore}_preview/#{method_name}.html.erb")
path = Pathname.new("previews/docs/#{short_name.underscore}_preview/#{method_name}.html.erb")
path.dirname.mkdir unless path.dirname.exist?
File.open(path, "w") do |view_file|
view_file.puts(code.to_s)
Expand Down Expand Up @@ -485,7 +485,7 @@ namespace :docs do
def preview_exists?(component)
path = component.name.underscore

File.exist?("test/previews/#{path}_preview.rb")
File.exist?("previews/#{path}_preview.rb")
end

def example_path(component)
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/test.rake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace :test do

t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/system/**/*_test.rb", "test/previews/**/*_test.rb"]
t.test_files = FileList["test/system/**/*_test.rb"]
end

Rake::TestTask.new(:bench) do |t|
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion primer_view_components.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
"public gem pushes."
end

spec.files = Dir["CHANGELOG.md", "LICENSE.txt", "README.md", "lib/**/*", "app/**/*", "static/**/*"]
spec.files = Dir["CHANGELOG.md", "LICENSE.txt", "README.md", "lib/**/*", "app/**/*", "static/**/*", "previews/**/*"]
spec.require_paths = ["lib"]

spec.add_runtime_dependency "actionview", ">= 5.0.0"
Expand Down
2 changes: 1 addition & 1 deletion test/previews/preview_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class PreviewTest < Minitest::Test
def setup
@previews = Dir.glob("test/previews/**/*.rb").reject { |f| f.include?("forms_preview.rb") || f.include?("/docs/") }
@previews = Dir.glob("previews/**/*.rb").reject { |f| f.include?("forms_preview.rb") || f.include?("/docs/") }
end

def test_previews_exist
Expand Down

0 comments on commit 8e29027

Please sign in to comment.