Top Level Namespace
Defined Under Namespace
Modules: AvoCli
Instance Method Summary collapse
- #bundler_token ⇒ Object
- #change_in_file(file, regex, text_to_put_in_place) ⇒ Object
- #cmd ⇒ Object
- #colorize(text, color_code) ⇒ Object
- #gemspec ⇒ Object
- #gemspec_name ⇒ Object
- #gemspec_path ⇒ Object
- #green(text) ⇒ Object
- #red(text) ⇒ Object
- #say(text) ⇒ Object
- #version ⇒ Object
- #yell(text) ⇒ Object
- #yellow(text) ⇒ Object
Instance Method Details
#bundler_token ⇒ Object
50 51 52 |
# File 'lib/support.rb', line 50 def bundler_token @token ||= `bundle config get https://packager.dev/avo-hq`.match(/^.*: "(.*)"$/).captures.first end |
#change_in_file(file, regex, text_to_put_in_place) ⇒ Object
45 46 47 48 |
# File 'lib/support.rb', line 45 def change_in_file(file, regex, text_to_put_in_place) text = File.read file File.open(file, "w+") { |f| f << text.gsub(/#{regex}/, text_to_put_in_place) } end |
#cmd ⇒ Object
41 42 43 |
# File 'lib/support.rb', line 41 def cmd TTY::Command.new uuid: false end |
#colorize(text, color_code) ⇒ Object
9 10 11 |
# File 'lib/support.rb', line 9 def colorize(text, color_code) "#{color_code}#{text}\e[0m" end |
#gemspec ⇒ Object
29 30 31 |
# File 'lib/support.rb', line 29 def gemspec Gem::Specification.load(gemspec_path) end |
#gemspec_name ⇒ Object
37 38 39 |
# File 'lib/support.rb', line 37 def gemspec_name gemspec.name end |
#gemspec_path ⇒ Object
25 26 27 |
# File 'lib/support.rb', line 25 def gemspec_path Dir["#{Dir.pwd}/*.gemspec"].first end |
#green(text) ⇒ Object
21 22 23 |
# File 'lib/support.rb', line 21 def green(text) colorize(text, "\e[32m") end |
#red(text) ⇒ Object
17 18 19 |
# File 'lib/support.rb', line 17 def red(text) colorize(text, "\e[31m") end |
#say(text) ⇒ Object
1 2 3 |
# File 'lib/support.rb', line 1 def say(text) puts "=> #{yellow(text)}" end |
#version ⇒ Object
33 34 35 |
# File 'lib/support.rb', line 33 def version @version ||= gemspec.version.to_s end |
#yell(text) ⇒ Object
5 6 7 |
# File 'lib/support.rb', line 5 def yell(text) puts "=> #{red(text)}" end |
#yellow(text) ⇒ Object
13 14 15 |
# File 'lib/support.rb', line 13 def yellow(text) colorize(text, "\e[33m") end |