app_up 0.0.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eef6f3f77e220c881a1ee5b8e4807976c6915a9c
4
- data.tar.gz: 1fecafff7c0e6c14a60cc29f3097c8dcbe4a3fd7
3
+ metadata.gz: f6264df18b90b7334a402f1014f216dff432adcf
4
+ data.tar.gz: 8fe5a3b5832b6b28dc25e2e5603da299de8108e1
5
5
  SHA512:
6
- metadata.gz: 200f718b10203e5b2db99ee188b2394d9e9acf4657d1792b346bf6efceda300753242458591bd0e60340cce68fea7859a2b134a4a7ff4209ee6f4945832547e8
7
- data.tar.gz: 2f2abe122a1cfbe867010adcca4703a1a9a2f93b69fe11b9db73c3aa5b98f27b804bdf4daadf2e38b20458412dc712f5607be9362fa5f6e275e361fc9de56250
6
+ metadata.gz: 746d761c3b042190eae0047be9d768df94e0347d07e4ac1afc84a4c74b4672ec3cee10bee1f95d7b8d04178b9a90fb13b5b2b9e8e25f91838ef17482ba6592ae
7
+ data.tar.gz: 79bef96bf3eb9f891298604e4c5044f68cb1115b3d12cc8dc9a15b38f8320eabb41ac2fca49b52d78e69a958707fd1f2da213f39dc016d817de3be2ac936f1a9
data/.gitignore CHANGED
@@ -13,3 +13,4 @@
13
13
  *.a
14
14
  mkmf.log
15
15
  *.gem
16
+ notes.txt
data/Gemfile CHANGED
@@ -5,6 +5,9 @@ gemspec
5
5
 
6
6
  gem 'minitest'
7
7
  gem 'pry'
8
+ gem 'pry-byebug'
9
+ gem 'pry-rescue'
10
+ gem 'pry-stack_explorer'
8
11
  gem 'mocha'
9
12
 
10
13
  ruby '2.1.5'
