discorb 0.3.1 → 0.5.0

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: 48ed0b82cf398970b54454d1d41f60e8fdf55fb6d5499f1e55a54769d61bc954
4
- data.tar.gz: 5aae36deb140de42e2ff94249f61aa346856682ae27de444eb2aadc8a0b29591
3
+ metadata.gz: 26ef2cd9945ad11a9816b4ece328391c265b8f59f8b9a67e66326e21414f083c
4
+ data.tar.gz: 06662ff1518386e95e615afffc6b8338cb9e337bb0dc36c66f6d1d79fd7a01e8
5
5
  SHA512:
6
- metadata.gz: 3cc6e43128c370e30e6d16b6a19ec88be33a848e56a112981a6f272146d3506222f2240d55edb359e2d1d60f64b002841e37de5b52aa5142d837bddf75afcf5f
7
- data.tar.gz: 3cf2390626afa7eb22ac3d906e9915ba2e4cee75e40a3d6dc9bbf25b5d00db0bd693ae2c7d1798a8811ea2c57475ab90e9825ffb3ceb762e415167a80bb9f192
6
+ metadata.gz: 83ddc5818285d4ed50e08998446a5fa9763cffe9c0a1992a70085af38a323e304851ca4dd77f43a8108e4ece850f097eaca9dc119b83c9bdb9a66e5c32b40f5a
7
+ data.tar.gz: 8a409f031d896344586bb2001019b9431299683a99df36f090f3a0da748d08bd6b4f2191c0a32823106d5b3b0cd6d22624106367d8e4adc400acf430ddb60370
@@ -0,0 +1,51 @@
1
+ name: Build YARD with main
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ schedule:
6
+ - cron: "*/8 * * * *"
7
+
8
+ jobs:
9
+ main:
10
+
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: 3.0.2
19
+ bundler-cache: true
20
+ - name: Set up git settings
21
+ run: |
22
+ git config --global user.email "action@github.com"
23
+ git config --global user.name "GitHub Action"
24
+ - name: Clone pages
25
+ env:
26
+ SSH_SECRET: ${{ secrets.SSH }}
27
+ GIT_SSH_COMMAND: ssh -i ~/ssh_secret
28
+ run: |
29
+ echo "$SSH_SECRET" > ~/ssh_secret
30
+ chmod 600 ~/ssh_secret
31
+ git clone git@github.com:discorb-lib/discorb-lib.github.io /tmp/pages
32
+ - name: Install dependencies
33
+ run: |
34
+ bundle config --local with 'docs'
35
+ bundle install
36
+ - name: Generate document
37
+ run: bundle exec rake document
38
+ - name: Push document
39
+ env:
40
+ SSH_SECRET: ${{ secrets.SSH }}
41
+ GIT_SSH_COMMAND: ssh -i ~/ssh_secret
42
+ run: |
43
+ echo "$SSH_SECRET" > ~/ssh_secret
44
+ chmod 600 ~/ssh_secret
45
+ cp -r ./doc/. /tmp/pages
46
+ cd /tmp/pages
47
+ git add -A
48
+ git commit -m "Update: Update document for ${{ github.sha }} by cron"
49
+ git update-ref -d refs/remotes/origin/user
50
+ git push origin main -f
51
+ continue-on-error: true
data/.gitignore CHANGED
@@ -35,7 +35,7 @@ build-iPhoneSimulator/
35
35
  ## Documentation cache and generated files:
36
36
  /.yardoc/
37
37
  /_yardoc/
38
- /doc/
38
+ # /doc/
39
39
  /rdoc/
40
40
 
41
41
  ## Environment normalization:
@@ -54,4 +54,8 @@ build-iPhoneSimulator/
54
54
 
55
55
  # Used by RuboCop. Remote config files pulled in from inherit_from directive.
56
56
  # .rubocop-https?--*
57
+
58
+ # For documentation generation.
57
59
  tmp-template-replace
60
+ tmp-doc
61
+ doc
data/.yardopts CHANGED
@@ -3,6 +3,7 @@
3
3
  --markup markdown
4
4
  --tag flags:"Flags"
5
5
  --verbose
6
+ --asset docs/assets:assets
6
7
  -
7
8
  docs/**/*.md
8
9
  Changelog.md
data/Changelog.md CHANGED
@@ -73,4 +73,36 @@
73
73
  ## 0.2.5
74
74
 
