repo_name
stringlengths 6
97
| path
stringlengths 3
341
| text
stringlengths 8
1.02M
|
|---|---|---|
MortarStone/planning_center_online-ruby
|
examples/helpers/addresses.rb
|
<gh_stars>0
# frozen_string_literal: true
def print_addresses(list)
print_list('address', 'id', list)
end
def print_address(item)
print_item('address', item)
end
def address_columns
%w[
id
street
city
state
zip
location
primary
]
end
|
MortarStone/planning_center_online-ruby
|
lib/planning_center/endpoints/addresses.rb
|
# frozen_string_literal: true
module PlanningCenter
module Endpoints
module Addresses
def address(id, params = {})
get(
"people/v2/addresses/#{id}",
params
)
end
def addresses(params = {})
# We need to order the addresses by a value (created_at being the default),
# because the results are not consistently ordered without it.
get(
'people/v2/addresses',
{ order: :created_at }.merge(params)
)
end
end
end
end
|
MortarStone/planning_center_online-ruby
|
lib/planning_center/version.rb
|
<reponame>MortarStone/planning_center_online-ruby
# frozen_string_literal: true
module PlanningCenter
VERSION = '0.0.1'
end
|
MortarStone/planning_center_online-ruby
|
lib/planning_center/auto_load.rb
|
# frozen_string_literal: true
require 'faraday'
require 'json'
require_relative 'endpoints/addresses'
require_relative 'endpoints/campuses'
require_relative 'endpoints/designation_refunds'
require_relative 'endpoints/donations'
require_relative 'endpoints/emails'
require_relative 'endpoints/funds'
require_relative 'endpoints/households'
require_relative 'endpoints/inactive_reasons'
require_relative 'endpoints/marital_statuses'
require_relative 'endpoints/name_suffixes'
require_relative 'endpoints/people'
require_relative 'endpoints/phone_numbers'
require_relative 'endpoints/pledge_campaigns'
require_relative 'endpoints/pledges'
require_relative 'endpoints/recurring_donation_designations'
require_relative 'endpoints/recurring_donations'
require_relative 'endpoints/refunds'
require_relative 'request_formatter'
require_relative 'response_handler'
|
MortarStone/planning_center_online-ruby
|
lib/planning_center/endpoints/marital_statuses.rb
|
<gh_stars>0
# frozen_string_literal: true
module PlanningCenter
module Endpoints
module MaritalStatuses
def marital_status(id, params = {})
get(
"people/v2/marital_statuses/#{id}",
params
)
end
def marital_statuses(params = {})
get(
'people/v2/marital_statuses',
params
)
end
end
end
end
|
MortarStone/planning_center_online-ruby
|
examples/name_suffix.rb
|
# frozen_string_literal: true
require_relative 'helper'
name_suffix = @client.name_suffix(296_925)
print_name_suffix(name_suffix)
|
MortarStone/planning_center_online-ruby
|
lib/planning_center/endpoints/people.rb
|
# frozen_string_literal: true
module PlanningCenter
module Endpoints
module People
def person(id, params = {})
get(
"people/v2/people/#{id}",
params
)
end
def people(params = {})
# We need to order the people by a value (created_at being the default),
# because the results are not consistently ordered without it.
get(
'people/v2/people',
{ order: :created_at }.merge(params)
)
end
end
end
end
|
MortarStone/planning_center_online-ruby
|
examples/recurring_donation.rb
|
<gh_stars>0
# frozen_string_literal: true
require_relative 'helper'
recurring_donation = @client.recurring_donation(362_440)
print_recurring_donation(recurring_donation)
|
MortarStone/planning_center_online-ruby
|
examples/donations.rb
|
<gh_stars>0
# frozen_string_literal: true
require_relative 'helper'
donations = @client.donations
print_donations(donations)
|
MortarStone/planning_center_online-ruby
|
examples/helpers/funds.rb
|
# frozen_string_literal: true
def print_funds(list)
print_list('fund', 'id', list)
end
def print_fund(item)
print_item('fund', item)
end
def fund_columns
%w[
id
name
]
end
|
MortarStone/planning_center_online-ruby
|
examples/marital_statuses.rb
|
# frozen_string_literal: true
require_relative 'helper'
marital_statuses = @client.marital_statuses
print_marital_statuses(marital_statuses)
|
MortarStone/planning_center_online-ruby
|
spec/planning_center/endpoints/name_suffixes_spec.rb
|
<reponame>MortarStone/planning_center_online-ruby<filename>spec/planning_center/endpoints/name_suffixes_spec.rb
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe PlanningCenter::Endpoints::NameSuffixes do
let!(:client) { FactoryBot.build(:client) }
describe '#name_suffixes', :vcr do
before do
@name_suffixes = client.name_suffixes(per_page: 25)
end
it 'returns an array' do
expect(@name_suffixes['data']).to be_an(Array)
end
it 'returns the correct number of objects' do
expect(@name_suffixes['data'].count).to eq 5
end
it 'returns name_suffixes objects' do
expect(@name_suffixes['data'].first).to be_a(Hash)
expect(@name_suffixes['data'].first['id']).to_not be_nil
end
end
describe '#name_suffix', :vcr do
before do
@name_suffix = client.name_suffix(296_925)
end
it 'returns a name_suffix object' do
expect(@name_suffix).to be_a(Hash)
expect(@name_suffix['data']['id']).to eq('296925')
end
end
end
|
MortarStone/planning_center_online-ruby
|
spec/planning_center/endpoints/refunds_spec.rb
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe PlanningCenter::Endpoints::Refunds do
let!(:client) { FactoryBot.build(:client) }
describe '#refund', :vcr do
before do
@refund = client.refund(53_134_447)
end
it 'returns a refund object' do
expect(@refund).to be_a(Hash)
expect(@refund['data']['id']).to eq('27505')
end
end
end
|
MortarStone/planning_center_online-ruby
|
examples/emails.rb
|
# frozen_string_literal: true
require_relative 'helper'
emails = @client.emails
print_emails(emails)
|
MortarStone/planning_center_online-ruby
|
examples/helpers/pledge_campaigns.rb
|
# frozen_string_literal: true
def print_pledge_campaigns(list)
print_list('pledge_campaign', 'id', list)
end
def print_pledge_campaign(item)
print_item('pledge_campaign', item)
end
def pledge_campaign_columns
%w[
id
amount_cents
]
end
|
MortarStone/planning_center_online-ruby
|
examples/phone_number.rb
|
# frozen_string_literal: true
require_relative 'helper'
phone_number = @client.phone_number(2_669_139, 60_503_519)
print_phone_number(phone_number)
|
MortarStone/planning_center_online-ruby
|
lib/planning_center/endpoints/inactive_reasons.rb
|
# frozen_string_literal: true
module PlanningCenter
module Endpoints
module InactiveReasons
def inactive_reason(id, params = {})
get(
"people/v2/inactive_reasons/#{id}",
params
)
end
def inactive_reasons(params = {})
get(
'people/v2/inactive_reasons',
params
)
end
end
end
end
|
MortarStone/planning_center_online-ruby
|
examples/phone_numbers.rb
|
<filename>examples/phone_numbers.rb
# frozen_string_literal: true
require_relative 'helper'
phone_numbers = @client.phone_numbers(2_669_139)
print_phone_numbers(phone_numbers)
|
MortarStone/planning_center_online-ruby
|
lib/planning_center/endpoints/phone_numbers.rb
|
<gh_stars>0
# frozen_string_literal: true
module PlanningCenter
module Endpoints
module PhoneNumbers
def phone_number(person_id, id, params = {})
get(
"people/v2/people/#{person_id}/phone_numbers/#{id}",
params
)
end
def phone_numbers(person_id, params = {})
# We need to order the phone_numbers by a value (created_at being the default),
# because the results are not consistently ordered without it.
get(
"people/v2/people/#{person_id}/phone_numbers",
{ order: :created_at }.merge(params)
)
end
end
end
end
|
MortarStone/planning_center_online-ruby
|
examples/name_suffixes.rb
|
# frozen_string_literal: true
require_relative 'helper'
name_suffixes = @client.name_suffixes
print_name_suffixes(name_suffixes)
|
MortarStone/planning_center_online-ruby
|
examples/people.rb
|
# frozen_string_literal: true
require_relative 'helper'
people = @client.people(
include: %w[
households
marital_status
emails
phone_numbers
inactive_reason
addresses
name_suffix
]
)
print_people(people)
|
MortarStone/planning_center_online-ruby
|
examples/inactive_reasons.rb
|
<filename>examples/inactive_reasons.rb
# frozen_string_literal: true
require_relative 'helper'
inactive_reasons = @client.inactive_reasons
print_inactive_reasons(inactive_reasons)
|
MortarStone/planning_center_online-ruby
|
examples/helper.rb
|
# frozen_string_literal: true
require 'pry'
require 'active_support/inflector'
require_relative '../lib/planning_center'
require_relative 'helpers/addresses'
require_relative 'helpers/campuses'
require_relative 'helpers/designation_refunds'
require_relative 'helpers/donations'
require_relative 'helpers/emails'
require_relative 'helpers/funds'
require_relative 'helpers/households'
require_relative 'helpers/inactive_reasons'
require_relative 'helpers/marital_statuses'
require_relative 'helpers/name_suffixes'
require_relative 'helpers/people'
require_relative 'helpers/phone_numbers'
require_relative 'helpers/pledges'
require_relative 'helpers/pledge_campaigns'
require_relative 'helpers/recurring_donation_designations'
require_relative 'helpers/recurring_donations'
require_relative 'helpers/refunds'
require 'dotenv'
Dotenv.load('../.env')
@client = PlanningCenter::Client.new(
access_token: ENV['ACCESS_TOKEN']
)
def print_list(object_name, pk_id_name, response)
list = response['data']
if list.blank?
puts 'Nothing found'
else
headers = column_headers(object_name)
puts "There were #{list.count} #{object_name.pluralize} found"
puts
puts print_column_headers(headers)
list.each_with_index do |item, index|
print_row(index, item, headers)
end
puts
print_duplicates(pk_id_name, list)
end
end
def column_headers(object_name)
send("#{object_name}_columns")
end
def print_column_headers(headers)
headers = [:index] + headers
puts headers.join(' :: ')
end
def print_row(index, item, column_headers)
cells = [index]
column_headers.each do |header|
value = header == 'id' ? item[header] : item['attributes'][header]
# value = value.to_digits if value.class == BigDecimal
cells << value
end
puts cells.join(' :: ')
end
def print_item(object_name, response)
item = response['data']
puts
if item.nil?
puts 'Item not found'
else
column_headers(object_name).each do |header|
value = header == 'id' ? item[header] : item['attributes'][header]
# value = value.to_digits if value.class == BigDecimal
puts "#{header}: #{value}"
end
end
end
def print_duplicates(pk_id_name, list)
counts = {}
list.each do |item|
id = item[pk_id_name]
counts[id] ||= 0
counts[id] += 1
end
duplicates = counts.select { |_key, value| value > 1 }.keys - [nil]
puts "There are #{duplicates.count} duplicates: #{duplicates.inspect}"
end
|
MortarStone/planning_center_online-ruby
|
lib/planning_center.rb
|
<reponame>MortarStone/planning_center_online-ruby
# frozen_string_literal: true
require_relative 'planning_center/client'
require_relative 'planning_center/exceptions'
require_relative 'planning_center/version'
module PlanningCenter
end
|
MortarStone/planning_center_online-ruby
|
examples/campus.rb
|
# frozen_string_literal: true
require_relative 'helper'
campus = @client.campus(44_710)
print_campus(campus)
|
MortarStone/planning_center_online-ruby
|
examples/helpers/people.rb
|
# frozen_string_literal: true
def print_people(list)
print_list('person', 'id', list)
end
def print_person(item)
print_item('person', item)
end
def person_columns
%w[
id
first_name
last_name
]
end
|
MortarStone/planning_center_online-ruby
|
lib/planning_center/response_handler.rb
|
# frozen_string_literal: true
module PlanningCenter
class ResponseHandler
attr_accessor :response
def initialize(response:)
@response = response
end
def call
handle_response
end
private
def handle_response
case response.status
when 200..299
format_response
when 400
raise PlanningCenter::Exceptions::BadRequest, response
when 401
raise PlanningCenter::Exceptions::Unauthorized, response
when 403
raise PlanningCenter::Exceptions::Forbidden, response
when 404
raise PlanningCenter::Exceptions::NotFound, response
when 405
raise PlanningCenter::Exceptions::MethodNotAllowed, response
when 422
raise PlanningCenter::Exceptions::UnprocessableEntity, response
when 429
raise PlanningCenter::Exceptions::TooManyRequests, response
when 400..499
raise PlanningCenter::Exceptions::ClientError, response
when 500
raise PlanningCenter::Exceptions::InternalServerError, response
when 500..599
raise PlanningCenter::Exceptions::ServerError, response
else
raise "unknown status #{response.status}"
end
end
def format_response
results = JSON.parse(response.body)
results['headers'] = response.headers
results
end
end
end
|
MortarStone/planning_center_online-ruby
|
examples/donation.rb
|
# frozen_string_literal: true
require_relative 'helper'
donation = @client.donation(46_653_783)
print_donation(donation)
|
MortarStone/planning_center_online-ruby
|
lib/planning_center/endpoints/pledges.rb
|
<gh_stars>0
# frozen_string_literal: true
module PlanningCenter
module Endpoints
module Pledges
def pledge(id, params = {})
get(
"giving/v2/pledges/#{id}",
params
)
end
def pledges(params = {})
# We need to order the pledges by a value (created_at being the default),
# because the results are not consistently ordered without it.
get(
'giving/v2/pledges',
{ order: :created_at }.merge(params)
)
end
end
end
end
|
MortarStone/planning_center_online-ruby
|
lib/planning_center/endpoints/campuses.rb
|
# frozen_string_literal: true
module PlanningCenter
module Endpoints
module Campuses
def campus(id, params = {})
get(
"people/v2/campuses/#{id}",
params
)
end
def campuses(params = {})
# We need to order the campuses by a value (created_at being the default),
# because the results are not consistently ordered without it.
get(
'people/v2/campuses',
{ order: :created_at }.merge(params)
)
end
end
end
end
|
MortarStone/planning_center_online-ruby
|
examples/addresses.rb
|
<reponame>MortarStone/planning_center_online-ruby
# frozen_string_literal: true
require_relative 'helper'
addresses = @client.addresses
print_addresses(addresses)
|
MortarStone/planning_center_online-ruby
|
spec/planning_center/endpoints/campuses_spec.rb
|
<filename>spec/planning_center/endpoints/campuses_spec.rb
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe PlanningCenter::Endpoints::Campuses do
let!(:client) { FactoryBot.build(:client) }
describe '#campuses', :vcr do
before do
@campuses = client.campuses
end
it 'returns an array' do
expect(@campuses['data']).to be_an(Array)
end
it 'returns campuses objects' do
expect(@campuses['data'].first).to be_a(Hash)
expect(@campuses['data'].first['id']).to_not be_nil
end
end
describe '#campus', :vcr do
before do
@campus = client.campus(44_710)
end
it 'returns a campus object' do
expect(@campus).to be_a(Hash)
expect(@campus['data']['id']).to eq('44710')
end
end
end
|
MortarStone/planning_center_online-ruby
|
spec/planning_center/endpoints/donations_spec.rb
|
<reponame>MortarStone/planning_center_online-ruby<gh_stars>0
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe PlanningCenter::Endpoints::Donations do
let!(:client) { FactoryBot.build(:client) }
describe '#donations', :vcr do
before do
@donations = client.donations(per_page: 25)
end
it 'returns an array' do
expect(@donations['data']).to be_an(Array)
end
it 'returns the correct number of objects' do
expect(@donations['data'].count).to eq 25
end
it 'returns donations objects' do
expect(@donations['data'].first).to be_a(Hash)
expect(@donations['data'].first['id']).to_not be_nil
end
end
describe '#donation', :vcr do
before do
@donation = client.donation(46_653_783)
end
it 'returns a donation object' do
expect(@donation).to be_a(Hash)
expect(@donation['data']['id']).to eq('46653783')
end
end
end
|
MortarStone/planning_center_online-ruby
|
examples/helpers/pledges.rb
|
<filename>examples/helpers/pledges.rb
# frozen_string_literal: true
def print_pledges(list)
print_list('pledge', 'id', list)
end
def print_pledge(item)
print_item('pledge', item)
end
def pledge_columns
%w[
id
amount_cents
]
end
|
MortarStone/planning_center_online-ruby
|
examples/helpers/households.rb
|
# frozen_string_literal: true
def print_households(list)
print_list('household', 'id', list)
end
def print_household(item)
print_item('household', item)
end
def household_columns
%w[
id
name
member_count
primary_contact_name
primary_contact_id
]
end
|
MortarStone/planning_center_online-ruby
|
examples/marital_status.rb
|
# frozen_string_literal: true
require_relative 'helper'
marital_status = @client.marital_status(296_943)
print_marital_status(marital_status)
|
MortarStone/planning_center_online-ruby
|
spec/planning_center/endpoints/inactive_reasons_spec.rb
|
<gh_stars>0
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe PlanningCenter::Endpoints::InactiveReasons do
let!(:client) { FactoryBot.build(:client) }
describe '#inactive_reasons', :vcr do
before do
@inactive_reasons = client.inactive_reasons(per_page: 25)
end
it 'returns an array' do
expect(@inactive_reasons['data']).to be_an(Array)
end
it 'returns the correct number of objects' do
expect(@inactive_reasons['data'].count).to eq 3
end
it 'returns inactive_reasons objects' do
expect(@inactive_reasons['data'].first).to be_a(Hash)
expect(@inactive_reasons['data'].first['id']).to_not be_nil
end
end
describe '#inactive_reason', :vcr do
before do
@inactive_reason = client.inactive_reason(296_937)
end
it 'returns a inactive_reason object' do
expect(@inactive_reason).to be_a(Hash)
expect(@inactive_reason['data']['id']).to eq('296937')
end
end
end
|
MortarStone/planning_center_online-ruby
|
examples/helpers/refunds.rb
|
<filename>examples/helpers/refunds.rb
# frozen_string_literal: true
def print_refunds(list)
print_list('refund', 'id', list)
end
def print_refund(item)
print_item('refund', item)
end
def refund_columns
%w[
id
amount_cents
refunded_at
]
end
|
MortarStone/planning_center_online-ruby
|
examples/helpers/designation_refunds.rb
|
<filename>examples/helpers/designation_refunds.rb<gh_stars>0
# frozen_string_literal: true
def print_designation_refunds(list)
print_list('designation_refund', 'id', list)
end
def print_designation_refund(item)
print_item('designation_refund', item)
end
def designation_refund_columns
%w[
id
amount_cents
]
end
|
MortarStone/planning_center_online-ruby
|
lib/planning_center/endpoints/recurring_donations.rb
|
<gh_stars>0
# frozen_string_literal: true
module PlanningCenter
module Endpoints
module RecurringDonations
def recurring_donation(id, params = {})
get(
"giving/v2/recurring_donations/#{id}",
params
)
end
def recurring_donations(params = {})
get(
'giving/v2/recurring_donations',
params
)
end
end
end
end
|
MortarStone/planning_center_online-ruby
|
lib/planning_center/endpoints/funds.rb
|
<gh_stars>0
# frozen_string_literal: true
module PlanningCenter
module Endpoints
module Funds
def fund(id, params = {})
get(
"giving/v2/funds/#{id}",
params
)
end
def funds(params = {})
get(
'giving/v2/funds',
params
)
end
end
end
end
|
MortarStone/planning_center_online-ruby
|
examples/inactive_reason.rb
|
# frozen_string_literal: true
require_relative 'helper'
inactive_reason = @client.inactive_reason(296_937)
print_inactive_reason(inactive_reason)
|
MortarStone/planning_center_online-ruby
|
examples/helpers/inactive_reasons.rb
|
# frozen_string_literal: true
def print_inactive_reasons(list)
print_list('inactive_reason', 'id', list)
end
def print_inactive_reason(item)
print_item('inactive_reason', item)
end
def inactive_reason_columns
%w[
id
value
]
end
|
MortarStone/planning_center_online-ruby
|
examples/refund.rb
|
<gh_stars>0
# frozen_string_literal: true
require_relative 'helper'
refund = @client.refund(53_134_447)
print_refund(refund)
|
MortarStone/planning_center_online-ruby
|
examples/pledge_campaigns.rb
|
<filename>examples/pledge_campaigns.rb
# frozen_string_literal: true
require_relative 'helper'
pledge_campaigns = @client.pledge_campaigns
print_pledge_campaigns(pledge_campaigns)
|
MortarStone/planning_center_online-ruby
|
examples/designation_refunds.rb
|
<filename>examples/designation_refunds.rb
# frozen_string_literal: true
require_relative 'helper'
designation_refunds = @client.designation_refunds(53_134_447)
print_designation_refunds(designation_refunds)
|
MortarStone/planning_center_online-ruby
|
examples/helpers/name_suffixes.rb
|
# frozen_string_literal: true
def print_name_suffixes(list)
print_list('name_suffix', 'id', list)
end
def print_name_suffix(item)
print_item('name_suffix', item)
end
def name_suffix_columns
%w[
id
value
]
end
|
MortarStone/planning_center_online-ruby
|
spec/planning_center/endpoints/recurring_donations_spec.rb
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe PlanningCenter::Endpoints::RecurringDonations do
let!(:client) { FactoryBot.build(:client) }
describe '#recurring_donations', :vcr do
before do
@recurring_donations = client.recurring_donations
end
it 'returns an array' do
expect(@recurring_donations['data']).to be_an(Array)
end
it 'returns recurring_donations objects' do
expect(@recurring_donations['data'].first).to be_a(Hash)
expect(@recurring_donations['data'].first['id']).to_not be_nil
end
end
describe '#recurring_donation', :vcr do
before do
@recurring_donation = client.recurring_donation(362_440)
end
it 'returns a recurring_donation object' do
expect(@recurring_donation).to be_a(Hash)
expect(@recurring_donation['data']['id']).to eq('362440')
end
end
end
|
MortarStone/planning_center_online-ruby
|
examples/campuses.rb
|
<filename>examples/campuses.rb
# frozen_string_literal: true
require_relative 'helper'
campuses = @client.campuses
print_campuses(campuses)
|
MortarStone/planning_center_online-ruby
|
examples/recurring_donations.rb
|
<gh_stars>0
# frozen_string_literal: true
require_relative 'helper'
recurring_donations = @client.recurring_donations
print_recurring_donations(recurring_donations)
|
MortarStone/planning_center_online-ruby
|
spec/planning_center/endpoints/phone_numbers_spec.rb
|
<reponame>MortarStone/planning_center_online-ruby<filename>spec/planning_center/endpoints/phone_numbers_spec.rb<gh_stars>0
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe PlanningCenter::Endpoints::PhoneNumbers do
let!(:client) { FactoryBot.build(:client) }
describe '#phone_numbers', :vcr do
before do
@phone_numbers = client.phone_numbers(2_669_139)
end
it 'returns an array' do
expect(@phone_numbers['data']).to be_an(Array)
end
it 'returns phone_numbers objects' do
expect(@phone_numbers['data'].first).to be_a(Hash)
expect(@phone_numbers['data'].first['id']).to_not be_nil
end
end
describe '#phone_number', :vcr do
before do
@phone_number = client.phone_number(2_669_139, 60_503_519)
end
it 'returns a phone_number object' do
expect(@phone_number).to be_a(Hash)
expect(@phone_number['data']['id']).to eq('60503519')
end
end
end
|
MortarStone/planning_center_online-ruby
|
examples/recurring_donation_designation.rb
|
# frozen_string_literal: true
require_relative 'helper'
recurring_donation_designation = @client.recurring_donation_designation(358_916, 383_099)
print_recurring_donation_designation(recurring_donation_designation)
|
MortarStone/planning_center_online-ruby
|
examples/fund.rb
|
# frozen_string_literal: true
require_relative 'helper'
fund = @client.fund(131_737)
print_fund(fund)
|
MortarStone/planning_center_online-ruby
|
examples/helpers/marital_statuses.rb
|
<filename>examples/helpers/marital_statuses.rb
# frozen_string_literal: true
def print_marital_statuses(list)
print_list('marital_status', 'id', list)
end
def print_marital_status(item)
print_item('marital_status', item)
end
def marital_status_columns
%w[
id
value
]
end
|
MortarStone/planning_center_online-ruby
|
lib/planning_center/endpoints/name_suffixes.rb
|
<reponame>MortarStone/planning_center_online-ruby
# frozen_string_literal: true
module PlanningCenter
module Endpoints
module NameSuffixes
def name_suffix(id, params = {})
get(
"people/v2/name_suffixes/#{id}",
params
)
end
def name_suffixes(params = {})
get(
'people/v2/name_suffixes',
params
)
end
end
end
end
|
coincovemx/localbitcoins
|
spec/client_spec.rb
|
require 'spec_helper'
require 'oauth2'
describe 'Client' do
let(:client) { LocalBitcoins::Client.new(
client_id: 'CLIENT_ID',
client_secret: 'CLIENT_SECRET',
oauth_token: 'ACCESS_TOKEN'
)}
describe "#escrows" do
before do
stub_get('/api/escrows/','escrows.json')
stub_post('/api/escrow_release/12345/', 'escrow_release.json')
end
it 'returns escrows, which the owner of the access token can release' do
expect { client.escrows }.not_to raise_error
escrows = client.escrows
expect(escrows).to be_a Hashie::Mash
expect(escrows.escrow_list[0].data.buyer_username).to eq "alice"
expect(escrows.escrow_list[0].data.reference_code).to eq "123"
expect(escrows.escrow_list[1].data.reference_code).to eq "456"
expect(escrows.escrow_list[1].actions.release_url).to eq "/api/escrow_release/2/"
end
it 'returns a success message indicating the escrow has been released' do
expect { client.escrow_release('12345') }.not_to raise_error
message = client.escrow_release('12345')
expect(message).to be_a Hashie::Mash
expect(message.message).to eq "The escrow has been released successfully."
end
end
describe "#ads" do
before do
stub_get('/api/ads/', 'ads.json')
stub_post('/api/ad/12345/', 'ad_update.json')
stub_get('/api/ad-get/12345/', 'ad_single.json')
stub_post('/api/ad-create/', 'ad_create.json')
stub_get('/api/ad-get/', 'ad_list.json',{:ads=>"12345,123456"})
end
it 'returns listing of the token owners ads' do
expect { client.ads }.not_to raise_error
ads = client.ads
expect(ads).to be_a Hashie::Mash
expect(ads.ad_count).to eq 2
expect(ads.ad_list[0].data.ad_id).to eq 12345
expect(ads.ad_list[1].data.ad_id).to eq 123456
expect(ads.ad_list[0].data.location_string).to eq "<NAME>, JAL, Mexico"
expect(ads.ad_list[0].data.profile.username).to eq "Bob"
expect(ads.ad_list[0].actions.contact_form).to eq "https://localbitcoins.com/api/contact_create/12345/"
expect(ads.ad_list[1].data.atm_model).to eq nil
end
it 'returns success message if the ad was updated' do
expect { client.update_ad(12345,{:price_equation => "localbitcoins_sell_usd"}) }.not_to raise_error
ad_update = client.update_ad(12345,{:price_equation => "localbitcoins_sell_usd"})
expect(ad_update).to be_a Hashie::Mash
expect(ad_update.message).to eq "Ad changed successfully!"
end
it 'returns success message if the ad was created' do
expect { client.create_ad({}) }.not_to raise_error
ad_create = client.create_ad({})
expect(ad_create).to be_a Hashie::Mash
expect(ad_create.message).to eq "Ad added successfully!"
end
it 'returns listing of ads from passed ids' do
expect { client.ad_list("12345,123456") }.not_to raise_error
ad_list = client.ad_list("12345,123456")
expect(ad_list).to be_a Hashie::Mash
expect(ad_list.count).to eq 2
expect(ad_list.ad_list[0].data.ad_id).to eq 12345
expect(ad_list.ad_list[1].data.ad_id).to eq 123456
end
it 'returns ad from passed id' do
expect { client.ad("12345") }.not_to raise_error
ad = client.ad("12345")
expect(ad).to be_a Hashie::Mash
expect(ad.count).to eq 2
expect(ad.ad_list[0].data.ad_id).to eq 12345
expect(ad.ad_count).to eq 1
end
end
describe "#wallet" do
before do
stub_get('/api/wallet/', 'wallet.json')
stub_get('/api/wallet-balance/', 'wallet_balance.json')
stub_post('/api/wallet-send/', 'wallet_send.json')
stub_post('/api/wallet-addr/', 'wallet_addr.json')
end
it 'returns information about the token owners wallet' do
expect { client.wallet }.not_to raise_error
wallet = client.wallet
expect(wallet).to be_a Hashie::Mash
expect(wallet.total.balance).to eq "0.05"
expect(wallet.total.sendable).to eq "0.05"
expect(wallet.receiving_address_list[0].address).to eq "15HfUY9LwwewaWwrKRXzE91tjDnHmye1hc"
end
it 'returns balance information for the token owners wallet' do
expect { client.wallet_balance }.not_to raise_error
wallet_balance = client.wallet_balance
expect(wallet_balance).to be_a Hashie::Mash
expect(wallet_balance.message).to eq "ok"
expect(wallet_balance.total.balance).to eq "0.05"
expect(wallet_balance.total.sendable).to eq "0.05"
expect(wallet_balance.receiving_address_list[0].address).to eq "15HfUY9LwwewaWwrKRXzE91tjDnHmye1hc"
end
it 'returns confirmation message for sending btc' do
expect { client.wallet_send("15HfUY9LwwewaWwrKRXzE91tjDnHmy2d2hc","0.001") }.not_to raise_error
wallet_send = client.wallet_send("15HfUY9LwwewaWwrKRXzE91tjDnHmy2d2hc","0.001")
expect(wallet_send).to be_a Hashie::Mash
expect(wallet_send.message).to eq "Money is being sent"
end
it 'returns unused wallet address from token owners wallet' do
expect { client.wallet_addr }.not_to raise_error
wallet_address = client.wallet_addr
expect(wallet_address.address).to eq "15HfUY9LwwewaWwrKRXzE91tjDnHmy2d2hc"
expect(wallet_address.message).to eq "OK!"
end
end
describe "#contacts" do
before do
stub_post('/api/contact_message_post/12345/', 'contact_message.json')
stub_get('/api/dashboard/', 'contacts_active.json')
stub_get('/api/dashboard/buyer/', 'contacts_active_buyers.json')
stub_get('/api/dashboard/seller/', 'contacts_active_sellers.json')
stub_get('/api/dashboard/released/', 'contacts_released_contacts.json')
stub_get('/api/dashboard/canceled/', 'contacts_canceled_contacts.json')
stub_get('/api/dashboard/closed/', 'contacts_canceled_contacts.json')
stub_get('/api/contact_messages/12345/', 'contacts_messages.json')
stub_post('/api/contact_cancel/12345/','contacts_cancel.json')
stub_post('/api/contact_create/12345/', 'contacts_create.json')
stub_get('/api/contact_info/12345/', 'contacts_contact_info.json')
stub_get('/api/contact_info/', 'contacts_contacts_info.json', {:contacts=>"12345,54321"})
end
it 'returns confirmation for sending a message' do
expect { client.message_contact('12345', 'Text of the message.') }.not_to raise_error
contact_message = client.message_contact('12345', 'Text of the message.')
expect(contact_message).to be_a Hashie::Mash
expect(contact_message.message).to eq "Message sent successfully."
end
it 'returns active contact list for token owner' do
expect { client.active_contacts }.not_to raise_error
active_contacts = client.active_contacts
expect(active_contacts).to be_a Hashie::Mash
expect(active_contacts.contact_count).to eq 3
expect(active_contacts.contact_list[0].data.currency).to eq "MXN"
expect(active_contacts.contact_list[1].data.currency).to eq "MXN"
expect(active_contacts.contact_list[2].data.currency).to eq "USD"
expect(active_contacts.contact_list[0].data.amount).to eq "1.00"
expect(active_contacts.contact_list[1].data.amount).to eq "2.00"
expect(active_contacts.contact_list[2].data.amount).to eq "0.10"
expect(active_contacts.contact_list[0].data.advertisement.id).to eq 1234567
expect(active_contacts.contact_list[1].data.advertisement.id).to eq 1234567
expect(active_contacts.contact_list[2].data.advertisement.id).to eq 1234567
expect(active_contacts.contact_list[0].data.advertisement.advertiser.username).to eq "Bob"
expect(active_contacts.contact_list[1].data.advertisement.advertiser.username).to eq "Bob"
expect(active_contacts.contact_list[2].data.advertisement.advertiser.username).to eq "Alice"
expect(active_contacts.contact_list[0].data.is_selling).to eq true
expect(active_contacts.contact_list[1].data.is_selling).to eq true
expect(active_contacts.contact_list[2].data.is_selling).to eq false
expect(active_contacts.contact_list[0].data.is_buying).to eq false
expect(active_contacts.contact_list[1].data.is_buying).to eq false
expect(active_contacts.contact_list[2].data.is_buying).to eq true
end
it 'returns active buyer contacts for token owner' do
expect { client.active_contacts('buyer') }.not_to raise_error
active_buyer_contacts = client.active_contacts('buyer')
expect(active_buyer_contacts).to be_a Hashie::Mash
expect(active_buyer_contacts.contact_count).to eq 1
expect(active_buyer_contacts.contact_list[0].data.advertisement.id).to eq 123456
expect(active_buyer_contacts.contact_list[0].data.advertisement.advertiser.username).to eq "Alice"
expect(active_buyer_contacts.contact_list[0].data.contact_id).to eq 543210
end
it 'returns active seller contacts for token owner' do
expect { client.active_contacts('seller') }.not_to raise_error
active_seller_contacts = client.active_contacts('seller')
expect(active_seller_contacts).to be_a Hashie::Mash
expect(active_seller_contacts.contact_count).to eq 2
expect(active_seller_contacts.contact_list[0].data.currency).to eq "MXN"
expect(active_seller_contacts.contact_list[1].data.currency).to eq "MXN"
expect(active_seller_contacts.contact_list[0].data.payment_completed_at).to eq nil
end
it 'returns list of released contacts' do
expect { client.released_contacts }.not_to raise_error
released_contacts = client.released_contacts
expect(released_contacts).to be_a Hashie::Mash
expect(released_contacts.contact_count).to eq 1
expect(released_contacts.contact_list[0].data.advertisement.id).to eq 123456
expect(released_contacts.contact_list[0].data.advertisement.advertiser.username).to eq "Alice"
expect(released_contacts.contact_list[0].data.contact_id).to eq 543210
end
it 'returns list of canceled contacts' do
expect { client.canceled_contacts }.not_to raise_error
canceled_contacts = client.canceled_contacts
expect(canceled_contacts).to be_a Hashie::Mash
expect(canceled_contacts.contact_count).to eq 3
expect(canceled_contacts.contact_list[0].data.advertisement.advertiser.username).to eq "Bob"
expect(canceled_contacts.contact_list[2].data.advertisement.advertiser.username).to eq "Bob"
expect(canceled_contacts.contact_list[0].data.canceled_at).to eq "2014-06-19T20:34:18+00:00"
expect(canceled_contacts.contact_list[2].data.canceled_at).to eq "2014-06-19T18:56:45+00:00"
expect(canceled_contacts.contact_list[1].data.amount).to eq "108.46"
expect(canceled_contacts.contact_list[2].data.amount).to eq "100.02"
end
it 'returns list of closed contacts' do
expect { client.closed_contacts }.not_to raise_error
closed_contacts = client.closed_contacts
expect(closed_contacts).to be_a Hashie::Mash
expect(closed_contacts.contact_count).to eq 3
expect(closed_contacts.contact_list[0].data.advertisement.advertiser.username).to eq "Bob"
expect(closed_contacts.contact_list[2].data.advertisement.advertiser.username).to eq "Bob"
expect(closed_contacts.contact_list[0].data.canceled_at).to eq "2014-06-19T20:34:18+00:00"
expect(closed_contacts.contact_list[2].data.canceled_at).to eq "2014-06-19T18:56:45+00:00"
expect(closed_contacts.contact_list[1].data.amount).to eq "108.46"
expect(closed_contacts.contact_list[2].data.amount).to eq "100.02"
end
it 'returns list of messages for a contact' do
expect { client.messages_from_contact('12345') }.not_to raise_error
contact_messages = client.messages_from_contact('12345')
expect(contact_messages).to be_a Hashie::Mash
expect(contact_messages.message_count).to eq 3
expect(contact_messages.message_list[0].msg).to eq "Message body"
expect(contact_messages.message_list[1].msg).to eq "Text of the message."
expect(contact_messages.message_list[0].sender.username).to eq "Bob"
expect(contact_messages.message_list[2].sender.username).to eq "Alice"
end
it 'returns confirmation on cancellation of a contact' do
expect { client.cancel_contact('12345') }.not_to raise_error
cancel_contact = client.cancel_contact('12345')
expect(cancel_contact).to be_a Hashie::Mash
expect(cancel_contact.message).to eq "Contact canceled."
end
it 'returns confirmation of contact creation' do
expect { client.create_contact('12345', '1000', 'Message body') }.not_to raise_error
create_contact = client.create_contact('12345', '1000', 'Message body')
expect(create_contact).to be_a Hashie::Mash
expect(create_contact.data.message).to eq "OK!"
expect(create_contact.actions.contact_url).to eq "https://localbitcoins.com/api/contact_info/123456/"
end
it 'returns specified contact' do
expect { client.contact_info(12345) }.not_to raise_error
contact_info = client.contact_info(12345)
expect(contact_info.data.advertisement.advertiser.username).to eq "Bob"
expect(contact_info.data.buyer.username).to eq "Alice"
expect(contact_info.data.advertisement.id).to eq 1234567
expect(contact_info.actions.messages_url).to eq "https://localbitcoins.com/api/contact_messages/12345/"
end
it 'returns list of contacts, from specified list' do
expect { client.contacts_info('12345,54321') }.not_to raise_error
contacts = client.contacts_info('12345,54321')
expect(contacts).to be_a Hashie::Mash
expect(contacts.contact_count).to eq 2
expect(contacts.contact_list[0].data.advertisement.advertiser.username).to eq "Bob"
expect(contacts.contact_list[1].data.advertisement.advertiser.username).to eq "Bob"
expect(contacts.contact_list[0].data.buyer.username).to eq "Alice"
expect(contacts.contact_list[1].data.buyer.username).to eq "Alice"
expect(contacts.contact_list[0].actions.cancel_url).to eq "https://localbitcoins.com/api/contact_cancel/12345/"
end
end
describe "#users" do
before do
stub_get('/api/myself/', 'myself.json')
stub_get('/api/account_info/bob/', 'account_info.json')
stub_post('/api/logout/', 'logout.json')
end
it 'returns user information on the token owner' do
expect { client.myself }.not_to raise_error
myself = client.myself
expect(myself.username).to eq "alice"
expect(myself.has_common_trades).to eq false
expect(myself.trusted_count).to eq 4
end
it 'returns user information on user with specified username' do
expect { client.account_info('bob') }.not_to raise_error
account_info = client.account_info('bob')
expect(account_info.username).to eq "bob"
expect(account_info.trade_volume_text).to eq "Less than 25 BTC"
expect(account_info.url).to eq "https://localbitcoins.com/p/bob/"
end
it 'immediately expires currently authorized access_token' do
#expect { client.logout }.not_to raise_error
end
end
describe "#markets" do
before do
stub_get_unauth('/bitcoinaverage/ticker-all-currencies/', 'ticker.json')
stub_get_unauth('/bitcoincharts/USD/trades.json?since=170892', 'trades.json')
stub_get_unauth('/bitcoincharts/USD/orderbook.json', 'orderbook.json')
end
it 'returns current bitcoin prices in all currencies' do
expect { client.ticker }.not_to raise_error
ticker = client.ticker
expect(ticker.USD.volume_btc).to eq "701.42"
expect(ticker.MXN.rates.last).to eq "8431.10"
expect(ticker.PHP.avg_12h).to eq 24559.67
end
it 'returns last 500 trades in a specified currency since last_tid' do
expect { client.trades('USD', '170892') }.not_to raise_error
trades = client.trades('USD', '170892')
expect(trades).to be_a Array
expect(trades[0]['tid']).to eq 170892
expect(trades[-1]['amount']).to eq "1.54970000"
end
it 'immediately expires currently authorized access_token' do
expect { client.orderbook('USD') }.not_to raise_error
orderbook = client.orderbook('USD')
expect(orderbook).to be_a Hashie::Mash
expect(orderbook.asks[0][1]).to eq "1190.53"
expect(orderbook.bids[-1][0]).to eq "0.16"
end
end
describe "#public" do
before do
stub_get_unauth('/buy-bitcoins-online/US/usa/moneygram/.json', 'online_buy_ads.json')
stub_get_unauth('/sell-bitcoins-online/.json', 'online_sell_ads.json')
stub_get_unauth('/api/payment_methods/us/', 'payment_methods.json')
stub_get_unauth('/api/currencies/', 'currencies.json')
stub_get_unauth('/buy-bitcoins-with-cash/214875/48453-mx/.json?lat=20&lon=-105', 'local_buy_ads.json')
stub_get_unauth('/sell-bitcoins-with-cash/214875/48453-mx/.json?lat=20&lon=-105', 'local_sell_ads.json')
stub_get_unauth('/api/places/?lat=35&lon=100', 'places.json')
end
it 'shows all online buy ads with given specifications' do
expect { client.online_buy_ads_lookup({:countrycode => "US", :country_name => "usa", :payment_method => "moneygram"}) }.not_to raise_error
ads = client.online_buy_ads_lookup({:countrycode => "US", :country_name => "usa", :payment_method => "moneygram"})
expect(ads).to be_a Hashie::Mash
expect(ads.data.ad_list[0][:data][:profile][:username]).to eq "btcusd"
expect(ads.data.ad_count).to eq 15
end
it 'shows all online sell ads with given specifications' do
expect { client.online_sell_ads_lookup }.not_to raise_error
ads = client.online_sell_ads_lookup
expect(ads).to be_a Hashie::Mash
expect(ads.data.ad_list[0][:data][:created_at]).to eq "2013-09-22T08:50:04+00:00"
expect(ads.data.ad_list[1][:actions][:public_view]).to eq "https://localbitcoins.com/ad/55455"
expect(ads.pagination.next).to eq "https://localbitcoins.com/sell-bitcoins-online/.json?temp_price_usd__lt=571.35"
end
it 'shows all payment methods accepted in given countrycode' do
expect { client.payment_methods('us') }.not_to raise_error
payment = client.payment_methods('us')
expect(payment).to be_a Hashie::Mash
expect(payment[:methods].solidtrustpay.name).to eq "SolidTrustPay"
expect(payment.method_count).to eq 22
end
it 'shows all currencies used by localbitcoins' do
expect { client.currencies }.not_to raise_error
currencies = client.currencies
expect(currencies.currencies.EGP.name).to eq "Egyptian Pound"
expect(currencies.currency_count).to eq 166
end
it 'shows all local buy ads with given specifications' do
expect { client.local_buy_ad({:location_id=>214875, :location_slug=>"48453-MX", :lat=>20, :lon=>-105}) }.not_to raise_error
ads = client.local_buy_ad({:location_id=>214875, :location_slug=>"48453-MX", :lat=>20, :lon=>-105})
expect(ads.data.ad_list[0].data.profile.username).to eq "bob"
expect(ads.data.ad_list[0].data.ad_id).to eq 123456
expect(ads.data.ad_list[1].data.msg).to eq("Fell in a hole and found a secret and magical world! Bitcoins grow on trees down here ;)")
end
it 'shows all local sell ads with given specifications' do
expect { client.local_sell_ad({:location_id=>214875, :location_slug=>"48453-MX", :lat=>20, :lon=>-105}) }.not_to raise_error
ads = client.local_sell_ad({:location_id=>214875, :location_slug=>"48453-MX", :lat=>20, :lon=>-105})
expect(ads.data.ad_list[0].data.profile.username).to eq "bobby"
expect(ads.data.ad_list[0].data.ad_id).to eq 12345
expect(ads.data.ad_list[1].data.msg).to eq "Hola, mundo!"
expect(ads.data.ad_list[1].actions.public_view).to eq "https://localbitcoins.com/ad/67890"
end
it 'shows the location information associated with a given latitude and longitude' do
expect { client.places({:lat=>35, :lon=>100}) }.not_to raise_error
places = client.places({:lat=>35, :lon=>100})
expect(places.places[0].location_string).to eq "Hainan, Qinghai, China"
expect(places.places[0].lon).to eq 100.62
expect(places.place_count).to eq 1
end
end
end
|
coincovemx/localbitcoins
|
lib/localbitcoins/version.rb
|
<gh_stars>1-10
module LocalBitcoins
unless defined?(LocalBitcoins::VERSION)
VERSION = '1.0.0'
end
end
|
coincovemx/localbitcoins
|
lib/localbitcoins/client.rb
|
require 'localbitcoins/client'
require 'localbitcoins/client/escrows'
require 'localbitcoins/client/ads'
require 'localbitcoins/client/users'
require 'localbitcoins/client/contacts'
require 'localbitcoins/client/markets'
require 'localbitcoins/client/wallet'
require 'localbitcoins/client/public'
module LocalBitcoins
class Client
include LocalBitcoins::Request
include LocalBitcoins::Escrows
include LocalBitcoins::Ads
include LocalBitcoins::Users
include LocalBitcoins::Contacts
include LocalBitcoins::Markets
include LocalBitcoins::Wallet
include LocalBitcoins::Contacts
include LocalBitcoins::Public
attr_reader :oauth_client, :access_token
# Initialize a LocalBitcoins::Client instance
#
# options[:client_id]
# options[:client_secret]
# options[:oauth_token]
#
def initialize(options={})
unless options.kind_of?(Hash)
raise ArgumentError, "Options hash required."
end
@oauth_client = OAuth2::Client.new(
options[:client_id],
options[:client_secret],
authorize_url: "/oauth2/authorize",
token_url: "/oauth2/access_token",
site: "https://localbitcoins.com"
)
@access_token = OAuth2::AccessToken.new(
oauth_client,
options[:oauth_token]
)
end
end
end
|
coincovemx/localbitcoins
|
lib/localbitcoins/client/contacts.rb
|
<gh_stars>0
module LocalBitcoins
module Contacts
# Contact interaction endpoints
# contact_id - id number associated with the contact
def mark_contact_as_paid(contact_id)
oauth_request(:post, "/api/contact_mark_as_paid/#{contact_id}/")
end
def messages_from_contact(contact_id)
oauth_request(:get, "/api/contact_messages/#{contact_id}/").data
end
def message_contact(contact_id, msg)
oauth_request(:post, "/api/contact_message_post/#{contact_id}/", {:msg=>msg}).data
end
def dispute_contact(contact_id)
oauth_request(:post, "/api/contact_dispute/#{contact_id}/")
end
def cancel_contact(contact_id)
oauth_request(:post, "/api/contact_cancel/#{contact_id}/").data
end
def fund_contact(contact_id)
oauth_request(:post, "/api/contact_fund/#{contact_id}/")
end
def create_contact(ad_id, amount, message=nil)
oauth_request(:post, "/api/contact_create/#{ad_id}/", {:amount=>amount, :message=>message})
end
def contact_info(contact_id)
oauth_request(:get, "/api/contact_info/#{contact_id}/")
end
# contacts - comma separated list of contact ids [string]
def contacts_info(contacts)
oauth_request(:get, '/api/contact_info/', {:contacts=>contacts}).data
end
# Dashboard contact endpoints
# contact_type - optional filter 'buyer' or 'seller' [string]
#
def active_contacts(contact_type = nil)
contact_type<<'/' unless contact_type.nil?
oauth_request(:get, "/api/dashboard/#{contact_type}").data
end
def released_contacts(contact_type = nil)
contact_type<<'/' unless contact_type.nil?
oauth_request(:get, "/api/dashboard/released/#{contact_type}").data
end
def canceled_contacts(contact_type = nil)
contact_type<<'/' unless contact_type.nil?
oauth_request(:get, "/api/dashboard/canceled/#{contact_type}").data
end
def closed_contacts(contact_type = nil)
contact_type<<'/' unless contact_type.nil?
oauth_request(:get, "/api/dashboard/closed/#{contact_type}").data
end
end
end
|
coincovemx/localbitcoins
|
lib/localbitcoins.rb
|
<filename>lib/localbitcoins.rb
require 'localbitcoins/version'
require 'localbitcoins/errors'
require 'localbitcoins/request'
require 'localbitcoins/client'
module LocalBitcoins
@@options = {}
# Create a new LocalBitcoins::Client instance
#
def self.new(options={})
LocalBitcoins::Client.new(options)
end
# Define a global configuration
#
# options[:client_id]
# options[:client_secret]
#
def self.configure(options={})
unless options.kind_of?(Hash)
raise ArgumentError, "Options hash required."
end
@@options[:client_id] = options[:client_id]
@@options[:client_secret] = options[:client_secret]
@@options
end
# Returns global configuration hash
#
def self.configuration
@@options
end
# Resets the global configuration
#
def self.reset_configuration
@@options = {}
end
end
|
coincovemx/localbitcoins
|
lib/localbitcoins/errors.rb
|
module LocalBitcoins
class Error < StandardError; end
class ConfigurationError < Error; end
class Unauthorized < Error; end
class NotFound < Error; end
end
|
coincovemx/localbitcoins
|
spec/spec_helper.rb
|
$:.unshift File.expand_path("../..", __FILE__)
require 'localbitcoins'
require 'rest-client'
require 'webmock'
require 'webmock/rspec'
WebMock.disable_net_connect!(allow_localhost: true)
RSpec.configure do |config|
config.color = true
end
def stub_get(path, fixture_name, params={})
stub_request(:get, api_url(path)).
with(:query => {"Accept" => "application/json", "access_token" => "ACCESS_TOKEN"}.merge!(params),
:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
'Authorization'=>'Bearer ACCESS_TOKEN','Content-Type'=>'application/x-www-form-urlencoded',
'User-Agent'=>'Faraday v0.9.0'}).to_return(:status => 200, :body => fixture(fixture_name),
:headers => {})
end
def stub_get_unauth(path, fixture_name)
stub_request(:get, api_url(path)).
with(
# :query => {"Accept" => "application/json"},
:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
#'Content-Type'=>'application/x-www-form-urlencoded',
'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => fixture(fixture_name),
:headers => {})
end
def stub_post(path, fixture_name)
stub_request(:post, api_url(path)).
with(:query => {"Accept" => "application/json", "access_token" => "ACCESS_TOKEN"},
:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
'Authorization'=>'Bearer ACCESS_TOKEN', 'Content-Type'=>'application/x-www-form-urlencoded',
'User-Agent'=>'Faraday v0.9.0'}).to_return(:status => 200, :body => fixture(fixture_name),
:headers => {})
end
def fixture_path(file=nil)
path = File.expand_path("../fixtures", __FILE__)
file.nil? ? path : File.join(path, file)
end
def fixture(file)
File.read(fixture_path(file))
end
def api_url(path)
"#{LocalBitcoins::Request::API_URL}#{path}"
end
|
coincovemx/localbitcoins
|
lib/localbitcoins/client/wallet.rb
|
module LocalBitcoins
module Wallet
# Gets information about the token owner's wallet balance
def wallet
oauth_request(:get, '/api/wallet/').data
end
def wallet_balance
oauth_request(:get, '/api/wallet-balance/').data
end
def wallet_send(address, amount)
oauth_request(:post, '/api/wallet-send/', {:address=>address, :amount=>amount}).data
end
def wallet_pin_send(address, amount, pin)
oauth_request(:post, '/api/wallet-send/', {:address=>address, :amount=>amount, :pin=>pin}).data if valid_pin?(pin)
end
def valid_pin?(pin)
oauth_request(:post, '/api/pincode/', {:pincode=>pin}).data.pincode_ok
end
def wallet_addr
oauth_request(:post, '/api/wallet-addr/').data
end
end
end
|
coincovemx/localbitcoins
|
spec/localbitcoins_spec.rb
|
<gh_stars>10-100
require 'spec_helper'
describe 'LocalBitcoins' do
describe '.new' do
it 'returns a new client instance' do
LocalBitcoins.new.should be_a LocalBitcoins::Client
end
end
describe '.configure' do
it 'sets a global configuration options' do
r = LocalBitcoins.configure(client_id: 'TEST_ID', client_secret: 'TEST_SECRET')
r.should be_a Hash
r.should have_key(:client_id)
r.should have_key(:client_secret)
r[:client_id].should eql('TEST_ID')
r[:client_secret].should eql('TEST_SECRET')
end
it 'raises ConfigurationError on invalid config parameter' do
proc { LocalBitcoins.configure(nil) }.
should raise_error(ArgumentError, "Options hash required.")
proc { LocalBitcoins.configure('foo') }.
should raise_error ArgumentError, "Options hash required."
end
end
describe '.configuration' do
before do
LocalBitcoins.configure(client_id: 'TEST_ID', client_secret: 'TEST_SECRET')
end
it 'returns global configuration options' do
r = LocalBitcoins.configuration
r.should be_a Hash
r.should have_key(:client_id)
r.should have_key(:client_secret)
r[:client_id].should eql('TEST_ID')
r[:client_secret].should eql('TEST_SECRET')
end
end
describe '.reset_configuration' do
before do
LocalBitcoins.configure(client_id: 'TEST_ID', client_secret: 'TEST_SECRET')
end
it 'resets global configuration options' do
LocalBitcoins.reset_configuration
LocalBitcoins.configuration.should eql({})
end
end
end
|
coincovemx/localbitcoins
|
lib/localbitcoins/request.rb
|
require 'rest-client'
require 'active_support/core_ext'
require 'json'
require 'hashie'
require 'oauth2'
module LocalBitcoins
module Request
API_URL = "https://localbitcoins.com"
protected
# Perform an OAuth API request. The client must be initialized
# with a valid OAuth access token to make requests with this method
#
# path - Request path
# body - Parameters for requests - GET and POST
#
def oauth_request(http_method, path, body={})
raise 'OAuth access token required!' unless @access_token
params = { :Accept =>'application/json', :access_token => @access_token.token }
params.merge!(body) if http_method == :get
resp = @access_token.request(http_method, path, :params => params, :body => body)
case resp
when Net::HTTPUnauthorized
raise LocalBitcoins::Unauthorized
when Net::HTTPNotFound
raise LocalBitcoins::NotFound
end
hash = Hashie::Mash.new(JSON.parse(resp.body))
raise Error.new(hash.error) if hash.error
raise Error.new(hash.errors.join(',')) if hash.errors
hash
end
end
end
|
coincovemx/localbitcoins
|
lib/localbitcoins/client/markets.rb
|
<gh_stars>10-100
require 'open-uri'
module LocalBitcoins
module Markets
# LocalBitcoins.com provides public trade data available for market chart services and tickers
# The API is in bitcoincharts.com format
# Currently supported currencies:
# ARS, AUD, BRL, CAD, CHF, CZK, DKK, EUR, GBP, HKD, ILS, INR, MXN, NOK, NZD, PLN, RUB, SEK, SGD, THB, USD, ZAR
ROOT = 'https://localbitcoins.com'
def ticker
ticker_uri = open("#{ROOT}/bitcoinaverage/ticker-all-currencies/")
Hashie::Mash.new(JSON.parse(ticker_uri.read)) if ticker_uri.status.first=='200'
end
def trades(currency, last_tid=nil)
trade_uri = open("#{ROOT}/bitcoincharts/#{currency}/trades.json?since=#{last_tid}")
JSON.parse(trade_uri.read) if trade_uri.status.first=='200'
end
def orderbook(currency)
orderbook_uri = open("#{ROOT}/bitcoincharts/#{currency}/orderbook.json")
Hashie::Mash.new(JSON.parse(orderbook_uri.read)) if orderbook_uri.status.first=='200'
end
end
end
|
jeffreybozek/machinist_rails
|
lib/machinist_rails.rb
|
<filename>lib/machinist_rails.rb<gh_stars>0
require 'machinist_rails/railtie'
|
jeffreybozek/machinist_rails
|
lib/machinist_rails/railtie.rb
|
require 'machinist'
require 'rails'
module Machinist
class Railtie < Rails::Railtie
config.generators.fixture_replacement :machinist
config.after_initialize do
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
end
end
end
|
0x07CB/linuxbrew-core
|
Formula/nestopia-ue.rb
|
<filename>Formula/nestopia-ue.rb
class NestopiaUe < Formula
desc "NES emulator"
homepage "http://0ldsk00l.ca/nestopia/"
url "https://github.com/0ldsk00l/nestopia/archive/1.51.1.tar.gz"
sha256 "6c2198ed5f885b160bf7e22a777a5e139a7625444ec47625cd07a36627e94b3f"
license "GPL-2.0-or-later"
head "https://github.com/0ldsk00l/nestopia.git", branch: "master"
bottle do
sha256 arm64_big_sur: "48cc9146b538dde455e89b91882abc5cb6e0a3bb5272d546c747df16a7399379"
sha256 big_sur: "c3b7a00feb7ccce40ed9edf2dc3a00aaea2c6422912a13917c481cd5389f4838"
sha256 catalina: "8a08b57d2e7287b0792d3c0ae3688e563e6efd15a7069525ab62836ba8c6f924"
sha256 mojave: "5fb8a05db0ae55c4d2bf0be06a88a825a0c502cdf289119c088eabe660e7eab2"
sha256 x86_64_linux: "e4d3611733b865fb44f3edacf8963bb87a7ea31bc1a1f47b9d08fcd3678a7b43" # linuxbrew-core
end
depends_on "autoconf" => :build
depends_on "autoconf-archive" => :build
depends_on "automake" => :build
depends_on "pkg-config" => :build
depends_on "fltk"
depends_on "libarchive"
depends_on "sdl2"
uses_from_macos "zlib"
def install
system "autoreconf", "-fiv"
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--datarootdir=#{pkgshare}"
system "make", "install"
end
test do
assert_match(/Nestopia UE #{version}$/, shell_output("#{bin}/nestopia --version"))
end
end
|
0x07CB/linuxbrew-core
|
Formula/shadowenv.rb
|
class Shadowenv < Formula
desc "Reversible directory-local environment variable manipulations"
homepage "https://shopify.github.io/shadowenv/"
url "https://github.com/Shopify/shadowenv/archive/2.0.6.tar.gz"
sha256 "d23e8bfa2a251e164b6c1a13583a89f81628728951b49b404c73c0cae461eff9"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "e1385722a4196c36cac9be0f24f41a134031ec800caf336cb52d29beccd1777e"
sha256 cellar: :any_skip_relocation, big_sur: "0aa59a919ee173a4f52a792cf8efac267df60233fcd5ea48ea89749dad43f350"
sha256 cellar: :any_skip_relocation, catalina: "a61f75e84322bc9554691f540a53c51042034163d85328c6f1eb78cb4cb0cfd6"
sha256 cellar: :any_skip_relocation, mojave: "cbbfa9a3b1a4850cf12f8f025533edb6c142ed68e75f201061773d0cd6006750"
sha256 cellar: :any_skip_relocation, x86_64_linux: "dcb47fa72005c040117c9409206ae8c4274a5d0ceb7a0e94a728fd760afc58a3" # linuxbrew-core
end
depends_on "rust" => :build
def install
system "cargo", "install", *std_cargo_args
man1.install "#{buildpath}/man/man1/shadowenv.1"
man5.install "#{buildpath}/man/man5/shadowlisp.5"
end
test do
expected_output = <<~EOM
EXAMPLE:
EXAMPLE2:b
EXAMPLE3:b
EXAMPLE_PATH:a:b:d
---
EXAMPLE:a
EXAMPLE2:
EXAMPLE3:a
EXAMPLE_PATH:c:d
EOM
environment = "export EXAMPLE2=b EXAMPLE3=b EXAMPLE_PATH=a:b:d;"
hash = "1256a7c3de15e864"
data = {
"scalars" => [
{ "name" => "EXAMPLE2", "original" => nil, "current" => "b" },
{ "name" => "EXAMPLE", "original" => "a", "current" => nil },
{ "name" => "EXAMPLE3", "original" => "a", "current" => "b" },
],
"lists" => [
{ "name" => "EXAMPLE_PATH", "additions" => ["b", "a"], "deletions" => ["c"] },
],
}
# Read ...'\"'\"'... on the next line as a ruby `...' + "'" + '...` but for bash
shadowenv_command = "#{bin}/shadowenv hook '\"'\"'#{hash}:#{data.to_json}'\"'\"' 2> /dev/null"
print_vars =
"echo EXAMPLE:$EXAMPLE; echo EXAMPLE2:$EXAMPLE2; echo EXAMPLE3:$EXAMPLE3; echo EXAMPLE_PATH:$EXAMPLE_PATH;"
assert_equal expected_output,
shell_output("bash -c '#{environment} #{print_vars} echo ---; eval \"$(#{shadowenv_command})\"; #{print_vars}'")
end
end
|
0x07CB/linuxbrew-core
|
Formula/libuvc.rb
|
<filename>Formula/libuvc.rb
class Libuvc < Formula
desc "Cross-platform library for USB video devices"
homepage "https://github.com/ktossell/libuvc"
url "https://github.com/ktossell/libuvc/archive/v0.0.6.tar.gz"
sha256 "42175a53c1c704365fdc782b44233925e40c9344fbb7f942181c1090f06e2873"
license "BSD-3-Clause"
head "https://github.com/ktossell/libuvc.git"
bottle do
rebuild 1
sha256 cellar: :any, arm64_big_sur: "51c899af95c83a96799af845463826cd9c4a939c030bfa1fa7597603f3470dd5"
sha256 cellar: :any, big_sur: "1bb47911fa2b70dabe09cb9520498700ff75d0349991f36460b28d762c5cf03d"
sha256 cellar: :any, catalina: "4051cd7aa8dbf7a5e940a85f8c38900829e66cabfb00be22a592dd3a421e3cca"
sha256 cellar: :any, mojave: "1ff736e2499c4da037ff74ea31ebe2be23defd7e316ad974ff57cd9a712c7445"
sha256 cellar: :any, high_sierra: "c0ec2076095af1c5154bc43d18a5869b5678f026f1b3c76964f136e4ada07717"
sha256 cellar: :any, sierra: "1888941024fe1b8ca44f15b98e51390872286c0145806fbd0a61999bab225905"
sha256 cellar: :any, el_capitan: "4defbab7e171c20da065eb5e4f2b11b5b27165efbd850e742674be281f3a0fcd"
sha256 cellar: :any, x86_64_linux: "53b5d544c54769aca873258fa6d022cf0a342173d90f92373439cc25b68bd434" # linuxbrew-core
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "libusb"
def install
system "cmake", ".", *std_cmake_args
system "make"
system "make", "install"
end
end
|
0x07CB/linuxbrew-core
|
Formula/vilistextum.rb
|
class Vilistextum < Formula
desc "HTML to text converter"
homepage "https://bhaak.net/vilistextum/"
url "https://bhaak.net/vilistextum/vilistextum-2.6.9.tar.gz"
sha256 "3a16b4d70bfb144e044a8d584f091b0f9204d86a716997540190100c20aaf88d"
license "GPL-2.0"
livecheck do
url "https://bhaak.net/vilistextum/download.html"
regex(/href=.*?vilistextum[._-]v?(\d+(?:\.\d+)+)\.t/i)
strategy :page_match do |page, regex|
# Omit version with old scheme that is incorrectly treated as newest
# NOTE: This `strategy` block can be removed in the future if/when the
# download page only contains versions with three parts like 2.3.0.
page.scan(regex).map { |match| (version = match.first) == "2.22" ? nil : version }
end
end
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "dfd4ab35a880dbac2c93e43eed5e0001093fad04c94c32f955c3f91822d84ccd"
sha256 cellar: :any_skip_relocation, big_sur: "c1107f3edeb308819c5b074f1ed2072583c3bc5a7800af162ab10ef460548f18"
sha256 cellar: :any_skip_relocation, catalina: "cead55f6cb7e4d66d3f6ca2bf013f0cb653144a0fe79620fdd5735a1e57566a5"
sha256 cellar: :any_skip_relocation, mojave: "c36418e1556b9f5f9c0126811fddca3149137abfed6b36596ec4612c3806a3ec"
sha256 cellar: :any_skip_relocation, high_sierra: "6005ce3b4c593707dfe7ffbc10ea64f26ce6e441803a9133ab46ba0fbaee422f"
sha256 cellar: :any_skip_relocation, sierra: "b8fa6ddde71b9b86128e12bbc343935ca5ec58e15d28da2a1a9972a23df9becd"
sha256 cellar: :any_skip_relocation, el_capitan: "d46bae51c7e9a7193a735660af8583960c98e50f03aa33c8a9d81c22b2d9bf61"
sha256 cellar: :any_skip_relocation, yosemite: "77ab66b58db8649e9444584b5ee85e6c6c7badeb665425263c50282367eea003"
sha256 cellar: :any_skip_relocation, x86_64_linux: "02e351bc8ccd19bf766514f585d1c8184ab7ad9d137dd10005e78cbd56ae9bb8" # linuxbrew-core
end
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}", "--mandir=#{man}"
system "make", "install"
end
test do
system "#{bin}/vilistextum", "-v"
end
end
|
0x07CB/linuxbrew-core
|
Formula/git-standup.rb
|
<reponame>0x07CB/linuxbrew-core
class GitStandup < Formula
desc "Git extension to generate reports for standup meetings"
homepage "https://github.com/kamranahmedse/git-standup"
url "https://github.com/kamranahmedse/git-standup/archive/2.3.2.tar.gz"
sha256 "48d5aaa3c585037c950fa99dd5be8a7e9af959aacacde9fe94143e4e0bfcd6ba"
license "MIT"
head "https://github.com/kamranahmedse/git-standup.git"
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "70ed7f5656e81453300e666c3db4c883ee9ef1f88206833b8eeb6b578fb56966"
sha256 cellar: :any_skip_relocation, big_sur: "39e65939c0bfd35248200c980400b99e72d4cf2054487d63c72c7e6b7268d3b0"
sha256 cellar: :any_skip_relocation, catalina: "0a75c65615d92237a59492ac00867d12ab4a23865d85d5cb464d9deb1f6d8ee8"
sha256 cellar: :any_skip_relocation, mojave: "0a75c65615d92237a59492ac00867d12ab4a23865d85d5cb464d9deb1f6d8ee8"
sha256 cellar: :any_skip_relocation, high_sierra: "0a75c65615d92237a59492ac00867d12ab4a23865d85d5cb464d9deb1f6d8ee8"
sha256 cellar: :any_skip_relocation, x86_64_linux: "27a1f93f4e66e7f25f1fcbc33687d9cab72d45b3a557f1132ece60adc5e7be47" # linuxbrew-core
end
def install
system "make", "install", "PREFIX=#{prefix}"
end
test do
system "git", "init"
(testpath/"test").write "test"
system "git", "add", "#{testpath}/test"
system "git", "commit", "--message", "test"
system "git", "standup"
end
end
|
0x07CB/linuxbrew-core
|
Formula/pcre++.rb
|
class Pcrexx < Formula
desc "C++ wrapper for the Perl Compatible Regular Expressions"
homepage "https://www.daemon.de/projects/pcrepp/"
url "https://www.daemon.de/idisk/Apps/pcre++/pcre++-0.9.5.tar.gz"
mirror "https://distfiles.openadk.org/pcre++-0.9.5.tar.gz"
sha256 "77ee9fc1afe142e4ba2726416239ced66c3add4295ab1e5ed37ca8a9e7bb638a"
license "LGPL-2.1-only"
livecheck do
url "https://www.daemon.de/projects/pcrepp/download/"
regex(/href=.*?pcre\+\+[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
rebuild 2
sha256 cellar: :any, arm64_big_sur: "1232e288cacfd0124da243208e1584caf1925be4dcdcc7b94b96585fb50bfabf"
sha256 cellar: :any, big_sur: "0b05be19479fa7181d354dfafc905f874a17c3135170bedfc324fe0873e113c4"
sha256 cellar: :any, catalina: "15b001d9d01f073cb76772112bc6b3ebac92a3337b19c6dee4eb54d39fe9b6f6"
sha256 cellar: :any, mojave: "fdaf9cab000ba7b2f7787acd98e53aa3cade6e6536c0c0ec32a010ecade2cb53"
sha256 cellar: :any, x86_64_linux: "1ccba2c50d2c14132afe80be18e1bce27282cd9467091cff52da6d1cc8f5bed0" # linuxbrew-core
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "pcre"
# Fix building with libc++. Patch sent to maintainer.
patch :DATA
def install
pcre = Formula["pcre"]
# Don't install "config.log" into doc/ directory. "brew audit" will complain
# about references to the compiler shims that exist there, and there doesn't
# seem to be much reason to keep it around
inreplace "doc/Makefile.am", "../config.log", ""
system "autoreconf", "-fvi"
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--with-pcre-lib=#{pcre.opt_lib}",
"--with-pcre-include=#{pcre.opt_include}"
system "make", "install"
# Pcre++ ships Pcre.3, which causes a conflict with pcre.3 from pcre
# in case-insensitive file system. Rename it to pcre++.3 to avoid
# this problem.
mv man3/"Pcre.3", man3/"pcre++.3"
end
def caveats
<<~EOS
The man page has been renamed to pcre++.3 to avoid conflicts with
pcre in case-insensitive file system. Please use "man pcre++"
instead.
EOS
end
test do
(testpath/"test.cc").write <<~EOS
#include <pcre++.h>
#include <iostream>
int main() {
pcrepp::Pcre reg("[a-z]+ [0-9]+", "i");
if (!reg.search("abc 512")) {
std::cerr << "search failed" << std::endl;
return 1;
}
if (reg.search("512 abc")) {
std::cerr << "search should not have passed" << std::endl;
return 2;
}
return 0;
}
EOS
flags = ["-I#{include}", "-L#{lib}",
"-I#{Formula["pcre"].opt_include}", "-L#{Formula["pcre"].opt_lib}",
"-lpcre++", "-lpcre"] + ENV.cflags.to_s.split
system ENV.cxx, "-o", "test_pcrepp", "test.cc", *flags
system "./test_pcrepp"
end
end
__END__
diff --git a/libpcre++/pcre++.h b/libpcre++/pcre++.h
index d80b387..21869fc 100644
--- a/libpcre++/pcre++.h
+++ b/libpcre++/pcre++.h
@@ -47,11 +47,11 @@
#include <map>
#include <stdexcept>
#include <iostream>
+#include <clocale>
extern "C" {
#include <pcre.h>
- #include <locale.h>
}
namespace pcrepp {
|
0x07CB/linuxbrew-core
|
Formula/msmtp.rb
|
class Msmtp < Formula
desc "SMTP client that can be used as an SMTP plugin for Mutt"
homepage "https://marlam.de/msmtp/"
url "https://marlam.de/msmtp/releases/msmtp-1.8.17.tar.xz"
sha256 "0fddbe74c1a9dcf6461b4a1b0db3e4d34266184500c403d7f107ad42db4ec4d3"
license "GPL-3.0-or-later"
livecheck do
url "https://marlam.de/msmtp/download/"
regex(/href=.*?msmtp[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_big_sur: "ab15c648729695ee988e5b1442c1ed8e4260cb8fe94c0eca7ad2e7c84ffbe651"
sha256 big_sur: "bc3bbdeb0e3334f9a60a37a24ec28c22f33364a37b53e01ad0a0a625f3eccde5"
sha256 catalina: "de21416d9080c652d1579c71309daa54b41f7ba93414399aeac8f0c83cce8637"
sha256 mojave: "a9cafc6ae8a4e6c0fd8ebc7db4bb6e06f0d4a3a981daf37d1d3deae1c02105e5"
sha256 x86_64_linux: "577cbcb8bf6a7ee660b0d33d3cc6a0aaa1a785478af46bf9d59d242bf3b41bbc" # linuxbrew-core
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "pkg-config" => :build
depends_on "gettext"
depends_on "gnutls"
depends_on "libidn2"
# Patch is needed on top of 1.8.17 to fix build on macOS.
# Remove in next release. Build dependencies autoconf and automake can also
# be removed in next release, as well as the autoreconf call in the install block.
# See https://github.com/marlam/mpop-mirror/issues/9#issuecomment-941099714
patch do
url "https://git.marlam.de/gitweb/?p=msmtp.git;a=patch;h=7f03f3767ee6b7311621386c77cb5575fcaa13d0"
sha256 "5896a6ec4f12e8c2c56c957974448778bcdf1308654564cdc5672dac642400c3"
end
def install
system "autoreconf", "-ivf"
system "./configure", *std_configure_args, "--disable-silent-rules", "--with-macosx-keyring"
system "make", "install"
(pkgshare/"scripts").install "scripts/msmtpq"
end
test do
system bin/"msmtp", "--help"
end
end
|
0x07CB/linuxbrew-core
|
Formula/libdap.rb
|
<filename>Formula/libdap.rb<gh_stars>100-1000
class Libdap < Formula
desc "Framework for scientific data networking"
homepage "https://www.opendap.org/"
url "https://www.opendap.org/pub/source/libdap-3.20.8.tar.gz"
sha256 "65eb5c8f693cf74d58eece5eaa2e7c3c65f368926b1bffab0cf5b207757b94eb"
license "LGPL-2.1-or-later"
livecheck do
url "https://www.opendap.org/pub/source/"
regex(/href=.*?libdap[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_big_sur: "114b06032e3190ea6af91825f75fc44017bdc474c96b4cd88e4f289ed8f03c9b"
sha256 big_sur: "d8e3d1ea27305a3e49c1dc3902f57eec4fd9ae6dfeb102f0dab709b8c8e27e9b"
sha256 catalina: "7f6ab80b93c32c6cb09e30af1634f1064bcb2e3bec08f500ac7c78b86fda68dd"
sha256 mojave: "433eb5d60160d3ffd96b0e7a8ea215b4b555d9a94001ff6c41c40c13f93e0f42"
sha256 x86_64_linux: "1cfc0be83a99c1c2cfcdf04d22b9e8503e99a638f59b3e504b5b0bd5c87927c9" # linuxbrew-core
end
head do
url "https://github.com/OPENDAP/libdap4.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "bison" => :build
depends_on "pkg-config" => :build
depends_on "libxml2"
depends_on "openssl@1.1"
uses_from_macos "flex" => :build
uses_from_macos "curl"
on_linux do
depends_on "util-linux"
end
def install
args = %W[
--prefix=#{prefix}
--disable-dependency-tracking
--disable-debug
--with-included-regex
]
system "autoreconf", "-fvi" if build.head?
system "./configure", *args
system "make"
system "make", "check"
system "make", "install"
# Ensure no Cellar versioning of libxml2 path in dap-config entries
xml2 = Formula["libxml2"]
inreplace bin/"dap-config", xml2.opt_prefix.realpath, xml2.opt_prefix
end
test do
assert_match version.to_s, shell_output("#{bin}/dap-config --version")
end
end
|
0x07CB/linuxbrew-core
|
Formula/nfcutils.rb
|
<reponame>0x07CB/linuxbrew-core<filename>Formula/nfcutils.rb
class Nfcutils < Formula
desc "Near Field Communication (NFC) tools under POSIX systems"
homepage "https://github.com/nfc-tools/nfcutils"
url "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/nfc-tools/nfcutils-0.3.2.tar.gz"
sha256 "dea258774bd08c8b7ff65e9bed2a449b24ed8736326b1bb83610248e697c7f1b"
license "GPL-3.0"
revision 1
bottle do
sha256 cellar: :any, arm64_big_sur: "257b8265cf3e136dd2a11c3b26b37f31cc3de371d97401a5fadaf1681330fbd8"
sha256 cellar: :any, big_sur: "ae40ef6e8f1d98d6fc6114893715c713c28e0747a5c5a84779c89726970f8a95"
sha256 cellar: :any, catalina: "963e5bf77bc285e81b9f7480f8b0362c73e5138bced77608043742df6e0992cd"
sha256 cellar: :any, mojave: "972af2e69529bde17b450d36ccfbb4b9d124c59beb7bb4d69a9c63b76f7cff58"
sha256 cellar: :any, high_sierra: "44dc64d49e9edc0c7b8f22c7f259262d5706f83bb452099b968b9f3576047367"
sha256 cellar: :any_skip_relocation, x86_64_linux: "36cef625c3d5b297c8093422b704c88fb9f6a64a16a25d7b801e0ddbb63e004a" # linuxbrew-core
end
depends_on "pkg-config" => :build
depends_on "libnfc"
depends_on "libusb"
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make"
system "make", "install"
end
end
|
0x07CB/linuxbrew-core
|
Formula/mlogger.rb
|
<reponame>0x07CB/linuxbrew-core<filename>Formula/mlogger.rb
class Mlogger < Formula
desc "Log to syslog from the command-line"
homepage "https://github.com/nbrownus/mlogger"
url "https://github.com/nbrownus/mlogger/archive/v1.2.0.tar.gz"
sha256 "141bb9af13a8f0e865c8509ac810c10be4e21f14db5256ef5c7a6731b490bf32"
license "BSD-4-Clause-UC"
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "ae9dd6052251a2283883741ec0c1643cf70e62c2acbda9bec06971375b98eced"
sha256 cellar: :any_skip_relocation, big_sur: "251a03f6e4954f46183a2eaa1ead28e993974d1ab5e6b4b6ae85d1777b15a379"
sha256 cellar: :any_skip_relocation, catalina: "553fe787f0d6a1982544a74ec268d3db6bdf800d538238cd627ba39d8bb1cc37"
sha256 cellar: :any_skip_relocation, mojave: "003cc065352384eeb31109f19c9be3223b5e94cbe859dc3c55c9b1f4e3bd0cb3"
sha256 cellar: :any_skip_relocation, high_sierra: "9eec751c684f9043f667bf5e9d793379ca3a9824a05b359ed91af2d7e41d52b7"
sha256 cellar: :any_skip_relocation, sierra: "1f7392a3d16a2bf595487a4b35bf5c866fa00c0967629eef46f07cbf6e696ff4"
sha256 cellar: :any_skip_relocation, el_capitan: "e1f78a9ef569085efcac8c41bd2a70feda85e7fcba5eb7b46a9ee5341cf8cb2d"
sha256 cellar: :any_skip_relocation, yosemite: "f64331a815b26047bc982340650aae806a568a10060adfc819e25d077059af2e"
sha256 cellar: :any_skip_relocation, x86_64_linux: "5e14ef214b719ce23d386b70e3a08c821737428b2e3d8ecacfd3d2e219e6a748" # linuxbrew-core
end
def install
system "make"
bin.install "mlogger"
end
test do
system "#{bin}/mlogger", "-i", "-d", "test"
end
end
|
0x07CB/linuxbrew-core
|
Formula/libsmi.rb
|
<reponame>0x07CB/linuxbrew-core
class Libsmi < Formula
desc "Library to Access SMI MIB Information"
homepage "https://www.ibr.cs.tu-bs.de/projects/libsmi/"
url "https://www.ibr.cs.tu-bs.de/projects/libsmi/download/libsmi-0.5.0.tar.gz"
mirror "https://www.mirrorservice.org/sites/distfiles.macports.org/libsmi/libsmi-0.5.0.tar.gz"
sha256 "f21accdadb1bb328ea3f8a13fc34d715baac6e2db66065898346322c725754d3"
livecheck do
url "https://www.ibr.cs.tu-bs.de/projects/libsmi/download/"
regex(/href=.*?libsmi[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
rebuild 1
sha256 cellar: :any, arm64_big_sur: "608287866cf55d742ebe601ff14e984f39a3e7b11374d461b4dc3e5a41854ca6"
sha256 cellar: :any, big_sur: "5c3ea572911edc5c6beb54b78e34d840dc458d6b0b5f465298fd0fe673f117be"
sha256 cellar: :any, catalina: "1a25b44883bb95940e789ec6395dfa796ec44fd4e0d9ae1ee81a4119fe70ac14"
sha256 cellar: :any, mojave: "507d7f52bd7be5c1cc3170831de43e3ebd5a4312b6eda5d795d7519437016246"
sha256 cellar: :any, high_sierra: "25a31cf7557ddfc1174a932b904d6c96bda4f3c733caf8258edbdef376e99544"
sha256 cellar: :any, x86_64_linux: "d33ce3b67917f68e4cdedfbac29df8a93f94e97ce4493a952a594b1e70314777" # linuxbrew-core
end
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make", "install"
end
test do
assert_match version.to_s, shell_output("#{bin}/smidiff -V")
end
end
|
0x07CB/linuxbrew-core
|
Formula/microsocks.rb
|
class Microsocks < Formula
desc "Tiny, portable SOCKS5 server with very moderate resource usage"
homepage "https://github.com/rofl0r/microsocks"
url "https://github.com/rofl0r/microsocks/archive/v1.0.2.tar.gz"
sha256 "5ece77c283e71f73b9530da46302fdb4f72a0ae139aa734c07fe532407a6211a"
license "MIT"
head "https://github.com/rofl0r/microsocks.git", branch: "master"
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "ac28cf21d02ba3d7d48950bfab977718e5aaef2eac6e19f0885a5e54cc5bdd92"
sha256 cellar: :any_skip_relocation, big_sur: "f80592c439fb03b85318e2356ff0c9481b0dc6643b4224697f359fcbb9d585ce"
sha256 cellar: :any_skip_relocation, catalina: "95c80ff1e1fe1f25efa6c5bd2498c969575978c0bac2935b293ae1dc6a0cfef5"
sha256 cellar: :any_skip_relocation, mojave: "007187db61ac04906954220f606b66d23d00d04457ce94667b0f59f82ac1bfcc"
sha256 cellar: :any_skip_relocation, x86_64_linux: "4356d57b9e923021407147fb19c46d36223daffc5ed6c2475eae751ca70da3a5" # linuxbrew-core
end
def install
# fix `illegal option -- D` issue for the build
# upstream issue report, https://github.com/rofl0r/microsocks/issues/42
inreplace "Makefile", "install -D", "install -c"
system "make", "install", "prefix=#{prefix}"
end
test do
port = free_port
fork do
exec bin/"microsocks", "-p", port.to_s
end
sleep 2
assert_match "The Missing Package Manager for macOS (or Linux)",
shell_output("curl --socks5 0.0.0.0:#{port} https://brew.sh")
end
end
|
0x07CB/linuxbrew-core
|
Formula/mtools.rb
|
class Mtools < Formula
desc "Tools for manipulating MSDOS files"
homepage "https://www.gnu.org/software/mtools/"
url "https://ftp.gnu.org/gnu/mtools/mtools-4.0.35.tar.gz"
mirror "https://ftpmirror.gnu.org/mtools/mtools-4.0.35.tar.gz"
sha256 "27af3ebb1b5c6c74ca0b8276bf21b70c3fb497dd8eb1b605d74df7a761aedef5"
license "GPL-3.0-or-later"
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "18cddaa9135b9523b2bf852c66cebf108a52c665faabb4eceb1dc8038f7b3265"
sha256 cellar: :any_skip_relocation, big_sur: "5b327d09dd012e22085b77055ca713db9e2b0b054b58d2da0f446d977d4a7d17"
sha256 cellar: :any_skip_relocation, catalina: "82f3ac919cf59793834c72e525d8b76f0249401a78c6bdc16eb70ea394f1b798"
sha256 cellar: :any_skip_relocation, mojave: "eff0b4cc2fa5e3090634b2f25865593c240a654edeb0a0b21c628179ac8899d2"
sha256 cellar: :any_skip_relocation, x86_64_linux: "<KEY>" # linuxbrew-core
end
conflicts_with "multimarkdown", because: "both install `mmd` binaries"
# 4.0.25 doesn't include the proper osx locale headers.
patch :DATA
def install
args = %W[
--disable-debug
--prefix=#{prefix}
--sysconfdir=#{etc}
--without-x
]
args << "LIBS=-liconv" if OS.mac?
# The mtools configure script incorrectly detects stat64. This forces it off
# to fix build errors on Apple Silicon. See stat(6) and pv.rb.
ENV["ac_cv_func_stat64"] = "no" if Hardware::CPU.arm?
system "./configure", *args
system "make"
ENV.deparallelize
system "make", "install"
end
test do
assert_match version.to_s, shell_output("#{bin}/mtools --version")
end
end
__END__
diff --git a/sysincludes.h b/sysincludes.h
index 056218e..ba3677b 100644
--- a/sysincludes.h
+++ b/sysincludes.h
@@ -279,6 +279,8 @@ extern int errno;
#include <pwd.h>
#endif
+#include <xlocale.h>
+#include <strings.h>
#ifdef HAVE_STRING_H
# include <string.h>
|
0x07CB/linuxbrew-core
|
Formula/liboil.rb
|
class Liboil < Formula
desc "C library of simple functions optimized for various CPUs"
homepage "https://wiki.freedesktop.org/liboil/"
url "https://liboil.freedesktop.org/download/liboil-0.3.17.tar.gz"
sha256 "105f02079b0b50034c759db34b473ecb5704ffa20a5486b60a8b7698128bfc69"
livecheck do
url "https://liboil.freedesktop.org/download/"
regex(/href=.*?liboil[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
rebuild 1
sha256 cellar: :any, arm64_big_sur: "915b7c9defeb1e3d056cd4ead9442b6da74c033d776a3d29eab11f3a74cc4bc6"
sha256 cellar: :any, big_sur: "ca18b013a3853b8d751276c3aea1891d945cb510fd73c3f6704eeb84aba49216"
sha256 cellar: :any, catalina: "4568936a9d090ea8a2a349e4009a0b2f0a66edc49c93b4bda1a9c30d6ad64544"
sha256 cellar: :any, mojave: "e8655c3c54d78829199c130758a73dce27e27d8a925cb9ec943a1d32522c13f6"
sha256 cellar: :any, high_sierra: "3214b8910deb69c2c0138a5ece603515c089fa2178ead16e4106695dd6b4c4b4"
sha256 cellar: :any, sierra: "f242435c284690879f84812481843e92c54adc190a8201aa31d550c262e1951d"
sha256 cellar: :any, el_capitan: "7d76b7a220caeb8dbaef27b879f4f3ac0ad5b236b563961abd9484e8bc9e0160"
sha256 cellar: :any, yosemite: "9ea78f801296e8643f366d634449a043376e9015e9329dc1c591a9ad55a37b66"
sha256 cellar: :any, x86_64_linux: "d9a3f5e5422b01b9d8e7d234ddd8843ca97c7263064d8d34789c5766285db2d2" # linuxbrew-core
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
def install
ENV.append "CFLAGS", "-fheinous-gnu-extensions" if ENV.compiler == :clang
system "autoreconf", "-fvi"
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <liboil/liboil.h>
int main(int argc, char** argv) {
oil_init();
return 0;
}
EOS
flags = ["-I#{include}/liboil-0.3", "-L#{lib}", "-loil-0.3"] + ENV.cflags.to_s.split
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end
|
0x07CB/linuxbrew-core
|
Formula/eprover.rb
|
<filename>Formula/eprover.rb
class Eprover < Formula
desc "Theorem prover for full first-order logic with equality"
homepage "https://eprover.org/"
url "https://wwwlehre.dhbw-stuttgart.de/~sschulz/WORK/E_DOWNLOAD/V_2.6/E.tgz"
sha256 "aa1f3deaa229151e60d607560301a46cd24b06a51009e0a9ba86071e40d73edd"
license any_of: ["GPL-2.0-or-later", "LGPL-2.1-or-later"]
livecheck do
url "https://wwwlehre.dhbw-stuttgart.de/~sschulz/WORK/E_DOWNLOAD/"
regex(%r{href=.*?V?[._-]?(\d+(?:\.\d+)+)/?["' >]}i)
end
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "6c5b3ef3fe7c4d8a83d6bc36414cc31a75ee9ec0444e8bc3a53ad9c0e398d388"
sha256 cellar: :any_skip_relocation, big_sur: "5ca253b65f824844b7238c6a48870d62aa7c59759b30caaaf297019dddb1546f"
sha256 cellar: :any_skip_relocation, catalina: "fdad068ad22a703c18f58502d91a24fa16ba2fce017b0f39b9145583930b19c2"
sha256 cellar: :any_skip_relocation, mojave: "2d9b6284695c33af156b99e32026eb934a889ffa0d8891cb1f7f49a8a1b72942"
sha256 cellar: :any_skip_relocation, x86_64_linux: "c5038a0c14455835be07e268a78233512aed9ecc0cfcb22bb0041c533d58cdbe" # linuxbrew-core
end
def install
system "./configure", "--prefix=#{prefix}",
"--man-prefix=#{man1}"
system "make"
system "make", "install"
end
test do
system "#{bin}/eprover", "--help"
end
end
|
0x07CB/linuxbrew-core
|
Formula/linklint.rb
|
<filename>Formula/linklint.rb
class Linklint < Formula
desc "Link checker and web site maintenance tool"
homepage "http://linklint.org"
url "http://linklint.org/download/linklint-2.3.5.tar.gz"
sha256 "ecaee456a3c2d6a3bd18a580d6b09b6b7b825df3e59f900270fe3f84ec3ac9c7"
livecheck do
url "http://linklint.org/download.html"
regex(/href=.*?linklint[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any_skip_relocation, x86_64_linux: "b3e69e9293cd50a460e6ac8ca468ffbb08f9e91bee792b6dd4297c6c77df0127" # linuxbrew-core
end
def install
mv "READ_ME.txt", "README"
doc.install "README"
bin.install "linklint-#{version}" => "linklint"
end
test do
(testpath/"index.html").write('<a href="/">Home</a>')
system "#{bin}/linklint", "/"
end
end
|
0x07CB/linuxbrew-core
|
Formula/libsvg.rb
|
<filename>Formula/libsvg.rb
class Libsvg < Formula
desc "Library for SVG files"
homepage "https://cairographics.org/"
url "https://cairographics.org/snapshots/libsvg-0.1.4.tar.gz"
sha256 "4c3bf9292e676a72b12338691be64d0f38cd7f2ea5e8b67fbbf45f1ed404bc8f"
license "LGPL-2.1-or-later"
revision 1
livecheck do
url "https://cairographics.org/snapshots/"
regex(/href=.*?libsvg[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
rebuild 1
sha256 cellar: :any, arm64_big_sur: "4b7fe8ed8d541c65566d01ce26d3d31a6f051c13d24e947000140de55fe01164"
sha256 cellar: :any, big_sur: "96c398556141fc2ad73955de0c52a0217eeeb627102099592d1ccc85250809c9"
sha256 cellar: :any, catalina: "e0f21af595963a7c99ffa098f593f5d46cf5f78facf1df84ffe97858f29fecbe"
sha256 cellar: :any, mojave: "3984d65fa6524a142ad9094aa095f106ca9c8b6857cdd3f62b913e7e3c8f5b65"
sha256 cellar: :any, high_sierra: "7cfe0b5417654beb7092afec3389a14a4c67eeaa760eb77c9b28082e40f0b11a"
sha256 cellar: :any, sierra: "c9435455e3fb30ce81d467edf1cf4c15c39fb1d061c21738007d6af2565455a7"
sha256 cellar: :any, el_capitan: "4e7903c15847c2d07a2bdf16d6ddad5a0191ef452cf7733624703fd1b5fd7859"
sha256 cellar: :any, yosemite: "05c230ab37e4f4a3b854373b5c71b275414f852d1b776a60351c0fd49c31674a"
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
depends_on "jpeg"
depends_on "libpng"
uses_from_macos "libxml2"
# Fix undefined reference to 'png_set_gray_1_2_4_to_8' in libpng 1.4.0+
patch do
url "https://raw.githubusercontent.com/buildroot/buildroot/45c3b0ec49fac67cc81651f0bed063722a48dc29/package/libsvg/0002-Fix-undefined-symbol-png_set_gray_1_2_4_to_8.patch"
sha256 "a0ca1e25ea6bd5cb9aac57ac541c90ebe3b12c1340dbc5762d487d827064e0b9"
end
# Allow building on M1 Macs. This patch is adapted from
# https://cgit.freedesktop.org/cairo/commit/?id=afdf3917ee86a7d8ae17f556db96478682674a76
patch :DATA
def install
system "autoreconf", "-fiv"
system "./configure", "--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.svg").write <<~EOS
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns:svg="http://www.w3.org/2000/svg" height="72pt" width="144pt" viewBox="0 -20 144 72"><text font-size="12" text-anchor="left" y="0" x="0" font-family="Times New Roman" fill="green">sample text here</text></svg>
EOS
(testpath/"test.c").write <<~EOS
#include <stdio.h>
#include "svg.h"
int main(int argc, char **argv) {
svg_t *svg = NULL;
svg_status_t result = SVG_STATUS_SUCCESS;
FILE *fp = NULL;
printf("1\\n");
result = svg_create(&svg);
if (SVG_STATUS_SUCCESS != result) {
printf ("svg_create failed\\n");
/* Fail if alloc failed */
return -1;
}
printf("2\\n");
result = svg_parse(svg, "test.svg");
if (SVG_STATUS_SUCCESS != result) {
printf ("svg_parse failed\\n");
/* Fail if alloc failed */
return -2;
}
printf("3\\n");
result = svg_destroy(svg);
if (SVG_STATUS_SUCCESS != result) {
printf ("svg_destroy failed\\n");
/* Fail if alloc failed */
return -3;
}
svg = NULL;
printf("4\\n");
result = svg_create(&svg);
if (SVG_STATUS_SUCCESS != result) {
printf ("svg_create failed\\n");
/* Fail if alloc failed */
return -4;
}
fp = fopen("test.svg", "r");
if (NULL == fp) {
printf ("failed to fopen test.svg\\n");
/* Fail if alloc failed */
return -5;
}
printf("5\\n");
result = svg_parse_file(svg, fp);
if (SVG_STATUS_SUCCESS != result) {
printf ("svg_parse_file failed\\n");
/* Fail if alloc failed */
return -6;
}
printf("6\\n");
result = svg_destroy(svg);
if (SVG_STATUS_SUCCESS != result) {
printf ("svg_destroy failed\\n");
/* Fail if alloc failed */
return -7;
}
svg = NULL;
printf("SUCCESS\\n");
return 0;
}
EOS
flags = %W[
-I#{include}
-L#{lib}
-lsvg
]
on_linux do
flags << "-lpng"
flags << "-ljpeg"
end
system ENV.cc, "test.c", "-o", "test", *flags
assert_equal "1\n2\n3\n4\n5\n6\nSUCCESS\n", shell_output("./test")
end
end
__END__
diff --git a/configure.in b/configure.in
index a9f871e..c84d417 100755
--- a/configure.in
+++ b/configure.in
@@ -8,18 +8,18 @@ LIBSVG_VERSION=0.1.4
# libtool shared library version
# Increment if the interface has additions, changes, removals.
-LT_CURRENT=1
+m4_define(LT_CURRENT, 1)
# Increment any time the source changes; set to
# 0 if you increment CURRENT
-LT_REVISION=0
+m4_define(LT_REVISION, 0)
# Increment if any interfaces have been added; set to 0
# if any interfaces have been removed. removal has
# precedence over adding, so set to 0 if both happened.
-LT_AGE=0
+m4_define(LT_AGE, 0)
-VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE"
+VERSION_INFO="LT_CURRENT():LT_REVISION():LT_AGE()"
AC_SUBST(VERSION_INFO)
dnl ===========================================================================
|
0x07CB/linuxbrew-core
|
Formula/cssembed.rb
|
class Cssembed < Formula
desc "Automatic data URI embedding in CSS files"
homepage "https://www.nczonline.net/blog/2009/11/03/automatic-data-uri-embedding-in-css-files/"
url "https://github.com/downloads/nzakas/cssembed/cssembed-0.4.5.jar"
sha256 "8955016c0d32de8755d9ee33d365d1ad658a596aba48537a810ce62f3d32a1af"
license "MIT"
deprecate! date: "2020-11-10", because: :repo_archived
def install
libexec.install "cssembed-#{version}.jar"
bin.write_jar_script libexec/"cssembed-#{version}.jar", "cssembed"
end
end
|
0x07CB/linuxbrew-core
|
Formula/git-annex-remote-rclone.rb
|
class GitAnnexRemoteRclone < Formula
desc "Use rclone supported cloud storage with git-annex"
homepage "https://github.com/DanielDent/git-annex-remote-rclone"
url "https://github.com/DanielDent/git-annex-remote-rclone/archive/v0.6.tar.gz"
sha256 "fb9bb77c6dd30dad4966926af87f63be92ef442cfeabcfd02202c657f40439d0"
license "GPL-3.0"
depends_on arch: :x86_64 # Remove this when `git-annex` is bottled for ARM
depends_on "git-annex"
depends_on "rclone"
def install
bin.install "git-annex-remote-rclone"
end
test do
# try a test modeled after git-annex.rb's test (copy some lines
# from there)
# make sure git can find git-annex
ENV.prepend_path "PATH", bin
# We don't want this here or it gets "caught" by git-annex.
rm_r "Library/Python/2.7/lib/python/site-packages/homebrew.pth"
system "git", "init"
system "git", "annex", "init"
(testpath/"Hello.txt").write "Hello!"
assert !File.symlink?("Hello.txt")
assert_match(/^add Hello.txt.*ok.*\(recording state in git\.\.\.\)/m, shell_output("git annex add ."))
system "git", "commit", "-a", "-m", "Initial Commit"
assert File.symlink?("Hello.txt")
ENV["RCLONE_CONFIG_TMPLOCAL_TYPE"]="local"
system "git", "annex", "initremote", "testremote", "type=external", "externaltype=rclone",
"target=tmplocal", "encryption=none", "rclone_layout=lower"
system "git", "annex", "copy", "Hello.txt", "--to=testremote"
# The steps below are necessary to ensure the directory cleanly deletes.
# git-annex guards files in a way that isn't entirely friendly of automatically
# wiping temporary directories in the way `brew test` does at end of execution.
system "git", "rm", "Hello.txt", "-f"
system "git", "commit", "-a", "-m", "Farewell!"
system "git", "annex", "unused"
assert_match "dropunused 1 ok", shell_output("git annex dropunused 1 --force")
system "git", "annex", "uninit"
end
end
|
0x07CB/linuxbrew-core
|
Formula/helib.rb
|
<filename>Formula/helib.rb
class Helib < Formula
desc "Implementation of homomorphic encryption"
homepage "https://github.com/homenc/HElib"
url "https://github.com/homenc/HElib/archive/v2.2.1.tar.gz"
sha256 "cbe030c752c915f1ece09681cadfbe4f140f6752414ab000b4cf076b6c3019e4"
license "Apache-2.0"
bottle do
sha256 cellar: :any, arm64_big_sur: "86a2b67a36f009f5da7031f426a62516ba43683636a7f124d0592fbd827e048b"
sha256 cellar: :any, big_sur: "7ec83df94881c5a6e6219e22c4d2f7676f6ccd6d1def7315d443316a47e92b07"
sha256 cellar: :any, catalina: "479118627ff0025805e67dbbe8a75a4097a66fc5eb900adb307bb72372b813c6"
sha256 cellar: :any, mojave: "503957a2db03e7df3255616e8e51b430133ae5e7b91985edddafd18e1317db99"
sha256 cellar: :any_skip_relocation, x86_64_linux: "61758fb498cd2ead0b91ec6c975b10b1e42c84160036ae9ba208ba4a8b017eb8" # linuxbrew-core
end
depends_on "cmake" => :build
depends_on "bats-core" => :test
depends_on "gmp"
depends_on "ntl"
on_linux do
depends_on "gcc" # for C++17
end
fails_with gcc: "5"
def install
mkdir "build" do
system "cmake", "-DBUILD_SHARED=ON", "..", *std_cmake_args
system "make", "install"
end
pkgshare.install "examples"
end
test do
cp pkgshare/"examples/BGV_country_db_lookup/BGV_country_db_lookup.cpp", testpath/"test.cpp"
mkdir "build"
system ENV.cxx, "test.cpp", "-std=c++17", "-L#{lib}", "-L#{Formula["ntl"].opt_lib}",
"-pthread", "-lhelib", "-lntl", "-o", "build/BGV_country_db_lookup"
cp_r pkgshare/"examples/tests", testpath
system "bats", "."
end
end
|
0x07CB/linuxbrew-core
|
Formula/gluon.rb
|
<reponame>0x07CB/linuxbrew-core
class Gluon < Formula
desc "Static, type inferred and embeddable language written in Rust"
homepage "https://gluon-lang.org"
url "https://github.com/gluon-lang/gluon/archive/v0.17.2.tar.gz"
sha256 "8fc8cc2211cff7a3d37a64c0b1f0901767725d3c2c26535cb9aabbfe921ba18e"
license "MIT"
head "https://github.com/gluon-lang/gluon.git"
livecheck do
url :stable
strategy :github_latest
end
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "62a081e09aff7da0df608c4b9c7a852e75c2226d5953bc0a938af6fb716b793e"
sha256 cellar: :any_skip_relocation, big_sur: "4c46d2aa89cd80b3fd135f8160019076bc0f01a208a561ef63d84e7959a5d64e"
sha256 cellar: :any_skip_relocation, catalina: "abea6a7007ec7663a5d3d8994a8028412843d45210b5b17723f2bcb0dc43134b"
sha256 cellar: :any_skip_relocation, mojave: "b6a865cd7da1a201a008ae65478191082501e1dc9ab7b6dae189e4f2f2bef8e4"
sha256 cellar: :any_skip_relocation, high_sierra: "847b61a0a4b7d4afc4598301c5bbf6afac3e70c737cdb0a26ad0438db42b1e44"
sha256 cellar: :any_skip_relocation, x86_64_linux: "08580a9a5c430e40e64d2e3c5b3e1f3159bbe21c8f28e96c9a2b5fb34afaf2df" # linuxbrew-core
end
depends_on "rust" => :build
def install
cd "repl" do
system "cargo", "install", *std_cargo_args
end
end
test do
(testpath/"test.glu").write <<~EOS
let io = import! std.io
io.print "Hello world!\\n"
EOS
assert_equal "Hello world!\n", shell_output("#{bin}/gluon test.glu")
end
end
|
0x07CB/linuxbrew-core
|
Formula/sdlpop.rb
|
<reponame>0x07CB/linuxbrew-core
class Sdlpop < Formula
desc "Open-source port of Prince of Persia"
homepage "https://github.com/NagyD/SDLPoP"
url "https://github.com/NagyD/SDLPoP/archive/v1.22.tar.gz"
sha256 "1af170f7f6def61b2ab9c3a9227feca335461d224faa99f3578fc09115ac505c"
license "GPL-3.0-or-later"
bottle do
sha256 cellar: :any, arm64_big_sur: "1ccdaf2e5186bcc2d0094fbdc59206c5b602b367287ee76a3473969897f1af8a"
sha256 cellar: :any, big_sur: "2c3a47b467b2bdd321d1b7f2d73ad7f40859319b2ae6b51ef0009c2274c2581b"
sha256 cellar: :any, catalina: "4c2307714ee64456baac5c4b758e48c8aca6747a0daa92b8bc31fd1597663250"
sha256 cellar: :any, mojave: "d304d506f73fec8e98b223eb0f8cfd087dd7a15a144fd0b46522f7a2b78261b9"
sha256 cellar: :any_skip_relocation, x86_64_linux: "0f0fb2d039d5e9d70aed935ad790888eb514431ca9fa6e15859ad90003e06fa2" # linuxbrew-core
end
depends_on "pkg-config" => :build
depends_on "sdl2"
depends_on "sdl2_image"
# Fix SDL2 header search location during build. Patch accepted upstream, remove on next release.
patch do
url "https://github.com/NagyD/SDLPoP/commit/26d3fb9ffee2831ab98b1f0359ba25b41f6fffc8.patch?full_index=1"
sha256 "4c62ddef19d5550f3dc0db6d5a2fff7ba2c2454d376ca624a147b4c650512097"
end
def install
system "make", "-C", "src"
doc.install Dir["doc/*"]
libexec.install "data"
libexec.install "prince"
# Use var directory to keep save and replay files
pkgvar = var/"sdlpop"
pkgvar.install "SDLPoP.ini" unless (pkgvar/"SDLPoP.ini").exist?
(bin/"prince").write <<~EOS
#!/bin/bash
cd "#{pkgvar}" && exec "#{libexec}/prince" $@
EOS
end
def caveats
<<~EOS
Save and replay files are stored in the following directory:
#{var}/sdlpop
EOS
end
test do
assert_equal "See doc/Readme.txt", shell_output("#{bin}/prince --help").chomp
end
end
|
0x07CB/linuxbrew-core
|
Formula/sdl_sound.rb
|
class SdlSound < Formula
desc "Library to decode several popular sound file formats"
homepage "https://icculus.org/SDL_sound/"
url "https://icculus.org/SDL_sound/downloads/SDL_sound-1.0.3.tar.gz"
mirror "https://deb.debian.org/debian/pool/main/s/sdl-sound1.2/sdl-sound1.2_1.0.3.orig.tar.gz"
sha256 "3999fd0bbb485289a52be14b2f68b571cb84e380cc43387eadf778f64c79e6df"
revision 1
bottle do
sha256 cellar: :any, arm64_big_sur: "2da102c4035e6cd0138668695cbee5eed9f730077a78e7221e73cb2a047d915c"
sha256 cellar: :any, big_sur: "8a2c07271bbc94a345cd8951ed897e9d12edda47d713c247a77e3186780247fc"
sha256 cellar: :any, catalina: "b8ac8b382c94d4a92032a8bc9c93d777fac1367851bd3df382089f747c347f05"
sha256 cellar: :any, mojave: "3661daa8d14b8b8ab613a5fb449ad6b3f758739eb3b69700b23c0ccdc49068b6"
sha256 cellar: :any, high_sierra: "c571e007bcbb022e6fd0042e506ce6cd47a26d814de06f348b13231fc95a1581"
sha256 cellar: :any, sierra: "0e692b6c08600d6d7014fc582b5a351e8a4eea42ce95d231ef39a0c07c41c71b"
sha256 cellar: :any, el_capitan: "fd93d8be366bfe3f16839f50d11ab1149cc725c6bf6248befe90feae25c0e052"
sha256 cellar: :any, yosemite: "8f06d7c6c18c8a5192aebf5672c20f9f3b27bbd3109459ef96110d935c00f87b"
sha256 cellar: :any_skip_relocation, x86_64_linux: "3017fd9a630ffce338eb378471a7d2e9c61012ad9022818b2f5ded89fc234b6d" # linuxbrew-core
end
head do
url "https://github.com/icculus/SDL_sound.git", branch: "stable-1.0"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
# SDL 1.2 is deprecated, unsupported, and not recommended for new projects.
deprecate! date: "2013-08-17", because: :deprecated_upstream
depends_on "pkg-config" => :build
depends_on "libogg"
depends_on "libvorbis"
depends_on "sdl"
def install
system "./autogen.sh" if build.head?
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--disable-sdltest"
system "make"
system "make", "install"
end
end
|
0x07CB/linuxbrew-core
|
Formula/monolith.rb
|
class Monolith < Formula
desc "CLI tool for saving complete web pages as a single HTML file"
homepage "https://github.com/Y2Z/monolith"
url "https://github.com/Y2Z/monolith/archive/v2.6.1.tar.gz"
sha256 "dc08e6fa786c2cdfc7a8f6c307022c368d875c172737b695222c2b2f3bfe2a72"
license "CC0-1.0"
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "f8d25cc101ab57a7b2392d748815de0d2dbf36654a4ef592b5eedf992846f17a"
sha256 cellar: :any_skip_relocation, big_sur: "f665108ed7bbba69ffd99220d6d23d6baeb380fee9ce569eaef11b510c8affec"
sha256 cellar: :any_skip_relocation, catalina: "03eead42ea9e5f888b968147d1975ffaa04ad470747b985c3920dfe5724f9c62"
sha256 cellar: :any_skip_relocation, mojave: "3794386713e0d813abbcbc6377c943421efb94b8dde4ce01729bd8a88d206af2"
sha256 cellar: :any_skip_relocation, x86_64_linux: "5720edf89dab9a94242e1f570c60bd7c9c4508531544513a0958a998109f34a6" # linuxbrew-core
end
depends_on "pkg-config" => :build
depends_on "rust" => :build
depends_on "openssl@1.1"
def install
system "cargo", "install", *std_cargo_args
end
test do
system bin/"monolith", "https://lyrics.github.io/db/P/Portishead/Dummy/Roads/"
end
end
|
0x07CB/linuxbrew-core
|
Formula/brew-gem.rb
|
<reponame>0x07CB/linuxbrew-core
class BrewGem < Formula
desc "Install RubyGems as Homebrew formulae"
homepage "https://github.com/sportngin/brew-gem"
url "https://github.com/sportngin/brew-gem/archive/v1.1.1.tar.gz"
sha256 "affa68105dcabc5c8b4832cf70ee2b35c1fbf19496173753645bda496d9b0a34"
license "MIT"
head "https://github.com/sportngin/brew-gem.git", branch: "master"
# Until versions exceed 2.2, the leading `v` in this regex isn't optional, as
# we need to avoid an older `2.2` tag (a typo) while continuing to match
# newer tags like `v1.1.1` and allowing for a future `v2.2.0` version.
livecheck do
url :stable
regex(/^v(\d+(?:\.\d+)+)$/i)
end
bottle do
rebuild 1
sha256 cellar: :any_skip_relocation, x86_64_linux: "db5b7cf04d8c3a9ccf0e55b035545686d9faeb8d781c20df561fb7c77f8d54f9" # linuxbrew-core
end
uses_from_macos "ruby"
def install
inreplace "lib/brew/gem/formula.rb.erb", "/usr/local", HOMEBREW_PREFIX
lib.install Dir["lib/*"]
bin.install "bin/brew-gem"
end
test do
system "#{bin}/brew-gem", "help"
end
end
|
0x07CB/linuxbrew-core
|
Formula/surfraw.rb
|
<reponame>0x07CB/linuxbrew-core<filename>Formula/surfraw.rb
class Surfraw < Formula
desc "Shell Users' Revolutionary Front Rage Against the Web"
homepage "https://packages.debian.org/sid/surfraw"
url "https://ftp.openbsd.org/pub/OpenBSD/distfiles/surfraw-2.3.0.tar.gz"
sha256 "ad0420583c8cdd84a31437e59536f8070f15ba4585598d82638b950e5c5c3625"
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "65d1418f750b53be50f7d67e98791242056d4d7b5e21ba177899435fd9ac9d0f"
sha256 cellar: :any_skip_relocation, big_sur: "a9e126e0e78269271cee0952d6576fb99c443f49449dc9196a53ee2eb65d7ea6"
sha256 cellar: :any_skip_relocation, catalina: "2a2267217bfdd25ea00b3a08f76c44518e33dac0192a8590e4b3bfa3b5d90073"
sha256 cellar: :any_skip_relocation, mojave: "c9f5fc8020b021799c68cd204d4612f487c44315c15967be78a037576b378920"
sha256 cellar: :any_skip_relocation, high_sierra: "69920395cbde5fdc2492aa27fc765d4dafe910e26d9d3a05777888425310a0a9"
sha256 cellar: :any_skip_relocation, sierra: "69920395cbde5fdc2492aa27fc765d4dafe910e26d9d3a05777888425310a0a9"
sha256 cellar: :any_skip_relocation, el_capitan: "69920395cbde5fdc2492aa27fc765d4dafe910e26d9d3a05777888425310a0a9"
sha256 cellar: :any_skip_relocation, x86_64_linux: "48b20736aae201046c9fdd3f0952ee5776be80c7eb0a7b68b3c75b837eca9285" # linuxbrew-core
end
def install
system "./configure", "--prefix=#{prefix}",
"--sysconfdir=#{etc}",
"--with-graphical-browser=open"
system "make"
ENV.deparallelize
system "make", "install"
end
test do
output = shell_output("#{bin}/surfraw -p duckduckgo homebrew")
assert_equal "https://duckduckgo.com/lite/?q=homebrew", output.chomp
end
end
|
0x07CB/linuxbrew-core
|
Formula/optipng.rb
|
class Optipng < Formula
desc "PNG file optimizer"
homepage "https://optipng.sourceforge.io/"
url "https://downloads.sourceforge.net/project/optipng/OptiPNG/optipng-0.7.7/optipng-0.7.7.tar.gz"
sha256 "4f32f233cef870b3f95d3ad6428bfe4224ef34908f1b42b0badf858216654452"
license "Zlib"
head "http://hg.code.sf.net/p/optipng/mercurial", using: :hg
bottle do
rebuild 1
sha256 cellar: :any_skip_relocation, arm64_big_sur: "796af028b1dea8b680e40103712976b4f9df285df553db06d2643779630c716c"
sha256 cellar: :any_skip_relocation, big_sur: "5cee26efb92016f057a55b2711a08c4a0350046b7c0b1d969c75a913caf66fc2"
sha256 cellar: :any_skip_relocation, catalina: "3d423dfa59e07122f70e2a15026289dfc6884798ac76898065dbe587256c6e35"
sha256 cellar: :any_skip_relocation, mojave: "bd44fa66b00a6ee0340a9a5b239d22823787fcaa26312783b21c0f4afc39fd0b"
sha256 cellar: :any_skip_relocation, x86_64_linux: "898b50a718d01660252200536d1a3c422b56ec35f9537a91cd1ba499b7f5c70c" # linuxbrew-core
end
depends_on "libpng"
uses_from_macos "zlib"
def install
system "./configure", "--with-system-zlib",
"--with-system-libpng",
"--prefix=#{prefix}",
"--mandir=#{man}"
system "make", "install"
end
test do
system "#{bin}/optipng", "-simulate", test_fixtures("test.png")
end
end
|
0x07CB/linuxbrew-core
|
Formula/gst-editing-services.rb
|
class GstEditingServices < Formula
desc "GStreamer Editing Services"
homepage "https://gstreamer.freedesktop.org/modules/gst-editing-services.html"
url "https://gstreamer.freedesktop.org/src/gst-editing-services/gst-editing-services-1.18.4.tar.xz"
sha256 "4687b870a7de18aebf50f45ff572ad9e0138020e3479e02a6f056a0c4c7a1d04"
license "LGPL-2.0-or-later"
livecheck do
url "https://gstreamer.freedesktop.org/src/gst-editing-services/"
regex(/href=.*?gst(?:reamer)?-editing-services[._-]v?(\d+\.\d*[02468](?:\.\d+)*)\.t/i)
end
bottle do
sha256 arm64_big_sur: "22be5c42f2f8d13852d3fe7a1d48bff59cbca21b9163a7d9c361d2830acef909"
sha256 big_sur: "2f5ec6f0fa4f143367006e9c84a77206b554f362b0010478bd13248d9562cde5"
sha256 catalina: "2b3b2e79dd2432db081ac4b8b6561edc587ce08b6abcba9eb74bbc25c7b9d9ae"
sha256 mojave: "199d6eb47c8ff8469c7397b97c263b99357d72916437cb41c3d70c3ec8e0f3ab"
sha256 x86_64_linux: "17a690a0ea7863d01f3b51af53e224841b78bd657a63925f9ade3efb63d4439f" # linuxbrew-core
end
depends_on "gobject-introspection" => :build
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "gst-plugins-base"
depends_on "gstreamer"
def install
args = std_meson_args + %w[
-Dintrospection=enabled
-Dtests=disabled
]
mkdir "build" do
system "meson", *args, ".."
system "ninja", "-v"
system "ninja", "install", "-v"
end
end
test do
system "#{bin}/ges-launch-1.0", "--ges-version"
end
end
|
0x07CB/linuxbrew-core
|
Formula/eralchemy.rb
|
class Eralchemy < Formula
include Language::Python::Virtualenv
desc "Simple entity relation (ER) diagrams generation"
homepage "https://github.com/Alexis-benoist/eralchemy"
url "https://files.pythonhosted.org/packages/87/40/07b58c29406ad9cc8747e567e3e37dd74c0a8756130ad8fd3a4d71c796e3/ERAlchemy-1.2.10.tar.gz"
sha256 "be992624878278195c3240b90523acb35d97453f1a350c44b4311d4333940f0d"
license "Apache-2.0"
revision 5
bottle do
sha256 cellar: :any, arm64_big_sur: "d925eb8686a32d2bbf7b9bab62f65f6b761952dcb32923ef7b6428f5325c11a1"
sha256 cellar: :any, big_sur: "2a5ce41209235c75eeb092f0b6c17c6c46c03f2faada2b2a337fcda7f28a4288"
sha256 cellar: :any, catalina: "e844701e7824dc9497969cc6592302bf56ac060d5aa18105e1ee2887411a5f12"
sha256 cellar: :any, mojave: "cfb423a7299d1d307e58aa756675f26ea65ad405e6e2fb707727de49aa36eb64"
sha256 cellar: :any, high_sierra: "cb2442baa298aa27c860ad7d80116131f286ea283625dbd809d4b518ba81707a"
sha256 cellar: :any_skip_relocation, x86_64_linux: "2f68a9efd69251081c3948657da0919a871dc1b3748f9b609e0546bae40ddcda" # linuxbrew-core
end
depends_on "pkg-config" => :build
depends_on "graphviz"
depends_on "libpq"
depends_on "openssl@1.1"
depends_on "python@3.9"
resource "psycopg2" do
url "https://files.pythonhosted.org/packages/fd/ae/98cb7a0cbb1d748ee547b058b14604bd0e9bf285a8e0cc5d148f8a8a952e/psycopg2-2.8.6.tar.gz"
sha256 "fb23f6c71107c37fd667cb4ea363ddeb936b348bbd6449278eb92c189699f543"
end
resource "pygraphviz" do
url "https://files.pythonhosted.org/packages/1e/19/acf3b8dbd378a2b38c6d9aaa6fa9fcd9f7b4aea5fcd3460014999ff92b3c/pygraphviz-1.6.zip"
sha256 "411ae84a5bc313e3e1523a1cace59159f512336318a510573b47f824edef8860"
end
resource "SQLAlchemy" do
url "https://files.pythonhosted.org/packages/69/ef/6d18860e18db68b8f25e0d268635f2f8cefa7a1cbf6d9d9f90214555a364/SQLAlchemy-1.3.20.tar.gz"
sha256 "d2f25c7f410338d31666d7ddedfa67570900e248b940d186b48461bd4e5569a1"
end
resource "er_example" do
url "https://raw.githubusercontent.com/Alexis-benoist/eralchemy/v1.1.0/example/newsmeme.er"
sha256 "5c475bacd91a63490e1cbbd1741dc70a3435e98161b5b9458d195ee97f40a3fa"
end
def install
venv = virtualenv_create(libexec, Formula["python@3.9"].opt_bin/"python3")
res = resources.reject { |r| r.name == "er_example" }
res.each do |r|
venv.pip_install r
end
venv.pip_install_and_link buildpath
end
test do
system "#{bin}/eralchemy", "-v"
resource("er_example").stage do
system "#{bin}/eralchemy", "-i", "newsmeme.er", "-o", "test_eralchemy.pdf"
assert_predicate Pathname.pwd/"test_eralchemy.pdf", :exist?
end
end
end
|
0x07CB/linuxbrew-core
|
Formula/libnfnetlink.rb
|
<gh_stars>100-1000
class Libnfnetlink < Formula
desc "Low-level library for netfilter related communication"
homepage "https://www.netfilter.org/projects/libnfnetlink"
url "https://www.netfilter.org/projects/libnfnetlink/files/libnfnetlink-1.0.1.tar.bz2"
sha256 "f270e19de9127642d2a11589ef2ec97ef90a649a74f56cf9a96306b04817b51a"
license "LGPL-2.1-or-later"
livecheck do
url "https://www.netfilter.org/projects/libnfnetlink/downloads.html"
regex(/href=.*?libnfnetlink[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any_skip_relocation, x86_64_linux: "6935ad517877f2c838d8d44b87519b0862b586bf5344785e0da55d1460de7417" # linuxbrew-core
end
depends_on :linux
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <libnfnetlink/libnfnetlink.h>
int main() {
int i = NFNL_BUFFSIZE;
}
EOS
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lnfnetlink", "-o", "test"
end
end
|
0x07CB/linuxbrew-core
|
Formula/libmng.rb
|
class Libmng < Formula
desc "MNG/JNG reference library"
homepage "https://libmng.com/"
url "https://downloads.sourceforge.net/project/libmng/libmng-devel/2.0.3/libmng-2.0.3.tar.gz"
sha256 "cf112a1fb02f5b1c0fce5cab11ea8243852c139e669c44014125874b14b7dfaa"
license "Zlib"
bottle do
sha256 cellar: :any, arm64_big_sur: "10950a560440734b94a43fffd1988e483c2ff6530b3cf76825c80e9453069831"
sha256 cellar: :any, big_sur: "ae1a19ad2cb9cad4f252aafd63c43d8c44b68175ddace7b0b6369d8541514bce"
sha256 cellar: :any, catalina: "0102c3da599178979dba5b225b6fd15cf7896cd64cb41bd548c2cc2487425db2"
sha256 cellar: :any, mojave: "e1468ebcdd4fdbb47edf1e0c053206bbaa8792f0ef73fb297cc96f21533965f6"
sha256 cellar: :any_skip_relocation, x86_64_linux: "76a41e2666007dabb0bce0da17d0a55ca7694168e74f31ec6136cb9632642eea" # linuxbrew-core
end
depends_on "jpeg"
depends_on "little-cms2"
uses_from_macos "zlib"
resource "sample" do
url "https://telparia.com/fileFormatSamples/image/mng/abydos.mng"
sha256 "4819310da1bbee591957185f55983798a0f8631c32c72b6029213c67071caf8d"
end
def install
system "./configure", *std_configure_args, "--disable-silent-rules"
system "make", "install"
# Keep an example for test purposes, but fix header location to use system-level includes
inreplace "contrib/gcc/mngtree/mngtree.c", "\"../../../libmng.h\"", "<libmng.h>"
pkgshare.install "contrib/gcc/mngtree/mngtree.c"
end
test do
system ENV.cc, pkgshare/"mngtree.c", "-DMNG_USE_SO",
"-I#{include}", "-L#{lib}", "-lmng", "-o", "mngtree"
resource("sample").stage do
output = shell_output("#{testpath}/mngtree abydos.mng")
assert_match "Starting dump of abydos.mng.", output
assert_match "Done.", output
end
end
end
|
0x07CB/linuxbrew-core
|
Formula/joshua.rb
|
<reponame>0x07CB/linuxbrew-core
class Joshua < Formula
desc "Statistical machine translation decoder"
homepage "https://cwiki.apache.org/confluence/display/JOSHUA/"
url "https://cs.jhu.edu/~post/files/joshua-6.0.5.tgz"
sha256 "972116a74468389e89da018dd985f1ed1005b92401907881a14bdcc1be8bd98a"
revision 1
livecheck do
url :homepage
regex(/href=.*?joshua[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "d9a3dcdc2356e269c23318dd304ec54fa172306d100b274c04a7e78440573987"
sha256 cellar: :any_skip_relocation, big_sur: "8e37238c958548a5f28c843f65e9f9a6e9eede05d9f9b9a8e802fabae5e42906"
sha256 cellar: :any_skip_relocation, catalina: "126f37758cb9f1ace827883911906cab4976bf5f211b200ed0e2f307fae87982"
sha256 cellar: :any_skip_relocation, mojave: "126f37758cb9f1ace827883911906cab4976bf5f211b200ed0e2f307fae87982"
sha256 cellar: :any_skip_relocation, high_sierra: "126f37758cb9f1ace827883911906cab4976bf5f211b200ed0e2f307fae87982"
sha256 cellar: :any_skip_relocation, x86_64_linux: "e7acfaf7a26f9977cea0296e8d1efe3aa525683101a8a1da20cf2544735d287f" # linuxbrew-core
end
depends_on "openjdk"
def install
rm Dir["lib/*.{gr,tar.gz}"]
rm_rf "lib/README"
rm_rf "bin/.gitignore"
libexec.install Dir["*"]
bin.install Dir["#{libexec}/bin/*"]
bin.env_script_all_files libexec/"bin", JAVA_HOME: Formula["openjdk"].opt_prefix
end
test do
assert_equal "test_OOV\n", pipe_output("#{bin}/joshua-decoder -v 0 -output-format %s -mark-oovs", "test")
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.