Skip to content

Commit

Permalink
Back to single quoted strings
Browse files Browse the repository at this point in the history
  • Loading branch information
bougyman committed Jan 26, 2024
1 parent 02d99ce commit 220b961
Show file tree
Hide file tree
Showing 20 changed files with 85 additions and 85 deletions.
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ require:
- rubocop-rspec

AllCops:
TargetRubyVersion: 3.3.0
TargetRubyVersion: 3.2.0
NewCops: enable

Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes
EnforcedStyle: single_quotes

Style/StringLiteralsInInterpolation:
Enabled: true
Expand Down
20 changes: 10 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# frozen_string_literal: true

source "https://rubygems.org"
source 'https://rubygems.org'

# Specify your gem's dependencies in linear-cli.gemspec
gemspec

group :development, :test do
gem "aruba", "~> 2.2"
gem "cucumber", "~> 9.1"
gem "gem-release", "~> 2.2"
gem "pry-byebug"
gem "rake", "~> 13.0"
gem "rspec", "~> 3.0"
gem "rubocop", "~> 1.21"
gem "rubocop-rake", require: false
gem "rubocop-rspec", require: false
gem 'aruba', '~> 2.2'
gem 'cucumber', '~> 9.1'
gem 'gem-release', '~> 2.2'
gem 'pry-byebug'
gem 'rake', '~> 13.0'
gem 'rspec', '~> 3.0'
gem 'rubocop', '~> 1.21'
gem 'rubocop-rake', require: false
gem 'rubocop-rspec', require: false
end
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

require "rubocop/rake_task"
require 'rubocop/rake_task'

RuboCop::RakeTask.new

Expand Down
6 changes: 3 additions & 3 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "pry"
require "linear"
require 'bundler/setup'
require 'pry'
require 'linear'

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
Expand Down
2 changes: 1 addition & 1 deletion exe/lc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "linear"
require 'linear'
Rubyists::Linear::L :cli
Dry::CLI.new(Rubyists::Linear::CLI).call
2 changes: 1 addition & 1 deletion features/support/setup.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# frozen_string_literal: true

require "aruba/cucumber"
require 'aruba/cucumber'
8 changes: 4 additions & 4 deletions lib/linear.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require "pathname"
require "semantic_logger"
require 'pathname'
require 'semantic_logger'
SemanticLogger.default_level = :info
SemanticLogger.add_appender(io: $stderr, formatter: :color)

Expand All @@ -17,7 +17,7 @@ module Rubyists
module Linear
include SemanticLogger::Loggable
# rubocop:disable Layout/SpaceAroundOperators
ROOT = (Pathname(__FILE__)/"../..").expand_path
ROOT = (Pathname(__FILE__)/'../..').expand_path
LIBROOT = ROOT/:lib/:linear
MODEL_ROOT = ROOT/:lib/:linear/:models
SPEC_ROOT = ROOT/:spec
Expand All @@ -42,7 +42,7 @@ def self.verbosity
def self.verbosity=(debug)
return verbosity unless debug

logger.warn "Debug level should be between 0 and 3" unless debug.between?(0, 3)
logger.warn 'Debug level should be between 0 and 3' unless debug.between?(0, 3)
@verbosity = debug
level = @verbosity > (DEBUG_LEVELS.size - 1) ? :trace : DEBUG_LEVELS[@verbosity]
SemanticLogger.default_level = level
Expand Down
14 changes: 7 additions & 7 deletions lib/linear/api.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# frozen_string_literal: true

require "httpx"
require "semantic_logger"
require 'httpx'
require 'semantic_logger'

module Rubyists
module Linear
# Responsible for making requests to the Linear API
class GraphApi
include SemanticLogger::Loggable
BASE_URI = "https://api.linear.app/graphql"
BASE_URI = 'https://api.linear.app/graphql'
RETRY_AFTER = lambda do |*|
@retries ||= 0
@retries += 1
Expand All @@ -25,13 +25,13 @@ def session

def headers
@headers ||= {
"Content-Type" => "application/json",
"Authorization" => api_key
'Content-Type' => 'application/json',
'Authorization' => api_key
}
end

