forked from interagent/pliny-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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 interagent#118 from interagent/brandur-pry
Add Pry support for Pliny
- Loading branch information
Showing
4 changed files
with
56 additions
and
5 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
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 |
---|---|---|
@@ -1,9 +1,31 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require "irb" | ||
require "irb/completion" | ||
require "bundler" | ||
Bundler.require | ||
require "./lib/initializer" | ||
|
||
IRB.start | ||
def basic_prompt(target_self, nest_level, pry) | ||
# override CONSOLE_BANNER to include something like a release identifier | ||
nesting = nest_level.zero? ? "" : ":#{nest_level}" | ||
"[#{pry.input_array.size}] #{console_prefix}(#{Pry.view_clip(target_self)})#{nesting}" | ||
end | ||
|
||
def console_prefix | ||
if Config.console_banner | ||
Config.console_banner | ||
elsif Config.rack_env == "production" | ||
"production" | ||
end | ||
end | ||
|
||
Pry.prompt = [ | ||
proc { |target_self, nest_level, pry| | ||
basic_prompt(target_self, nest_level, pry) + "> " | ||
}, | ||
|
||
proc { |target_self, nest_level, pry| | ||
basic_prompt(target_self, nest_level, pry) + "* " | ||
} | ||
] | ||
|
||
Pry.start |
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