75
75
  - Add: Add way to add event listener
76
- - Change: Move document to https://discorb-lib.github.io/
76
+ - Change: Move document to https://discorb-lib.github.io/
77
+
78
+ ## 0.3.0
79
+
80
+ - Add: Improve CLI tools
81
+ - Add: Add `discorb init`
82
+ - Change: Change `discord-irb` to `discorb irb`
83
+
84
+ ## 0.3.1
85
+
86
+ - Add: Add `discorb show`
87
+ - Fix: Fix documenting
88
+
89
+ ## 0.4.0
90
+
91
+ - Add: Add `discorb setup`
92
+ - Add: Add `discorb run`
93
+ - Add: Add realtime documentation
94
+
95
+ ## 0.4.1
96
+
97
+ - Add: Add `-s` option to `discorb run`
98
+
99
+ ## 0.4.2
100
+
101
+ - Fix: Fix error in `discorb run`
102
+
103
+ ## 0.5.0
104
+
105
+ - Change: Use zlib stream instead
106
+ - Add: Add tutorials
107
+ - Add: Add ratelimit handler
108
+ - Change: Make `--git` option in `discorb init` false
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- discorb (0.3.1)
5
- async
6
- async-http
7
- async-websocket
4
+ discorb (0.5.0)
5
+ async (~> 1.30.1)
6
+ async-http (~> 0.56.5)
7
+ async-websocket (~> 0.19.0)
8
8
  mime-types (~> 3.3)
9
9
 
10
10
  GEM
@@ -54,6 +54,7 @@ GEM
54
54
 
55
55
  PLATFORMS
56
56
  x86-mingw32
57
+ x86_64-linux
57
58
 
58
59
  DEPENDENCIES
59
60
  discorb!
data/Rakefile CHANGED
@@ -7,10 +7,11 @@ task default: %i[]
7
7
  # @!visibility private
8
8
  def get_version
9
9
  require_relative "lib/discorb/common"
10
- latest_commit = `git log --oneline`.force_encoding("utf-8").split("\n")[0]
11
- version = Discorb::VERSION
12
- unless latest_commit.downcase.include?("update version")
13
- version += "-dev"
10
+ tag = `git tag --points-at HEAD`.force_encoding("utf-8").strip
11
+ if tag.empty?
12
+ version = "main"
13
+ else
14
+ version = Discorb::VERSION
14
15
  end
15
16
  version
16
17
  end
@@ -19,7 +20,7 @@ desc "Build emoji_table.rb"
19
20
  task :emoji_table do
20
21
  require_relative "lib/discorb"
21
22
 
22
- gputs "Building emoji_table.rb"
23
+ iputs "Building emoji_table.rb"
23
24
  res = {}
24
25
  Discorb::EmojiTable::DISCORD_TO_UNICODE.each do |discord, unicode|
25
26
  res[unicode] ||= []
@@ -47,7 +48,7 @@ task :format do
47
48
  Dir.glob("**/*.rb").each do |file|
48
49
  next if file.start_with?("vendor")
49
50
 
50
- gputs "Formatting #{file}"
51
+ iputs "Formatting #{file}"
51
52
  `rufo ./#{file}`
52
53
  content = ""
53
54
  File.open(file, "rb") do |f|
@@ -66,7 +67,7 @@ namespace :document do
66
67
 
67
68
  desc "Just generate document"
68
69
  task :yard do
69
- sh "yardoc -o doc/#{version}"
70
+ sh "bundle exec yardoc -o doc/#{version}"
70
71
  end
71
72
 
72
73
  desc "Replace files"
@@ -75,7 +76,7 @@ namespace :document do
75
76
 
76
77
  desc "Replace CSS"
77
78
  task :css do
78
- gputs "Replacing css"
79
+ iputs "Replacing css"
79
80
  Dir.glob("template-replace/files/**/*.*")
80
81
  .map { |f| f.delete_prefix("template-replace/files") }.each do |file|
81
82
  FileUtils.cp("template-replace/files" + file, "doc/#{version}/#{file}")
@@ -89,7 +90,7 @@ namespace :document do
89
90
  require_relative "template-replace/scripts/version.rb"
90
91
  require_relative "template-replace/scripts/index.rb"
91
92
  require_relative "template-replace/scripts/yard_replace.rb"
92
- gputs "Resetting changes"
93
+ iputs "Resetting changes"
93
94
  Dir.glob("doc/#{version}/**/*.html") do |f|