def query(query)
gql = format('{ "query": "%s" }', query.to_s.gsub("\n", "").gsub('"', '\"'))
gql = format('{ "query": "%s" }', query.to_s.gsub("\n", '').gsub('"', '\"'))

res = session.post(BASE_URI, body: gql)
raise SmellsBad, "Bad Response from #{BASE_URI}: #{res}" if res.error
Expand All @@ -43,7 +43,7 @@ def query(query)
end

def api_key
@api_key ||= ENV.fetch("LINEAR_API_KEY")
@api_key ||= ENV.fetch('LINEAR_API_KEY')
end
end
Api = Rubyists::Linear::GraphApi.new
Expand Down
18 changes: 9 additions & 9 deletions lib/linear/cli.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# frozen_string_literal: true

require "dry/cli"
require "dry/cli/completion/command"
require "neatjson"
require_relative "../linear"
require 'dry/cli'
require 'dry/cli/completion/command'
require 'neatjson'
require_relative '../linear'

# The Rubyists module is the top-level namespace for all Rubyists projects
module Rubyists
Expand All @@ -16,13 +16,13 @@ module CLI
module CommonOptions
def self.included(mod)
mod.instance_eval do
option :output, type: :string, default: "text", values: %w[text json], desc: "Output format"
option :debug, type: :integer, default: 0, desc: "Debug level"
option :output, type: :string, default: 'text', values: %w[text json], desc: 'Output format'
option :debug, type: :integer, default: 0, desc: 'Debug level'
end
end

def display(subject, options)
return puts(JSON.neat_generate(subject)) if options[:output] == "json"
return puts(JSON.neat_generate(subject)) if options[:output] == 'json'
return subject.each(&:display) if subject.respond_to?(:each)
unless subject.respond_to?(:display)
raise SmellsBad, "Cannot display #{subject}, there is no #display method and it is not a collection"
Expand Down Expand Up @@ -57,14 +57,14 @@ def self.prepended(_mod) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
end

# Load all our commands
Pathname.new(__FILE__).dirname.join("commands").glob("*.rb").each do |file|
Pathname.new(__FILE__).dirname.join('commands').glob('*.rb').each do |file|
require file.expand_path
end

module Linear
# Open this back up to register commands
module CLI
register "completion", Dry::CLI::Completion::Command[self]
register 'completion', Dry::CLI::Completion::Command[self]
end
end
end
2 changes: 1 addition & 1 deletion lib/linear/cli/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Rubyists
module Linear
VERSION = "0.1.7"
VERSION = '0.1.7'
end
end
2 changes: 1 addition & 1 deletion lib/linear/commands/issue.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

Pathname.new(__FILE__).dirname.join("issue").glob("*.rb").each do |file|
Pathname.new(__FILE__).dirname.join('issue').glob('*.rb').each do |file|
require file.expand_path
end
10 changes: 5 additions & 5 deletions lib/linear/commands/issue/list.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "semantic_logger"
require 'semantic_logger'

module Rubyists
# Namespace for Linear
Expand All @@ -16,10 +16,10 @@ class List
include SemanticLogger::Loggable
include Rubyists::Linear::CLI::CommonOptions

option :mine, type: :boolean, default: true, desc: "Only show my issues"
option :mine, type: :boolean, default: true, desc: 'Only show my issues'

def call(**options)
logger.debug "Listing issues"
logger.debug 'Listing issues'
display issues_for(options), options
end

Expand All @@ -32,8 +32,8 @@ def issues_for(options)
prepend Rubyists::Linear::CLI::Caller
end
end
register "issue", aliases: %w[i] do |issue|
issue.register "ls", Issue::List
register 'issue', aliases: %w[i] do |issue|
issue.register 'ls', Issue::List
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/linear/commands/whoami.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "semantic_logger"
require 'semantic_logger'

module Rubyists
# Namespace for Linear
Expand All @@ -15,13 +15,13 @@ class WhoAmI
include Rubyists::Linear::CLI::CommonOptions

def call(**options)
logger.debug "Getting user info"
logger.debug 'Getting user info'
display Rubyists::Linear::User.me, options
end

prepend Rubyists::Linear::CLI::Caller
end
register "whoami", WhoAmI
register 'whoami', WhoAmI
end
end
end
4 changes: 2 additions & 2 deletions lib/linear/fragments.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# frozen_string_literal: true

