Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Steepfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ target :lib do

# ignore "lib/templates/*.rb"

configure_code_diagnostics(D::Ruby.default) # `default` diagnostics setting (applies by default)
#configure_code_diagnostics(D::Ruby.default) # `default` diagnostics setting (applies by default)
# configure_code_diagnostics(D::Ruby.strict) # `strict` diagnostics setting
# configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting
configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting
# configure_code_diagnostics(D::Ruby.silent) # `silent` diagnostics setting
# configure_code_diagnostics do |hash| # You can setup everything yourself
# # Apparently UnsafeSpec metaprograms too hard and confuses it.
Expand Down
2 changes: 1 addition & 1 deletion lib/jim/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def sign_in(username, password, otp=nil)

puts "Please choose which scopes you want your API key to have:"
scopes.each do |k, v|
scopes[k] = prompt_yesno(k, default_to_yes: scopes[k])
scopes[k] = prompt_yesno(k.to_s, default_to_yes: scopes[k])
end

name = "jim--#{Etc.uname[:nodename]}-#{Etc.getlogin}-#{DateTime.now.strftime('%Y-%m-%dT%H%M%S')}"
Expand Down
4 changes: 2 additions & 2 deletions lib/jim/console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Console
@always_default = false

def prompt(msg, default=nil, noecho: false)
return default if always_default
return default if @always_default

print "#{msg}: "

Expand All @@ -16,7 +16,7 @@ def prompt(msg, default=nil, noecho: false)
end

def prompt_yesno(msg, default_to_yes: false)
return default_to_yes if always_default
return default_to_yes if @always_default

yesno = (default_to_yes ? "Y/n" : "y/N")

Expand Down
2 changes: 1 addition & 1 deletion lib/jim/tar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def add_file_path(path, **opts)
Dir[File.join(path, '**', '*.rb')].map { |p|
add_file_path(p, **opts)
}
return
return self
end

File.open(path, 'rb') { |f|
Expand Down
24 changes: 23 additions & 1 deletion sig/jim.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ end

module Jim
class Client
include Jim::Console
@base_uri: String

def initialize: (String base_uri) -> void
Expand All @@ -24,6 +25,7 @@ module Jim
private
def get: (String endpoint, **untyped kwargs) -> untyped
def post: (String endpoint, **untyped kwargs) -> untyped
def create_api_key: (untyped headers, untyped form_data, String username, String password) -> untyped
end
end

Expand All @@ -34,6 +36,8 @@ module Jim

def self.run: () -> untyped

def self.pack: (*String args) -> (String | nil)

def self.config: (untyped command, untyped setting, ?untyped? value) -> untyped

# Sign in to the specified gem server.
Expand All @@ -57,6 +61,8 @@ module Jim
def self.help_text: (untyped prefix, untyped method_name, ?summary: bool) -> ::Array[::String | untyped]

def self.subcommand_summaries: (untyped prefix, untyped methods) -> untyped

def self.load_spec_or_abort!: (?String spec) -> ::Jim::UnsafeSpec
end
end

Expand All @@ -73,6 +79,9 @@ module Jim
CONFIG_FILE: String
KEY_FILE: String

def self.config_dir: () -> String
def self.config_file: () -> String
def self.key_file: () -> String
def self.save_api_key: (untyped name, untyped server, untyped key, untyped scopes, untyped needs_mfa) -> untyped
def self.api_key: () -> untyped
def self.load_api_key: () -> untyped
Expand All @@ -84,7 +93,8 @@ end

module Jim
module Console
def prompt: (untyped msg, ?untyped? default, ?noecho: bool) -> untyped
def prompt: (untyped msg, ?String default, ?noecho: bool) -> String
def prompt_yesno: (String msg, ?default_to_yes: bool) -> bool
end
end

Expand All @@ -98,6 +108,16 @@ module Net
end
end

module Jim
module GithubApiHelpers
self.@token: untyped
def api_req: (untyped endpoint, untyped data, untyped headers, untyped server, untyped method) -> untyped
def api_post: (untyped endpoint, untyped data, ?untyped headers, ?untyped server) -> untyped
def api_get: (untyped endpoint, ?untyped headers, ?untyped server) -> untyped
def api_patch: (untyped endpoint, untyped data, ?untyped headers, ?untyped server) -> untyped
end
end

module Jim
module HTTP
class RedirectLimitError < StandardError
Expand All @@ -110,6 +130,8 @@ module Jim

def self.post: (untyped url, ?data: untyped?, ?form_data: untyped?, ?headers: ::Hash[untyped, untyped], ?basic_auth: untyped?) -> untyped

def self.patch: (untyped url, ?data: untyped?, ?headers: ::Hash[untyped, untyped], ?basic_auth: untyped?) -> untyped

# Helper method for actually creating a request.
#
# @param http_method [Symbol] A symbol representing the class name for
Expand Down