94
95
  next if (m = f.match(/[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+)?/)) && m[0] != version
95
96
 
@@ -97,25 +98,26 @@ namespace :document do
97
98
  content.gsub!(/<!--od-->[\s\S]*<!--eod-->/, "")
98
99
  File.write(f, content)
99
100
  end
100
- gputs "Adding version tab"
101
+ iputs "Adding version tab"
101
102
  %w[file_list class_list method_list].each do |f|
102
103
  replace_sidebar("doc/#{version}/#{f}.html")
103
104
  end
104
105
 
105
- gputs "Building version tab"
106
- build_version_sidebar("doc/#{version}")
107
- gputs "Replacing _index.html"
106
+ iputs "Building version tab"
107
+ build_version_sidebar("doc/#{version}", version)
108
+ iputs "Replacing _index.html"
108
109
  replace_index("doc/#{version}", version)
109
- gputs "Replacing YARD credits"
110
+ iputs "Replacing YARD credits"
110
111
  yard_replace("doc/#{version}", version)
111
- gputs "Successfully replaced htmls"
112
+ iputs "Successfully replaced htmls"
112
113
  end
113
114
 
114
115
  desc "Replace EOL"
115
116
  task :eol do
116
- gputs "Replacing CRLF with LF"
117
+ iputs "Replacing CRLF with LF"
117
118
  Dir.glob("doc/**/*.*") do |file|
118
119
  next unless File.file?(file)
120
+ next unless %w[html css js].include? file.split(".").last
119
121
 
120
122
  content = ""
121
123
  File.open(file, "rb") do |f|
@@ -134,18 +136,32 @@ namespace :document do
134
136
  desc "Build all versions"
135
137
  task :build_all do
136
138
  require "fileutils"
137
- gputs "Building all versions"
139
+
140
+ class Bundler::Definition
141
+ def validate_platforms!
142
+ # noop
143
+ end
144
+ end
145
+
146
+ iputs "Building all versions"
147
+ FileUtils.rm_rf("doc") rescue nil
138
148
  FileUtils.cp_r("./template-replace/.", "./tmp-template-replace")
149
+ Rake::Task["document:yard"].execute
150
+ Rake::Task["document:replace:html"].execute
151
+ Rake::Task["document:replace:css"].execute
152
+ Rake::Task["document:replace:eol"].execute
139
153
  tags = `git tag`.force_encoding("utf-8").split("\n")
140
154
  tags.each do |tag|
141
155
  sh "git checkout #{tag} -f"
142
- gputs "Building #{tag}"
156
+ iputs "Building #{tag}"
143
157
  FileUtils.cp_r("./tmp-template-replace/.", "./template-replace")
144
158
  version = tag.delete_prefix("v")
145
159
  Rake::Task["document:yard"].execute
146
160
  Rake::Task["document:replace:html"].execute
147
161
  Rake::Task["document:replace:css"].execute
148
162
  Rake::Task["document:replace:eol"].execute
163
+ FileUtils.cp_r("./doc/.", "./tmp-doc")
164
+ FileUtils.rm_rf("doc")
149
165
  end
150
166
  version = "."
151
167
  Rake::Task["document:yard"].execute
@@ -153,13 +169,19 @@ namespace :document do
153
169
  Rake::Task["document:replace:css"].execute
154
170
  Rake::Task["document:replace:eol"].execute
155
171
  sh "git switch main -f"
172
+ FileUtils.cp_r("./tmp-doc/.", "./doc")
156
173
  sputs "Successfully built all versions"
174
+ rescue => e
175
+ sh "git switch main -f"
176
+ raise e
157
177
  end
158
178
 
159
179
  desc "Push to discorb-lib/discorb-lib.github.io"
160
180
  task :push do
161
- gputs "Pushing documents"
181
+ iputs "Pushing documents"
162
182
  Dir.chdir("doc") do
183
+ sh "git init"
184
+ sh "git remote add origin git@github.com:discorb-lib/discorb-lib.github.io"
163
185
  sh "git add ."
164
186
  sh "git commit -m \"Update: Update document\""
165
187
  sh "git push -f"
data/discorb.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.metadata["homepage_uri"] = spec.homepage
19
19
  spec.metadata["source_code_uri"] = "https://github.com/discorb-lib/discorb"
