-
-
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 #86 from TruemarkDev/generator-for-whenever
Added boring generator for Whenever gem with its minitest
- Loading branch information
Showing
6 changed files
with
56 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ | |
.byebug_history | ||
|
||
*.log | ||
.idea |
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 |
---|---|---|
|
@@ -144,3 +144,4 @@ DEPENDENCIES | |
|
||
BUNDLED WITH | ||
2.4.10 | ||
|
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
25 changes: 25 additions & 0 deletions
25
lib/generators/boring/whenever/install/install_generator.rb
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 Whenever | ||
class InstallGenerator < Rails::Generators::Base | ||
desc "Adds whenever gem to the application for managing cron jobs" | ||
|
||
def add_whenever_gem | ||
say "Adding whenever gem", :green | ||
|
||
Bundler.with_unbundled_env do | ||
run "bundle add whenever" | ||
end | ||
end | ||
|
||
def add_schedule_file | ||
say "Create schedule.rb file", :green | ||
|
||
Bundler.with_unbundled_env do | ||
run "bundle exec wheneverize ." | ||
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,26 @@ | ||
# frozen_string_literal: true | ||
|
||
require "test_helper" | ||
require "generators/boring/whenever/install/install_generator" | ||
|
||
class WheneverInstallGeneratorTest < Rails::Generators::TestCase | ||
tests Boring::Whenever::InstallGenerator | ||
setup :build_app | ||
teardown :teardown_app | ||
|
||
include GeneratorHelper | ||
include ActiveSupport::Testing::Isolation | ||
|
||
def destination_root | ||
app_path | ||
end | ||
|
||
def test_should_configure_whenever_gem | ||
Dir.chdir(app_path) do | ||
quietly { run_generator } | ||
|
||
assert_gem "whenever" | ||
assert_file "config/schedule.rb" | ||
end | ||
end | ||
end |