Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Gem #10

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Ruby Gem

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Rubocop
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: Lint
run: bundle exec rubocop -P
tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
ruby_version: ['2.7', '3.0', '3.1', "3.2"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Ruby 2.6
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true
- name: Run tests
run: bundle exec rspec
13 changes: 13 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require: rubocop-rspec

AllCops:
Exclude:
- "*.gemspec"
- "vendor/bundle/**/*" # https://github.com/rubocop/rubocop/issues/9832#issuecomment-882111229
NewCops: enable

Style/StringLiterals:
EnforcedStyle: double_quotes

RSpec/ExampleLength:
Max: 12
27 changes: 14 additions & 13 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# frozen_string_literal: true

source "http://rubygems.org"
# Add dependencies required to use your gem here.
# Example:
# gem "activesupport", ">= 2.3.5"

# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
gem "rspec", "~> 2.11.0"
gem "rdoc", "~> 3.12"
gem "bundler", "~> 1.3.5"
gem "jeweler", "~> 2.0.1"
gem "simplecov"
gem "socksify"
end
group :development, :test do
gem "bundler", "~> 2.4"
gem "byebug", "~> 11.1"
gem "jeweler", "~> 2.3"
gem "rdoc", "~> 6.5"
gem "rspec", "~> 3.12"
gem "rubocop", "~> 1.53"
gem "rubocop-rspec", "~> 2.22"
gem "simplecov", "~> 0.22.0"
gem "socksify", "~> 1.7"
gem "webmock", "~> 3.13"
end
183 changes: 132 additions & 51 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,64 +1,145 @@
GEM
remote: http://rubygems.org/
specs:
addressable (2.3.6)
builder (3.2.2)
diff-lcs (1.1.3)
faraday (0.7.6)
addressable (~> 2.2)
multipart-post (~> 1.1)
rack (~> 1.1)
git (1.2.6)
github_api (0.4.10)
faraday (~> 0.7.6)
hashie (~> 1.2.0)
multi_json (~> 1.0)
oauth2 (~> 0.5.2)
hashie (1.2.0)
highline (1.6.21)
jeweler (2.0.1)
addressable (2.4.0)
ast (2.4.2)
builder (3.2.4)
byebug (11.1.3)
crack (0.4.5)
rexml
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
diff-lcs (1.5.0)
docile (1.4.0)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
git (1.11.0)
rchardet (~> 1.8)
github_api (0.16.0)
addressable (~> 2.4.0)
descendants_tracker (~> 0.0.4)
faraday (~> 0.8, < 0.10)
hashie (>= 3.4)
mime-types (>= 1.16, < 3.0)
oauth2 (~> 1.0)
hashdiff (1.0.1)
hashie (5.0.0)
highline (2.1.0)
jeweler (2.3.9)
builder
bundler (>= 1.0)
bundler
git (>= 1.2.5)
github_api
github_api (~> 0.16.0)
highline (>= 1.6.15)
nokogiri (>= 1.5.10)
psych
rake
rdoc
json (1.7.3)
mini_portile (0.5.3)
multi_json (1.3.6)
multipart-post (1.2.0)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
oauth2 (0.5.2)
faraday (~> 0.7)
multi_json (~> 1.0)
rack (1.5.2)
rake (10.2.2)
rdoc (3.12)
json (~> 1.4)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.3)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.3)
simplecov (0.6.4)
multi_json (~> 1.0)
simplecov-html (~> 0.5.3)
simplecov-html (0.5.3)
socksify (1.4.1)
semver2
json (2.6.3)
jwt (2.7.1)
language_server-protocol (3.17.0.3)
mime-types (2.99.3)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.3.0)
nokogiri (1.15.2-aarch64-linux)
racc (~> 1.4)
nokogiri (1.15.2-arm64-darwin)
racc (~> 1.4)
nokogiri (1.15.2-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.15.2-x86_64-linux)
racc (~> 1.4)
oauth2 (1.4.8)
faraday (>= 0.8, < 3.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
parallel (1.23.0)
parser (3.2.2.3)
ast (~> 2.4.1)
racc
psych (5.1.0)
stringio
racc (1.7.1)
rack (2.2.7)
rainbow (3.1.1)
rake (13.0.6)
rchardet (1.8.0)
rdoc (6.5.0)
psych (>= 4.0.0)
regexp_parser (2.8.1)
rexml (3.2.5)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
rubocop (1.53.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.3)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.18.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.23.1)
rubocop (~> 1.33)
rubocop-rspec (2.22.0)
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
semver2 (3.4.2)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
socksify (1.7.1)
stringio (3.0.7)
thread_safe (0.3.6)
unicode-display_width (2.4.2)
webmock (3.13.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)

PLATFORMS
ruby
aarch64-linux
arm64-darwin-21
x86_64-darwin-20
x86_64-linux

DEPENDENCIES
bundler (~> 1.3.5)
jeweler (~> 2.0.1)
rdoc (~> 3.12)
rspec (~> 2.11.0)
simplecov
socksify
bundler (~> 2.4)
byebug (~> 11.1)
jeweler (~> 2.3)
rdoc (~> 6.5)
rspec (~> 3.12)
rubocop (~> 1.53)
rubocop-rspec (~> 2.22)
simplecov (~> 0.22.0)
socksify (~> 1.7)
webmock (~> 3.13)

BUNDLED WITH
2.4.9
40 changes: 21 additions & 19 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
# encoding: utf-8
# frozen_string_literal: true

require "rubygems"
require "bundler"
require "rake"
require "jeweler"
require "rspec/core"
require "rspec/core/rake_task"
require "rdoc/task"

require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
warn e.message
warn "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake'

require 'jeweler'
Jeweler::Tasks.new do |gem|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
gem.name = "tor_requests"
Expand All @@ -22,29 +26,27 @@ Jeweler::Tasks.new do |gem|
gem.email = "[email protected]"
gem.authors = ["Bruno Ghisi"]
# dependencies defined in Gemfile
gem.add_dependency 'socksify'
gem.add_dependency "socksify"
end

Jeweler::RubygemsDotOrgTasks.new

require 'rspec/core'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = FileList['spec/**/*_spec.rb']
spec.pattern = FileList["spec/**/*_spec.rb"]
end

RSpec::Core::RakeTask.new(:rcov) do |spec|
spec.pattern = 'spec/**/*_spec.rb'
spec.pattern = "spec/**/*_spec.rb"
spec.rcov = true
end

task :default => :spec

require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
version = File.exist?("VERSION") ? File.read("VERSION") : ""

rdoc.rdoc_dir = 'rdoc'
rdoc.rdoc_dir = "rdoc"
rdoc.title = "tor_requests #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
rdoc.rdoc_files.include("README*")
rdoc.rdoc_files.include("lib/**/*.rb")
end

task default: :spec
21 changes: 9 additions & 12 deletions lib/tor/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
require 'net/http'
require 'socksify/http'
# frozen_string_literal: true

module Tor
require "net/http"
require "socksify/http"

module Tor
# This class wraps a Tor client configuration
class Configuration

attr_accessor :ip,
:port

attr_accessor :ip, :port
attr_reader :headers

def add_header(header, value)
@headers[header] = value
end

def initialize
@ip = '127.0.0.1'
@port = 9050
@headers = Hash.new
@ip = "127.0.0.1"
@port = 9050
@headers = {}
end

end

end
Loading