-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from TruemarkDev/generator-for-avo
Generator for Avo
- Loading branch information
Showing
4 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
module Boring | ||
module Avo | ||
class InstallGenerator < Rails::Generators::Base | ||
desc 'Adds Avo to the application' | ||
|
||
def add_avo_gem | ||
say 'Adding Avo gem', :green | ||
|
||
Bundler.with_unbundled_env do | ||
run 'bundle add avo' | ||
end | ||
end | ||
|
||
def configure_avo | ||
say 'Setting up Avo', :green | ||
|
||
Bundler.with_unbundled_env do | ||
run 'bundle exec rails generate avo:install' | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# frozen_string-literal: true | ||
|
||
require 'test_helper' | ||
require 'generators/boring/avo/install/install_generator' | ||
|
||
class AvoInstallGeneratorTest < Rails::Generators::TestCase | ||
tests Boring::Avo::InstallGenerator | ||
setup :build_app | ||
teardown :teardown_app | ||
|
||
include GeneratorHelper | ||
|
||
def destination_root | ||
app_path | ||
end | ||
|
||
def test_should_configure_avo_gem | ||
Dir.chdir(app_path) do | ||
quietly { run_generator } | ||
|
||
assert_gem 'avo' | ||
|
||
assert_file 'config/initializers/avo.rb' do |content| | ||
assert_match(/Avo.configure do |config|/, content) | ||
assert_match(/config.root_path = '\/avo'/, content) | ||
end | ||
|
||
assert_file 'config/routes.rb' do |content| | ||
assert_match(/mount Avo::Engine, at: Avo.configuration.root_path/, content) | ||
end | ||
end | ||
end | ||
end |