discorb 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f5c9c3f2c3e472300d1fe8462b9e667008bce0a30d11b2ce6cf866f697aedb0
4
- data.tar.gz: d2c2fa2edd51a84a1001675d0572bfae3464f5d25b85865a95a7c7f5daebf109
3
+ metadata.gz: 48ed0b82cf398970b54454d1d41f60e8fdf55fb6d5499f1e55a54769d61bc954
4
+ data.tar.gz: 5aae36deb140de42e2ff94249f61aa346856682ae27de444eb2aadc8a0b29591
5
5
  SHA512:
6
- metadata.gz: ed4bb639464a3adc7a5982088149421d6d15f7e3c4be37bb59855a5d106ee5a1e1756b10ba401fd3d3ced9008c15e99bb3967f93eb7ff197903fb6cf95e19699
7
- data.tar.gz: fc6809db6b8e7a7e65e70fb49ce3b25a2aa4f42145477730e234511a95f278879759d76f5ee9547fa213f34ce3c413f5ba167c7f042d7f73a954718ba22e51d4
6
+ metadata.gz: 3cc6e43128c370e30e6d16b6a19ec88be33a848e56a112981a6f272146d3506222f2240d55edb359e2d1d60f64b002841e37de5b52aa5142d837bddf75afcf5f
7
+ data.tar.gz: 3cf2390626afa7eb22ac3d906e9915ba2e4cee75e40a3d6dc9bbf25b5d00db0bd693ae2c7d1798a8811ea2c57475ab90e9825ffb3ceb762e415167a80bb9f192
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- discorb (0.3.0)
4
+ discorb (0.3.1)
5
5
  async
6
6
  async-http
7
7
  async-websocket
data/Rakefile CHANGED
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bundler/gem_tasks"
4
+ require_relative "lib/discorb/utils/colored_puts"
4
5
  task default: %i[]
5
6
 
7
+ # @!visibility private
6
8
  def get_version
7
9
  require_relative "lib/discorb/common"
8
10
  latest_commit = `git log --oneline`.force_encoding("utf-8").split("\n")[0]
@@ -13,14 +15,7 @@ def get_version
13
15
  version
14
16
  end
15
17
 
16
- def gputs(text)
17
- puts "\e[90m#{text}\e[m"
18
- end
19
-
20
- def sputs(text)
21
- puts "\e[92m#{text}\e[m"
22
- end
23
-
18
+ desc "Build emoji_table.rb"
24
19
  task :emoji_table do
25
20
  require_relative "lib/discorb"
26
21
 
@@ -47,6 +42,7 @@ task :emoji_table do
47
42
  sputs "Successfully made emoji_table.rb"
48
43
  end
49
44
 
45
+ desc "Format files"
50
46
  task :format do
51
47
  Dir.glob("**/*.rb").each do |file|
52
48
  next if file.start_with?("vendor")
@@ -63,13 +59,21 @@ task :format do
63
59
  end
64
60
  end
65
61
  end
62
+
63
+ desc "Generate document and replace"
66
64
  namespace :document do
67
65
  version = get_version
66
+
67
+ desc "Just generate document"
68
68
  task :yard do
69
69
  sh "yardoc -o doc/#{version}"
70
70
  end
71
+
72
+ desc "Replace files"
71
73
  namespace :replace do
72
74
  require "fileutils"
75
+
76
+ desc "Replace CSS"
73
77
  task :css do
74
78
  gputs "Replacing css"
75
79
  Dir.glob("template-replace/files/**/*.*")
@@ -78,6 +82,8 @@ namespace :document do
78
82
  end
79
83
  sputs "Successfully replaced css"
80
84
  end
85
+
86
+ desc "Replace HTML"
81
87
  task :html do
82
88
  require_relative "template-replace/scripts/sidebar.rb"
83
89
  require_relative "template-replace/scripts/version.rb"
@@ -104,6 +110,8 @@ namespace :document do
104
110
  yard_replace("doc/#{version}", version)
105
111
  gputs "Successfully replaced htmls"
106
112
  end
113
+
114
+ desc "Replace EOL"
107
115
  task :eol do
108
116
  gputs "Replacing CRLF with LF"
109
117
  Dir.glob("doc/**/*.*") do |file|
@@ -122,6 +130,8 @@ namespace :document do
122
130
  end
123
131
  end
124
132
  task :replace => %i[replace:css replace:html replace:eol]
133
+
134
+ desc "Build all versions"
125
135
  task :build_all do
126
136
  require "fileutils"
127
137
  gputs "Building all versions"
@@ -145,6 +155,8 @@ namespace :document do
145
155
  sh "git switch main -f"
146
156
  sputs "Successfully built all versions"
147
157
  end
158
+
159
+ desc "Push to discorb-lib/discorb-lib.github.io"
148
160
  task :push do
