Skip to content

Commit

Permalink
Merge pull request #481 from DannyBen/remove/inspect-args-in-production
Browse files Browse the repository at this point in the history
Avoid rendering `inspect_args()` when generating for production env
  • Loading branch information
DannyBen authored Dec 26, 2023
2 parents 6192a92 + 10899cf commit 8e5013b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/bashly/commands/generate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class Generate < Base
option '-e --env ENV', <<~HELP
Force the generation environment:
- production generate a smaller script, without file markers
- development generate with file markers
- development default script output
- production remove file marker comments and development functions
HELP

example 'bashly generate --force'
Expand Down
2 changes: 1 addition & 1 deletion lib/bashly/views/command/master_script.gtx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
= render :version_command
= render :usage
= render :normalize_input
= render :inspect_args
= render :inspect_args unless Settings.production?
= render :user_lib if user_lib.any?
= render :command_functions
= render :parse_requirements
Expand Down
4 changes: 2 additions & 2 deletions spec/approvals/cli/generate/help
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Options:
-e --env ENV
Force the generation environment:

- production generate a smaller script, without file markers
- development generate with file markers
- development default script output
- production remove file marker comments and development functions

-h --help
Show this help
Expand Down
3 changes: 2 additions & 1 deletion spec/bashly/commands/generate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@
before { Settings.env = :production }
after { Settings.env = nil }

it 'generates a script without view markers' do
it 'generates a script without view markers or inspect_args function' do
expect { subject.execute %w[generate] }.to output_approval('cli/generate/production-env-var')
expect(File).to exist(cli_script)
expect(cli_script_content).not_to include '# :'
expect(cli_script_content).not_to include 'inspect_args()'
end
end

Expand Down

0 comments on commit 8e5013b

Please sign in to comment.