Skip to content

Commit

Permalink
Merge pull request #4 from kyledecot/kd-rubocop
Browse files Browse the repository at this point in the history
Adds Rubocop
  • Loading branch information
Kyle Decot authored Jun 21, 2019
2 parents 99ade52 + 7cb2375 commit 3247478
Show file tree
Hide file tree
Showing 23 changed files with 222 additions and 145 deletions.
19 changes: 19 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# The behavior of RuboCop can be controlled via the .rubocop.yml
# configuration file. It makes it possible to enable/disable
# certain cops (checks) and to alter their behavior if they accept
# any parameters. The file can be placed either in your home
# directory or in some project directory.
#
# RuboCop will start looking for the configuration file in the directory
# where the inspected file is and continue its way up to the root directory.
#
# See https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md
#
Style/Documentation:
Enabled: false

Metrics/LineLength:
Enabled: false

Style/StructInheritance:
Enabled: false
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ cache: bundler
rvm:
- 2.5.1
before_install: gem install bundler -v 2.0.1

script:
- bundle exec rspec
- bundle exec rubocop
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
source "https://rubygems.org"
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec
16 changes: 16 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ GEM
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
ast (2.4.0)
coderay (1.1.2)
concurrent-ruby (1.1.5)
diff-lcs (1.3)
Expand All @@ -26,16 +27,21 @@ GEM
multi_xml (>= 0.5.2)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
jaro_winkler (1.5.3)
jwt (2.2.1)
method_source (0.9.2)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.0331)
minitest (5.11.3)
multi_xml (0.6.0)
parallel (1.17.0)
parser (2.6.3.0)
ast (~> 2.4.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
rainbow (3.0.0)
rake (10.5.0)
rspec (3.8.0)
rspec-core (~> 3.8.0)
Expand All @@ -50,9 +56,18 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rubocop (0.71.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.6)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
ruby-progressbar (1.10.1)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.6.0)

PLATFORMS
ruby
Expand All @@ -64,6 +79,7 @@ DEPENDENCIES
pry (~> 0.12)
rake (~> 10.0)
rspec (~> 3.0)
rubocop (~> 0.71.0)

BUNDLED WITH
2.0.2
6 changes: 4 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"
# frozen_string_literal: true

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

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

Expand Down
42 changes: 22 additions & 20 deletions app_store_connect.gemspec
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
# frozen_string_literal: true

lib = File.expand_path("../lib", __FILE__)
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "app_store_connect/version"
require 'app_store_connect/version'

Gem::Specification.new do |spec|
spec.name = "app_store_connect"
spec.name = 'app_store_connect'
spec.version = AppStoreConnect::VERSION
spec.authors = ["Kyle Decot"]
spec.email = ["kyle.decot@icloud.com"]
spec.authors = ['Kyle Decot']
spec.email = ['kyle.decot@icloud.com']

spec.summary = %q{Write a short summary, because RubyGems requires one.}
spec.summary = 'Write a short summary, because RubyGems requires one.'
# spec.description = %q{TODO: Write a longer description or delete this line.}
spec.homepage = "https://github.com/kyledecot/app_store_connect"
spec.license = "MIT"
spec.homepage = 'https://github.com/kyledecot/app_store_connect'
spec.license = 'MIT'

spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
spec.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end

spec.bindir = "exe"
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.require_paths = ['lib']

spec.add_runtime_dependency "httparty", "~> 0.16"
spec.add_runtime_dependency "jwt", "~> 2.1"
spec.add_runtime_dependency "gli", "~> 2.17"
spec.add_runtime_dependency "activesupport", "~> 5.2.3"
spec.add_runtime_dependency 'activesupport', '~> 5.2.3'
spec.add_runtime_dependency 'gli', '~> 2.17'
spec.add_runtime_dependency 'httparty', '~> 0.16'
spec.add_runtime_dependency 'jwt', '~> 2.1'

spec.add_development_dependency "bundler", "~> 2.0"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "pry", "~> 0.12"
spec.add_development_dependency "factory_bot", "~> 5.0.2"
spec.add_development_dependency 'bundler', '~> 2.0'
spec.add_development_dependency 'factory_bot', '~> 5.0.2'
spec.add_development_dependency 'pry', '~> 0.12'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rubocop', '~> 0.71.0'
end
7 changes: 4 additions & 3 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "app_store_connect"
require "pry"
require 'bundler/setup'
require 'app_store_connect'
require 'pry'

Pry.start
1 change: 1 addition & 0 deletions exe/app_store_connect
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#! /usr/bin/env ruby
# frozen_string_literal: true

require 'app_store_connect'

Expand Down
18 changes: 10 additions & 8 deletions lib/app_store_connect.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
require "jwt"
require "httparty"
# frozen_string_literal: true

require "app_store_connect/authorization"
require "app_store_connect/client"
require "app_store_connect/cli"
require "app_store_connect/bundle_id_create_request"
require "app_store_connect/user_invitation_create_request"
require "app_store_connect/version"
require 'jwt'
require 'httparty'

require 'app_store_connect/authorization'
require 'app_store_connect/client'
require 'app_store_connect/cli'
require 'app_store_connect/bundle_id_create_request'
require 'app_store_connect/user_invitation_create_request'
require 'app_store_connect/version'

module AppStoreConnect
end
6 changes: 4 additions & 2 deletions lib/app_store_connect/authorization.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

module AppStoreConnect
class Authorization
AUDIENCE = "appstoreconnect-v1"
AUDIENCE = 'appstoreconnect-v1'

def initialize(key_id:, issuer_id:, private_key_path:)
@key_id = key_id
Expand All @@ -17,7 +19,7 @@ def payload
end

def token
JWT.encode(payload, private_key, "ES256", kid: @key_id)
JWT.encode(payload, private_key, 'ES256', kid: @key_id)
end

def private_key
Expand Down
14 changes: 8 additions & 6 deletions lib/app_store_connect/bundle_id_create_request.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
require_relative "./bundle_id_create_request/data"
# frozen_string_literal: true

require_relative './bundle_id_create_request/data'

module AppStoreConnect
class BundleIdCreateRequest
attr_reader :data

def initialize(*args)
@data = Data.new(*args)
end
end

def to_hash
def to_hash
{
data: data.to_hash
}
end
end
end
end
end
end
26 changes: 14 additions & 12 deletions lib/app_store_connect/bundle_id_create_request/data.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
require_relative "./data/attributes"
# frozen_string_literal: true

require_relative './data/attributes'

module AppStoreConnect
class BundleIdCreateRequest
class Data
TYPE = "bundleIds"
class Data
TYPE = 'bundleIds'

attr_reader :attributes

def initialize(*args)
@attributes = Attributes.new(*args)
end
end

def type
def type
TYPE
end
end

def to_hash
{
attributes: attributes.to_hash,
type: type
}
end
{
attributes: attributes.to_hash,
type: type
}
end
end
end
end
end
24 changes: 13 additions & 11 deletions lib/app_store_connect/bundle_id_create_request/data/attributes.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
# frozen_string_literal: true

module AppStoreConnect
class BundleIdCreateRequest
class Data
class BundleIdCreateRequest
class Data
class Attributes
attr_accessor :identifier, :name, :platform, :seed_id

def initialize(identifier:, name:, platform:, seed_id:)
self.identifier = identifier
self.name = name
self.platform = platform
self.seed_id = seed_id
end
end

def to_hash
{
identifier: identifier,
name: name,
name: name,
platform: platform,
seed_id: seed_id
}
end
end
end
end
end
end
end
end
end
end
Loading

0 comments on commit 3247478

Please sign in to comment.