require "gqli"
require 'gqli'

module Rubyists
module Linear
# Reusable fragments
module Fragments
extend GQLi::DSL
PageInfo = fragment("PageInfo", "PageInfo") do
PageInfo = fragment('PageInfo', 'PageInfo') do
pageInfo do
hasNextPage
endCursor
Expand Down
4 changes: 2 additions & 2 deletions lib/linear/models/issue.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "gqli"
require 'gqli'

module Rubyists
# Namespace for Linear
Expand All @@ -15,7 +15,7 @@ class Issue

BASIC_FILTER = { completedAt: { null: true } }.freeze

Base = fragment("BaseIssue", "Issue") do
Base = fragment('BaseIssue', 'Issue') do
id
identifier
title
Expand Down
4 changes: 2 additions & 2 deletions lib/linear/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "gqli"
require 'gqli'

module Rubyists
# Namespace for Linear
Expand All @@ -12,7 +12,7 @@ class User
include GQLi::DSL
include SemanticLogger::Loggable

Base = fragment("BaseUser", "User") do
Base = fragment('BaseUser', 'User') do
id
name
email
Expand Down
46 changes: 23 additions & 23 deletions linear-cli.gemspec
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# frozen_string_literal: true

require_relative "lib/linear"
require_relative 'lib/linear'

Gem::Specification.new do |spec|
spec.name = "linear-cli"
spec.name = 'linear-cli'
spec.version = Rubyists::Linear::VERSION
spec.authors = ["Tj (bougyman) Vanderpoel"]
spec.email = ["[email protected]"]
spec.authors = ['Tj (bougyman) Vanderpoel']
spec.email = ['[email protected]']

spec.summary = "CLI for interacting with Linear.app."
spec.description = "A CLI for interacting with Linear.app. Loosely based on the GitHub CLI"
spec.homepage = "https://github.com/rubyists/linear-cli"
spec.required_ruby_version = ">= 3.3.0"
spec.summary = 'CLI for interacting with Linear.app.'
spec.description = 'A CLI for interacting with Linear.app. Loosely based on the GitHub CLI'
spec.homepage = 'https://github.com/rubyists/linear-cli'
spec.required_ruby_version = '>= 3.2.0'

spec.license = "MIT"
spec.metadata["allowed_push_host"] = "https://rubygems.org"
spec.license = 'MIT'
spec.metadata['allowed_push_host'] = 'https://rubygems.org'

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = spec.homepage
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = spec.homepage
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/master/CHANGELOG.md"

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
Expand All @@ -28,20 +28,20 @@ Gem::Specification.new do |spec|
f.start_with?(*%w[pkg/ bin/ test/ spec/ features/ .git .github appveyor .rspec .rubocop cucumber.yml Gemfile])
end
end
spec.bindir = "exe"
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.require_paths = ['lib']

# Uncomment to register a new dependency of your gem
spec.add_dependency "base64"
spec.add_dependency "dry-cli", "~> 1.0"
spec.add_dependency "dry-cli-completion", "~> 1.0"
spec.add_dependency "gqli", "~> 1.2"
spec.add_dependency "httpx", "~> 1.2"
spec.add_dependency "neatjson"
spec.add_dependency "semantic_logger", "~> 4.0"
spec.add_dependency 'base64'
spec.add_dependency 'dry-cli', '~> 1.0'
spec.add_dependency 'dry-cli-completion', '~> 1.0'
spec.add_dependency 'gqli', '~> 1.2'
spec.add_dependency 'httpx', '~> 1.2'
spec.add_dependency 'neatjson'
spec.add_dependency 'semantic_logger', '~> 4.0'

# For more information and examples about making a new gem, check out our
# guide at: https://bundler.io/guides/creating_gem.html
spec.metadata["rubygems_mfa_required"] = "true"
spec.metadata['rubygems_mfa_required'] = 'true'
end
2 changes: 1 addition & 1 deletion spec/helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# frozen_string_literal: true

require_relative "../lib/linear"
require_relative '../lib/linear'
Loading

0 comments on commit 220b961

Please sign in to comment.