data/README.md CHANGED
@@ -1,31 +1,2 @@
1
- # GitUp
2
-
3
- TODO: Write a gem description
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'app_up'
11
- ```
12
-
13
- And then execute:
14
-
15
- $ bundle
16
-
17
- Or install it yourself as:
18
-
19
- $ gem install git_up
20
-
21
- ## Usage
22
-
23
- TODO: Write usage instructions here
24
-
25
- ## Contributing
26
-
27
- 1. Fork it ( https://github.com/[my-github-username]/git_up/fork )
28
- 2. Create your feature branch (`git checkout -b my-new-feature`)
29
- 3. Commit your changes (`git commit -am 'Add some feature'`)
30
- 4. Push to the branch (`git push origin my-new-feature`)
31
- 5. Create a new Pull Request
1
+ Todo:
2
+ this
data/bin/app_up CHANGED
@@ -1,24 +1,37 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'thor'
4
- require_relative '../lib/app_up'
4
+ require 'app_up'
5
5
 
6
6
  class AppUpCLI < Thor
7
7
 
8
- desc :run, description: "do stuff"
9
- option :diff, type: :array, desc: "SHAs to be diffed"
10
- option :all, type: :boolean, desc: "Run all of the hooks"
11
- option :verbose, type: :boolean, desc: "say all things"
12
- option :db_reset, aliases: ['--reset', '--drop-dbs'], type: :boolean, desc: "Drop and recreate all databases"
8
+ desc :run_hooks, %{Run "app_up --help run_hooks" to learn more}
9
+ long_desc <<-DESC
10
+ app_up automatically run "bundle install" and "rake db:migrate" in your app. It decides what to do based on the options listed above.
11
+
12
+ The AppUp gem installs two executables: "app_up" and "git_up". It is often more convenient to use the "git_up" command, which itself calls this "app_up" executable.
13
+ DESC
14
+
15
+ option :diff, type: :array, desc: %{Provide Git SHAs to be diffed. e.g. "app_up --diff HEAD d3be822a". If only one SHA is given, the second will default to HEAD.}
16
+ option :all, type: :boolean, desc: %{Run all hooks without diffing anything. This is the default action.}
17
+ option :verbose, type: :boolean, desc: %{Show the commands being run}
18
+ option :db_reset, aliases: ['--reset', '--drop-dbs'], type: :boolean, desc: %{Drop databases before creating and migrating}
13
19
 
14
20
  def run_hooks
15
- shell = AppUp::ShellRunner.new(
21
+ shell = AppUp::Shell::Runner.new(
16
22
  log_path: '/tmp/app_up.log',
17
- working_directory: '.'
23
+ working_directory: '.',
24
+ verbose: options[:verbose],
18
25
  )
19
26
 
27
+ if !options.has_key?(:diff)
28
+ options[:all] = true
29
+ elsif options[:diff].size == 1
30
+ options[:diff] << "HEAD"
31
+ end
32
+
20
33
  files = AppUp::Repo.new(shell, options).files
21
- AppUp::HookRunner.new(shell, files, options).run
34
+ AppUp::Hooks::Runner.new(shell, files, options).run
22
35
  end
23
36
 
24
37
  default_task :run_hooks
data/bin/git_up CHANGED
@@ -1,6 +1,20 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  #PETE: make this a bash script
4
+ if ARGV[0] == "--help" || ARGV[0] == "-h"
5
+ puts <<-HELP
6
+ ---
7
+ git_up is a wrapper for git. It compares the starting SHA and ending SHA of a git action and will run hooks to bundle and migrate your application.
8
+
9
+ You can pass git_up any git command. e.g. "git_up pull origin master"
10
+
11
+ If you pass no arguments, git_up will default to calling "git_up pull --rebase origin master"
12
+
13
+ See "app_up --help run_hooks" to see how the bundle/migration works.
14
+ ---
15
+ HELP
16
+ exit
17
+ end
4
18
 
5
19
  def get_sha
6
20
  %x{git rev-parse HEAD}.chomp
@@ -0,0 +1,13 @@
1
+ module AppUp
2
+ module Configuration
3
+ class Config
4
+
5
+ @ignore = []
6
+
7
+ class << self
8
+ attr_accessor :ignore
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ require "app_up/configuration/config"
2
+
3
+ module AppUp
4
+ module Configuration
5
+ module Loader
6
+
7
+ def user_config(config_class: Config, filename:)
8
+
9
+ self.singleton_class.send(:define_method, :config) do |&config_block|
10
+ config_block.call(config_class)
11
+ end
12
+
13
+ home = File.expand_path("~")
14
+ config_file = File.join(home, filename)
15
+ if File.exists?(config_file)
16
+ load config_file
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,14 @@
1
+ require "app_up/hooks/rails_up"
2
+
3
+ module AppUp
4
+ module Hooks
5
+ class Loader
6
+
7
+ def self.load
8
+ [
9
+ Hooks::RailsUp,
10
+ ]
11
+ end
12
+ end
13
+ end
14
+ end
@@ -14,12 +14,18 @@ module AppUp
14
14
  shell.notify( "Running RailsUp\n----------")
15
15
 
16
16
  files.each do |file|
17
- if File.basename(file) == "Gemfile.lock"
18
- add_command(:bundle, dir: File.split(file)[0])
17
+ exploded_path = Utils::Path.split(file)
18
+
19
+ # allow rebundle on only Gemfile edit, in case you're
20
+ # upping a gem, which probably doesn't have the Gemfile.lock
21
+ # checked in
22
+ if exploded_path.last.match(/Gemfile(\.lock)?|gemspec$/)
23
+ add_command(:bundle, dir: exploded_path[0..-2])
19
24
  end
20
25
 
21
- if file.match(/db\/migrate/)
22
- add_command(:migrate, dir: file.sub(/\/db\/migrate\/.*/, ''))
26
+ if exploded_path.include?("migrate")
27
+ last_db_index = exploded_path.rindex("db")
28
+ add_command(:migrate, dir: exploded_path[0...last_db_index])
23
29
  end
24
30
  end
25
31
 
@@ -47,7 +53,7 @@ module AppUp
47
53
  }
48
54
 
49
55
  actions.each do |command|
50
- shell.enqueue(:notify, "#{i.to_s.rjust(command_count.length)}/#{command_count.to_s} #{command.to_s.ljust(7)} : #{dir}")
56
+ shell.enqueue(:notify, "#{i.to_s.rjust(command_count.length)}/#{command_count.to_s} #{command.to_s.ljust(7)} : #{Utils::Path.join(dir)}")
51
57
  i+=1
52
58
  end
53
59
 
@@ -0,0 +1,18 @@
1
+ require "app_up/hooks/loader"
2
+
3
+ module AppUp
4
+ module Hooks
5
+ class Runner < Struct.new(:shell, :files, :options)
6
+
7
+ def run
8
+ hooks = Hooks::Loader.load
9
+
10
+ hooks.each do |hook|
11
+ hook.run(shell, files, options)
12
+ end
13
+
14
+ shell.flush
15
+ end
16
+ end
17
+ end
18
+ end
data/lib/app_up/repo.rb CHANGED
@@ -1,7 +1,16 @@
1
1
  module AppUp
2
2
  class Repo < Struct.new(:shell, :options)
3
3
 
4
+ private :shell, :options
5
+
4
6
  def files
7
+ ignores = options.has_key?(:ingore) ? options[:ignore] : Configuration::Config.ignore
8
+ default_files.reject {|f| ignores.any? {|i| f.match(i)} }
9
+ end
10
+
11
+ private
12
+
13
+ def default_files
5
14
  if options[:diff]
6
15
  diff(*options[:diff])
7
16
  else
@@ -9,8 +18,6 @@ module AppUp
9
18
  end
10
19
  end
11
20
 
12
- private
13
-
14
21
  def all
15
22
  shell.run "git ls-tree --full-tree -r HEAD --name-only"
16
23
  end
@@ -0,0 +1,26 @@
1
+ module AppUp
2
+ module Shell
3
+ module Color
4
+ CODES = {
5
+ red: 31,
6
+ green: 32,
7
+ yellow: 33,
8
+ pink: 35,
9
+ }.freeze
10
+
11
+ CODES.each do |color, code|
12
+ self.send(:define_method, color) do |string|
13
+ colorize(string, code)
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ # colorization
20
+ def colorize(string, color_code)
21
+ "\e[#{color_code}m#{string}\e[0m"
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,78 @@
1
+ require "work_queue"
2
+ require "app_up/shell/color"
3
+
4
+ module AppUp
5
+ module Shell
6
+ class Runner
7
+ include Color
8
+
9
+ MAX_PROCESS_COUNT = 8
10
+ CommandFailureError = Class.new(StandardError)
11
+
12
+ attr_accessor :working_directory, :log_path, :queue
13
+ private :working_directory, :log_path, :queue
14
+
15
+ def initialize(log_path:, working_directory:, verbose: false)
16
+ @working_directory = working_directory
17
+ @log_path = log_path
18
+ @verbose = verbose
19
+
20
+ @queue = WorkQueue.new(MAX_PROCESS_COUNT, nil)
21
+
22
+ %x{echo "" > #{log_path}}
23
+ Dir.chdir(%x[ git rev-parse --show-toplevel ].chomp)
24
+ end
25
+
26
+ # The block passed to run is a callback. It is used
27
+ # to add a dependent command to the queue.
28
+ def run(cmd, dir: working_directory, &block)
29
+ command = "cd #{Utils::Path.relative_join(dir)} && #{cmd}"
30
+ handle_output_for(command)
31
+
32
+ shell_out(command).split("\n").tap do
33
+ block.call if block_given?
34
+ end
35
+ end
36
+
37
+ def warn(msg)
38
+ log msg.to_s
39
+ print "#{red(msg.to_s)}\n"
40
+ end
41
+
42
+ def notify(msg)
43
+ return if @verbose
44
+
45
+ log msg.to_s
46
+ print "#{yellow(msg.to_s)}\n"
47
+ end
48
+
49
+ def enqueue(method, *args, &block)
50
+ queue.enqueue_b do
51
+ send(method, *args, &block)
52
+ end
53
+ end
54
+
55
+ def flush
56
+ queue.join
57
+ end
58
+
59
+ private
60
+
61
+ def log(msg)
62
+ %x{echo "#{msg.to_s}" >> #{log_path}}
63
+ end
64
+
65
+ def handle_output_for(cmd)
66
+ puts cmd if @verbose
67
+ log(cmd)
68
+ end
69
+
70
+ def shell_out(command)
71
+ %x{ set -o pipefail && #{command} 2>> #{log_path} | tee -a #{log_path} }.chomp.tap do
72
+ warn "The following command has failed: #{command}. See #{log_path} for a full log." if ($?.exitstatus != 0)
73
+ end
74
+ end
75
+
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,32 @@
1
+ require "pathname"
2
+
3
+ module AppUp
4
+ module Utils
5
+ module Path
6
+
7
+ def self.split(filename)
8
+ self.prepend_pwd(Pathname.new(filename).each_filename.to_a)
9
+ end
10
+
11
+ def self.path_for(filename)
12
+ self.split(File.split(file)[0])
13
+ end
14
+
15
+ def self.join(*array)
16
+ File.join(*array)
17
+ end
18
+
19
+ def self.prepend_pwd(dirs)
20
+ if dirs[0] == "."
21
+ dirs
22
+ else
23
+ ["."] + dirs
24
+ end
25
+ end
26
+
27
+ def self.relative_join(array)
28
+ join(prepend_pwd(array))
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,3 +1,3 @@
1
1
  module AppUp
2
- VERSION = "0.0.1"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/app_up.rb CHANGED
@@ -1,8 +1,12 @@
1
- require_relative "app_up/version"
2
- require_relative "app_up/hook_runner"
3
- require_relative 'app_up/repo'
4
- require_relative 'app_up/shell_runner'
1
+ require "app_up/version"
2
+ require "app_up/utils/path"
3
+ require "app_up/hooks/runner"
4
+ require "app_up/repo"
5
+ require "app_up/shell/runner"
6
+ require "app_up/configuration/loader"
5
7
 
6
8
  module AppUp
7
- # Your code goes here...
9
+ extend Configuration::Loader
10
+
11
+ user_config filename: ".app_up"
8
12
  end
@@ -1,4 +1,4 @@
1
- require 'test_helper'
1
+ require "test_helper"
2
2
 
3
3
  module AppUp
4
4
  module Hooks
@@ -31,44 +31,46 @@ module AppUp
31
31
 
32
32
  def test_bundle_directories
33
33
  files = [
34
- 'folder/sub_folder/Gemfile.lock',
35
- 'other_folder/other_subfolder/more/Gemfile.lock',
36
- 'unused/Gemfile'
34
+ "folder/sub_folder/Gemfile",
35
+ "other_folder/other_subfolder/more/Gemfile.lock",
36
+ "some_gem/thing/thing.gemspec",
37
+ "unused/Gemthingspec",
37
38
  ]
38
39
 
39
40
  hook = RailsUp.new(@shell, files, {})
40
41
 
41
42
  hook.run
42
- assert_equal 2, @shell.history[:enqueue].select {|c| c[0]==:run}.size
43
- assert @shell.history[:enqueue].include?([:run, RailsUp::BUNDLE_COMMAND, dir: 'folder/sub_folder']), @shell.history
44
- assert @shell.history[:enqueue].include?([:run, RailsUp::BUNDLE_COMMAND, dir: 'other_folder/other_subfolder/more']), @shell.history
43
+ assert_equal 3, @shell.history[:enqueue].select {|c| c[0]==:run}.size
44
+ assert @shell.history[:enqueue].include?([:run, RailsUp::BUNDLE_COMMAND, dir: [".", "folder", "sub_folder"]]), @shell.history
45
+ assert @shell.history[:enqueue].include?([:run, RailsUp::BUNDLE_COMMAND, dir: [".", "other_folder", "other_subfolder", "more"]]), @shell.history
46
+ assert @shell.history[:enqueue].include?([:run, RailsUp::BUNDLE_COMMAND, dir: [".", "some_gem", "thing"]]), @shell.history
45
47
  end
46
48
 
47
49
  def test_migrate_directories
48
50
  files = [
49
- 'folder/sub_folder/db/migrate/migration.rb',
50
- 'other_folder/other_subfolder/more/db/migrate/migration.rb',
51
- 'unused/db/config.rb',
51
+ "folder/sub_folder/db/migrate/migration.rb",
52
+ "other_folder/other_subfolder/more/db/migrate/migration.rb",
53
+ "unused/db/config.rb",
52
54
  ]
53
55
 
54
56
  hook = RailsUp.new(@shell, files, {})
55
- hook.stubs(:migrate).with('test').returns('migrate_test')
56
- hook.stubs(:migrate).with('development').returns('migrate_development')
57
+ hook.stubs(:migrate).with("test").returns("migrate_test")
58
+ hook.stubs(:migrate).with("development").returns("migrate_development")
57
59
 
58
60
  hook.run
59
61
  assert_equal 4, @shell.history[:enqueue].select {|c| c[0]==:run}.size
60
- assert @shell.history[:enqueue].include?([:run, 'migrate_test', dir: 'folder/sub_folder']), @shell.history
61
- assert @shell.history[:enqueue].include?([:run, 'migrate_development', dir: 'folder/sub_folder']), @shell.history
62
- assert @shell.history[:enqueue].include?([:run, 'migrate_test', dir: 'other_folder/other_subfolder/more']), @shell.history
63
- assert @shell.history[:enqueue].include?([:run, 'migrate_development', dir: 'other_folder/other_subfolder/more']), @shell.history
62
+ assert @shell.history[:enqueue].include?([:run, "migrate_test", dir: [".", "folder", "sub_folder"]]), @shell.history
63
+ assert @shell.history[:enqueue].include?([:run, "migrate_development", dir: [".", "folder", "sub_folder"]]), @shell.history
64
+ assert @shell.history[:enqueue].include?([:run, "migrate_test", dir: [".", "other_folder", "other_subfolder", "more"]]), @shell.history
65
+ assert @shell.history[:enqueue].include?([:run, "migrate_development", dir: [".", "other_folder", "other_subfolder", "more"]]), @shell.history
64
66
  end
65
67
 
66
68
  def test_migrate__drops_db
67
- no_drop_hook = RailsUp.new('stub', 'stub', {})
68
- assert_equal nil, no_drop_hook.send(:migrate, 'test').match(/db:drop/)
69
+ no_drop_hook = RailsUp.new("stub", "stub", {})
70
+ assert_equal nil, no_drop_hook.send(:migrate, "test").match(/db:drop/)
69
71
 
70
- no_drop_hook = RailsUp.new('stub', 'stub', {db_reset: true})
71
- assert no_drop_hook.send(:migrate, 'test').match(/db:drop/)
72
+ no_drop_hook = RailsUp.new("stub", "stub", {db_reset: true})
73
+ assert no_drop_hook.send(:migrate, "test").match(/db:drop/)
72
74
  end
73
75
  end
74
76
  end
data/test/test_helper.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), '../lib'))
2
2
 
3
- require 'pry'
4
3
  require 'minitest/autorun'
5
4
  require 'app_up'
6
5
  require 'mocha/mini_test'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_up
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Kinnecom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-25 00:00:00.000000000 Z
11
+ date: 2015-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -96,12 +96,16 @@ files:
96
96
  - bin/app_up
97
97
  - bin/git_up
98
98
  - lib/app_up.rb
99
- - lib/app_up/hook_loader.rb
100
- - lib/app_up/hook_runner.rb
99
+ - lib/app_up/configuration/config.rb
100
+ - lib/app_up/configuration/loader.rb
101
101
  - lib/app_up/hooks/hook.rb
102
+ - lib/app_up/hooks/loader.rb
102
103
  - lib/app_up/hooks/rails_up.rb
104
+ - lib/app_up/hooks/runner.rb
103
105
  - lib/app_up/repo.rb
104
- - lib/app_up/shell_runner.rb
106
+ - lib/app_up/shell/color.rb
107
+ - lib/app_up/shell/runner.rb
108
+ - lib/app_up/utils/path.rb
105
109
  - lib/app_up/version.rb
106
110
  - test/git_up/hooks/rails_up_test.rb
107
111
  - test/test_helper.rb
@@ -1,12 +0,0 @@
1
- require "app_up/hooks/rails_up"
2
-
3
- module AppUp
4
- class HookLoader
5
-
6
- def self.load
7
- [
8
- Hooks::RailsUp,
9
- ]
10
- end
11
- end
12
- end
@@ -1,16 +0,0 @@
1
- require "app_up/hook_loader"
2
-
3
- module AppUp
4
- class HookRunner < Struct.new(:shell, :files, :options)
5
-
6
- def run
7
- hooks = HookLoader.load
8
-
9
- hooks.each do |hook|
10
- hook.run(shell, files, options)
11
- end
12
-
13
- shell.flush
14
- end
15
- end
16
- end
@@ -1,99 +0,0 @@
1
- require 'work_queue'
2
-
3
- module AppUp
4
- class ShellRunner
5
- MAX_PROCESS_COUNT = 8
6
- CommandFailureError = Class.new(StandardError)
7
-
8
- attr_accessor :working_directory, :log_path, :queue
9
- private :working_directory, :log_path, :queue
10
-
11
- def initialize(log_path:, working_directory:, verbose: false)
12
- @working_directory = working_directory
13
- @log_path = log_path
14
- @queue = WorkQueue.new(MAX_PROCESS_COUNT, nil)
15
- @verbose = verbose
16
- Dir.chdir(%x[ git rev-parse --show-toplevel ].chomp)
17
-
18
- reset_log
19
- end
20
-
21
- # The block passed to run is a callback. It is used
22
- # to add a dependent command to the queue.
23
- def run(cmd, dir: working_directory, &block)
24
- command = "cd #{dir} && #{cmd}"
25
- handle_output_for(command)
26
-
27
- shell_out(command).split("\n").tap do
28
- block.call if block_given?
29
- end
30
- end
31
-
32
- def warn(msg)
33
- log msg.to_s
34
- print "#{msg.to_s.red}\n"
35
- end
36
-
37
- def notify(msg)
38
- log msg.to_s
39
- print "#{msg.to_s.yellow}\n"
40
- end
41
-
42
- def enqueue(method, *args, &block)
43
- queue.enqueue_b do
44
- send(method, *args, &block)
45
- end
46
- end
47
-
48
- def flush
49
- queue.join
50
- end
51
-
52
- private
53
-
54
- def log(msg)
55
- %x{echo "#{msg.to_s}" >> #{log_path}}
56
- end
57
-
58
- def reset_log
59
- %x{echo "" > #{log_path}}
60
- end
61
-
62
- def handle_output_for(cmd)
63
- puts cmd if @verbose
64
- log(cmd)
65
- end
66
-
67
- def shell_out(command)
68
- %x{ set -o pipefail && #{command} 2>> #{log_path} | tee -a #{log_path} }.chomp.tap do
69
- warn "The following command has failed: #{command}. See #{log_path} for a full log." if ($?.exitstatus != 0)
70
- end
71
- end
72
-
73
- end
74
- end
75
-
76
- #PETE: hack
77
-
78
- class String
79
- # colorization
80
- def colorize(color_code)
81
- "\e[#{color_code}m#{self}\e[0m"
82
- end
83
-
84
- def red
85
- colorize(31)
86
- end
87
-
88
- def green
89
- colorize(32)
90
- end
91
-
92
- def yellow
93
- colorize(33)
94
- end
95
-
96
- def pink
97
- colorize(35)
98
- end
99
- end