Class: ShopifyCLI::Sed
- Inherits:
-
Object
- Object
- ShopifyCLI::Sed
- Defined in:
- lib/shopify_cli/sed.rb
Defined Under Namespace
Classes: SedError
Instance Method Summary collapse
Instance Method Details
#replace_inline(filename, pattern, output) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/shopify_cli/sed.rb', line 5 def replace_inline(filename, pattern, output) command = case CLI::Kit::System.os when :mac "sed -i ''" when :linux "sed -i" else raise "Unrecognized system!" end success = system("#{command} 's/#{pattern}/#{output}/' #{filename}") raise SedError unless success end |