Skip to content

Commit

Permalink
Rails::Previews -> RailsPreviews
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Barone committed Nov 26, 2024
1 parent d5d7c76 commit 840295f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Write [rails-previews](https://github.com/rangerscience/rails-previews) for your

```ruby
module Previews
class Example < Rails::Previews::Preview
class Example < RailsPreviews::Preview
def partial
render_partial "application/example", title: "Hello, World!"
end
Expand Down
6 changes: 3 additions & 3 deletions lib/generators/storybook/examples_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def create_example_partial_preview
create_file "spec/previews/example_partial.rb", <<~RUBY
# frozen_string_literal: true
module Previews
class ExamplePartial < Rails::Previews::Preview
class ExamplePartial < RailsPreviews::Preview
def default
render_partial "application/example", locals: { title: "Hello, World!" }
end
Expand Down Expand Up @@ -48,7 +48,7 @@ def create_example_view_component_preview
# frozen_string_literal: true
module Previews
class ExampleViewComponent < Rails::Previews::Preview
class ExampleViewComponent < RailsPreviews::Preview
def default
ExampleComponent.new(title: "Hello, World!")
end
Expand Down Expand Up @@ -129,7 +129,7 @@ def create_example_react_component_preview
# frozen_string_literal: true
module Previews
class ExampleReactComponent < Rails::Previews::Preview
class ExampleReactComponent < RailsPreviews::Preview
def default
render_react_on_rails "HelloWorld", props: { name: "Hello, World!" }
end
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/storybook/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def install_rack_cors
end

def mount_previews
insert_into_file "config/routes.rb", " mount Rails::Previews::Engine => \"/previews\"\n", after: "Rails.application.routes.draw do\n"
insert_into_file "config/routes.rb", " mount RailsPreviews::Engine => \"/previews\"\n", after: "Rails.application.routes.draw do\n"
end

def update_storybook
Expand Down
2 changes: 1 addition & 1 deletion lib/storybook/preview.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

module Rails::Previews
module RailsPreviews
# Re-open the class to add the Storybook methods
class Preview
class << self
Expand Down
2 changes: 1 addition & 1 deletion lib/storybook/tasks/stories.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace :storybook do
task stories: :environment do
stories_dir = "stories"
# TODO: Also needs to *remove* stale stories
Rails::Previews::Preview.all.map do |preview|
RailsPreviews::Preview.all.map do |preview|
filename = Rails.root.join("#{stories_dir}/#{preview.preview_name}.stories.json")
stories_json = JSON.pretty_generate(preview.to_csf)
File.open(filename, "w") { |f| f.write(stories_json) }
Expand Down

0 comments on commit 840295f

Please sign in to comment.