Top Level Namespace

Defined Under Namespace

Modules: Discorb Classes: Time

Constant Summary collapse

FILES =
{
  "main.rb" => <<~'RUBY',
  ".env" => <<~BASH,
  ".gitignore" => <<~GITIGNORE,
}

Instance Method Summary collapse

Instance Method Details

#bundle_init -> Object



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/discorb/exe/init.rb', line 97

def bundle_init
  iputs "Initializing bundle..."
  File.write($path + "/Gemfile", <<~'RUBY', mode: "wb")
    # frozen_string_literal: true

    source "https://rubygems.org"

    git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

    gem "discorb", "~> 0.2.5"
    gem "dotenv", "~> 2.7"
  RUBY
  iputs "Installing gems..."
  system "bundle install"
  sputs "Installed gems.\n"
end

#eputs(text) -> Object



5
6
7
# File 'lib/discorb/utils/colored_puts.rb', line 5

def eputs(text)
  puts "\e[91m#{text}\e[m"
end

#git_init -> Object



114
115
116
117
118
119
120
121
122
# File 'lib/discorb/exe/init.rb', line 114

def git_init
  iputs "Initializing git repository..."
  system "git init"
  system "git add ."
  system "git commit -m \"Initial commit\""
  sputs "Initialized repository, use " +
          "\e[32mgit commit --amend -m '...'\e[92m" +
          " to change commit message of initial commit.\n"
end

#iputs(text) -> Object



9
10
11
# File 'lib/discorb/utils/colored_puts.rb', line 9

def iputs(text)
  puts "\e[90m#{text}\e[m"
end

#make_files -> Object



89
90
91
92
93
94
95
# File 'lib/discorb/exe/init.rb', line 89

def make_files
  iputs "Making files..."
  FILES.each do |file, content|
    File.write($path + "/#{file}", format(content, token: $values[:token]), mode: "wb")
  end
  sputs "Made files.\n"
end

#sputs(text) -> Object



1
2
3
# File 'lib/discorb/utils/colored_puts.rb', line 1

def sputs(text)
  puts "\e[92m#{text}\e[m"
end