149
161
  gputs "Pushing documents"
150
162
  Dir.chdir("doc") do
data/docs/cli.md CHANGED
@@ -17,4 +17,5 @@ Currently, discorb has the following commands:
17
17
  | Command | Description |
18
18
  |---------|-------------|
19
19
  | {file:docs/cli/init.md `init`} | Create a new project. |
20
- | {file:docs/cli/irb.md `irb`} | Start an interactive Ruby shell with connected client. |
20
+ | {file:docs/cli/irb.md `irb`} | Start an interactive Ruby shell with connected client. |
21
+ | `show` | Show your environment. |
@@ -4,7 +4,7 @@ module Discorb
4
4
  # @return [String] The API base URL.
5
5
  API_BASE_URL = "https://discord.com/api/v9"
6
6
  # @return [String] The version of discorb.
7
- VERSION = "0.3.0"
7
+ VERSION = "0.3.1"
8
8
  # @return [String] The user agent for the bot.
9
9
  USER_AGENT = "DiscordBot (https://github.com/discorb-lib/discorb #{VERSION}) Ruby/#{RUBY_VERSION}"
10
10
 
@@ -5,6 +5,7 @@ require_relative "../utils/colored_puts"
5
5
 
6
6
  $path = Dir.pwd
7
7
 
8
+ # @!visibility private
8
9
  FILES = {
9
10
  "main.rb" => <<~'RUBY',
10
11
  require "discorb"
@@ -84,19 +85,7 @@ FILES = {
84
85
  # This gitignore is from github/gitignore.
85
86
  # https://github.com/github/gitignore/blob/master/Ruby.gitignore
86
87
  GITIGNORE
87
- }
88
-
89
- def make_files
90
- iputs "Making files..."
91
- FILES.each do |file, content|
92
- File.write($path + "/#{file}", format(content, token: $values[:token]), mode: "wb")
93
- end
94
- sputs "Made files.\n"
95
- end
96
-
97
- def bundle_init
98
- iputs "Initializing bundle..."
99
- File.write($path + "/Gemfile", <<~'RUBY', mode: "wb")
88
+ "Gemfile" => <<~RUBY,
100
89
  # frozen_string_literal: true
101
90
 
102
91
  source "https://rubygems.org"
@@ -106,12 +95,33 @@ def bundle_init
106
95
  gem "discorb", "~> 0.2.5"
107
96
  gem "dotenv", "~> 2.7"
108
97
  RUBY
98
+ }
99
+
100
+ # @!visibility private
101
+ def create_file(name)
102
+ File.write($path + "/#{name}", format(FILES[name], token: $values[:token]), mode: "wb")
103
+ end
104
+
105
+ # @!visibility private
106
+ def make_files
107
+ iputs "Making files..."
108
+ create_file("main.rb")
109
+ create_file(".env")
110
+ sputs "Made files.\n"
111
+ end
112
+
113
+ # @!visibility private
114
+ def bundle_init
115
+ iputs "Initializing bundle..."
116
+ create_file("Gemfile")
109
117
  iputs "Installing gems..."
110
118
  system "bundle install"
111
119
  sputs "Installed gems.\n"
112
120
  end
113
121
 
122
+ # @!visibility private
114
123
  def git_init
124
+ create_file(".gitignore")
115
125
  iputs "Initializing git repository..."
116
126
  system "git init"
117
127
  system "git add ."
@@ -0,0 +1,8 @@
1
+ # description: Show information of your environment.
2
+
3
+ require "etc"
4
+ require "discorb"
5
+ puts "\e[90mRuby:\e[m #{RUBY_VERSION}"
6
+ puts "\e[90mdiscorb:\e[m #{Discorb::VERSION}"
7
+ uname = Etc.uname
8
+ puts "\e[90mSystem:\e[m #{uname[:sysname]} #{uname[:release]}"
@@ -1,11 +1,14 @@
1
+ # @!visibility private
1
2
  def sputs(text)
2
3
  puts "\e[92m#{text}\e[m"
3
4
  end
4
5
 
6
+ # @!visibility private
5
7
  def eputs(text)
6
8
  puts "\e[91m#{text}\e[m"
7
9
  end
8
10
 
11
+ # @!visibility private
9
12
  def iputs(text)
10
13
  puts "\e[90m#{text}\e[m"
11
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discorb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sevenc-nanashi
@@ -124,6 +124,7 @@ files:
124
124
  - lib/discorb/event.rb
125
125
  - lib/discorb/exe/init.rb
126
126
  - lib/discorb/exe/irb.rb
127
+ - lib/discorb/exe/show.rb
127
128
  - lib/discorb/extend.rb
128
129
  - lib/discorb/extension.rb
129
130
  - lib/discorb/file.rb