20
- spec.metadata["changelog_uri"] = "https://github.com/discorb-lib/discorb/blob/main/Changelog.md"
20
+ spec.metadata["changelog_uri"] = "https://discorb-lib.github.io/file.Changelog.html"
21
21
  spec.metadata["documentation_uri"] = "https://discorb-lib.github.io"
22
22
 
23
23
  # Specify which files should be added to the gem when it is released.
@@ -30,9 +30,9 @@ Gem::Specification.new do |spec|
30
30
  spec.require_paths = ["lib"]
31
31
 
32
32
  # Uncomment to register a new dependency of your gem
33
- spec.add_dependency "async"
34
- spec.add_dependency "async-http"
35
- spec.add_dependency "async-websocket"
33
+ spec.add_dependency "async", "~> 1.30.1"
34
+ spec.add_dependency "async-http", "~> 0.56.5"
35
+ spec.add_dependency "async-websocket", "~> 0.19.0"
36
36
 
37
37
  spec.add_dependency "mime-types", "~> 3.3"
38
38
  # For more information and examples about making a new gem, checkout our
@@ -10,7 +10,13 @@ From: [Discord API docs](https://discord.com/developers/docs/interactions/applic
10
10
 
11
11
  ## How do I register an application command?
12
12
 
13
- Use {Discorb::Command::Handler.slash}, {Discorb::Command::Handler.slash_group} for slash commands, {Discorb::Command::Handler.user_command} for user menu commands, and {Discorb::Command::Handler.message_command} for message menu commands.
13
+ Write to a your script:
14
+ - {Discorb::Command::Handler.slash}, {Discorb::Command::Handler.slash_group} for slash commands,
15
+ - {Discorb::Command::Handler.user_command} for user menu commands,
16
+ - {Discorb::Command::Handler.message_command} for message menu commands.
17
+
18
+ And then run `discorb setup` to register your application commands.
19
+ {file:docs/cli/setup.md Learn more about `discorb setup`}.
14
20
 
15
21
  ### Note
16
22
 
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/docs/cli/init.md CHANGED
@@ -30,7 +30,7 @@ Default to true.
30
30
  Whether to initialize git.
31
31
  If true, the command will initialize git and commit the initial files with commit message `Initial commit`.
32
32
  Use `git commit --amend -m "..."` to change the commit message.
33
- Default to true.
33
+ Default to false.
34
34
 
35
35
  ### `-t`, `--token`
36
36
 
data/docs/cli/irb.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # discorb irb
4
4
 
5
- discorb irb is a command line tool for interacting with the Discord API.
5
+ This command will start an interactive Ruby shell with connected client.
6
6
 
7
7
 
8
8
  ## Usage
data/docs/cli/run.md ADDED
@@ -0,0 +1,46 @@
1
+ # @title CLI: discorb run
2
+
3
+ # discorb run
4
+
5
+ This command will run a client.
6
+
7
+
8
+ ## Usage
9
+
10
+ ```
11
+ discorb run [options] [script]
12
+ ```
13
+
14
+ ### Arguments
15
+
16
+ #### `script`
17
+
18
+ The script to run. Defaults to `main.rb`.
19
+
20
+ #### `-d`, `--deamon`
21
+
22
+ Run the client in deamon mode.
23
+
24
+ #### `-l`, `--log-level`
25
+
26
+ Specify the log level.
27
+ Should be one of the following:
28
+
29
+ * `none`
30
+ * `debug`
31
+ * `info`
32
+ * `warn`
33
+ * `error`
34
+ * `fatal`
35
+
36
+ #### `-f`, `--log-file`
37
+
38
+ Specify the file to write logs to.
39
+ You can use `stdout` to write to the standard output, and `stderr` to write to the standard error.
40
+
41
+ #### `-c`, `--[no-]log-color`
42
+
43
+ Whether to colorize the log output.
44
+ If not specified, the default will be:
45
+ - `true` if the file to write logs to is `stdout` or `stderr`.
46
+ - `false` otherwise.
data/docs/cli/setup.md ADDED
@@ -0,0 +1,17 @@
1
+ # @title CLI: discorb setup
2
+
3
+ # discorb setup
4
+
5
+ This command will setup application commands.
6
+
7
+ ## Usage
8
+
9
+ ```
10
+ discorb setup [script]
11
+ ```
12
+
13
+ ### Arguments
14
+
15
+ #### `script`
16
+
17
+ The script to setup. Defaults to `main.rb`.