CombinedText stringlengths 4 3.42M |
|---|
added ability module
module EnjuLibrary
class Ability
include CanCan::Ability
def initialize(user, ip_address = nil)
case user.try(:role).try(:name)
when 'Administrator'
can [:read, :create, :update], Bookstore
can :destroy, Bookstore do |bookstore|
bookstore.items.empty?
end
can [:read, :create, :update], Library
can :destroy, Library do |library|
library.shelves.empty? and !library.web?
end
can [:read, :create, :update], Shelf
can :destroy, Shelf do |shelf|
shelf.items.empty?
end
can :manage, [
Accept,
BudgetType,
SearchEngine,
Subscribe,
Subscription
]
can :update, [
LibraryGroup,
RequestStatusType,
RequestType
] if LibraryGroup.site_config.network_access_allowed?(ip_address)
can :read, [
LibraryGroup,
RequestStatusType,
RequestType
]
when 'Librarian'
can :manage, [
Accept,
Subscribe,
Subscription
]
can :read, [
Bookstore,
BudgetType,
Library,
LibraryGroup,
RequestStatusType,
RequestType,
SearchEngine,
Shelf
]
when 'User'
can :read, [
Library,
LibraryGroup,
Shelf
]
else
can :read, [
Library,
LibraryGroup,
Shelf
]
end
end
end
end
|
require 'formula'
class NoExpatFramework < Requirement
def expat_framework
'/Library/Frameworks/expat.framework'
end
satisfy :build_env => false do
not File.exist? expat_framework
end
def message; <<-EOS.undent
Detected #{expat_framework}
This will be picked up by CMake's build system and likely cause the
build to fail, trying to link to a 32-bit version of expat.
You may need to move this file out of the way to compile CMake.
EOS
end
end
class Cmake < Formula
homepage 'http://www.cmake.org/'
url 'http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz'
sha1 '31f217c9305add433e77eff49a6eac0047b9e929'
head 'http://cmake.org/cmake.git'
bottle do
cellar :any
sha1 '024d5263bce0f7f36bde4579ce6fc9be9d55fd72' => :mountain_lion
sha1 'bfcc7c9925aea56bd5ce883ed8ca391c27144551' => :lion
sha1 '22a1369e2ed4b4a4113621b9df6fd75b162e35fb' => :snow_leopard
end
depends_on NoExpatFramework
def install
args = %W[
--prefix=#{prefix}
--system-libs
--no-system-libarchive
--datadir=/share/cmake
--docdir=/share/doc/cmake
--mandir=/share/man
]
system "./bootstrap", *args
system "make"
system "make install"
end
test do
(testpath/'CMakeLists.txt').write('find_package(Ruby)')
system "#{bin}/cmake", '.'
end
end
cmake 2.8.12
Closes Homebrew/homebrew#23309.
Signed-off-by: Mike McQuaid <a17fed27eaa842282862ff7c1b9c8395a26ac320@mikemcquaid.com>
require 'formula'
class NoExpatFramework < Requirement
def expat_framework
'/Library/Frameworks/expat.framework'
end
satisfy :build_env => false do
not File.exist? expat_framework
end
def message; <<-EOS.undent
Detected #{expat_framework}
This will be picked up by CMake's build system and likely cause the
build to fail, trying to link to a 32-bit version of expat.
You may need to move this file out of the way to compile CMake.
EOS
end
end
class Cmake < Formula
homepage 'http://www.cmake.org/'
url 'http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz'
sha1 '93c93d556e702f8c967acf139fd716268ce69f39'
head 'http://cmake.org/cmake.git'
depends_on NoExpatFramework
def install
args = %W[
--prefix=#{prefix}
--system-libs
--no-system-libarchive
--datadir=/share/cmake
--docdir=/share/doc/cmake
--mandir=/share/man
]
system "./bootstrap", *args
system "make"
system "make install"
end
test do
(testpath/'CMakeLists.txt').write('find_package(Ruby)')
system "#{bin}/cmake", '.'
end
end
|
module Etsource
class MeritOrder
def initialize(etsource = Etsource::Base.instance)
@etsource = etsource
end
# Public: reads the electricity merit order definitions from Atlas Node
# data.
#
# See MeritOrder#import
#
# Returns a hash.
def import_electricity
import(:merit_order)
end
# Public: reads the heat network merit order definitions from Atlas Node
# data.
#
# See MeritOrder#import
#
# Returns a hash.
def import_heat_network
import(:heat_network)
end
private
# Internal: Reads the merit order definitions from the Atlas nodes list.
#
# There are a few weird idiosyncrasies here; the method returns a hash
# containing keys for each "type" of merit order node, where each value is
# a hash. This nested hash contains keys for each merit order node, and the
# "group" to which the node belongs.
#
# The "type" and "group" are cast to strings (from symbols) because that's
# what other code expects.
#
# The hash looks like this:
#
# { "dispatchable" => { "node_one" => nil,
# "node_two" => "buildings_chp" },
# "volatile" => { "node_three" => "solar_pv" } }
#
# Returns a hash.
def import(attribute)
Rails.cache.fetch("#{attribute}_hash") do
mo_nodes = Atlas::Node.all.select(&attribute)
mo_data = {}
mo_nodes.each do |node|
config = node.public_send(attribute)
type = config.type.to_s
group = config.group&.to_s
mo_data[type] ||= {}
mo_data[type][node.key.to_s] = group
end
mo_data
end
end
end
end
Order merit order nodes consistently by key
module Etsource
class MeritOrder
def initialize(etsource = Etsource::Base.instance)
@etsource = etsource
end
# Public: reads the electricity merit order definitions from Atlas Node
# data.
#
# See MeritOrder#import
#
# Returns a hash.
def import_electricity
import(:merit_order)
end
# Public: reads the heat network merit order definitions from Atlas Node
# data.
#
# See MeritOrder#import
#
# Returns a hash.
def import_heat_network
import(:heat_network)
end
private
# Internal: Reads the merit order definitions from the Atlas nodes list.
#
# There are a few weird idiosyncrasies here; the method returns a hash
# containing keys for each "type" of merit order node, where each value is
# a hash. This nested hash contains keys for each merit order node, and the
# "group" to which the node belongs.
#
# The "type" and "group" are cast to strings (from symbols) because that's
# what other code expects.
#
# The hash looks like this:
#
# { "dispatchable" => { "node_one" => nil,
# "node_two" => "buildings_chp" },
# "volatile" => { "node_three" => "solar_pv" } }
#
# Returns a hash.
def import(attribute)
Rails.cache.fetch("#{attribute}_hash") do
mo_nodes = Atlas::Node.all.select(&attribute).sort_by(&:key)
mo_data = {}
mo_nodes.each do |node|
config = node.public_send(attribute)
type = config.type.to_s
group = config.group&.to_s
mo_data[type] ||= {}
mo_data[type][node.key.to_s] = group
end
mo_data
end
end
end
end
|
class Cmake < Formula
desc "Cross-platform make"
homepage "https://www.cmake.org/"
url "https://github.com/Kitware/CMake/releases/download/v3.14.4/cmake-3.14.4.tar.gz"
sha256 "00b4dc9b0066079d10f16eed32ec592963a44e7967371d2f5077fd1670ff36d9"
head "https://cmake.org/cmake.git"
bottle do
root_url "https://linuxbrew.bintray.com/bottles"
cellar :any_skip_relocation
sha256 "5966170978a7df7552799372ebe2b440e0f1b413a318f87707f50a7d3063a2a5" => :mojave
sha256 "b02cfd5f6bcb53e276ad14ba709652a687236afe35fb03157bc262bdf064716d" => :high_sierra
sha256 "26c1ca3b19df96f16c618bd1311716c02706a78850367eef37f8f8ac7dc5e469" => :sierra
end
depends_on "sphinx-doc" => :build
unless OS.mac?
depends_on "ncurses"
depends_on "openssl"
end
# The completions were removed because of problems with system bash
# The `with-qt` GUI option was removed due to circular dependencies if
# CMake is built with Qt support and Qt is built with MySQL support as MySQL uses CMake.
# For the GUI application please instead use `brew cask install cmake`.
def install
# Reduce memory usage below 4 GB for Circle CI.
ENV.deparallelize if ENV["CIRCLECI"]
ENV.cxx11 unless OS.mac?
args = %W[
--prefix=#{prefix}
--no-system-libs
--parallel=#{ENV.make_jobs}
--datadir=/share/cmake
--docdir=/share/doc/cmake
--mandir=/share/man
--sphinx-build=#{Formula["sphinx-doc"].opt_bin}/sphinx-build
--sphinx-html
--sphinx-man
--system-zlib
--system-bzip2
--system-curl
]
args -= ["--system-zlib", "--system-bzip2", "--system-curl"] unless OS.mac?
# There is an existing issue around macOS & Python locale setting
# See https://bugs.python.org/issue18378#msg215215 for explanation
ENV["LC_ALL"] = "en_US.UTF-8"
system "./bootstrap", *args, "--", "-DCMAKE_BUILD_TYPE=Release"
system "make"
system "make", "install"
elisp.install "Auxiliary/cmake-mode.el"
end
test do
(testpath/"CMakeLists.txt").write("find_package(Ruby)")
system bin/"cmake", "."
end
end
cmake: update 3.14.4 bottle.
Closes #13162.
Signed-off-by: Michka Popoff <7b0496f66f66ee22a38826c310c38b415671b832@gmail.com>
class Cmake < Formula
desc "Cross-platform make"
homepage "https://www.cmake.org/"
url "https://github.com/Kitware/CMake/releases/download/v3.14.4/cmake-3.14.4.tar.gz"
sha256 "00b4dc9b0066079d10f16eed32ec592963a44e7967371d2f5077fd1670ff36d9"
head "https://cmake.org/cmake.git"
bottle do
root_url "https://linuxbrew.bintray.com/bottles"
cellar :any_skip_relocation
sha256 "5966170978a7df7552799372ebe2b440e0f1b413a318f87707f50a7d3063a2a5" => :mojave
sha256 "b02cfd5f6bcb53e276ad14ba709652a687236afe35fb03157bc262bdf064716d" => :high_sierra
sha256 "26c1ca3b19df96f16c618bd1311716c02706a78850367eef37f8f8ac7dc5e469" => :sierra
sha256 "7e146f2e53986cd44f759486b4becf03a3b32b83f8b33f1249a490928b0499ce" => :x86_64_linux
end
depends_on "sphinx-doc" => :build
unless OS.mac?
depends_on "ncurses"
depends_on "openssl"
end
# The completions were removed because of problems with system bash
# The `with-qt` GUI option was removed due to circular dependencies if
# CMake is built with Qt support and Qt is built with MySQL support as MySQL uses CMake.
# For the GUI application please instead use `brew cask install cmake`.
def install
# Reduce memory usage below 4 GB for Circle CI.
ENV.deparallelize if ENV["CIRCLECI"]
ENV.cxx11 unless OS.mac?
args = %W[
--prefix=#{prefix}
--no-system-libs
--parallel=#{ENV.make_jobs}
--datadir=/share/cmake
--docdir=/share/doc/cmake
--mandir=/share/man
--sphinx-build=#{Formula["sphinx-doc"].opt_bin}/sphinx-build
--sphinx-html
--sphinx-man
--system-zlib
--system-bzip2
--system-curl
]
args -= ["--system-zlib", "--system-bzip2", "--system-curl"] unless OS.mac?
# There is an existing issue around macOS & Python locale setting
# See https://bugs.python.org/issue18378#msg215215 for explanation
ENV["LC_ALL"] = "en_US.UTF-8"
system "./bootstrap", *args, "--", "-DCMAKE_BUILD_TYPE=Release"
system "make"
system "make", "install"
elisp.install "Auxiliary/cmake-mode.el"
end
test do
(testpath/"CMakeLists.txt").write("find_package(Ruby)")
system bin/"cmake", "."
end
end
|
# This is lifted almost verbatim from Whitehall
# If you're changing it, consider extracting to a common Gem first, eh
module GovukTaxonomy
class Taxon
extend Forwardable
attr_reader :name, :content_id, :base_path
attr_accessor :parent_node, :children
def_delegators :tree, :map, :each
def initialize(title:, base_path:, content_id:)
@name = title
@content_id = content_id
@base_path = base_path
@children = []
end
def tree
children.each_with_object([self]) do |child, tree|
tree.concat(child.tree)
end
end
def descendants
tree.tap(&:shift)
end
# Get ancestors of a taxon
#
# @return [Array] all taxons in the path from the root of the taxonomy to the parent taxon
def ancestors
if parent_node.nil?
[]
else
parent_node.ancestors + [parent_node]
end
end
# Get a breadcrumb trail for a taxon
#
# @return [Array] all taxons in the path from the root of the taxonomy to this taxon
def breadcrumb_trail
ancestors + [self]
end
delegate :count, to: :tree
def root?
parent_node.nil?
end
def node_depth
return 0 if root?
1 + parent_node.node_depth
end
end
end
Fix subtle 'delegate' v Forwardable conflict
These two methods of delegation aren't compatible. Since 'delegate'
is the one preferred by RuboCop, this removes all instances of the
'Forwardable' module, and replaces them with plain 'delegate' calls.
# This is lifted almost verbatim from Whitehall
# If you're changing it, consider extracting to a common Gem first, eh
module GovukTaxonomy
class Taxon
attr_reader :name, :content_id, :base_path
attr_accessor :parent_node, :children
delegate :map,
:each,
:count,
to: :tree
def initialize(title:, base_path:, content_id:)
@name = title
@content_id = content_id
@base_path = base_path
@children = []
end
def tree
children.each_with_object([self]) do |child, tree|
tree.concat(child.tree)
end
end
def descendants
tree.tap(&:shift)
end
# Get ancestors of a taxon
#
# @return [Array] all taxons in the path from the root of the taxonomy to the parent taxon
def ancestors
if parent_node.nil?
[]
else
parent_node.ancestors + [parent_node]
end
end
# Get a breadcrumb trail for a taxon
#
# @return [Array] all taxons in the path from the root of the taxonomy to this taxon
def breadcrumb_trail
ancestors + [self]
end
def root?
parent_node.nil?
end
def node_depth
return 0 if root?
1 + parent_node.node_depth
end
end
end
|
class Cmake < Formula
desc "Cross-platform make"
homepage "https://www.cmake.org/"
url "https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz"
sha256 "dc1246c4e6d168ea4d6e042cfba577c1acd65feea27e56f5ff37df920c30cae0"
head "https://cmake.org/cmake.git"
bottle do
cellar :any_skip_relocation
sha256 "2220cacb9082f8239edba730a60821c31950ae01efc121948cfe673410bd0376" => :sierra
sha256 "6e1486bcc9d1f0483319cd7b730492ab8a35bf9b7aa747eddafab9035c849017" => :el_capitan
sha256 "c8086bc9f149cb0b944273497a40ac0dfd23b7bb720f95f57e313e82ede73dea" => :yosemite
end
option "without-docs", "Don't build man pages"
option "with-completion", "Install Bash completion (Has potential problems with system bash)"
depends_on "sphinx-doc" => :build if build.with? "docs"
# The `with-qt` GUI option was removed due to circular dependencies if
# CMake is built with Qt support and Qt is built with MySQL support as MySQL uses CMake.
# For the GUI application please instead use `brew cask install cmake`.
def install
args = %W[
--prefix=#{prefix}
--no-system-libs
--parallel=#{ENV.make_jobs}
--datadir=/share/cmake
--docdir=/share/doc/cmake
--mandir=/share/man
--system-zlib
--system-bzip2
]
# https://github.com/Homebrew/legacy-homebrew/issues/45989
if MacOS.version <= :lion
args << "--no-system-curl"
else
args << "--system-curl"
end
if build.with? "docs"
# There is an existing issue around macOS & Python locale setting
# See https://bugs.python.org/issue18378#msg215215 for explanation
ENV["LC_ALL"] = "en_US.UTF-8"
args << "--sphinx-man" << "--sphinx-build=#{Formula["sphinx-doc"].opt_bin}/sphinx-build"
end
system "./bootstrap", *args
system "make"
system "make", "install"
if build.with? "completion"
cd "Auxiliary/bash-completion/" do
bash_completion.install "ctest", "cmake", "cpack"
end
end
elisp.install "Auxiliary/cmake-mode.el"
end
test do
(testpath/"CMakeLists.txt").write("find_package(Ruby)")
system bin/"cmake", "."
end
end
cmake: update 3.7.2 bottle.
class Cmake < Formula
desc "Cross-platform make"
homepage "https://www.cmake.org/"
url "https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz"
sha256 "dc1246c4e6d168ea4d6e042cfba577c1acd65feea27e56f5ff37df920c30cae0"
head "https://cmake.org/cmake.git"
bottle do
cellar :any_skip_relocation
sha256 "ebc6de5933ad96a3ccc3764559dd489a7c02588c1485849c540893f28c9a4ae5" => :sierra
sha256 "d5ba6ead168e5524c10e8409a22d69ed5983b1799e916332b6f27827bf58118b" => :el_capitan
sha256 "1881ea166e4c7182d357f25c640d564f1e8d342ed658e6c43d95639bb2d60a07" => :yosemite
end
option "without-docs", "Don't build man pages"
option "with-completion", "Install Bash completion (Has potential problems with system bash)"
depends_on "sphinx-doc" => :build if build.with? "docs"
# The `with-qt` GUI option was removed due to circular dependencies if
# CMake is built with Qt support and Qt is built with MySQL support as MySQL uses CMake.
# For the GUI application please instead use `brew cask install cmake`.
def install
args = %W[
--prefix=#{prefix}
--no-system-libs
--parallel=#{ENV.make_jobs}
--datadir=/share/cmake
--docdir=/share/doc/cmake
--mandir=/share/man
--system-zlib
--system-bzip2
]
# https://github.com/Homebrew/legacy-homebrew/issues/45989
if MacOS.version <= :lion
args << "--no-system-curl"
else
args << "--system-curl"
end
if build.with? "docs"
# There is an existing issue around macOS & Python locale setting
# See https://bugs.python.org/issue18378#msg215215 for explanation
ENV["LC_ALL"] = "en_US.UTF-8"
args << "--sphinx-man" << "--sphinx-build=#{Formula["sphinx-doc"].opt_bin}/sphinx-build"
end
system "./bootstrap", *args
system "make"
system "make", "install"
if build.with? "completion"
cd "Auxiliary/bash-completion/" do
bash_completion.install "ctest", "cmake", "cpack"
end
end
elisp.install "Auxiliary/cmake-mode.el"
end
test do
(testpath/"CMakeLists.txt").write("find_package(Ruby)")
system bin/"cmake", "."
end
end
|
# frozen_string_literal: true
#
# = Location Descriptions
#
# == Version
#
# Changes are kept in the "location_descriptions_versions" table using
# ActiveRecord::Acts::Versioned.
#
# == Attributes
#
# id:: (-) Locally unique numerical id, starting at 1.
# created_at:: (-) Date/time it was first created.
# updated_at:: (V) Date/time it was last updated.
# user:: (V) User that created it.
# version:: (V) Version number.
# merge_source_id:: (V) Tracks of descriptions that were merged into this one.
# Primarily useful in the past versions: stores id of latest version of the
# Description merged into this one at the time of the merge.
#
# ==== Statistics
# num_views:: (-) Number of times it has been viewed.
# last_view:: (-) Last time it was viewed.
#
# ==== Description Fields
# license:: (V) License description info is kept under.
# gen_desc:: (V) General description of geographic location.
# ecology:: (V) Description of climate, geology, habitat, etc.
# species:: (V) Notes on dominant or otherwise interesting species.
# notes:: (V) Other notes.
# refs:: (V) References
#
# ('V' indicates that this attribute is versioned in
# location_descriptions_versions table.)
#
# == Class Methods
#
# all_note_fields:: NameDescriptive text fields: all.
#
# == Instance Methods
#
# versions:: Old versions.
# comments:: Comments about this NameDescription. (not used yet)
# interests:: Interest in this NameDescription
#
# == Callbacks
#
# notify_users:: Notify authors, etc. of changes.
#
############################################################################
class LocationDescription < Description
require "acts_as_versioned"
# enum definitions for use by simple_enum gem
# Do not change the integer associated with a value
as_enum(:source_type,
{ public: 1,
foreign: 2,
project: 3,
source: 4,
user: 5 },
source: :source_type,
accessor: :whiny)
belongs_to :license
belongs_to :location
belongs_to :project
belongs_to :user
has_many :comments, as: :target, dependent: :destroy
has_many :interests, as: :target, dependent: :destroy
has_and_belongs_to_many :admin_groups,
class_name: "UserGroup",
join_table: "location_descriptions_admins"
has_and_belongs_to_many :writer_groups,
class_name: "UserGroup",
join_table: "location_descriptions_writers"
has_and_belongs_to_many :reader_groups,
class_name: "UserGroup",
join_table: "location_descriptions_readers"
has_and_belongs_to_many :authors,
class_name: "User",
join_table: "location_descriptions_authors"
has_and_belongs_to_many :editors,
class_name: "User",
join_table: "location_descriptions_editors"
ALL_NOTE_FIELDS = [:gen_desc, :ecology, :species, :notes, :refs].freeze
acts_as_versioned(
table_name: "location_descriptions_versions",
if_changed: ALL_NOTE_FIELDS,
association_options: { dependent: :nullify }
)
non_versioned_columns.push(
"created_at",
"updated_at",
"location_id",
"num_views",
"last_view",
"ok_for_export",
"source_type",
"source_name",
"project_id",
"public",
"locale"
)
versioned_class.before_save { |x| x.user_id = User.current_id }
after_update :notify_users
##############################################################################
#
# :section: Descriptions
#
##############################################################################
# Override the default show_controller
def self.show_controller
"/location"
end
# Returns an Array of all the descriptive text fields (Symbol's).
def self.all_note_fields
ALL_NOTE_FIELDS
end
# This is called after saving potential changes to a Location. It will
# determine if the changes are important enough to notify people, and do so.
def notify_users
if saved_version_changes?
sender = User.current
recipients = []
# Tell admins of the change.
for user in admins
recipients.push(user) if user.email_locations_admin
end
# Tell authors of the change.
for user in authors
recipients.push(user) if user.email_locations_author
end
# Tell editors of the change.
for user in editors
recipients.push(user) if user.email_locations_editor
end
# Tell masochists who want to know about all location changes.
for user in User.where(email_locations_all: true)
recipients.push(user)
end
# Send to people who have registered interest.
# Also remove everyone who has explicitly said they are NOT interested.
for interest in location.interests
if interest.state
recipients.push(interest.user)
else
recipients.delete(interest.user)
end
end
# Send notification to all except the person who triggered the change.
for recipient in recipients.uniq - [sender]
QueuedEmail::LocationChange.create_email(
sender, recipient, location, self
)
end
end
end
end
Fix LocationDescription GuardClause offense
# frozen_string_literal: true
#
# = Location Descriptions
#
# == Version
#
# Changes are kept in the "location_descriptions_versions" table using
# ActiveRecord::Acts::Versioned.
#
# == Attributes
#
# id:: (-) Locally unique numerical id, starting at 1.
# created_at:: (-) Date/time it was first created.
# updated_at:: (V) Date/time it was last updated.
# user:: (V) User that created it.
# version:: (V) Version number.
# merge_source_id:: (V) Tracks of descriptions that were merged into this one.
# Primarily useful in the past versions: stores id of latest version of the
# Description merged into this one at the time of the merge.
#
# ==== Statistics
# num_views:: (-) Number of times it has been viewed.
# last_view:: (-) Last time it was viewed.
#
# ==== Description Fields
# license:: (V) License description info is kept under.
# gen_desc:: (V) General description of geographic location.
# ecology:: (V) Description of climate, geology, habitat, etc.
# species:: (V) Notes on dominant or otherwise interesting species.
# notes:: (V) Other notes.
# refs:: (V) References
#
# ('V' indicates that this attribute is versioned in
# location_descriptions_versions table.)
#
# == Class Methods
#
# all_note_fields:: NameDescriptive text fields: all.
#
# == Instance Methods
#
# versions:: Old versions.
# comments:: Comments about this NameDescription. (not used yet)
# interests:: Interest in this NameDescription
#
# == Callbacks
#
# notify_users:: Notify authors, etc. of changes.
#
############################################################################
class LocationDescription < Description
require "acts_as_versioned"
# enum definitions for use by simple_enum gem
# Do not change the integer associated with a value
as_enum(:source_type,
{ public: 1,
foreign: 2,
project: 3,
source: 4,
user: 5 },
source: :source_type,
accessor: :whiny)
belongs_to :license
belongs_to :location
belongs_to :project
belongs_to :user
has_many :comments, as: :target, dependent: :destroy
has_many :interests, as: :target, dependent: :destroy
has_and_belongs_to_many :admin_groups,
class_name: "UserGroup",
join_table: "location_descriptions_admins"
has_and_belongs_to_many :writer_groups,
class_name: "UserGroup",
join_table: "location_descriptions_writers"
has_and_belongs_to_many :reader_groups,
class_name: "UserGroup",
join_table: "location_descriptions_readers"
has_and_belongs_to_many :authors,
class_name: "User",
join_table: "location_descriptions_authors"
has_and_belongs_to_many :editors,
class_name: "User",
join_table: "location_descriptions_editors"
ALL_NOTE_FIELDS = [:gen_desc, :ecology, :species, :notes, :refs].freeze
acts_as_versioned(
table_name: "location_descriptions_versions",
if_changed: ALL_NOTE_FIELDS,
association_options: { dependent: :nullify }
)
non_versioned_columns.push(
"created_at",
"updated_at",
"location_id",
"num_views",
"last_view",
"ok_for_export",
"source_type",
"source_name",
"project_id",
"public",
"locale"
)
versioned_class.before_save { |x| x.user_id = User.current_id }
after_update :notify_users
##############################################################################
#
# :section: Descriptions
#
##############################################################################
# Override the default show_controller
def self.show_controller
"/location"
end
# Returns an Array of all the descriptive text fields (Symbol's).
def self.all_note_fields
ALL_NOTE_FIELDS
end
# This is called after saving potential changes to a Location. It will
# determine if the changes are important enough to notify people, and do so.
def notify_users
return unless saved_version_changes?
sender = User.current
recipients = []
# Tell admins of the change.
for user in admins
recipients.push(user) if user.email_locations_admin
end
# Tell authors of the change.
for user in authors
recipients.push(user) if user.email_locations_author
end
# Tell editors of the change.
for user in editors
recipients.push(user) if user.email_locations_editor
end
# Tell masochists who want to know about all location changes.
for user in User.where(email_locations_all: true)
recipients.push(user)
end
# Send to people who have registered interest.
# Also remove everyone who has explicitly said they are NOT interested.
for interest in location.interests
if interest.state
recipients.push(interest.user)
else
recipients.delete(interest.user)
end
end
# Send notification to all except the person who triggered the change.
for recipient in recipients.uniq - [sender]
QueuedEmail::LocationChange.create_email(
sender, recipient, location, self
)
end
end
end
|
require 'formula'
class Cmake <Formula
url 'http://www.cmake.org/files/v2.8/cmake-2.8.2.tar.gz'
md5 '8c967d5264657a798f22ee23976ff0d9'
homepage 'http://www.cmake.org/'
def patches
# CMAKE_OSX_ARCHITECTURES quoting bug. See: http://www.vtk.org/Bug/view.php?id=11244
# Not needed with CMake 2.8.3 and above.
"http://cmake.org/gitweb?p=cmake.git;a=patch;h=a8ded533"
"http://cmake.org/gitweb?p=cmake.git;a=patch;h=0790af3b"
end
def install
# xmlrpc is a stupid little library, rather than waste our users' time
# just let cmake use its own copy. God knows why something like cmake
# needs an xmlrpc library anyway! It is amazing!
inreplace 'CMakeLists.txt',
"# Mention to the user what system libraries are being used.",
"SET(CMAKE_USE_SYSTEM_XMLRPC 0)"
system "./bootstrap", "--prefix=#{prefix}",
"--system-libs",
"--datadir=/share/cmake",
"--docdir=/share/doc/cmake",
"--mandir=/share/man"
ENV.j1 # There appear to be parallelism issues.
system "make"
system "make install"
end
end
Wrap CMake patches in an array to get both of them applied, not just one.
Signed-off-by: Adam Vandenberg <34c2b6407fd5a10249a15d699d40f9ed1782e98c@gmail.com>
require 'formula'
class Cmake <Formula
url 'http://www.cmake.org/files/v2.8/cmake-2.8.2.tar.gz'
md5 '8c967d5264657a798f22ee23976ff0d9'
homepage 'http://www.cmake.org/'
def patches
# CMAKE_OSX_ARCHITECTURES quoting bug. See: http://www.vtk.org/Bug/view.php?id=11244
# Not needed with CMake 2.8.3 and above.
[ "http://cmake.org/gitweb?p=cmake.git;a=patch;h=a8ded533",
"http://cmake.org/gitweb?p=cmake.git;a=patch;h=0790af3b" ]
end
def install
# xmlrpc is a stupid little library, rather than waste our users' time
# just let cmake use its own copy. God knows why something like cmake
# needs an xmlrpc library anyway! It is amazing!
inreplace 'CMakeLists.txt',
"# Mention to the user what system libraries are being used.",
"SET(CMAKE_USE_SYSTEM_XMLRPC 0)"
system "./bootstrap", "--prefix=#{prefix}",
"--system-libs",
"--datadir=/share/cmake",
"--docdir=/share/doc/cmake",
"--mandir=/share/man"
ENV.j1 # There appear to be parallelism issues.
system "make"
system "make install"
end
end
|
class ManualWithSections
attr_writer :sections, :removed_sections
def initialize(sections: [], removed_sections: [])
@sections = sections
@removed_sections = removed_sections
end
def sections
@sections.to_enum
end
def removed_sections
@removed_sections.to_enum
end
def reorder_sections(section_order)
unless section_order.sort == @sections.map(&:id).sort
raise(
ArgumentError,
"section_order must contain each section_id exactly once",
)
end
@sections.sort_by! { |sec| section_order.index(sec.id) }
end
def remove_section(section_id)
found_section = @sections.find { |d| d.id == section_id }
return if found_section.nil?
removed = @sections.delete(found_section)
return if removed.nil?
@removed_sections << removed
end
def add_section(section)
@sections << section
end
end
Make array accessors return mutable instance vars
While this isn't ideal, it's going to make it easier for me to move
methods in `ManualWithSections` up into `Manual` incrementally.
class ManualWithSections
attr_accessor :sections, :removed_sections
def initialize(sections: [], removed_sections: [])
@sections = sections
@removed_sections = removed_sections
end
def reorder_sections(section_order)
unless section_order.sort == @sections.map(&:id).sort
raise(
ArgumentError,
"section_order must contain each section_id exactly once",
)
end
@sections.sort_by! { |sec| section_order.index(sec.id) }
end
def remove_section(section_id)
found_section = @sections.find { |d| d.id == section_id }
return if found_section.nil?
removed = @sections.delete(found_section)
return if removed.nil?
@removed_sections << removed
end
def add_section(section)
@sections << section
end
end
|
class Cmake < Formula
desc "Cross-platform make"
homepage "https://www.cmake.org/"
url "https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1.tar.gz"
mirror "http://fresh-center.net/linux/misc/cmake-3.23.1.tar.gz"
mirror "http://fresh-center.net/linux/misc/legacy/cmake-3.23.1.tar.gz"
sha256 "33fd10a8ec687a4d0d5b42473f10459bb92b3ae7def2b745dc10b192760869f3"
license "BSD-3-Clause"
head "https://gitlab.kitware.com/cmake/cmake.git", branch: "master"
# The "latest" release on GitHub has been an unstable version before, so we
# check the Git tags instead.
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "9fe99b75d9e37e3acd653f93d429af93f94c5460a50284e6c56cf99fb4f8aa7b"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "40417555a252c5ea054b8e71aeb99af82fafca14d3f93a7f6c1555bab64352a8"
sha256 cellar: :any_skip_relocation, monterey: "67dedaec2350dcd6535d442cfe152589c743141cf72a078fde582f0e15be1b48"
sha256 cellar: :any_skip_relocation, big_sur: "bfbdb089a9742a91c4568ab84d90cb285f43c635e999d67aa8e40abc570eba55"
sha256 cellar: :any_skip_relocation, catalina: "696eaafc168fa04a4f36203e2e76186cd534fd007feaa7d813fb21142680380e"
sha256 cellar: :any_skip_relocation, x86_64_linux: "6217894919a4025d748e4cfd64cb94a809cc8db7af731e16520924b16623c49e"
end
uses_from_macos "ncurses"
on_linux do
depends_on "openssl@1.1"
end
# The completions were removed because of problems with system bash
# The `with-qt` GUI option was removed due to circular dependencies if
# CMake is built with Qt support and Qt is built with MySQL support as MySQL uses CMake.
# For the GUI application please instead use `brew install --cask cmake`.
def install
args = %W[
--prefix=#{prefix}
--no-system-libs
--parallel=#{ENV.make_jobs}
--datadir=/share/cmake
--docdir=/share/doc/cmake
--mandir=/share/man
]
if OS.mac?
args += %w[
--system-zlib
--system-bzip2
--system-curl
]
end
system "./bootstrap", *args, "--", *std_cmake_args,
"-DCMake_INSTALL_EMACS_DIR=#{elisp}",
"-DCMake_BUILD_LTO=ON"
system "make"
system "make", "install"
end
def caveats
<<~EOS
To install the CMake documentation, run:
brew install cmake-docs
EOS
end
test do
(testpath/"CMakeLists.txt").write("find_package(Ruby)")
system bin/"cmake", "."
# These should be supplied in a separate cmake-docs formula.
refute_path_exists doc/"html"
refute_path_exists man
end
end
cmake: patch for gcc 12
Closes #101399.
Signed-off-by: BrewTestBot <8a898ee6867e4f2028e63d2a6319b2224641c06c@users.noreply.github.com>
class Cmake < Formula
desc "Cross-platform make"
homepage "https://www.cmake.org/"
url "https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1.tar.gz"
mirror "http://fresh-center.net/linux/misc/cmake-3.23.1.tar.gz"
mirror "http://fresh-center.net/linux/misc/legacy/cmake-3.23.1.tar.gz"
sha256 "33fd10a8ec687a4d0d5b42473f10459bb92b3ae7def2b745dc10b192760869f3"
license "BSD-3-Clause"
revision 1
head "https://gitlab.kitware.com/cmake/cmake.git", branch: "master"
# The "latest" release on GitHub has been an unstable version before, so we
# check the Git tags instead.
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "9fe99b75d9e37e3acd653f93d429af93f94c5460a50284e6c56cf99fb4f8aa7b"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "40417555a252c5ea054b8e71aeb99af82fafca14d3f93a7f6c1555bab64352a8"
sha256 cellar: :any_skip_relocation, monterey: "67dedaec2350dcd6535d442cfe152589c743141cf72a078fde582f0e15be1b48"
sha256 cellar: :any_skip_relocation, big_sur: "bfbdb089a9742a91c4568ab84d90cb285f43c635e999d67aa8e40abc570eba55"
sha256 cellar: :any_skip_relocation, catalina: "696eaafc168fa04a4f36203e2e76186cd534fd007feaa7d813fb21142680380e"
sha256 cellar: :any_skip_relocation, x86_64_linux: "6217894919a4025d748e4cfd64cb94a809cc8db7af731e16520924b16623c49e"
end
uses_from_macos "ncurses"
on_linux do
depends_on "openssl@1.1"
end
# Tentative workaround for bug with gfortran 12 and clang
# https://gitlab.kitware.com/cmake/cmake/-/issues/23500
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/533fd564/cmake/gcc-12.diff"
sha256 "f9c7e39c10cf4c88e092da65f2859652529103e364828188e0ae4fef10a18936"
end
# The completions were removed because of problems with system bash
# The `with-qt` GUI option was removed due to circular dependencies if
# CMake is built with Qt support and Qt is built with MySQL support as MySQL uses CMake.
# For the GUI application please instead use `brew install --cask cmake`.
def install
args = %W[
--prefix=#{prefix}
--no-system-libs
--parallel=#{ENV.make_jobs}
--datadir=/share/cmake
--docdir=/share/doc/cmake
--mandir=/share/man
]
if OS.mac?
args += %w[
--system-zlib
--system-bzip2
--system-curl
]
end
system "./bootstrap", *args, "--", *std_cmake_args,
"-DCMake_INSTALL_EMACS_DIR=#{elisp}",
"-DCMake_BUILD_LTO=ON"
system "make"
system "make", "install"
end
def caveats
<<~EOS
To install the CMake documentation, run:
brew install cmake-docs
EOS
end
test do
(testpath/"CMakeLists.txt").write("find_package(Ruby)")
system bin/"cmake", "."
# These should be supplied in a separate cmake-docs formula.
refute_path_exists doc/"html"
refute_path_exists man
end
end
|
class MiqUiWorker::Runner < MiqWorker::Runner
include MiqWebServerRunnerMixin
end
Start httpd in the UI worker container
In this container, httpd will listen on port 3000 and will serve
assets and some error documents as well as the UI
class MiqUiWorker::Runner < MiqWorker::Runner
include MiqWebServerRunnerMixin
def prepare
super
MiqApache::Control.start if MiqEnvironment::Command.is_container?
end
end
|
class Cntlm < Formula
desc "NTLM authentication proxy with tunneling"
homepage "https://cntlm.sourceforge.io/"
url "https://downloads.sourceforge.net/project/cntlm/cntlm/cntlm%200.92.3/cntlm-0.92.3.tar.bz2"
sha256 "7b603d6200ab0b26034e9e200fab949cc0a8e5fdd4df2c80b8fc5b1c37e7b930"
license "GPL-2.0-only"
livecheck do
url :stable
regex(%r{url=.*?/cntlm[._-]v?(\d+(?:\.\d+)+)\.t}i)
end
bottle do
rebuild 2
sha256 arm64_ventura: "f4674d812c8b17f3e78bea4dfd0bccf3149de7c0be14f9027d2f07724f3eaf32"
sha256 arm64_monterey: "ec776bb3b8bd91670fdf97e67fefc1ae8c2a4f2901cbb2b007622d22b8e697d7"
sha256 arm64_big_sur: "edfcd9088709ea81afc22ec95e7fc9e3c2707dfbcf25582955af0d6288dc4d11"
sha256 monterey: "473e65aea1b1536ccbd7390fa121cf0273f47c0184b08bf0398d28aa0e128e92"
sha256 big_sur: "fccbf3803f9aff9aa6b0bb9b8f0e17c28b80e1b85ef0d712082744bdd417eda9"
sha256 catalina: "7239fa52155edd2040ed7bff62b954351bb5e96fd226b4f0e1f7e956c64223d7"
sha256 mojave: "79b1221fa60196d7670bb3cbcd6bab63490ba780222e7faf84404a57ac52d6ba"
sha256 high_sierra: "9a1bafd1930ba3ade9b8df892d9fd28a0c414750ee728a791886dd9c999d0173"
sha256 x86_64_linux: "523184cb07c5b9c17d65a2a36f767ed37726570ec5ac3239ae49be84e12c5f6b"
end
def install
system "./configure"
system "make", "CC=#{ENV.cc}", "SYSCONFDIR=#{etc}"
# install target fails - @adamv
bin.install "cntlm"
man1.install "doc/cntlm.1"
etc.install "doc/cntlm.conf"
end
def caveats
"Edit #{etc}/cntlm.conf to configure Cntlm"
end
plist_options startup: true
service do
run [opt_bin/"cntlm", "-f"]
end
test do
assert_match "version #{version}", shell_output("#{bin}/cntlm -h 2>&1", 1)
bind_port = free_port
(testpath/"cntlm.conf").write <<~EOS
# Cntlm Authentication Proxy Configuration
Username testuser
Domain corp-uk
Password password
Proxy localhost:#{free_port}
NoProxy localhost, 127.0.0.*, 10.*, 192.168.*
Listen #{bind_port}
EOS
fork do
exec "#{bin}/cntlm -c #{testpath}/cntlm.conf -v"
end
sleep 2
assert_match "502 Parent proxy unreacheable", shell_output("curl -s localhost:#{bind_port}")
end
end
cntlm: update 0.92.3 bottle.
class Cntlm < Formula
desc "NTLM authentication proxy with tunneling"
homepage "https://cntlm.sourceforge.io/"
url "https://downloads.sourceforge.net/project/cntlm/cntlm/cntlm%200.92.3/cntlm-0.92.3.tar.bz2"
sha256 "7b603d6200ab0b26034e9e200fab949cc0a8e5fdd4df2c80b8fc5b1c37e7b930"
license "GPL-2.0-only"
livecheck do
url :stable
regex(%r{url=.*?/cntlm[._-]v?(\d+(?:\.\d+)+)\.t}i)
end
bottle do
rebuild 2
sha256 arm64_ventura: "f4674d812c8b17f3e78bea4dfd0bccf3149de7c0be14f9027d2f07724f3eaf32"
sha256 arm64_monterey: "ec776bb3b8bd91670fdf97e67fefc1ae8c2a4f2901cbb2b007622d22b8e697d7"
sha256 arm64_big_sur: "edfcd9088709ea81afc22ec95e7fc9e3c2707dfbcf25582955af0d6288dc4d11"
sha256 ventura: "3bb0d9bd593c362c6303a22d404efc85a9ffcc648110808b3271654574326284"
sha256 monterey: "473e65aea1b1536ccbd7390fa121cf0273f47c0184b08bf0398d28aa0e128e92"
sha256 big_sur: "fccbf3803f9aff9aa6b0bb9b8f0e17c28b80e1b85ef0d712082744bdd417eda9"
sha256 catalina: "7239fa52155edd2040ed7bff62b954351bb5e96fd226b4f0e1f7e956c64223d7"
sha256 mojave: "79b1221fa60196d7670bb3cbcd6bab63490ba780222e7faf84404a57ac52d6ba"
sha256 high_sierra: "9a1bafd1930ba3ade9b8df892d9fd28a0c414750ee728a791886dd9c999d0173"
sha256 x86_64_linux: "523184cb07c5b9c17d65a2a36f767ed37726570ec5ac3239ae49be84e12c5f6b"
end
def install
system "./configure"
system "make", "CC=#{ENV.cc}", "SYSCONFDIR=#{etc}"
# install target fails - @adamv
bin.install "cntlm"
man1.install "doc/cntlm.1"
etc.install "doc/cntlm.conf"
end
def caveats
"Edit #{etc}/cntlm.conf to configure Cntlm"
end
plist_options startup: true
service do
run [opt_bin/"cntlm", "-f"]
end
test do
assert_match "version #{version}", shell_output("#{bin}/cntlm -h 2>&1", 1)
bind_port = free_port
(testpath/"cntlm.conf").write <<~EOS
# Cntlm Authentication Proxy Configuration
Username testuser
Domain corp-uk
Password password
Proxy localhost:#{free_port}
NoProxy localhost, 127.0.0.*, 10.*, 192.168.*
Listen #{bind_port}
EOS
fork do
exec "#{bin}/cntlm -c #{testpath}/cntlm.conf -v"
end
sleep 2
assert_match "502 Parent proxy unreacheable", shell_output("curl -s localhost:#{bind_port}")
end
end
|
class DailyReport < Report
attr_accessor :date, :loan_product_id, :branch_id, :staff_member_id, :center_id
def initialize(params, dates, user)
@date = dates[:date]||Date.today
@name = "Report for #{@date}"
get_parameters(params, user)
end
def name
"Daily Report for #{date}"
end
def self.name
"Daily report"
end
def generate
branches, centers, data, clients, loans = {}, {}, {}, {}, {}
histories = (LoanHistory.sum_outstanding_grouped_by(self.date, [:center], self.loan_product_id)||{}).group_by{|x| x.center_id}
advances = (LoanHistory.sum_advance_payment(self.date, self.date, :center)||{}).group_by{|x| x.center_id}
balances = (LoanHistory.advance_balance(self.date, :center)||{}).group_by{|x| x.center_id}
old_balances = (LoanHistory.advance_balance(self.date-1, :center)||{}).group_by{|x| x.center_id}
@center.each{|c| centers[c.id] = c}
@branch.each{|b|
data[b]||= {}
branches[b.id] = b
b.centers.each{|c|
next unless centers.key?(c.id)
data[b][c] ||= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
#0 1 2 3 4 5 6 7 8 9 10
#amount_applied,amount_sanctioned,amount_disbursed,bal_outstanding(p),bo(i),tot,principal_paidback,interest_collected, processing_fee, no_of_defaults, name
history = histories[c.id][0] if histories.key?(c.id)
advance = advances[c.id][0] if advances.key?(c.id)
balance = balances[c.id][0] if balances.key?(c.id)
old_balance = old_balances[c.id][0] if old_balances.key?(c.id)
if history
principal_scheduled = history.scheduled_outstanding_principal.to_i
total_scheduled = history.scheduled_outstanding_total.to_i
advance_principal = history.advance_principal.to_i
advance_total = history.advance_total.to_i
principal_actual = history.actual_outstanding_principal.to_i
total_actual = history.actual_outstanding_total.to_i
else
next
end
#balance outstanding
data[b][c][7] += principal_actual
data[b][c][9] += total_actual
data[b][c][8] += total_actual - principal_actual
#balance overdue
data[b][c][10] += ((principal_actual > principal_scheduled ? (principal_actual - principal_scheduled): 0) + advance_principal)
#data[b][c][11] += ((total_actual - principal_actual) > (total_scheduled - principal_scheduled) ? (total_actual - principal_actual - (total_scheduled - principal_scheduled)) : 0)
data[b][c][12] += ((total_actual > total_scheduled ? (total_actual - total_scheduled): 0) + advance_total)
data[b][c][11] += (data[b][c][12] - data[b][c][10])
advance_total = advance ? advance.advance_total : 0
balance_total = balance ? balance.balance_total : 0
old_balance_total = old_balance ? old_balance.balance_total : 0
#advance repayment
data[b][c][13] += advance_total
data[b][c][15] += balance_total
data[b][c][14] += advance_total - balance_total + old_balance_total
}
}
hash = {:center_id => @center.map{|c| c.id}}
hash[:loan_product_id] = self.loan_product_id if self.loan_product_id
payment_type_colum = {:principal => 3, :interest => 4, :fees => 5}
# principal, interest and fees paid
LoanHistory.sum_repayment_grouped_by(:center, date, date, hash, ["lh.branch_id"]).each{|ptype, rows|
rows.each{|row|
next unless center = centers[row.center_id]
branch = branches[row.branch_id]
data[branch][center] ||= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
data[branch][center][payment_type_colum[ptype]] += row.amount.round(2)
}
}
# client fee
repository.adapter.query(%Q{
SELECT c.id center_id, c.branch_id branch_id, SUM(p.amount) amount
FROM payments p, clients cl, centers c
WHERE p.received_on = '#{date.strftime('%Y-%m-%d')}' AND p.loan_id is NULL AND p.type=3
AND p.deleted_at is NULL AND p.client_id=cl.id AND cl.center_id=c.id AND cl.deleted_at is NULL AND c.id in (#{@center.map{|c| c.id}.join(', ')})
GROUP BY branch_id, center_id
}).each{|p|
if branch = branches[p.branch_id] and center = centers[p.center_id]
data[branch][center] ||= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
data[branch][center][5] += p.amount.round(2)
end
}
#1: Applied on
LoanHistory.sum_applied_grouped_by([:branch, :center], date, date, hash).each{|l|
next if not centers.key?(l.center_id)
center = centers[l.center_id]
branch = branches[l.branch_id]
data[branch][center] ||= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
data[branch][center][0] += l.loan_amount
}
#2: Approved on
LoanHistory.sum_approved_grouped_by([:branch, :center], date, date, hash).each{|l|
next if not centers.key?(l.center_id)
center = centers[l.center_id]
branch = branches[l.branch_id]
data[branch][center] ||= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
data[branch][center][1] += l.loan_amount
}
#3: Disbursal date
LoanHistory.sum_disbursed_grouped_by([:branch, :center], date, date, hash).each{|l|
next if not centers.key?(l.center_id)
center = centers[l.center_id]
branch = branches[l.branch_id]
data[branch][center] ||= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
data[branch][center][2] += l.loan_amount
}
return data
end
end
all filters for daily report generation now work
class DailyReport < Report
attr_accessor :date, :loan_product_id, :branch_id, :staff_member_id, :center_id
def initialize(params, dates, user)
@date = dates[:date]||Date.today
@name = "Report for #{@date}"
get_parameters(params, user)
end
def name
"Daily Report for #{date}"
end
def self.name
"Daily report"
end
def generate
branches, centers, data, clients, loans = {}, {}, {}, {}, {}
extra_conditions = ["loan_product_id=#{loan_product_id}"] if loan_product_id
histories = (LoanHistory.sum_outstanding_grouped_by(self.date, [:center], extra_conditions)||{}).group_by{|x| x.center_id}
advances = (LoanHistory.sum_advance_payment(self.date, self.date, :center)||{}).group_by{|x| x.center_id}
balances = (LoanHistory.advance_balance(self.date, :center)||{}).group_by{|x| x.center_id}
old_balances = (LoanHistory.advance_balance(self.date-1, :center)||{}).group_by{|x| x.center_id}
@center.each{|c| centers[c.id] = c}
@branch.each{|b|
data[b]||= {}
branches[b.id] = b
b.centers.each{|c|
next unless centers.key?(c.id)
data[b][c] ||= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
#0 1 2 3 4 5 6 7 8 9 10
#amount_applied,amount_sanctioned,amount_disbursed,bal_outstanding(p),bo(i),tot,principal_paidback,interest_collected, processing_fee, no_of_defaults, name
history = histories[c.id][0] if histories.key?(c.id)
advance = advances[c.id][0] if advances.key?(c.id)
balance = balances[c.id][0] if balances.key?(c.id)
old_balance = old_balances[c.id][0] if old_balances.key?(c.id)
if history
principal_scheduled = history.scheduled_outstanding_principal.to_i
total_scheduled = history.scheduled_outstanding_total.to_i
advance_principal = history.advance_principal.to_i
advance_total = history.advance_total.to_i
principal_actual = history.actual_outstanding_principal.to_i
total_actual = history.actual_outstanding_total.to_i
else
next
end
#balance outstanding
data[b][c][7] += principal_actual
data[b][c][9] += total_actual
data[b][c][8] += total_actual - principal_actual
#balance overdue
data[b][c][10] += ((principal_actual > principal_scheduled ? (principal_actual - principal_scheduled): 0) + advance_principal)
#data[b][c][11] += ((total_actual - principal_actual) > (total_scheduled - principal_scheduled) ? (total_actual - principal_actual - (total_scheduled - principal_scheduled)) : 0)
data[b][c][12] += ((total_actual > total_scheduled ? (total_actual - total_scheduled): 0) + advance_total)
data[b][c][11] += (data[b][c][12] - data[b][c][10])
advance_total = advance ? advance.advance_total : 0
balance_total = balance ? balance.balance_total : 0
old_balance_total = old_balance ? old_balance.balance_total : 0
#advance repayment
data[b][c][13] += advance_total
data[b][c][15] += balance_total
data[b][c][14] += advance_total - balance_total + old_balance_total
}
}
hash = {:'lh.center_id' => @center.map{|c| c.id}}
if loan_product_id
hash[:'lh.loan_id'] = LoanProduct.get(loan_product_id).loans.aggregate(:id)
end
payment_type_colum = {:principal => 3, :interest => 4, :fees => 5}
# principal, interest and fees paid
LoanHistory.sum_repayment_grouped_by(:center, date, date, hash, ["lh.branch_id"]).each{|ptype, rows|
rows.each{|row|
next unless center = centers[row.center_id]
branch = branches[row.branch_id]
data[branch][center] ||= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
data[branch][center][payment_type_colum[ptype]] += row.amount.round(2)
}
}
# client fee
center_ids = @center.map{|c| c.id}.join(', ')
center_ids = 'NULL' if center_ids.empty?
repository.adapter.query(%Q{
SELECT c.id center_id, c.branch_id branch_id, SUM(p.amount) amount
FROM payments p, clients cl, centers c
WHERE p.received_on = '#{date.strftime('%Y-%m-%d')}' AND p.loan_id is NULL AND p.type=3
AND p.deleted_at is NULL AND p.client_id=cl.id AND cl.center_id=c.id AND cl.deleted_at is NULL AND c.id in (#{center_ids})
GROUP BY branch_id, center_id
}).each{|p|
if branch = branches[p.branch_id] and center = centers[p.center_id]
data[branch][center] ||= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
data[branch][center][5] += p.amount.round(2)
end
}
#1: Applied on
LoanHistory.sum_applied_grouped_by([:branch, :center], date, date, hash).each{|l|
next if not centers.key?(l.center_id)
center = centers[l.center_id]
branch = branches[l.branch_id]
data[branch][center] ||= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
data[branch][center][0] += l.loan_amount
}
#2: Approved on
LoanHistory.sum_approved_grouped_by([:branch, :center], date, date, hash).each{|l|
next if not centers.key?(l.center_id)
center = centers[l.center_id]
branch = branches[l.branch_id]
data[branch][center] ||= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
data[branch][center][1] += l.loan_amount
}
#3: Disbursal date
LoanHistory.sum_disbursed_grouped_by([:branch, :center], date, date, hash).each{|l|
next if not centers.key?(l.center_id)
center = centers[l.center_id]
branch = branches[l.branch_id]
data[branch][center] ||= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
data[branch][center][2] += l.loan_amount
}
return data
end
end
|
class Comby < Formula
desc "Tool for changing code across many languages"
homepage "https://comby.dev"
url "https://github.com/comby-tools/comby/archive/0.16.0.tar.gz"
sha256 "f2be6809818baac0c4e3df6f1462616ae379319a19e2287b3cae623386fc4938"
license "Apache-2.0"
bottle do
cellar :any
sha256 "0f53fe71e3908a0d12571e20bfb3f9ed969a17d823e95281513312a3024e74e1" => :catalina
sha256 "7d08b2c3033529ca796125e666063df36e2eb036448ffb0a60b3bd141cc7f9d3" => :mojave
sha256 "d41bc25a97d82c1a8ef3a8f73014c4911edcfe153e11fb0b7a37b8d729b83c37" => :high_sierra
end
depends_on "gmp" => :build
depends_on "ocaml" => :build
depends_on "opam" => :build
depends_on "pcre"
depends_on "pkg-config"
uses_from_macos "m4"
uses_from_macos "unzip"
uses_from_macos "zlib"
def install
ENV.deparallelize
opamroot = buildpath/".opam"
ENV["OPAMROOT"] = opamroot
ENV["OPAMYES"] = "1"
system "opam", "init", "--no-setup", "--disable-sandboxing"
system "opam", "config", "exec", "--", "opam", "install", ".", "--deps-only", "-y"
ENV.prepend_path "LIBRARY_PATH", opamroot/"default/lib/hack_parallel" # for -lhp
system "opam", "config", "exec", "--", "make", "release"
bin.install "_build/default/src/main.exe" => "comby"
end
test do
expect = <<~EXPECT
--- /dev/null
+++ /dev/null
@@ -1,3 +1,3 @@
int main(void) {
- printf("hello world!");
+ printf("comby, hello!");
}
EXPECT
input = <<~INPUT
EOF
int main(void) {
printf("hello world!");
}
EOF
INPUT
match = 'printf(":[1] :[2]!")'
rewrite = 'printf("comby, :[1]!")'
assert_equal expect, shell_output("#{bin}/comby '#{match}' '#{rewrite}' .c -stdin -diff << #{input}")
end
end
comby 0.17.0
Closes #58424.
Signed-off-by: Dawid Dziurla <c4a7db180859322ef5630a1dfc2805b5bc97fc25@gmail.com>
Signed-off-by: Dustin Rodrigues <bb8ef414f2e67efe7ad38cfa83d7e2ec855def2b@gmail.com>
class Comby < Formula
desc "Tool for changing code across many languages"
homepage "https://comby.dev"
url "https://github.com/comby-tools/comby/archive/0.17.0.tar.gz"
sha256 "5f45a49b1d2e412e2774333df43a4955e585098b748db484a520e98b57385c91"
license "Apache-2.0"
bottle do
cellar :any
sha256 "0f53fe71e3908a0d12571e20bfb3f9ed969a17d823e95281513312a3024e74e1" => :catalina
sha256 "7d08b2c3033529ca796125e666063df36e2eb036448ffb0a60b3bd141cc7f9d3" => :mojave
sha256 "d41bc25a97d82c1a8ef3a8f73014c4911edcfe153e11fb0b7a37b8d729b83c37" => :high_sierra
end
depends_on "gmp" => :build
depends_on "ocaml" => :build
depends_on "opam" => :build
depends_on "pcre"
depends_on "pkg-config"
uses_from_macos "m4"
uses_from_macos "unzip"
uses_from_macos "zlib"
def install
ENV.deparallelize
opamroot = buildpath/".opam"
ENV["OPAMROOT"] = opamroot
ENV["OPAMYES"] = "1"
system "opam", "init", "--no-setup", "--disable-sandboxing"
system "opam", "config", "exec", "--", "opam", "install", ".", "--deps-only", "-y"
ENV.prepend_path "LIBRARY_PATH", opamroot/"default/lib/hack_parallel" # for -lhp
system "opam", "config", "exec", "--", "make", "release"
bin.install "_build/default/src/main.exe" => "comby"
end
test do
expect = <<~EXPECT
--- /dev/null
+++ /dev/null
@@ -1,3 +1,3 @@
int main(void) {
- printf("hello world!");
+ printf("comby, hello!");
}
EXPECT
input = <<~INPUT
EOF
int main(void) {
printf("hello world!");
}
EOF
INPUT
match = 'printf(":[1] :[2]!")'
rewrite = 'printf("comby, :[1]!")'
assert_equal expect, shell_output("#{bin}/comby '#{match}' '#{rewrite}' .c -stdin -diff << #{input}")
end
end
|
class RummageableArtefact
FORMATS_NOT_TO_INDEX = %W(business_support completed_transaction) +
Artefact::FORMATS_BY_DEFAULT_OWNING_APP["whitehall"] +
Artefact::FORMATS_BY_DEFAULT_OWNING_APP["specialist-publisher"] +
Artefact::FORMATS_BY_DEFAULT_OWNING_APP["finder-api"]
EXCEPTIONAL_SLUGS = %W(
gosuperfast
growthaccelerator
technology-strategy-board
enterprise-finance-guarantee
manufacturing-advisory-service-mas
research-development-tax-credit-smes
enterprise-investment-scheme
seed-enterprise-investment-scheme
designing-demand
business-mentoring-support
start-up-loans
new-enterprise-allowance
helping-your-business-grow-internationally
unimoney
horizon-2020
civil-service-apprenticeships
)
def initialize(artefact)
@artefact = artefact
end
def logger
Rails.logger
end
def should_be_indexed?
@artefact.live? && indexable_artefact?
end
def self.indexable_artefact?(kind, slug)
(FORMATS_NOT_TO_INDEX.exclude?(kind) || EXCEPTIONAL_SLUGS.include?(slug))
end
def indexable_artefact?
self.class.indexable_artefact?(@artefact.kind, @artefact.slug)
end
def submit
return unless indexable_artefact?
search_index = SearchIndex.instance
# API requests, if they know about the single registration API, will be
# providing the indexable_content field to update Rummager. UI requests
# and requests from apps that don't know about single registration, will
# not include this field
if should_amend?
logger.info "Posting amendments to Rummager: #{artefact_link}"
search_index.amend artefact_link, artefact_hash
else
logger.info "Posting document to Rummager: #{artefact_link}"
search_index.add artefact_hash
end
end
def delete
logger.info "Deleting item from Rummager: #{artefact_link}"
search_index = SearchIndex.instance
search_index.delete(artefact_link)
search_index.commit
end
def should_amend?
@artefact.indexable_content.nil?
end
def artefact_hash
# This won't cope with nested values, but we don't have any of those yet
# When we want to include additional links, this will become an issue
rummageable_keys = %w{title description format
indexable_content boost_phrases organisations additional_links
specialist_sectors public_timestamp latest_change_note mainstream_browse_pages}
# If a key is in this list, and the corresponding value in the artefact is
# nil, then it will be omitted from the hash returned from this method
strip_nil_keys = %w{
indexable_content
description
public_timestamp
latest_change_note
}
# When amending an artefact, requests with the "link" parameter will be
# refused, because we can't amend the link within Rummager
rummageable_keys << "link" unless should_amend?
result = {}
rummageable_keys.each_with_object(result) do |rummageable_key, hash|
strip_nils = strip_nil_keys.include? rummageable_key
# Use the relevant extraction method from this class if it exists
if respond_to? "artefact_#{rummageable_key}"
value = __send__ "artefact_#{rummageable_key}"
elsif @artefact.respond_to? rummageable_key
value = @artefact.__send__ rummageable_key
else
next
end
unless (strip_nils && value.nil?)
hash[rummageable_key] = value
end
end
result
end
def artefact_format
@artefact.kind
end
def artefact_title
@artefact.name
end
def artefact_link
"/#{@artefact.slug}"
end
def artefact_organisations
@artefact.organisation_ids
end
def artefact_specialist_sectors
@artefact.specialist_sectors.map(&:tag_id)
end
def artefact_mainstream_browse_pages
@artefact.sections.map(&:tag_id)
end
def artefact_public_timestamp
if @artefact.public_timestamp
@artefact.public_timestamp.iso8601
end
end
private
def section_parts
section_parts = []
return section_parts if @artefact.sections.empty?
if @artefact.primary_section.has_parent?
section_parts.push(@artefact.primary_section.parent.tag_id)
end
section_parts.push(@artefact.primary_section.tag_id.split("/").last)
end
end
Clean-up list of exceptional slugs
Some were campaigns, some are documents that have been unpublished/withdrawn/deleted.
class RummageableArtefact
FORMATS_NOT_TO_INDEX = %W(business_support completed_transaction) +
Artefact::FORMATS_BY_DEFAULT_OWNING_APP["whitehall"] +
Artefact::FORMATS_BY_DEFAULT_OWNING_APP["specialist-publisher"] +
Artefact::FORMATS_BY_DEFAULT_OWNING_APP["finder-api"]
EXCEPTIONAL_SLUGS = %W(
start-up-loans
new-enterprise-allowance
horizon-2020
)
def initialize(artefact)
@artefact = artefact
end
def logger
Rails.logger
end
def should_be_indexed?
@artefact.live? && indexable_artefact?
end
def self.indexable_artefact?(kind, slug)
(FORMATS_NOT_TO_INDEX.exclude?(kind) || EXCEPTIONAL_SLUGS.include?(slug))
end
def indexable_artefact?
self.class.indexable_artefact?(@artefact.kind, @artefact.slug)
end
def submit
return unless indexable_artefact?
search_index = SearchIndex.instance
# API requests, if they know about the single registration API, will be
# providing the indexable_content field to update Rummager. UI requests
# and requests from apps that don't know about single registration, will
# not include this field
if should_amend?
logger.info "Posting amendments to Rummager: #{artefact_link}"
search_index.amend artefact_link, artefact_hash
else
logger.info "Posting document to Rummager: #{artefact_link}"
search_index.add artefact_hash
end
end
def delete
logger.info "Deleting item from Rummager: #{artefact_link}"
search_index = SearchIndex.instance
search_index.delete(artefact_link)
search_index.commit
end
def should_amend?
@artefact.indexable_content.nil?
end
def artefact_hash
# This won't cope with nested values, but we don't have any of those yet
# When we want to include additional links, this will become an issue
rummageable_keys = %w{title description format
indexable_content boost_phrases organisations additional_links
specialist_sectors public_timestamp latest_change_note mainstream_browse_pages}
# If a key is in this list, and the corresponding value in the artefact is
# nil, then it will be omitted from the hash returned from this method
strip_nil_keys = %w{
indexable_content
description
public_timestamp
latest_change_note
}
# When amending an artefact, requests with the "link" parameter will be
# refused, because we can't amend the link within Rummager
rummageable_keys << "link" unless should_amend?
result = {}
rummageable_keys.each_with_object(result) do |rummageable_key, hash|
strip_nils = strip_nil_keys.include? rummageable_key
# Use the relevant extraction method from this class if it exists
if respond_to? "artefact_#{rummageable_key}"
value = __send__ "artefact_#{rummageable_key}"
elsif @artefact.respond_to? rummageable_key
value = @artefact.__send__ rummageable_key
else
next
end
unless (strip_nils && value.nil?)
hash[rummageable_key] = value
end
end
result
end
def artefact_format
@artefact.kind
end
def artefact_title
@artefact.name
end
def artefact_link
"/#{@artefact.slug}"
end
def artefact_organisations
@artefact.organisation_ids
end
def artefact_specialist_sectors
@artefact.specialist_sectors.map(&:tag_id)
end
def artefact_mainstream_browse_pages
@artefact.sections.map(&:tag_id)
end
def artefact_public_timestamp
if @artefact.public_timestamp
@artefact.public_timestamp.iso8601
end
end
private
def section_parts
section_parts = []
return section_parts if @artefact.sections.empty?
if @artefact.primary_section.has_parent?
section_parts.push(@artefact.primary_section.parent.tag_id)
end
section_parts.push(@artefact.primary_section.tag_id.split("/").last)
end
end
|
class Conan < Formula
include Language::Python::Virtualenv
desc "Distributed, open source, package manager for C/C++"
homepage "https://github.com/conan-io/conan"
url "https://github.com/conan-io/conan/archive/0.20.3.tar.gz"
sha256 "d725c43b5c9ca5a5c445ce258e99e9138630daccf6404c7282d5d13c7392a6cf"
head "https://github.com/conan-io/conan.git"
bottle do
cellar :any
sha256 "3649c002aec95f48d9e00fb8fb16b00129e07278757606e0b6f80818c34e0429" => :sierra
sha256 "38ad526962b8f0141313c6e9defa902fdb55d6627311574c99174377c69768c2" => :el_capitan
sha256 "7629cea74115f4e9a8e7718e3bc0b5c7efa3905fe12dfdd21ca7021a6ff4b6f0" => :yosemite
end
depends_on "pkg-config" => :build
depends_on :python if MacOS.version <= :snow_leopard
depends_on "libffi"
depends_on "openssl"
def install
venv = virtualenv_create(libexec)
system libexec/"bin/pip", "install", "-v", "--no-binary", ":all:",
"--ignore-installed", buildpath
system libexec/"bin/pip", "uninstall", "-y", name
venv.pip_install_and_link buildpath
end
test do
system bin/"conan", "install", "zlib/1.2.8@lasote/stable", "--build"
assert_predicate testpath/".conan/data/zlib/1.2.8", :exist?
end
end
conan: update 0.20.3 bottle.
class Conan < Formula
include Language::Python::Virtualenv
desc "Distributed, open source, package manager for C/C++"
homepage "https://github.com/conan-io/conan"
url "https://github.com/conan-io/conan/archive/0.20.3.tar.gz"
sha256 "d725c43b5c9ca5a5c445ce258e99e9138630daccf6404c7282d5d13c7392a6cf"
head "https://github.com/conan-io/conan.git"
bottle do
cellar :any
sha256 "2cf58ccd0e851c84e01a64f16a6cd12a14dd849974a48904a2a459670cdefc76" => :sierra
sha256 "4df95e3daf24c59b99d38b839c3ea0c902643b38d6f59b61d8e8b3a758a2f88f" => :el_capitan
sha256 "2f67010b1434e17fe6777a7381fdb7995fddd5ebe496a3cc28ffccda528bada6" => :yosemite
end
depends_on "pkg-config" => :build
depends_on :python if MacOS.version <= :snow_leopard
depends_on "libffi"
depends_on "openssl"
def install
venv = virtualenv_create(libexec)
system libexec/"bin/pip", "install", "-v", "--no-binary", ":all:",
"--ignore-installed", buildpath
system libexec/"bin/pip", "uninstall", "-y", name
venv.pip_install_and_link buildpath
end
test do
system bin/"conan", "install", "zlib/1.2.8@lasote/stable", "--build"
assert_predicate testpath/".conan/data/zlib/1.2.8", :exist?
end
end
|
class OrderItem < ApplicationRecord
belongs_to :order, autosave: true
belongs_to :good, polymorphic: true
end
# :good_id, :integer, limit: 4
# :quantity, :float
# :unit, :string
# :number, :integer, limit: 4, default: 1
# :total_price, :decimal, limit: 24
# :order_at :datetime
# :payed_at :datetime
add order item
class OrderItem < ApplicationRecord
belongs_to :order, autosave: true
belongs_to :good, polymorphic: true, optional: true
end
# :good_id, :integer, limit: 4
# :quantity, :float
# :unit, :string
# :number, :integer, limit: 4, default: 1
# :total_price, :decimal, limit: 24
# :order_at :datetime
# :payed_at :datetime
|
class Conan < Formula
include Language::Python::Virtualenv
desc "Distributed, open source, package manager for C/C++"
homepage "https://github.com/conan-io/conan"
url "https://github.com/conan-io/conan/archive/1.28.0.tar.gz"
sha256 "49c2d33ad7d85f3cffebcdd10d24b2df87fcf61fa779cfbafc6998066f4d54e6"
license "MIT"
head "https://github.com/conan-io/conan.git"
bottle do
cellar :any
sha256 "c0f0e14ad1b3831e31ac2c1c0cbe1b80424ca03047c956c4263e7068aa3f9b9a" => :catalina
sha256 "db8bc0eded3544aa54fd9c28280dd2db23e565fc0483340e165a08341cceed67" => :mojave
sha256 "80645c4aa1e555d0e50518b745ac10ae120d6ebc4ac8cc24168d9fea2c54c05a" => :high_sierra
end
depends_on "pkg-config" => :build
depends_on "libffi"
depends_on "openssl@1.1"
depends_on "python@3.8"
resource "asn1crypto" do
url "https://files.pythonhosted.org/packages/6b/b4/42f0e52ac2184a8abb31f0a6f98111ceee1aac0b473cee063882436e0e09/asn1crypto-1.4.0.tar.gz"
sha256 "f4f6e119474e58e04a2b1af817eb585b4fd72bdd89b998624712b5c99be7641c"
end
resource "bottle" do
url "https://files.pythonhosted.org/packages/d9/4f/57887a07944140dae0d039d8bc270c249fc7fc4a00744effd73ae2cde0a9/bottle-0.12.18.tar.gz"
sha256 "0819b74b145a7def225c0e83b16a4d5711fde751cd92bae467a69efce720f69e"
end
resource "certifi" do
url "https://files.pythonhosted.org/packages/40/a7/ded59fa294b85ca206082306bba75469a38ea1c7d44ea7e1d64f5443d67a/certifi-2020.6.20.tar.gz"
sha256 "5930595817496dd21bb8dc35dad090f1c2cd0adfaf21204bf6732ca5d8ee34d3"
end
resource "cffi" do
url "https://files.pythonhosted.org/packages/54/1d/15eae71ab444bd88a1d69f19592dcf32b9e3166ecf427dd9243ef0d3b7bc/cffi-1.14.1.tar.gz"
sha256 "b2a2b0d276a136146e012154baefaea2758ef1f56ae9f4e01c612b0831e0bd2f"
end
resource "chardet" do
url "https://files.pythonhosted.org/packages/fc/bb/a5768c230f9ddb03acc9ef3f0d4a3cf93462473795d18e9535498c8f929d/chardet-3.0.4.tar.gz"
sha256 "84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"
end
resource "colorama" do
url "https://files.pythonhosted.org/packages/82/75/f2a4c0c94c85e2693c229142eb448840fba0f9230111faa889d1f541d12d/colorama-0.4.3.tar.gz"
sha256 "e96da0d330793e2cb9485e9ddfd918d456036c7149416295932478192f4436a1"
end
resource "cryptography" do
url "https://files.pythonhosted.org/packages/22/21/233e38f74188db94e8451ef6385754a98f3cad9b59bedf3a8e8b14988be4/cryptography-2.3.1.tar.gz"
sha256 "8d10113ca826a4c29d5b85b2c4e045ffa8bad74fb525ee0eceb1d38d4c70dfd6"
end
resource "deprecation" do
url "https://files.pythonhosted.org/packages/cd/94/8d9d6303f5ddcbf40959fc2b287479bd9a201ea9483373d9b0882ae7c3ad/deprecation-2.0.7.tar.gz"
sha256 "c0392f676a6146f0238db5744d73e786a43510d54033f80994ef2f4c9df192ed"
end
resource "distro" do
url "https://files.pythonhosted.org/packages/21/7b/14198029b49abdf80c6b8aadd9862f863b683dc4d3c2418f01bc6fad9fa3/distro-1.1.0.tar.gz"
sha256 "722054925f339a39ca411a8c7079f390a41d42c422697bedf228f1a9c46ac1ee"
end
resource "fasteners" do
url "https://files.pythonhosted.org/packages/15/d7/1e8b3270f21dffcaaf5a2889675e8b2fa35f8a43a5817a31d3820e8e9495/fasteners-0.15.tar.gz"
sha256 "3a176da6b70df9bb88498e1a18a9e4a8579ed5b9141207762368a1017bf8f5ef"
end
resource "future" do
url "https://files.pythonhosted.org/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz"
sha256 "b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d"
end
resource "idna" do
url "https://files.pythonhosted.org/packages/f4/bd/0467d62790828c23c47fc1dfa1b1f052b24efdf5290f071c7a91d0d82fd3/idna-2.6.tar.gz"
sha256 "2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f"
end
resource "Jinja2" do
url "https://files.pythonhosted.org/packages/64/a7/45e11eebf2f15bf987c3bc11d37dcc838d9dc81250e67e4c5968f6008b6c/Jinja2-2.11.2.tar.gz"
sha256 "89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0"
end
resource "MarkupSafe" do
url "https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz"
sha256 "29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b"
end
resource "monotonic" do
url "https://files.pythonhosted.org/packages/19/c1/27f722aaaaf98786a1b338b78cf60960d9fe4849825b071f4e300da29589/monotonic-1.5.tar.gz"
sha256 "23953d55076df038541e648a53676fb24980f7a1be290cdda21300b3bc21dfb0"
end
resource "node-semver" do
url "https://files.pythonhosted.org/packages/f1/4e/1d9a619dcfd9f42d0e874a5b47efa0923e84829886e6a47b45328a1f32f1/node-semver-0.6.1.tar.gz"
sha256 "4016f7c1071b0493f18db69ea02d3763e98a633606d7c7beca811e53b5ac66b7"
end
resource "packaging" do
url "https://files.pythonhosted.org/packages/55/fd/fc1aca9cf51ed2f2c11748fa797370027babd82f87829c7a8e6dbe720145/packaging-20.4.tar.gz"
sha256 "4357f74f47b9c12db93624a82154e9b120fa8293699949152b22065d556079f8"
end
resource "patch-ng" do
url "https://files.pythonhosted.org/packages/c1/b2/ad3cd464101435fdf642d20e0e5e782b4edaef1affdf2adfc5c75660225b/patch-ng-1.17.4.tar.gz"
sha256 "627abc5bd723c8b481e96849b9734b10065426224d4d22cd44137004ac0d4ace"
end
resource "pluginbase" do
url "https://files.pythonhosted.org/packages/3d/3c/fe974b4f835f83cc46966e04051f8708b7535bac28fbc0dcca1ee0c237b8/pluginbase-1.0.0.tar.gz"
sha256 "497894df38d0db71e1a4fbbfaceb10c3ef49a3f95a0582e11b75f8adaa030005"
end
resource "pycparser" do
url "https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz"
sha256 "2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0"
end
resource "Pygments" do
url "https://files.pythonhosted.org/packages/6e/4d/4d2fe93a35dfba417311a4ff627489a947b01dc0cc377a3673c00cf7e4b2/Pygments-2.6.1.tar.gz"
sha256 "647344a061c249a3b74e230c739f434d7ea4d8b1d5f3721bc0f3558049b38f44"
end
resource "PyJWT" do
url "https://files.pythonhosted.org/packages/2f/38/ff37a24c0243c5f45f5798bd120c0f873eeed073994133c084e1cf13b95c/PyJWT-1.7.1.tar.gz"
sha256 "8d59a976fb773f3e6a39c85636357c4f0e242707394cadadd9814f5cbaa20e96"
end
resource "pyOpenSSL" do
url "https://files.pythonhosted.org/packages/9b/7c/ee600b2a9304d260d96044ab5c5e57aa489755b92bbeb4c0803f9504f480/pyOpenSSL-18.0.0.tar.gz"
sha256 "6488f1423b00f73b7ad5167885312bb0ce410d3312eb212393795b53c8caa580"
end
resource "pyparsing" do
url "https://files.pythonhosted.org/packages/c1/47/dfc9c342c9842bbe0036c7f763d2d6686bcf5eb1808ba3e170afdb282210/pyparsing-2.4.7.tar.gz"
sha256 "c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"
end
resource "python-dateutil" do
url "https://files.pythonhosted.org/packages/be/ed/5bbc91f03fa4c839c4c7360375da77f9659af5f7086b7a7bdda65771c8e0/python-dateutil-2.8.1.tar.gz"
sha256 "73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c"
end
resource "PyYAML" do
url "https://files.pythonhosted.org/packages/64/c2/b80047c7ac2478f9501676c988a5411ed5572f35d1beff9cae07d321512c/PyYAML-5.3.1.tar.gz"
sha256 "b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d"
end
resource "requests" do
url "https://files.pythonhosted.org/packages/da/67/672b422d9daf07365259958912ba533a0ecab839d4084c487a5fe9a5405f/requests-2.24.0.tar.gz"
sha256 "b3559a131db72c33ee969480840fff4bb6dd111de7dd27c8ee1f820f4f00231b"
end
resource "six" do
url "https://files.pythonhosted.org/packages/21/9f/b251f7f8a76dec1d6651be194dfba8fb8d7781d10ab3987190de8391d08e/six-1.14.0.tar.gz"
sha256 "236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a"
end
resource "tqdm" do
url "https://files.pythonhosted.org/packages/71/6c/6530032ec26dddd47bb9e052781bcbbcaa560f05d10cdaf365ecb990d220/tqdm-4.48.0.tar.gz"
sha256 "6baa75a88582b1db6d34ce4690da5501d2a1cb65c34664840a456b2c9f794d29"
end
resource "urllib3" do
url "https://files.pythonhosted.org/packages/81/f4/87467aeb3afc4a6056e1fe86626d259ab97e1213b1dfec14c7cb5f538bf0/urllib3-1.25.10.tar.gz"
sha256 "91056c15fa70756691db97756772bb1eb9678fa585d9184f24534b100dc60f4a"
end
def install
virtualenv_install_with_resources
end
test do
system bin/"conan", "install", "zlib/1.2.11@conan/stable", "--build"
assert_predicate testpath/".conan/data/zlib/1.2.11", :exist?
end
end
conan: update 1.28.0 bottle.
class Conan < Formula
include Language::Python::Virtualenv
desc "Distributed, open source, package manager for C/C++"
homepage "https://github.com/conan-io/conan"
url "https://github.com/conan-io/conan/archive/1.28.0.tar.gz"
sha256 "49c2d33ad7d85f3cffebcdd10d24b2df87fcf61fa779cfbafc6998066f4d54e6"
license "MIT"
head "https://github.com/conan-io/conan.git"
bottle do
cellar :any
sha256 "78167ed66cfb7405d7be36bd2a566bc5b14a5c7e7daf23f6e53658c81031bd0e" => :catalina
sha256 "500635cfd011d6ac4b486a6ff1e0da5de0d12ede6145c962472ba26731269836" => :mojave
sha256 "a2aa80831870e30bffebbda5b5a4bfeeaa2efe022485066e1fa8030cc2100381" => :high_sierra
end
depends_on "pkg-config" => :build
depends_on "libffi"
depends_on "openssl@1.1"
depends_on "python@3.8"
resource "asn1crypto" do
url "https://files.pythonhosted.org/packages/6b/b4/42f0e52ac2184a8abb31f0a6f98111ceee1aac0b473cee063882436e0e09/asn1crypto-1.4.0.tar.gz"
sha256 "f4f6e119474e58e04a2b1af817eb585b4fd72bdd89b998624712b5c99be7641c"
end
resource "bottle" do
url "https://files.pythonhosted.org/packages/d9/4f/57887a07944140dae0d039d8bc270c249fc7fc4a00744effd73ae2cde0a9/bottle-0.12.18.tar.gz"
sha256 "0819b74b145a7def225c0e83b16a4d5711fde751cd92bae467a69efce720f69e"
end
resource "certifi" do
url "https://files.pythonhosted.org/packages/40/a7/ded59fa294b85ca206082306bba75469a38ea1c7d44ea7e1d64f5443d67a/certifi-2020.6.20.tar.gz"
sha256 "5930595817496dd21bb8dc35dad090f1c2cd0adfaf21204bf6732ca5d8ee34d3"
end
resource "cffi" do
url "https://files.pythonhosted.org/packages/54/1d/15eae71ab444bd88a1d69f19592dcf32b9e3166ecf427dd9243ef0d3b7bc/cffi-1.14.1.tar.gz"
sha256 "b2a2b0d276a136146e012154baefaea2758ef1f56ae9f4e01c612b0831e0bd2f"
end
resource "chardet" do
url "https://files.pythonhosted.org/packages/fc/bb/a5768c230f9ddb03acc9ef3f0d4a3cf93462473795d18e9535498c8f929d/chardet-3.0.4.tar.gz"
sha256 "84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"
end
resource "colorama" do
url "https://files.pythonhosted.org/packages/82/75/f2a4c0c94c85e2693c229142eb448840fba0f9230111faa889d1f541d12d/colorama-0.4.3.tar.gz"
sha256 "e96da0d330793e2cb9485e9ddfd918d456036c7149416295932478192f4436a1"
end
resource "cryptography" do
url "https://files.pythonhosted.org/packages/22/21/233e38f74188db94e8451ef6385754a98f3cad9b59bedf3a8e8b14988be4/cryptography-2.3.1.tar.gz"
sha256 "8d10113ca826a4c29d5b85b2c4e045ffa8bad74fb525ee0eceb1d38d4c70dfd6"
end
resource "deprecation" do
url "https://files.pythonhosted.org/packages/cd/94/8d9d6303f5ddcbf40959fc2b287479bd9a201ea9483373d9b0882ae7c3ad/deprecation-2.0.7.tar.gz"
sha256 "c0392f676a6146f0238db5744d73e786a43510d54033f80994ef2f4c9df192ed"
end
resource "distro" do
url "https://files.pythonhosted.org/packages/21/7b/14198029b49abdf80c6b8aadd9862f863b683dc4d3c2418f01bc6fad9fa3/distro-1.1.0.tar.gz"
sha256 "722054925f339a39ca411a8c7079f390a41d42c422697bedf228f1a9c46ac1ee"
end
resource "fasteners" do
url "https://files.pythonhosted.org/packages/15/d7/1e8b3270f21dffcaaf5a2889675e8b2fa35f8a43a5817a31d3820e8e9495/fasteners-0.15.tar.gz"
sha256 "3a176da6b70df9bb88498e1a18a9e4a8579ed5b9141207762368a1017bf8f5ef"
end
resource "future" do
url "https://files.pythonhosted.org/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz"
sha256 "b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d"
end
resource "idna" do
url "https://files.pythonhosted.org/packages/f4/bd/0467d62790828c23c47fc1dfa1b1f052b24efdf5290f071c7a91d0d82fd3/idna-2.6.tar.gz"
sha256 "2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f"
end
resource "Jinja2" do
url "https://files.pythonhosted.org/packages/64/a7/45e11eebf2f15bf987c3bc11d37dcc838d9dc81250e67e4c5968f6008b6c/Jinja2-2.11.2.tar.gz"
sha256 "89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0"
end
resource "MarkupSafe" do
url "https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz"
sha256 "29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b"
end
resource "monotonic" do
url "https://files.pythonhosted.org/packages/19/c1/27f722aaaaf98786a1b338b78cf60960d9fe4849825b071f4e300da29589/monotonic-1.5.tar.gz"
sha256 "23953d55076df038541e648a53676fb24980f7a1be290cdda21300b3bc21dfb0"
end
resource "node-semver" do
url "https://files.pythonhosted.org/packages/f1/4e/1d9a619dcfd9f42d0e874a5b47efa0923e84829886e6a47b45328a1f32f1/node-semver-0.6.1.tar.gz"
sha256 "4016f7c1071b0493f18db69ea02d3763e98a633606d7c7beca811e53b5ac66b7"
end
resource "packaging" do
url "https://files.pythonhosted.org/packages/55/fd/fc1aca9cf51ed2f2c11748fa797370027babd82f87829c7a8e6dbe720145/packaging-20.4.tar.gz"
sha256 "4357f74f47b9c12db93624a82154e9b120fa8293699949152b22065d556079f8"
end
resource "patch-ng" do
url "https://files.pythonhosted.org/packages/c1/b2/ad3cd464101435fdf642d20e0e5e782b4edaef1affdf2adfc5c75660225b/patch-ng-1.17.4.tar.gz"
sha256 "627abc5bd723c8b481e96849b9734b10065426224d4d22cd44137004ac0d4ace"
end
resource "pluginbase" do
url "https://files.pythonhosted.org/packages/3d/3c/fe974b4f835f83cc46966e04051f8708b7535bac28fbc0dcca1ee0c237b8/pluginbase-1.0.0.tar.gz"
sha256 "497894df38d0db71e1a4fbbfaceb10c3ef49a3f95a0582e11b75f8adaa030005"
end
resource "pycparser" do
url "https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz"
sha256 "2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0"
end
resource "Pygments" do
url "https://files.pythonhosted.org/packages/6e/4d/4d2fe93a35dfba417311a4ff627489a947b01dc0cc377a3673c00cf7e4b2/Pygments-2.6.1.tar.gz"
sha256 "647344a061c249a3b74e230c739f434d7ea4d8b1d5f3721bc0f3558049b38f44"
end
resource "PyJWT" do
url "https://files.pythonhosted.org/packages/2f/38/ff37a24c0243c5f45f5798bd120c0f873eeed073994133c084e1cf13b95c/PyJWT-1.7.1.tar.gz"
sha256 "8d59a976fb773f3e6a39c85636357c4f0e242707394cadadd9814f5cbaa20e96"
end
resource "pyOpenSSL" do
url "https://files.pythonhosted.org/packages/9b/7c/ee600b2a9304d260d96044ab5c5e57aa489755b92bbeb4c0803f9504f480/pyOpenSSL-18.0.0.tar.gz"
sha256 "6488f1423b00f73b7ad5167885312bb0ce410d3312eb212393795b53c8caa580"
end
resource "pyparsing" do
url "https://files.pythonhosted.org/packages/c1/47/dfc9c342c9842bbe0036c7f763d2d6686bcf5eb1808ba3e170afdb282210/pyparsing-2.4.7.tar.gz"
sha256 "c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"
end
resource "python-dateutil" do
url "https://files.pythonhosted.org/packages/be/ed/5bbc91f03fa4c839c4c7360375da77f9659af5f7086b7a7bdda65771c8e0/python-dateutil-2.8.1.tar.gz"
sha256 "73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c"
end
resource "PyYAML" do
url "https://files.pythonhosted.org/packages/64/c2/b80047c7ac2478f9501676c988a5411ed5572f35d1beff9cae07d321512c/PyYAML-5.3.1.tar.gz"
sha256 "b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d"
end
resource "requests" do
url "https://files.pythonhosted.org/packages/da/67/672b422d9daf07365259958912ba533a0ecab839d4084c487a5fe9a5405f/requests-2.24.0.tar.gz"
sha256 "b3559a131db72c33ee969480840fff4bb6dd111de7dd27c8ee1f820f4f00231b"
end
resource "six" do
url "https://files.pythonhosted.org/packages/21/9f/b251f7f8a76dec1d6651be194dfba8fb8d7781d10ab3987190de8391d08e/six-1.14.0.tar.gz"
sha256 "236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a"
end
resource "tqdm" do
url "https://files.pythonhosted.org/packages/71/6c/6530032ec26dddd47bb9e052781bcbbcaa560f05d10cdaf365ecb990d220/tqdm-4.48.0.tar.gz"
sha256 "6baa75a88582b1db6d34ce4690da5501d2a1cb65c34664840a456b2c9f794d29"
end
resource "urllib3" do
url "https://files.pythonhosted.org/packages/81/f4/87467aeb3afc4a6056e1fe86626d259ab97e1213b1dfec14c7cb5f538bf0/urllib3-1.25.10.tar.gz"
sha256 "91056c15fa70756691db97756772bb1eb9678fa585d9184f24534b100dc60f4a"
end
def install
virtualenv_install_with_resources
end
test do
system bin/"conan", "install", "zlib/1.2.11@conan/stable", "--build"
assert_predicate testpath/".conan/data/zlib/1.2.11", :exist?
end
end
|
##
# Guest 是系统访客。
class Unidom::Visitor::Guest < Unidom::Visitor::ApplicationRecord
self.table_name = 'unidom_guests'
include Unidom::Common::Concerns::ModelExtension
validates :platform_specific_identification, presence: true, length: { in: 2..self.columns_hash['platform_specific_identification'].limit }
scope :platform_specific_identification_is, ->(platform_specific_identification) { where platform_specific_identification: platform_specific_identification }
end
1, Improve the Guest model to support the namespace neglecting.
##
# Guest 是系统访客。
class Unidom::Visitor::Guest < Unidom::Visitor::ApplicationRecord
self.table_name = 'unidom_guests'
include Unidom::Common::Concerns::ModelExtension
validates :platform_specific_identification, presence: true, length: { in: 2..self.columns_hash['platform_specific_identification'].limit }
scope :platform_specific_identification_is, ->(platform_specific_identification) { where platform_specific_identification: platform_specific_identification }
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Visitor::Guest'
|
class Conan < Formula
include Language::Python::Virtualenv
desc "Distributed, open source, package manager for C/C++"
homepage "https://github.com/conan-io/conan"
url "https://github.com/conan-io/conan/archive/0.13.3.tar.gz"
sha256 "8401c7db8fd909d93e1fb1d5f160b6d301ff538b145b2e2a6331edbb6651e173"
head "https://github.com/conan-io/conan.git"
bottle do
cellar :any
sha256 "965989d2e3404836dd1aa12433248af22dc259e5b6eba4a6ebf01730a5364d7e" => :sierra
sha256 "252bb5ce3b8820f6cb49e58b821f4f5130461b1680e5d5d7178c9c6e956c0318" => :el_capitan
sha256 "f39d72a141ed5ecf199f1c9c5fab55600e865d2e409723c342022486693390fe" => :yosemite
end
depends_on "pkg-config" => :build
depends_on :python if MacOS.version <= :snow_leopard
depends_on "libffi"
depends_on "openssl"
def install
venv = virtualenv_create(libexec)
system libexec/"bin/pip", "install", "-v", "--no-binary", ":all:",
"--ignore-installed", buildpath
system libexec/"bin/pip", "uninstall", "-y", name
venv.pip_install_and_link buildpath
end
test do
system bin/"conan", "install", "zlib/1.2.8@lasote/stable", "--build"
assert_predicate testpath/".conan/data/zlib/1.2.8", :exist?
end
end
conan: update 0.13.3 bottle.
class Conan < Formula
include Language::Python::Virtualenv
desc "Distributed, open source, package manager for C/C++"
homepage "https://github.com/conan-io/conan"
url "https://github.com/conan-io/conan/archive/0.13.3.tar.gz"
sha256 "8401c7db8fd909d93e1fb1d5f160b6d301ff538b145b2e2a6331edbb6651e173"
head "https://github.com/conan-io/conan.git"
bottle do
cellar :any
sha256 "8594084c880394046a7c3b9dcd08feb7c984ffd0193ca9893e0c846733ebea35" => :sierra
sha256 "5c336dc11e27b1dadeb8dda031a74f63c1616c5aecce1a57c6127f5af0d4ec27" => :el_capitan
sha256 "a9186285c99d3c4aa344d01eb8374f72529c2c8716ef90d931f031df1b8625d0" => :yosemite
end
depends_on "pkg-config" => :build
depends_on :python if MacOS.version <= :snow_leopard
depends_on "libffi"
depends_on "openssl"
def install
venv = virtualenv_create(libexec)
system libexec/"bin/pip", "install", "-v", "--no-binary", ":all:",
"--ignore-installed", buildpath
system libexec/"bin/pip", "uninstall", "-y", name
venv.pip_install_and_link buildpath
end
test do
system bin/"conan", "install", "zlib/1.2.8@lasote/stable", "--build"
assert_predicate testpath/".conan/data/zlib/1.2.8", :exist?
end
end
|
module Util
class UserDbManager < DbManager
def self.change_password(user, pwd)
new.change_password(user, pwd)
end
def create_user_account(user)
begin
return false if !can_create_user_account?(user)
#user.skip_password_validation=true # don't validate that user entered current password. already validated
#pub_con = PublicBase.establish_connection(ENV["AACT_PUBLIC_DATABASE_URL"]).connection
pub_con.execute("create user \"#{user.username}\" password '#{user.password}';")
pub_con.execute("revoke connect on database aact from #{user.username};")
#pub_con.disconnect!
#@pub_con=nil
return true
rescue => e
user.errors.add(:base, e.message)
return false
end
end
def can_create_user_account?(user)
if user_account_exists?(user.username)
user.errors.add(:Username, "Database account already exists for username '#{user.username}'")
return false
else
return true
end
end
def user_account_exists?(username)
return true if username == 'postgres'
return true if username == 'ctti'
pub_con.execute("SELECT * FROM pg_catalog.pg_user where usename = '#{username}'").count > 0
end
def remove_user(username)
begin
return false if !user_account_exists?(username)
revoke_db_privs(username)
pub_con.execute("reassign owned by #{username} to postgres;")
pub_con.execute("drop owned by #{username};")
pub_con.execute("drop user #{username};")
return true
rescue => e
raise e
end
end
def change_password(user,pwd)
begin
pub_con.execute("alter user \"#{user.username}\" password '#{pwd}';")
rescue => e
user.errors.add(:base, e.message)
end
end
def grant_db_privs(username)
pub_con.execute("grant connect on database aact to \"#{username}\";")
pub_con.execute("grant usage on schema ctgov TO \"#{username}\";")
pub_con.execute("grant select on all tables in schema ctgov to \"#{username}\";")
end
def revoke_db_privs(username)
pub_con = PublicBase.establish_connection(ENV["AACT_PUBLIC_DATABASE_URL"]).connection
pub_con.execute("reassign owned by #{username} to postgres;")
pub_con.execute("drop owned by #{username};")
pub_con.execute("revoke all on schema ctgov from #{username};")
pub_con.execute("revoke connect on database #{public_db_name} from #{username};")
pub_con.disconnect!
@pub_con=nil
end
def terminate_sessions_for(user)
con.select_all("select * from pg_stat_activity order by pid;").each { |session|
if session['usename']=="#{user.username}"
con.execute("select pg_terminate_backend(#{session['pid']})")
end
}
end
end
end
aact-617: use the ‘login’ db permission to control user access to the database. Also, set the user’s search_path when db permissions are granted, and the terminate_sessions_for method only needs the username, not the whole user object.
module Util
class UserDbManager < DbManager
def self.change_password(user, pwd)
new.change_password(user, pwd)
end
def create_user_account(user)
begin
return false if !can_create_user_account?(user)
#user.skip_password_validation=true # don't validate that user entered current password. already validated
#pub_con = PublicBase.establish_connection(ENV["AACT_PUBLIC_DATABASE_URL"]).connection
pub_con.execute("create user \"#{user.username}\" password '#{user.password}';")
pub_con.execute("revoke connect on database aact from #{user.username};")
#pub_con.disconnect!
#@pub_con=nil
return true
rescue => e
user.errors.add(:base, e.message)
return false
end
end
def can_create_user_account?(user)
if user_account_exists?(user.username)
user.errors.add(:Username, "Database account already exists for username '#{user.username}'")
return false
else
return true
end
end
def user_account_exists?(username)
return true if username == 'postgres'
return true if username == 'ctti'
pub_con.execute("SELECT * FROM pg_catalog.pg_user where usename = '#{username}'").count > 0
end
def remove_user(username)
begin
return false if !user_account_exists?(username)
revoke_db_privs(username)
pub_con.execute("reassign owned by #{username} to postgres;")
pub_con.execute("drop owned by #{username};")
pub_con.execute("drop user #{username};")
return true
rescue => e
raise e
end
end
def change_password(user,pwd)
begin
pub_con.execute("alter user \"#{user.username}\" password '#{pwd}';")
rescue => e
user.errors.add(:base, e.message)
end
end
def grant_db_privs(username)
pub_con.execute("alter role \"#{username}\" IN DATABASE aact set search_path = ctgov;")
pub_con.execute("grant connect on database aact to \"#{username}\";")
pub_con.execute("grant usage on schema ctgov TO \"#{username}\";")
pub_con.execute("grant select on all tables in schema ctgov to \"#{username}\";")
pub_con.execute("alter user \"#{username}\" login;")
end
def revoke_db_privs(username)
terminate_sessions_for(username)
pub_con.execute("alter user #{username} nologin;")
end
def terminate_sessions_for(username)
con.select_all("select * from pg_stat_activity order by pid;").each { |session|
if session['usename']=="#{username}"
con.execute("select pg_terminate_backend(#{session['pid']})")
end
}
end
end
end
|
class Conan < Formula
include Language::Python::Virtualenv
desc "Distributed, open source, package manager for C/C++"
homepage "https://github.com/conan-io/conan"
url "https://github.com/conan-io/conan/archive/1.5.1.tar.gz"
sha256 "9876637b10ec1959bd9fe031c380e07a1a94e22b4f6db4001edf6160f485ed52"
head "https://github.com/conan-io/conan.git"
bottle do
cellar :any
sha256 "e07991349d48d7422149f10f0a2bdee6c0808a3f2e6d60b2b7ae02664a87a652" => :high_sierra
sha256 "ac6775c5b320a74c4b16d8c17a64050bac61606c2ba147efe9afa47ae9a152c4" => :sierra
sha256 "644bd3f6b90d4e537caf7d063a57bd2945f0cabdd7b6cc4dd60231a706a88594" => :el_capitan
end
depends_on "pkg-config" => :build
depends_on "libffi"
depends_on "openssl"
depends_on "python"
def install
inreplace "conans/requirements.txt", "PyYAML>=3.11, <3.13.0", "PyYAML>=3.11"
venv = virtualenv_create(libexec, "python3")
system libexec/"bin/pip", "install", "-v", "--no-binary", ":all:",
"--ignore-installed", "PyYAML==4.2b1", buildpath
system libexec/"bin/pip", "uninstall", "-y", name
venv.pip_install_and_link buildpath
end
test do
system bin/"conan", "install", "zlib/1.2.11@conan/stable", "--build"
assert_predicate testpath/".conan/data/zlib/1.2.11", :exist?
end
end
conan: update 1.5.1 bottle.
class Conan < Formula
include Language::Python::Virtualenv
desc "Distributed, open source, package manager for C/C++"
homepage "https://github.com/conan-io/conan"
url "https://github.com/conan-io/conan/archive/1.5.1.tar.gz"
sha256 "9876637b10ec1959bd9fe031c380e07a1a94e22b4f6db4001edf6160f485ed52"
head "https://github.com/conan-io/conan.git"
bottle do
cellar :any
sha256 "c10e29162e937d5bae8006f36eda0738bb33eabeb253e48e8b1de7e229e1bf43" => :high_sierra
sha256 "ee018a208b314df13eb265e40adfe89e86fd4d33acc8c933669a6021ab4a77b0" => :sierra
sha256 "663e07d9921945c2b9f29441dd89bc88ee9ce19a9c58d01ac51bafadb8ee9953" => :el_capitan
end
depends_on "pkg-config" => :build
depends_on "libffi"
depends_on "openssl"
depends_on "python"
def install
inreplace "conans/requirements.txt", "PyYAML>=3.11, <3.13.0", "PyYAML>=3.11"
venv = virtualenv_create(libexec, "python3")
system libexec/"bin/pip", "install", "-v", "--no-binary", ":all:",
"--ignore-installed", "PyYAML==4.2b1", buildpath
system libexec/"bin/pip", "uninstall", "-y", name
venv.pip_install_and_link buildpath
end
test do
system bin/"conan", "install", "zlib/1.2.11@conan/stable", "--build"
assert_predicate testpath/".conan/data/zlib/1.2.11", :exist?
end
end
|
module Trisano
class Application
attr_reader :oid
attr_reader :bug_report_address
attr_reader :version_number
def initialize
@oid = %w{csi-trisano-ce 2.16.840.1.113883.4.434 ISO}
@bug_report_address = 'trisano-user@googlegroups.com'
@version_number = '3.0'
end
end
def self.application
@application ||= Application.new
end
end
changed Application attributes to attr_accessors
module Trisano
class Application
attr_accessor :oid
attr_accessor :bug_report_address
attr_accessor :version_number
def initialize
@oid = %w{csi-trisano-ce 2.16.840.1.113883.4.434 ISO}
@bug_report_address = 'trisano-user@googlegroups.com'
@version_number = '3.0'
end
end
def self.application
@application ||= Application.new
end
end
|
class VariantOverrideSet < ModelSet
def initialize(collection, attributes = {})
super(VariantOverride, collection, attributes, nil, proc { |attrs, tag_list| deletable?(attrs, tag_list) } )
end
private
def deletable?(attrs, tag_list)
attrs['price'].blank? &&
attrs['count_on_hand'].blank? &&
attrs['default_stock'].blank? &&
attrs['resettable'].blank? &&
attrs['sku'].nil? &&
attrs['on_demand'].nil? &&
tag_list.empty?
end
def collection_to_delete
# Override of ModelSet method to allow us to check presence of a tag_list (which is not an attribute)
deleted = []
collection.delete_if { |e| deleted << e if @delete_if.andand.call(e.attributes, e.tag_list) }
deleted
end
def collection_to_keep
collection.reject { |e| @delete_if.andand.call(e.attributes, e.tag_list) }
end
end
Add comment to better explain variant_override_set.collection_to_delete
class VariantOverrideSet < ModelSet
def initialize(collection, attributes = {})
super(VariantOverride, collection, attributes, nil, proc { |attrs, tag_list| deletable?(attrs, tag_list) } )
end
private
def deletable?(attrs, tag_list)
attrs['price'].blank? &&
attrs['count_on_hand'].blank? &&
attrs['default_stock'].blank? &&
attrs['resettable'].blank? &&
attrs['sku'].nil? &&
attrs['on_demand'].nil? &&
tag_list.empty?
end
# Override of ModelSet method to allow us to check presence of a tag_list (which is not an attribute)
# This method will delete VariantOverrides that have no values (see deletable? above)
# If the user sets all values to nil in the UI the VO will be deleted from the DB
def collection_to_delete
deleted = []
collection.delete_if { |e| deleted << e if @delete_if.andand.call(e.attributes, e.tag_list) }
deleted
end
def collection_to_keep
collection.reject { |e| @delete_if.andand.call(e.attributes, e.tag_list) }
end
end
|
class Conan < Formula
include Language::Python::Virtualenv
desc "Distributed, open source, package manager for C/C++"
homepage "https://github.com/conan-io/conan"
url "https://github.com/conan-io/conan/archive/1.10.1.tar.gz"
sha256 "a148dd438c027adb8dc04f3954164d39d12ea2da1cbd18f9d0d0ae2234ac82d4"
head "https://github.com/conan-io/conan.git"
bottle do
cellar :any
sha256 "778b361fce9c68007d0dc94909f547036c2c6886539f4b2652d3effcc49c43e1" => :mojave
sha256 "061f23d8886a335e7a1759c07b6b194a418e64d96c1d0c094bf089beda1e1b45" => :high_sierra
sha256 "bb8077858e6cad744d5805bc362ddbc7287e1a71319f9cfa557138aab9104f06" => :sierra
end
depends_on "pkg-config" => :build
depends_on "libffi"
depends_on "openssl"
depends_on "python"
def install
inreplace "conans/requirements.txt", "PyYAML>=3.11, <3.14.0", "PyYAML>=3.11"
venv = virtualenv_create(libexec, "python3")
system libexec/"bin/pip", "install", "-v", "--no-binary", ":all:",
"--ignore-installed", "PyYAML==3.13", buildpath
system libexec/"bin/pip", "uninstall", "-y", name
venv.pip_install_and_link buildpath
end
test do
system bin/"conan", "install", "zlib/1.2.11@conan/stable", "--build"
assert_predicate testpath/".conan/data/zlib/1.2.11", :exist?
end
end
conan: update 1.10.1 bottle for Linuxbrew.
class Conan < Formula
include Language::Python::Virtualenv
desc "Distributed, open source, package manager for C/C++"
homepage "https://github.com/conan-io/conan"
url "https://github.com/conan-io/conan/archive/1.10.1.tar.gz"
sha256 "a148dd438c027adb8dc04f3954164d39d12ea2da1cbd18f9d0d0ae2234ac82d4"
head "https://github.com/conan-io/conan.git"
bottle do
cellar :any
sha256 "778b361fce9c68007d0dc94909f547036c2c6886539f4b2652d3effcc49c43e1" => :mojave
sha256 "061f23d8886a335e7a1759c07b6b194a418e64d96c1d0c094bf089beda1e1b45" => :high_sierra
sha256 "bb8077858e6cad744d5805bc362ddbc7287e1a71319f9cfa557138aab9104f06" => :sierra
sha256 "c20c326b661100c218fdb17d4c196d0e8e7adac32109700372e04e36b2765bd8" => :x86_64_linux
end
depends_on "pkg-config" => :build
depends_on "libffi"
depends_on "openssl"
depends_on "python"
def install
inreplace "conans/requirements.txt", "PyYAML>=3.11, <3.14.0", "PyYAML>=3.11"
venv = virtualenv_create(libexec, "python3")
system libexec/"bin/pip", "install", "-v", "--no-binary", ":all:",
"--ignore-installed", "PyYAML==3.13", buildpath
system libexec/"bin/pip", "uninstall", "-y", name
venv.pip_install_and_link buildpath
end
test do
system bin/"conan", "install", "zlib/1.2.11@conan/stable", "--build"
assert_predicate testpath/".conan/data/zlib/1.2.11", :exist?
end
end
|
# encoding: utf-8
require 'forwardable'
require 'virtus'
require 'json'
require_relative '../markdown_render'
require_relative './presenter'
require_relative './name_checker'
require_relative '../permission'
require_relative './relator'
require_relative './like'
require_relative '../table/privacy_manager'
require_relative '../../../services/minimal-validation/validator'
require_relative '../../../services/named-maps-api-wrapper/lib/named_maps_wrapper'
require_relative '../../helpers/embed_redis_cache'
require_relative '../../helpers/redis_vizjson_cache'
# Every table has always at least one visualization (the "canonical visualization"), of type 'table',
# which shares the same privacy options as the table and gets synced.
# Users can create new visualizations, which will never be of type 'table',
# and those will use named maps when any source tables are private
module CartoDB
module Visualization
class Member
extend Forwardable
include Virtus.model
include CacheHelper
PRIVACY_PUBLIC = 'public' # published and listable in public user profile
PRIVACY_PRIVATE = 'private' # not published (viz.json and embed_map should return 404)
PRIVACY_LINK = 'link' # published but not listen in public profile
PRIVACY_PROTECTED = 'password' # published but password protected
TYPE_CANONICAL = 'table'
TYPE_DERIVED = 'derived'
TYPE_SLIDE = 'slide'
TYPE_REMOTE = 'remote'
KIND_GEOM = 'geom'
KIND_RASTER = 'raster'
PRIVACY_VALUES = [ PRIVACY_PUBLIC, PRIVACY_PRIVATE, PRIVACY_LINK, PRIVACY_PROTECTED ]
TEMPLATE_NAME_PREFIX = 'tpl_'
PERMISSION_READONLY = CartoDB::Permission::ACCESS_READONLY
PERMISSION_READWRITE = CartoDB::Permission::ACCESS_READWRITE
DEFAULT_URL_OPTIONS = 'title=true&description=true&search=false&shareable=true&cartodb_logo=true&layer_selector=false&legends=false&scrollwheel=true&fullscreen=true&sublayer_options=1&sql='
AUTH_DIGEST = '1211b3e77138f6e1724721f1ab740c9c70e66ba6fec5e989bb6640c4541ed15d06dbd5fdcbd3052b'
TOKEN_DIGEST = '6da98b2da1b38c5ada2547ad2c3268caa1eb58dc20c9144ead844a2eda1917067a06dcb54833ba2'
DEFAULT_OPTIONS_VALUE = '{}'
# Upon adding new attributes modify also:
# app/models/visualization/migrator.rb
# services/data-repository/spec/unit/backend/sequel_spec.rb -> before do
# spec/support/helpers.rb -> random_attributes_for_vis_member
# app/models/visualization/presenter.rb
attribute :id, String
attribute :name, String
attribute :display_name, String
attribute :map_id, String
attribute :active_layer_id, String
attribute :type, String
attribute :privacy, String
attribute :tags, Array[String], default: []
attribute :description, String
attribute :license, String
attribute :source, String
attribute :attributions, String
attribute :title, String
attribute :created_at, Time
attribute :updated_at, Time
attribute :encrypted_password, String, default: nil
attribute :password_salt, String, default: nil
attribute :url_options, String, default: DEFAULT_URL_OPTIONS
attribute :user_id, String
attribute :permission_id, String
attribute :locked, Boolean, default: false
attribute :parent_id, String, default: nil
attribute :kind, String, default: KIND_GEOM
attribute :prev_id, String, default: nil
attribute :next_id, String, default: nil
attribute :bbox, String, default: nil
# Don't use directly, use instead getter/setter "transition_options"
attribute :slide_transition_options, String, default: DEFAULT_OPTIONS_VALUE
attribute :active_child, String, default: nil
def_delegators :validator, :errors, :full_errors
def_delegators :relator, *Relator::INTERFACE
# This get called not only when creating a new but also when populating from the Collection
def initialize(attributes={}, repository=Visualization.repository, name_checker=nil)
super(attributes)
@repository = repository
self.id ||= @repository.next_id
@name_checker = name_checker
@validator = MinimalValidator::Validator.new
@named_maps = nil
@user_data = nil
self.permission_change_valid = true # Changes upon set of different permission_id
# this flag is passed to the table in case of canonical visualizations. It's used to say to the table to not touch the database and only change the metadata information, useful for ghost tables
self.register_table_only = false
@redis_vizjson_cache = RedisVizjsonCache.new()
@old_privacy = @privacy
end
def self.remote_member(name, user_id, privacy, description, tags, license, source, attributions, display_name)
Member.new({
name: name,
user_id: user_id,
privacy: privacy,
description: description,
tags: tags,
license: license,
source: source,
attributions: attributions,
display_name: display_name,
type: TYPE_REMOTE})
end
def update_remote_data(privacy, description, tags, license, source, attributions, display_name)
changed = false
if self.privacy != privacy
changed = true
self.privacy = privacy
end
if self.display_name != display_name
changed = true
self.display_name = display_name
end
if self.description != description
changed = true
self.description = description
end
if self.tags != tags
changed = true
self.tags = tags
end
if self.license != license
changed = true
self.license = license
end
if self.source != source
changed = true
self.source = source
end
if self.attributions != attributions
changed = true
self.attributions = attributions
end
changed
end
def transition_options
::JSON.parse(self.slide_transition_options).symbolize_keys
end
def transition_options=(value)
self.slide_transition_options = ::JSON.dump(value.nil? ? DEFAULT_OPTIONS_VALUE : value)
end
def ==(other_vis)
self.id == other_vis.id
end
def default_privacy(owner)
owner.try(:private_tables_enabled) ? PRIVACY_LINK : PRIVACY_PUBLIC
end
def store
raise CartoDB::InvalidMember.new(validator.errors) unless self.valid?
do_store
self
end
def store_from_map(fields)
self.map_id = fields[:map_id]
do_store(false)
self
end
def store_using_table(fields, table_privacy_changed = false)
if type == TYPE_CANONICAL
# Each table has a canonical visualization which must have privacy synced
self.privacy = fields[:privacy_text]
self.map_id = fields[:map_id]
end
# But as this method also notifies of changes in a table, must save always
do_store(false, table_privacy_changed)
self
end
def valid?
validator.validate_presence_of(name: name, privacy: privacy, type: type, user_id: user_id)
validator.validate_in(:privacy, privacy, PRIVACY_VALUES)
# do not validate names for slides, it's never used
validator.validate_uniqueness_of(:name, available_name?) unless type_slide?
if privacy == PRIVACY_PROTECTED
validator.validate_presence_of_with_custom_message(
{ encrypted_password: encrypted_password, password_salt: password_salt },
"password can't be blank")
end
# Allow only "maintaining" privacy link for everyone but not setting it
if privacy == PRIVACY_LINK && privacy_changed
validator.validate_expected_value(:private_tables_enabled, true, user.private_tables_enabled)
end
if type_slide?
if parent_id.nil?
validator.errors.store(:parent_id, "Type #{TYPE_SLIDE} must have a parent") if parent_id.nil?
else
begin
parent_member = Member.new(id:parent_id).fetch
if parent_member.type != TYPE_DERIVED
validator.errors.store(:parent_id, "Type #{TYPE_SLIDE} must have parent of type #{TYPE_DERIVED}")
end
rescue KeyError
validator.errors.store(:parent_id, "Type #{TYPE_SLIDE} has non-existing parent id")
end
end
else
validator.errors.store(:parent_id, "Type #{type} must not have parent") unless parent_id.nil?
end
unless permission_id.nil?
validator.errors.store(:permission_id, 'Cannot modify permission') unless permission_change_valid
end
if !license.nil? && !license.empty? && Carto::License.find(license.to_sym).nil?
validator.errors.store(:license, 'License should be an empty or a valid value')
end
validator.valid?
end
def fetch
data = repository.fetch(id)
raise KeyError if data.nil?
self.attributes = data
self.name_changed = false
@old_privacy = @privacy
self.privacy_changed = false
self.permission_change_valid = true
self.dirty = false
validator.reset
self
end
def delete(from_table_deletion = false)
# from_table_deletion would be enough for canonical viz-based deletes,
# but common data loading also calls this delete without the flag to true, causing a call without a Map
begin
if user.has_feature_flag?(Carto::VisualizationsExportService::FEATURE_FLAG_NAME) && map
Carto::VisualizationsExportService.new.export(id)
end
rescue => exception
# Don't break deletion flow
CartoDB.notify_error(exception.message, error: exception.inspect, user: user, visualization_id: id)
end
# Named map must be deleted before the map, or we lose the reference to it
begin
named_map = get_named_map
# non-existing named map is not a critical failure, keep deleting even if not found
named_map.delete if named_map
rescue NamedMapsWrapper::HTTPResponseError => exception
# CDB-1964: Silence named maps API exception if deleting data to avoid interrupting whole flow
unless from_table_deletion
CartoDB.notify_exception(exception, user: user)
end
end
unlink_self_from_list!
support_tables.delete_all
invalidate_cache
overlays.destroy
layers(:base).map(&:destroy)
layers(:cartodb).map(&:destroy)
safe_sequel_delete {
# "Mark" that this vis id is the destructor to avoid cycles: Vis -> Map -> relatedvis (Vis again)
related_map = map
related_map.being_destroyed_by_vis_id = id
related_map.destroy
} if map
safe_sequel_delete { table.destroy } if (type == TYPE_CANONICAL && table && !from_table_deletion)
safe_sequel_delete { children.map { |child|
# Refetch each item before removal so Relator reloads prev/next cursors
child.fetch.delete
}
}
safe_sequel_delete { permission.destroy } if permission
safe_sequel_delete { repository.delete(id) }
self.attributes.keys.each { |key| self.send("#{key}=", nil) }
self
end
# A visualization is linked to a table when it uses that table in a layergroup (but is not the canonical table)
def unlink_from(table)
invalidate_cache
remove_layers_from(table)
end
def user_data=(user_data)
@user_data = user_data
named_maps(true)
end
def name=(name)
name = name.downcase if name && table?
self.name_changed = true if name != @name && !@name.nil?
self.old_name = @name
super(name)
end
def description=(description)
self.dirty = true if description != @description && !@description.nil?
super(description)
end
def description_clean
if description.present?
description_html_safe.strip_tags
end
end
def description_html_safe
if description.present?
renderer = Redcarpet::Render::Safe
markdown = Redcarpet::Markdown.new(renderer, extensions = {})
markdown.render description
end
end
def source_html_safe
if source.present?
renderer = Redcarpet::Render::Safe
markdown = Redcarpet::Markdown.new(renderer, extensions = {})
markdown.render source
end
end
def attributions=(value)
self.dirty = true if value != @attributions
self.attributions_changed = true if value != @attributions
super(value)
end
def permission_id=(permission_id)
self.permission_change_valid = false
self.permission_change_valid = true if (@permission_id.nil? || @permission_id == permission_id)
super(permission_id)
end
def privacy=(new_privacy)
new_privacy = new_privacy.downcase if new_privacy
if new_privacy != @privacy && !@privacy.nil?
self.privacy_changed = true
@old_privacy = @privacy
end
super(new_privacy)
end
def tags=(tags)
tags.reject!(&:blank?) if tags
super(tags)
end
def public?
privacy == PRIVACY_PUBLIC
end
def public_with_link?
privacy == PRIVACY_LINK
end
def private?
privacy == PRIVACY_PRIVATE and not organization?
end
def is_privacy_private?
privacy == PRIVACY_PRIVATE
end
def organization?
privacy == PRIVACY_PRIVATE and permission.acl.size > 0
end
def password_protected?
privacy == PRIVACY_PROTECTED
end
# Called by controllers upon rendering
def to_json(options={})
::JSON.dump(to_hash(options))
end
def to_hash(options={})
presenter = Presenter.new(self, options.merge(real_privacy: true))
options.delete(:public_fields_only) === true ? presenter.to_public_poro : presenter.to_poro
end
def to_vizjson(options={})
@redis_vizjson_cache.cached(id, options.fetch(:https_request, false)) do
calculate_vizjson(options)
end
end
def is_owner?(user)
user.id == user_id
end
# @param user ::User
# @param permission_type String PERMISSION_xxx
def has_permission?(user, permission_type)
return is_owner?(user) if permission_id.nil?
is_owner?(user) || permission.is_permitted?(user, permission_type)
end
def users_with_permissions(permission_types)
permission.users_with_permissions(permission_types)
end
def all_users_with_read_permission
users_with_permissions([CartoDB::Visualization::Member::PERMISSION_READONLY,
CartoDB::Visualization::Member::PERMISSION_READWRITE]) + [user]
end
def varnish_key
sorted_table_names = related_tables.map{ |table|
"#{user.database_schema}.#{table.name}"
}.sort { |i, j|
i <=> j
}.join(',')
"#{user.database_name}:#{sorted_table_names},#{id}"
end
def surrogate_key
get_surrogate_key(CartoDB::SURROGATE_NAMESPACE_VISUALIZATION, self.id)
end
def varnish_vizjson_key
".*#{id}:vizjson"
end
def derived?
type == TYPE_DERIVED
end
def table?
type == TYPE_CANONICAL
end
# Used at Carto::Api::VisualizationPresenter
alias :canonical? :table?
def type_slide?
type == TYPE_SLIDE
end
def dependent?
derived? && single_data_layer?
end
def non_dependent?
derived? && !single_data_layer?
end
def invalidate_cache
invalidate_redis_cache
invalidate_varnish_vizjson_cache
parent.invalidate_cache unless parent_id.nil?
end
def has_private_tables?
has_private_tables = false
related_tables.each { |table|
has_private_tables |= table.private?
}
has_private_tables
end
# Despite storing always a named map, no need to retrieve it for "public" visualizations
def retrieve_named_map?
password_protected? || has_private_tables?
end
def get_named_map
return false if type == TYPE_REMOTE
data = named_maps.get(CartoDB::NamedMapsWrapper::NamedMap.template_name(id))
if data.nil?
false
else
data
end
end
def password=(value)
if value && value.size > 0
@password_salt = generate_salt if @password_salt.nil?
@encrypted_password = password_digest(value, @password_salt)
self.dirty = true
end
end
def has_password?
( !@password_salt.nil? && !@encrypted_password.nil? )
end
def password_valid?(password)
raise CartoDB::InvalidMember unless ( privacy == PRIVACY_PROTECTED && has_password? )
( password_digest(password, @password_salt) == @encrypted_password )
end
def remove_password
@password_salt = nil
@encrypted_password = nil
end
# To be stored with the named map
def make_auth_token
digest = secure_digest(Time.now, (1..10).map{ rand.to_s })
10.times do
digest = secure_digest(digest, TOKEN_DIGEST)
end
digest
end
def get_auth_tokens
named_map = get_named_map
raise CartoDB::InvalidMember unless named_map
tokens = named_map.template[:template][:auth][:valid_tokens]
raise CartoDB::InvalidMember if tokens.size == 0
tokens
end
def supports_private_maps?
!user.nil? && user.private_maps_enabled?
end
# @param other_vis CartoDB::Visualization::Member|nil
# Note: Changes state both of self, other_vis and other affected list items, but only reloads self & other_vis
def set_next_list_item!(other_vis)
repository.transaction do
close_list_gap(other_vis)
# Now insert other_vis after self
unless other_vis.nil?
if self.next_id.nil?
other_vis.next_id = nil
else
other_vis.next_id = self.next_id
next_item = next_list_item
next_item.prev_id = other_vis.id
next_item.store
end
self.next_id = other_vis.id
other_vis.prev_id = self.id
other_vis.store
.fetch
end
store
end
fetch
end
# @param other_vis CartoDB::Visualization::Member|nil
# Note: Changes state both of self, other_vis and other affected list items, but only reloads self & other_vis
def set_prev_list_item!(other_vis)
repository.transaction do
close_list_gap(other_vis)
# Now insert other_vis after self
unless other_vis.nil?
if self.prev_id.nil?
other_vis.prev_id = nil
else
other_vis.prev_id = self.prev_id
prev_item = prev_list_item
prev_item.next_id = other_vis.id
prev_item.store
end
self.prev_id = other_vis.id
other_vis.next_id = self.id
other_vis.store
.fetch
end
store
end
fetch
end
def unlink_self_from_list!
repository.transaction do
unless self.prev_id.nil?
prev_item = prev_list_item
prev_item.next_id = self.next_id
prev_item.store
end
unless self.next_id.nil?
next_item = next_list_item
next_item.prev_id = self.prev_id
next_item.store
end
self.prev_id = nil
self.next_id = nil
end
end
# @param user_id String UUID of the actor that likes the visualization
# @throws AlreadyLikedError
def add_like_from(user_id)
Like.create(actor: user_id, subject: id)
reload_likes
self
rescue Sequel::DatabaseError => exception
if exception.message =~ /duplicate key/i
raise AlreadyLikedError
else
raise exception
end
end
def remove_like_from(user_id)
item = likes.select { |like| like.actor == user_id }
item.first.destroy unless item.first.nil?
reload_likes
self
end
def liked_by?(user_id)
!(likes.select { |like| like.actor == user_id }.first.nil?)
end
# @param viewer_user ::User
def qualified_name(viewer_user=nil)
if viewer_user.nil? || is_owner?(viewer_user)
name
else
"#{user.sql_safe_database_schema}.#{name}"
end
end
attr_accessor :register_table_only
def invalidate_redis_cache
@redis_vizjson_cache.invalidate(id)
embed_redis_cache.invalidate(self.id)
end
# INFO: Handles doing nothing if instance is not eligible to have a named map
def save_named_map
return if type == TYPE_REMOTE
named_map = get_named_map
if named_map
update_named_map(named_map)
else
create_named_map
end
end
def license_info
if !license.nil?
Carto::License.find(license.to_sym)
end
end
def attributions_from_derived_visualizations
related_canonical_visualizations.map(&:attributions).reject {|attribution| attribution.blank?}
end
private
attr_reader :repository, :name_checker, :validator
attr_accessor :privacy_changed, :name_changed, :old_name, :permission_change_valid, :dirty, :attributions_changed
def embed_redis_cache
@embed_redis_cache ||= EmbedRedisCache.new($tables_metadata)
end
def calculate_vizjson(options={})
vizjson_options = {
full: false,
user_name: user.username,
user_api_key: user.api_key,
user: user,
viewer_user: user
}.merge(options)
VizJSON.new(self, vizjson_options, configuration).to_poro
end
def invalidate_varnish_vizjson_cache
CartoDB::Varnish.new.purge(varnish_vizjson_key)
end
def close_list_gap(other_vis)
reload_self = false
if other_vis.nil?
self.next_id = nil
old_prev = nil
old_next = nil
else
old_prev = other_vis.prev_list_item
old_next = other_vis.next_list_item
end
# First close gap left by other_vis
unless old_prev.nil?
old_prev.next_id = old_next.nil? ? nil : old_next.id
old_prev.store
reload_self |= old_prev.id == self.id
end
unless old_next.nil?
old_next.prev_id = old_prev.nil? ? nil : old_prev.id
old_next.store
reload_self |= old_next.id == self.id
end
fetch if reload_self
end
def do_store(propagate_changes = true, table_privacy_changed = false)
if password_protected?
raise CartoDB::InvalidMember.new('No password set and required') unless has_password?
else
remove_password
end
# Warning: imports create by default private canonical visualizations
if type != TYPE_CANONICAL && @privacy == PRIVACY_PRIVATE && privacy_changed && !supports_private_maps?
raise CartoDB::InvalidMember
end
perform_invalidations(table_privacy_changed)
set_timestamps
repository.store(id, attributes.to_hash)
# Careful to not call Permission.save until after persisted the vis
if permission.nil?
perm = CartoDB::Permission.new
perm.owner = user
perm.entity = self
perm.save
@permission_id = perm.id
# Need to save again
repository.store(id, attributes.to_hash)
end
begin
save_named_map
rescue => exception
CartoDB.notify_exception(exception, user: user, message: "Error saving visualization named map")
restore_previous_privacy
raise exception
end
propagate_attribution_change if table
if type == TYPE_REMOTE || type == TYPE_CANONICAL
propagate_privacy_and_name_to(table) if table and propagate_changes
else
propagate_name_to(table) if table and propagate_changes
end
end
def restore_previous_privacy
unless @old_privacy.nil?
self.privacy = @old_privacy
attributes[:privacy] = @old_privacy
repository.store(id, attributes.to_hash)
end
rescue => exception
CartoDB.notify_exception(exception, user: user, message: "Error restoring previous visualization privacy")
raise exception
end
def perform_invalidations(table_privacy_changed)
# previously we used 'invalidate_cache' but due to public_map displaying all the user public visualizations,
# now we need to purgue everything to avoid cached stale data or public->priv still showing scenarios
if name_changed || privacy_changed || table_privacy_changed || dirty
invalidate_cache
end
# When a table's relevant data is changed, propagate to all who use it or relate to it
if dirty && table
table.affected_visualizations.each do |affected_vis|
affected_vis.invalidate_cache
end
end
end
def named_maps(force_init = false)
if @named_maps.nil? || force_init
if user.nil?
name_param = @user_data.nil? ? '' : @user_data[:name]
api_key_param = @user_data.nil? ? '' : @user_data[:api_key]
else
name_param = user.username
api_key_param = user.api_key
end
@named_maps = CartoDB::NamedMapsWrapper::NamedMaps.new(
{
name: name_param,
api_key: api_key_param
},
{
domain: Cartodb.config[:tiler]['internal']['domain'],
port: Cartodb.config[:tiler]['internal']['port'] || 443,
protocol: Cartodb.config[:tiler]['internal']['protocol'],
verifycert: (Cartodb.config[:tiler]['internal']['verifycert'] rescue true),
host: (Cartodb.config[:tiler]['internal']['host'] rescue nil)
},
configuration
)
end
@named_maps
end
def create_named_map
new_named_map = named_maps.create(self)
!new_named_map.nil?
end
def update_named_map(named_map_instance)
named_map_instance.update(self)
end
def propagate_privacy_and_name_to(table)
raise "Empty table sent to Visualization::Member propagate_privacy_and_name_to()" unless table
propagate_privacy_to(table) if privacy_changed
propagate_name_to(table) if name_changed
end
def propagate_privacy_to(table)
if type == TYPE_CANONICAL
CartoDB::TablePrivacyManager.new(table)
.set_from_visualization(self)
.update_cdb_tablemetadata
end
self
end
# @param table Table
def propagate_name_to(table)
table.name = self.name
table.register_table_only = self.register_table_only
table.update(name: self.name)
if name_changed
support_tables.rename(old_name, name, recreate_constraints=true, seek_parent_name=old_name)
end
self
rescue => exception
if name_changed && !(exception.to_s =~ /relation.*does not exist/)
revert_name_change(old_name)
end
raise CartoDB::InvalidMember.new(exception.to_s)
end
def propagate_attribution_change
return unless attributions_changed
# This includes both the canonical and derived visualizations
table.affected_visualizations.each do |affected_visualization|
affected_visualization.layers(:carto_and_torque).each do |layer|
if layer.options['table_name'] == table.name
layer.options['attribution'] = self.attributions
layer.save
end
end
end
end
def revert_name_change(previous_name)
self.name = previous_name
store
rescue => exception
raise CartoDB::InvalidMember.new(exception.to_s)
end
def set_timestamps
self.created_at ||= Time.now
self.updated_at = Time.now
self
end
def relator
Relator.new(attributes)
end
def name_checker
@name_checker || NameChecker.new(user)
end
def available_name?
return true unless user && name_changed
name_checker.available?(name)
end
def remove_layers_from(table)
related_layers_from(table).each { |layer|
map.remove_layer(layer)
layer.destroy
}
self.active_layer_id = layers(:cartodb).first.nil? ? nil : layers(:cartodb).first.id
store
end
def related_layers_from(table)
layers(:cartodb).select do |layer|
(layer.affected_tables.map(&:name) + [layer.options.fetch('table_name', nil)]).include?(table.name)
end
end
def configuration
return {} unless defined?(Cartodb)
Cartodb.config
end
def password_digest(password, salt)
digest = AUTH_DIGEST
10.times do
digest = secure_digest(digest, salt, password, AUTH_DIGEST)
end
digest
end
def generate_salt
secure_digest(Time.now, (1..10).map{ rand.to_s })
end
def secure_digest(*args)
#noinspection RubyArgCount
Digest::SHA256.hexdigest(args.flatten.join)
end
def safe_sequel_delete
yield
rescue Sequel::NoExistingObject => exception
# INFO: don't fail on nonexistant object delete
CartoDB.notify_exception(exception)
end
end
end
end
Fixes visualization delete
# encoding: utf-8
require 'forwardable'
require 'virtus'
require 'json'
require_relative '../markdown_render'
require_relative './presenter'
require_relative './name_checker'
require_relative '../permission'
require_relative './relator'
require_relative './like'
require_relative '../table/privacy_manager'
require_relative '../../../services/minimal-validation/validator'
require_relative '../../../services/named-maps-api-wrapper/lib/named_maps_wrapper'
require_relative '../../helpers/embed_redis_cache'
require_relative '../../helpers/redis_vizjson_cache'
# Every table has always at least one visualization (the "canonical visualization"), of type 'table',
# which shares the same privacy options as the table and gets synced.
# Users can create new visualizations, which will never be of type 'table',
# and those will use named maps when any source tables are private
module CartoDB
module Visualization
class Member
extend Forwardable
include Virtus.model
include CacheHelper
PRIVACY_PUBLIC = 'public' # published and listable in public user profile
PRIVACY_PRIVATE = 'private' # not published (viz.json and embed_map should return 404)
PRIVACY_LINK = 'link' # published but not listen in public profile
PRIVACY_PROTECTED = 'password' # published but password protected
TYPE_CANONICAL = 'table'
TYPE_DERIVED = 'derived'
TYPE_SLIDE = 'slide'
TYPE_REMOTE = 'remote'
KIND_GEOM = 'geom'
KIND_RASTER = 'raster'
PRIVACY_VALUES = [ PRIVACY_PUBLIC, PRIVACY_PRIVATE, PRIVACY_LINK, PRIVACY_PROTECTED ]
TEMPLATE_NAME_PREFIX = 'tpl_'
PERMISSION_READONLY = CartoDB::Permission::ACCESS_READONLY
PERMISSION_READWRITE = CartoDB::Permission::ACCESS_READWRITE
DEFAULT_URL_OPTIONS = 'title=true&description=true&search=false&shareable=true&cartodb_logo=true&layer_selector=false&legends=false&scrollwheel=true&fullscreen=true&sublayer_options=1&sql='
AUTH_DIGEST = '1211b3e77138f6e1724721f1ab740c9c70e66ba6fec5e989bb6640c4541ed15d06dbd5fdcbd3052b'
TOKEN_DIGEST = '6da98b2da1b38c5ada2547ad2c3268caa1eb58dc20c9144ead844a2eda1917067a06dcb54833ba2'
DEFAULT_OPTIONS_VALUE = '{}'
# Upon adding new attributes modify also:
# app/models/visualization/migrator.rb
# services/data-repository/spec/unit/backend/sequel_spec.rb -> before do
# spec/support/helpers.rb -> random_attributes_for_vis_member
# app/models/visualization/presenter.rb
attribute :id, String
attribute :name, String
attribute :display_name, String
attribute :map_id, String
attribute :active_layer_id, String
attribute :type, String
attribute :privacy, String
attribute :tags, Array[String], default: []
attribute :description, String
attribute :license, String
attribute :source, String
attribute :attributions, String
attribute :title, String
attribute :created_at, Time
attribute :updated_at, Time
attribute :encrypted_password, String, default: nil
attribute :password_salt, String, default: nil
attribute :url_options, String, default: DEFAULT_URL_OPTIONS
attribute :user_id, String
attribute :permission_id, String
attribute :locked, Boolean, default: false
attribute :parent_id, String, default: nil
attribute :kind, String, default: KIND_GEOM
attribute :prev_id, String, default: nil
attribute :next_id, String, default: nil
attribute :bbox, String, default: nil
# Don't use directly, use instead getter/setter "transition_options"
attribute :slide_transition_options, String, default: DEFAULT_OPTIONS_VALUE
attribute :active_child, String, default: nil
def_delegators :validator, :errors, :full_errors
def_delegators :relator, *Relator::INTERFACE
# This get called not only when creating a new but also when populating from the Collection
def initialize(attributes={}, repository=Visualization.repository, name_checker=nil)
super(attributes)
@repository = repository
self.id ||= @repository.next_id
@name_checker = name_checker
@validator = MinimalValidator::Validator.new
@named_maps = nil
@user_data = nil
self.permission_change_valid = true # Changes upon set of different permission_id
# this flag is passed to the table in case of canonical visualizations. It's used to say to the table to not touch the database and only change the metadata information, useful for ghost tables
self.register_table_only = false
@redis_vizjson_cache = RedisVizjsonCache.new()
@old_privacy = @privacy
end
def self.remote_member(name, user_id, privacy, description, tags, license, source, attributions, display_name)
Member.new({
name: name,
user_id: user_id,
privacy: privacy,
description: description,
tags: tags,
license: license,
source: source,
attributions: attributions,
display_name: display_name,
type: TYPE_REMOTE})
end
def update_remote_data(privacy, description, tags, license, source, attributions, display_name)
changed = false
if self.privacy != privacy
changed = true
self.privacy = privacy
end
if self.display_name != display_name
changed = true
self.display_name = display_name
end
if self.description != description
changed = true
self.description = description
end
if self.tags != tags
changed = true
self.tags = tags
end
if self.license != license
changed = true
self.license = license
end
if self.source != source
changed = true
self.source = source
end
if self.attributions != attributions
changed = true
self.attributions = attributions
end
changed
end
def transition_options
::JSON.parse(self.slide_transition_options).symbolize_keys
end
def transition_options=(value)
self.slide_transition_options = ::JSON.dump(value.nil? ? DEFAULT_OPTIONS_VALUE : value)
end
def ==(other_vis)
self.id == other_vis.id
end
def default_privacy(owner)
owner.try(:private_tables_enabled) ? PRIVACY_LINK : PRIVACY_PUBLIC
end
def store
raise CartoDB::InvalidMember.new(validator.errors) unless self.valid?
do_store
self
end
def store_from_map(fields)
self.map_id = fields[:map_id]
do_store(false)
self
end
def store_using_table(fields, table_privacy_changed = false)
if type == TYPE_CANONICAL
# Each table has a canonical visualization which must have privacy synced
self.privacy = fields[:privacy_text]
self.map_id = fields[:map_id]
end
# But as this method also notifies of changes in a table, must save always
do_store(false, table_privacy_changed)
self
end
def valid?
validator.validate_presence_of(name: name, privacy: privacy, type: type, user_id: user_id)
validator.validate_in(:privacy, privacy, PRIVACY_VALUES)
# do not validate names for slides, it's never used
validator.validate_uniqueness_of(:name, available_name?) unless type_slide?
if privacy == PRIVACY_PROTECTED
validator.validate_presence_of_with_custom_message(
{ encrypted_password: encrypted_password, password_salt: password_salt },
"password can't be blank")
end
# Allow only "maintaining" privacy link for everyone but not setting it
if privacy == PRIVACY_LINK && privacy_changed
validator.validate_expected_value(:private_tables_enabled, true, user.private_tables_enabled)
end
if type_slide?
if parent_id.nil?
validator.errors.store(:parent_id, "Type #{TYPE_SLIDE} must have a parent") if parent_id.nil?
else
begin
parent_member = Member.new(id:parent_id).fetch
if parent_member.type != TYPE_DERIVED
validator.errors.store(:parent_id, "Type #{TYPE_SLIDE} must have parent of type #{TYPE_DERIVED}")
end
rescue KeyError
validator.errors.store(:parent_id, "Type #{TYPE_SLIDE} has non-existing parent id")
end
end
else
validator.errors.store(:parent_id, "Type #{type} must not have parent") unless parent_id.nil?
end
unless permission_id.nil?
validator.errors.store(:permission_id, 'Cannot modify permission') unless permission_change_valid
end
if !license.nil? && !license.empty? && Carto::License.find(license.to_sym).nil?
validator.errors.store(:license, 'License should be an empty or a valid value')
end
validator.valid?
end
def fetch
data = repository.fetch(id)
raise KeyError if data.nil?
self.attributes = data
self.name_changed = false
@old_privacy = @privacy
self.privacy_changed = false
self.permission_change_valid = true
self.dirty = false
validator.reset
self
end
def delete(from_table_deletion = false)
# from_table_deletion would be enough for canonical viz-based deletes,
# but common data loading also calls this delete without the flag to true, causing a call without a Map
begin
if user.has_feature_flag?(Carto::VisualizationsExportService::FEATURE_FLAG_NAME) && map
Carto::VisualizationsExportService.new.export(id)
end
rescue => exception
# Don't break deletion flow
CartoDB.notify_error(exception.message, error: exception.inspect, user: user, visualization_id: id)
end
# Named map must be deleted before the map, or we lose the reference to it
begin
named_map = get_named_map
# non-existing named map is not a critical failure, keep deleting even if not found
named_map.delete if named_map
rescue NamedMapsWrapper::HTTPResponseError => exception
# CDB-1964: Silence named maps API exception if deleting data to avoid interrupting whole flow
unless from_table_deletion
CartoDB.notify_exception(exception, user: user)
end
end
unlink_self_from_list!
support_tables.delete_all
invalidate_cache
overlays.map(&:destroy)
layers(:base).map(&:destroy)
layers(:cartodb).map(&:destroy)
safe_sequel_delete {
# "Mark" that this vis id is the destructor to avoid cycles: Vis -> Map -> relatedvis (Vis again)
related_map = map
related_map.being_destroyed_by_vis_id = id
related_map.destroy
} if map
safe_sequel_delete { table.destroy } if (type == TYPE_CANONICAL && table && !from_table_deletion)
safe_sequel_delete { children.map { |child|
# Refetch each item before removal so Relator reloads prev/next cursors
child.fetch.delete
}
}
safe_sequel_delete { permission.destroy } if permission
safe_sequel_delete { repository.delete(id) }
self.attributes.keys.each { |key| self.send("#{key}=", nil) }
self
end
# A visualization is linked to a table when it uses that table in a layergroup (but is not the canonical table)
def unlink_from(table)
invalidate_cache
remove_layers_from(table)
end
def user_data=(user_data)
@user_data = user_data
named_maps(true)
end
def name=(name)
name = name.downcase if name && table?
self.name_changed = true if name != @name && !@name.nil?
self.old_name = @name
super(name)
end
def description=(description)
self.dirty = true if description != @description && !@description.nil?
super(description)
end
def description_clean
if description.present?
description_html_safe.strip_tags
end
end
def description_html_safe
if description.present?
renderer = Redcarpet::Render::Safe
markdown = Redcarpet::Markdown.new(renderer, extensions = {})
markdown.render description
end
end
def source_html_safe
if source.present?
renderer = Redcarpet::Render::Safe
markdown = Redcarpet::Markdown.new(renderer, extensions = {})
markdown.render source
end
end
def attributions=(value)
self.dirty = true if value != @attributions
self.attributions_changed = true if value != @attributions
super(value)
end
def permission_id=(permission_id)
self.permission_change_valid = false
self.permission_change_valid = true if (@permission_id.nil? || @permission_id == permission_id)
super(permission_id)
end
def privacy=(new_privacy)
new_privacy = new_privacy.downcase if new_privacy
if new_privacy != @privacy && !@privacy.nil?
self.privacy_changed = true
@old_privacy = @privacy
end
super(new_privacy)
end
def tags=(tags)
tags.reject!(&:blank?) if tags
super(tags)
end
def public?
privacy == PRIVACY_PUBLIC
end
def public_with_link?
privacy == PRIVACY_LINK
end
def private?
privacy == PRIVACY_PRIVATE and not organization?
end
def is_privacy_private?
privacy == PRIVACY_PRIVATE
end
def organization?
privacy == PRIVACY_PRIVATE and permission.acl.size > 0
end
def password_protected?
privacy == PRIVACY_PROTECTED
end
# Called by controllers upon rendering
def to_json(options={})
::JSON.dump(to_hash(options))
end
def to_hash(options={})
presenter = Presenter.new(self, options.merge(real_privacy: true))
options.delete(:public_fields_only) === true ? presenter.to_public_poro : presenter.to_poro
end
def to_vizjson(options={})
@redis_vizjson_cache.cached(id, options.fetch(:https_request, false)) do
calculate_vizjson(options)
end
end
def is_owner?(user)
user.id == user_id
end
# @param user ::User
# @param permission_type String PERMISSION_xxx
def has_permission?(user, permission_type)
return is_owner?(user) if permission_id.nil?
is_owner?(user) || permission.is_permitted?(user, permission_type)
end
def users_with_permissions(permission_types)
permission.users_with_permissions(permission_types)
end
def all_users_with_read_permission
users_with_permissions([CartoDB::Visualization::Member::PERMISSION_READONLY,
CartoDB::Visualization::Member::PERMISSION_READWRITE]) + [user]
end
def varnish_key
sorted_table_names = related_tables.map{ |table|
"#{user.database_schema}.#{table.name}"
}.sort { |i, j|
i <=> j
}.join(',')
"#{user.database_name}:#{sorted_table_names},#{id}"
end
def surrogate_key
get_surrogate_key(CartoDB::SURROGATE_NAMESPACE_VISUALIZATION, self.id)
end
def varnish_vizjson_key
".*#{id}:vizjson"
end
def derived?
type == TYPE_DERIVED
end
def table?
type == TYPE_CANONICAL
end
# Used at Carto::Api::VisualizationPresenter
alias :canonical? :table?
def type_slide?
type == TYPE_SLIDE
end
def dependent?
derived? && single_data_layer?
end
def non_dependent?
derived? && !single_data_layer?
end
def invalidate_cache
invalidate_redis_cache
invalidate_varnish_vizjson_cache
parent.invalidate_cache unless parent_id.nil?
end
def has_private_tables?
has_private_tables = false
related_tables.each { |table|
has_private_tables |= table.private?
}
has_private_tables
end
# Despite storing always a named map, no need to retrieve it for "public" visualizations
def retrieve_named_map?
password_protected? || has_private_tables?
end
def get_named_map
return false if type == TYPE_REMOTE
data = named_maps.get(CartoDB::NamedMapsWrapper::NamedMap.template_name(id))
if data.nil?
false
else
data
end
end
def password=(value)
if value && value.size > 0
@password_salt = generate_salt if @password_salt.nil?
@encrypted_password = password_digest(value, @password_salt)
self.dirty = true
end
end
def has_password?
( !@password_salt.nil? && !@encrypted_password.nil? )
end
def password_valid?(password)
raise CartoDB::InvalidMember unless ( privacy == PRIVACY_PROTECTED && has_password? )
( password_digest(password, @password_salt) == @encrypted_password )
end
def remove_password
@password_salt = nil
@encrypted_password = nil
end
# To be stored with the named map
def make_auth_token
digest = secure_digest(Time.now, (1..10).map{ rand.to_s })
10.times do
digest = secure_digest(digest, TOKEN_DIGEST)
end
digest
end
def get_auth_tokens
named_map = get_named_map
raise CartoDB::InvalidMember unless named_map
tokens = named_map.template[:template][:auth][:valid_tokens]
raise CartoDB::InvalidMember if tokens.size == 0
tokens
end
def supports_private_maps?
!user.nil? && user.private_maps_enabled?
end
# @param other_vis CartoDB::Visualization::Member|nil
# Note: Changes state both of self, other_vis and other affected list items, but only reloads self & other_vis
def set_next_list_item!(other_vis)
repository.transaction do
close_list_gap(other_vis)
# Now insert other_vis after self
unless other_vis.nil?
if self.next_id.nil?
other_vis.next_id = nil
else
other_vis.next_id = self.next_id
next_item = next_list_item
next_item.prev_id = other_vis.id
next_item.store
end
self.next_id = other_vis.id
other_vis.prev_id = self.id
other_vis.store
.fetch
end
store
end
fetch
end
# @param other_vis CartoDB::Visualization::Member|nil
# Note: Changes state both of self, other_vis and other affected list items, but only reloads self & other_vis
def set_prev_list_item!(other_vis)
repository.transaction do
close_list_gap(other_vis)
# Now insert other_vis after self
unless other_vis.nil?
if self.prev_id.nil?
other_vis.prev_id = nil
else
other_vis.prev_id = self.prev_id
prev_item = prev_list_item
prev_item.next_id = other_vis.id
prev_item.store
end
self.prev_id = other_vis.id
other_vis.next_id = self.id
other_vis.store
.fetch
end
store
end
fetch
end
def unlink_self_from_list!
repository.transaction do
unless self.prev_id.nil?
prev_item = prev_list_item
prev_item.next_id = self.next_id
prev_item.store
end
unless self.next_id.nil?
next_item = next_list_item
next_item.prev_id = self.prev_id
next_item.store
end
self.prev_id = nil
self.next_id = nil
end
end
# @param user_id String UUID of the actor that likes the visualization
# @throws AlreadyLikedError
def add_like_from(user_id)
Like.create(actor: user_id, subject: id)
reload_likes
self
rescue Sequel::DatabaseError => exception
if exception.message =~ /duplicate key/i
raise AlreadyLikedError
else
raise exception
end
end
def remove_like_from(user_id)
item = likes.select { |like| like.actor == user_id }
item.first.destroy unless item.first.nil?
reload_likes
self
end
def liked_by?(user_id)
!(likes.select { |like| like.actor == user_id }.first.nil?)
end
# @param viewer_user ::User
def qualified_name(viewer_user=nil)
if viewer_user.nil? || is_owner?(viewer_user)
name
else
"#{user.sql_safe_database_schema}.#{name}"
end
end
attr_accessor :register_table_only
def invalidate_redis_cache
@redis_vizjson_cache.invalidate(id)
embed_redis_cache.invalidate(self.id)
end
# INFO: Handles doing nothing if instance is not eligible to have a named map
def save_named_map
return if type == TYPE_REMOTE
named_map = get_named_map
if named_map
update_named_map(named_map)
else
create_named_map
end
end
def license_info
if !license.nil?
Carto::License.find(license.to_sym)
end
end
def attributions_from_derived_visualizations
related_canonical_visualizations.map(&:attributions).reject {|attribution| attribution.blank?}
end
private
attr_reader :repository, :name_checker, :validator
attr_accessor :privacy_changed, :name_changed, :old_name, :permission_change_valid, :dirty, :attributions_changed
def embed_redis_cache
@embed_redis_cache ||= EmbedRedisCache.new($tables_metadata)
end
def calculate_vizjson(options={})
vizjson_options = {
full: false,
user_name: user.username,
user_api_key: user.api_key,
user: user,
viewer_user: user
}.merge(options)
VizJSON.new(self, vizjson_options, configuration).to_poro
end
def invalidate_varnish_vizjson_cache
CartoDB::Varnish.new.purge(varnish_vizjson_key)
end
def close_list_gap(other_vis)
reload_self = false
if other_vis.nil?
self.next_id = nil
old_prev = nil
old_next = nil
else
old_prev = other_vis.prev_list_item
old_next = other_vis.next_list_item
end
# First close gap left by other_vis
unless old_prev.nil?
old_prev.next_id = old_next.nil? ? nil : old_next.id
old_prev.store
reload_self |= old_prev.id == self.id
end
unless old_next.nil?
old_next.prev_id = old_prev.nil? ? nil : old_prev.id
old_next.store
reload_self |= old_next.id == self.id
end
fetch if reload_self
end
def do_store(propagate_changes = true, table_privacy_changed = false)
if password_protected?
raise CartoDB::InvalidMember.new('No password set and required') unless has_password?
else
remove_password
end
# Warning: imports create by default private canonical visualizations
if type != TYPE_CANONICAL && @privacy == PRIVACY_PRIVATE && privacy_changed && !supports_private_maps?
raise CartoDB::InvalidMember
end
perform_invalidations(table_privacy_changed)
set_timestamps
repository.store(id, attributes.to_hash)
# Careful to not call Permission.save until after persisted the vis
if permission.nil?
perm = CartoDB::Permission.new
perm.owner = user
perm.entity = self
perm.save
@permission_id = perm.id
# Need to save again
repository.store(id, attributes.to_hash)
end
begin
save_named_map
rescue => exception
CartoDB.notify_exception(exception, user: user, message: "Error saving visualization named map")
restore_previous_privacy
raise exception
end
propagate_attribution_change if table
if type == TYPE_REMOTE || type == TYPE_CANONICAL
propagate_privacy_and_name_to(table) if table and propagate_changes
else
propagate_name_to(table) if table and propagate_changes
end
end
def restore_previous_privacy
unless @old_privacy.nil?
self.privacy = @old_privacy
attributes[:privacy] = @old_privacy
repository.store(id, attributes.to_hash)
end
rescue => exception
CartoDB.notify_exception(exception, user: user, message: "Error restoring previous visualization privacy")
raise exception
end
def perform_invalidations(table_privacy_changed)
# previously we used 'invalidate_cache' but due to public_map displaying all the user public visualizations,
# now we need to purgue everything to avoid cached stale data or public->priv still showing scenarios
if name_changed || privacy_changed || table_privacy_changed || dirty
invalidate_cache
end
# When a table's relevant data is changed, propagate to all who use it or relate to it
if dirty && table
table.affected_visualizations.each do |affected_vis|
affected_vis.invalidate_cache
end
end
end
def named_maps(force_init = false)
if @named_maps.nil? || force_init
if user.nil?
name_param = @user_data.nil? ? '' : @user_data[:name]
api_key_param = @user_data.nil? ? '' : @user_data[:api_key]
else
name_param = user.username
api_key_param = user.api_key
end
@named_maps = CartoDB::NamedMapsWrapper::NamedMaps.new(
{
name: name_param,
api_key: api_key_param
},
{
domain: Cartodb.config[:tiler]['internal']['domain'],
port: Cartodb.config[:tiler]['internal']['port'] || 443,
protocol: Cartodb.config[:tiler]['internal']['protocol'],
verifycert: (Cartodb.config[:tiler]['internal']['verifycert'] rescue true),
host: (Cartodb.config[:tiler]['internal']['host'] rescue nil)
},
configuration
)
end
@named_maps
end
def create_named_map
new_named_map = named_maps.create(self)
!new_named_map.nil?
end
def update_named_map(named_map_instance)
named_map_instance.update(self)
end
def propagate_privacy_and_name_to(table)
raise "Empty table sent to Visualization::Member propagate_privacy_and_name_to()" unless table
propagate_privacy_to(table) if privacy_changed
propagate_name_to(table) if name_changed
end
def propagate_privacy_to(table)
if type == TYPE_CANONICAL
CartoDB::TablePrivacyManager.new(table)
.set_from_visualization(self)
.update_cdb_tablemetadata
end
self
end
# @param table Table
def propagate_name_to(table)
table.name = self.name
table.register_table_only = self.register_table_only
table.update(name: self.name)
if name_changed
support_tables.rename(old_name, name, recreate_constraints=true, seek_parent_name=old_name)
end
self
rescue => exception
if name_changed && !(exception.to_s =~ /relation.*does not exist/)
revert_name_change(old_name)
end
raise CartoDB::InvalidMember.new(exception.to_s)
end
def propagate_attribution_change
return unless attributions_changed
# This includes both the canonical and derived visualizations
table.affected_visualizations.each do |affected_visualization|
affected_visualization.layers(:carto_and_torque).each do |layer|
if layer.options['table_name'] == table.name
layer.options['attribution'] = self.attributions
layer.save
end
end
end
end
def revert_name_change(previous_name)
self.name = previous_name
store
rescue => exception
raise CartoDB::InvalidMember.new(exception.to_s)
end
def set_timestamps
self.created_at ||= Time.now
self.updated_at = Time.now
self
end
def relator
Relator.new(attributes)
end
def name_checker
@name_checker || NameChecker.new(user)
end
def available_name?
return true unless user && name_changed
name_checker.available?(name)
end
def remove_layers_from(table)
related_layers_from(table).each { |layer|
map.remove_layer(layer)
layer.destroy
}
self.active_layer_id = layers(:cartodb).first.nil? ? nil : layers(:cartodb).first.id
store
end
def related_layers_from(table)
layers(:cartodb).select do |layer|
(layer.affected_tables.map(&:name) + [layer.options.fetch('table_name', nil)]).include?(table.name)
end
end
def configuration
return {} unless defined?(Cartodb)
Cartodb.config
end
def password_digest(password, salt)
digest = AUTH_DIGEST
10.times do
digest = secure_digest(digest, salt, password, AUTH_DIGEST)
end
digest
end
def generate_salt
secure_digest(Time.now, (1..10).map{ rand.to_s })
end
def secure_digest(*args)
#noinspection RubyArgCount
Digest::SHA256.hexdigest(args.flatten.join)
end
def safe_sequel_delete
yield
rescue Sequel::NoExistingObject => exception
# INFO: don't fail on nonexistant object delete
CartoDB.notify_exception(exception)
end
end
end
end
|
class Conan < Formula
include Language::Python::Virtualenv
desc "Distributed, open source, package manager for C/C++"
homepage "https://github.com/conan-io/conan"
url "https://github.com/conan-io/conan/archive/1.19.2.tar.gz"
sha256 "1b824f14584a5da4deace6154ee49487faea99ddce3a2993f6a79f9a35b43d64"
revision 1
head "https://github.com/conan-io/conan.git"
bottle do
cellar :any
sha256 "2e7fc5de103497d21d49e40b4d51930980031d82acbd5984c655785903a8f02b" => :catalina
sha256 "4f79aecf6c0faf883db162d0a167ffdf59ce3eea5a528e318e6d63120fa69558" => :mojave
sha256 "1f74449d1ef308677f5b80a22112acf7ad3a0fd7259692c8b036c1272057ee31" => :high_sierra
end
depends_on "pkg-config" => :build
depends_on "libffi"
depends_on "openssl@1.1"
depends_on "python"
def install
venv = virtualenv_create(libexec, "python3")
system libexec/"bin/pip", "install", "-v", "--no-binary", ":all:",
"--ignore-installed", "PyYAML==3.13", buildpath
system libexec/"bin/pip", "uninstall", "-y", name
venv.pip_install_and_link buildpath
end
test do
system bin/"conan", "install", "zlib/1.2.11@conan/stable", "--build"
assert_predicate testpath/".conan/data/zlib/1.2.11", :exist?
end
end
conan 1.19.3
Closes #45938.
Signed-off-by: Rui Chen <5103e075d5305459d1efee7e3b0ff29fa7440564@meetup.com>
class Conan < Formula
include Language::Python::Virtualenv
desc "Distributed, open source, package manager for C/C++"
homepage "https://github.com/conan-io/conan"
url "https://github.com/conan-io/conan/archive/1.19.3.tar.gz"
sha256 "a60de842d7767b99e221025cff4b416c0ee19f45f1e1b8b38c2b045636aba192"
head "https://github.com/conan-io/conan.git"
bottle do
cellar :any
sha256 "2e7fc5de103497d21d49e40b4d51930980031d82acbd5984c655785903a8f02b" => :catalina
sha256 "4f79aecf6c0faf883db162d0a167ffdf59ce3eea5a528e318e6d63120fa69558" => :mojave
sha256 "1f74449d1ef308677f5b80a22112acf7ad3a0fd7259692c8b036c1272057ee31" => :high_sierra
end
depends_on "pkg-config" => :build
depends_on "libffi"
depends_on "openssl@1.1"
depends_on "python"
def install
venv = virtualenv_create(libexec, "python3")
system libexec/"bin/pip", "install", "-v", "--no-binary", ":all:",
"--ignore-installed", "PyYAML==3.13", buildpath
system libexec/"bin/pip", "uninstall", "-y", name
venv.pip_install_and_link buildpath
end
test do
system bin/"conan", "install", "zlib/1.2.11@conan/stable", "--build"
assert_predicate testpath/".conan/data/zlib/1.2.11", :exist?
end
end
|
playWithAFriend=Сыграть с другом
inviteAFriendToPlayWithYou=Пригласить друга
playWithTheMachine=Партия с компьютером
challengeTheArtificialIntelligence=Сразиться с искусственным интеллектом
toInviteSomeoneToPlayGiveThisUrl=Ссылка для приглашения в игру друга
gameOver=Игра завершена
waitingForOpponent=Ожидание противника
waiting=Ожидание
yourTurn=Ваш ход
aiNameLevelAiLevel=%s мастерство %s
level=Мастерство
toggleTheChat=Показывать окно чата
toggleSound=Вкл/выкл звук
chat=Чат
resign=Сдаться
checkmate=Мат
stalemate=Пат
white=Белые
black=Черные
createAGame=Создать игру
noGameAvailableRightNowCreateOne=Нет доступных игр, создайте ее!
whiteIsVictorious=Белые победили
blackIsVictorious=Чёрные победили
playWithTheSameOpponentAgain=Сыграть с тем же игроком ещё раз
newOpponent=Новый соперник
playWithAnotherOpponent=Сыграть с другим соперником
yourOpponentWantsToPlayANewGameWithYou=Ваш соперник предлагает вам сыграть ещё раз
joinTheGame=Присоединиться к игре
whitePlays=Ход белых
blackPlays=Ход чёрных
theOtherPlayerHasLeftTheGameYouCanForceResignationOrWaitForHim=Ваш соперник покинул игру. Вы можете завершить партию от его имени, или подождать его возвращения
makeYourOpponentResign=Закончить игру от имени соперника
forceResignation=Вынудить соперника сдаться
talkInChat=Общайтесь в чате
theFirstPersonToComeOnThisUrlWillPlayWithYou=Первый, кто придёт по этой ссылке, будет играть с вами.
whiteCreatesTheGame=Белые создали новую игру
blackCreatesTheGame=Чёрные создали новую игру
whiteJoinsTheGame=Белые присоединились к игре
blackJoinsTheGame=Чёрные присоединились к игре
whiteResigned=Белые сдались
blackResigned=Чёрные сдались
whiteLeftTheGame=Белые вышли из игры
blackLeftTheGame=Чёрные вышли из игры
shareThisUrlToLetSpectatorsSeeTheGame=Поделитесь этой ссылкой с другими для просмотра игры
youAreViewingThisGameAsASpectator=Вы являетесь зрителем в этой партии
replayAndAnalyse=Повтор и анализ игры
viewGameStats=Посмотреть статистику игры
flipBoard=Развернуть доску
threefoldRepetition=Троекратное повторение ходов
claimADraw=Потребовать ничью
offerDraw=Предложить ничью
draw=Ничья
nbConnectedPlayers=%s игроков онлайн
talkAboutChessAndDiscussLichessFeaturesInTheForum=Разговоры о шахматах и обсуждение возможностей lichess на форуме
seeTheGamesBeingPlayedInRealTime=Посмотреть партии, играемые в данный момент
gamesBeingPlayedRightNow=Партии, которые играются прямо сейчас
viewAllNbGames=Посмотреть все %s игры
viewNbCheckmates=Посмотреть все партии, закончившиеся %s матом
nbBookmarks=%s закладки
nbPopularGames=%s популярные игры
nbAnalysedGames=%s проанализированных игр
bookmarkedByNbPlayers=Закладки игрока %s
viewInFullSize=Посмотреть в полном размере
logOut=Выйти
signIn=Войти
signUp=Регистрация
people=Люди
games=Игры
forum=Форум
searchInForum=Искать на форуме
chessPlayers=Шахматисты
minutesPerSide=Минут на партию
variant=Вариант
timeControl=Ограничение по времени
start=Начать
username=Имя пользователя
password=Пароль
haveAnAccount=Есть учётная запись?
allYouNeedIsAUsernameAndAPassword=Вам нужно только имя и пароль
learnMoreAboutLichess=Узнать больше о Lichess
rank=Уровень
gamesPlayed=Игр сыграно
declineInvitation=Отклонить приглашение
cancel=Отменить
timeOut=Время истекло
drawOfferSent=Предложение ничьи отправлено
drawOfferDeclined=Предложение ничьи отклонено
drawOfferAccepted=Предложение ничьи принято
drawOfferCanceled=Предложение ничьи отменено
yourOpponentOffersADraw=Ваш оппонент предлагает ничью
accept=Принять
decline=Отклонить
playingRightNow=Играется в данный момент
abortGame=Отменить игру
gameAborted=Игра отменена
standard=Классические шахматы
unlimited=Без лимита времени
mode=Режим
casual=Дружеская игра
rated=Рейтинговая
thisGameIsRated=Игра на рейтинг
rematch=Реванш
rematchOfferSent=Предложение реванша отправлено
rematchOfferAccepted=Предложение реванша принято
rematchOfferCanceled=Предложение реванша отклонено
rematchOfferDeclined=Предложение реванша отклонено
cancelRematchOffer=Отказаться от реванша
viewRematch=Посмотреть ответную игру
play=Играть
inbox=Входящие
chatRoom=Окно чата
spectatorRoom=Чат для зрителей
composeMessage=Написать сообщение
sentMessages=Отправленные сообщения
incrementInSeconds=Прибавка в секундах
freeOnlineChess=Бесплатные онлайн-шахматы
spectators=Зрители:
nbWins=%s выиграл
nbLosses=%s проиграл
nbDraws=%s сыграл вничью
exportGames=Экспорт игр
color=Цвет
eloRange=Диапазон Эло
giveNbSeconds=Дать %s секунд
searchAPlayer=Поиск игрока
whoIsOnline=Кто онлайн
allPlayers=Всего игроков
premoveEnabledClickAnywhereToCancel=Предварительный ход включен. Нажмите где угодно для отмены
thisPlayerUsesChessComputerAssistance=Этот игрок использует шахматную программу
opening=Дебют
takeback=Вернуть на ход назад
proposeATakeback=Предложить возврат на один ход
takebackPropositionSent=Предложение возврата отправлено
takebackPropositionDeclined=Предложение возврата отклонено
takebackPropositionAccepted=Предложение возврата принято
takebackPropositionCanceled=Предложение возврата отменено
yourOpponentProposesATakeback=Ваш оппонент предлагает возврат хода
bookmarkThisGame=Добавить игру в закладки
toggleBackground=Изменить цвет фона
advancedSearch=Поиск с параметрами
tournament=Турнир
tournamentPoints=Турнирные очки
viewTournament=Просмотр турнира
freeOnlineChessGamePlayChessNowInACleanInterfaceNoRegistrationNoAdsNoPluginRequiredPlayChessWithComputerFriendsOrRandomOpponents=Бесплатные онлайн-шахматы. Играй в шахматы прямо сейчас в понятном интерфейсе . Без регистрации, рекламы и дополнений. Играй в шахматы с компьютером, с друзьями или случайным соперником.
teams=Команды
nbMembers=%s участников
allTeams=Все команды
newTeam=Новая команда
myTeams=Мои команды
noTeamFound=Не найдена команда
joinTeam=Присоединиться к команде
quitTeam=Выйти из команды
anyoneCanJoin=Любой может присоединиться
aConfirmationIsRequiredToJoin=Требуется подтверждение для присоединения
joiningPolicy=Политика вступления (присоединения)
teamLeader=Лидер команды
teamBestPlayers=Лучшие игроки команды
teamRecentMembers=Недавние члены команды
searchATeam=поиск команды
averageElo=Среднее ЭЛО
location=Местоположение
settings=Настройки
filterGames=Фильтр партий
reset=Сбросить
apply=Применить
leaderboard=Таблица лидеров
pasteTheFenStringHere=Вставьте строку в формате FEN
fromPosition=в позиции
continueFromHere=продолжить с данного места
ru "русский язык" translation #1698. Author: Gameiza. WTF
playWithAFriend=Сыграть с другом
inviteAFriendToPlayWithYou=Пригласить друга
playWithTheMachine=Партия с компьютером
challengeTheArtificialIntelligence=Сразиться с искусственным интеллектом
toInviteSomeoneToPlayGiveThisUrl=Ссылка для приглашения в игру друга
gameOver=Игра завершена
waitingForOpponent=Ожидание противника
waiting=Ожидание
yourTurn=Ваш ход
aiNameLevelAiLevel=%s мастерство %s
level=Мастерство
toggleTheChat=Показывать окно чата
toggleSound=Вкл/выкл звук
chat=Чат
resign=Сдаться
checkmate=Мат
stalemate=Пат
white=Белые
black=Черные
createAGame=Создать игру
noGameAvailableRightNowCreateOne=Нет доступных игр, создайте ее!
whiteIsVictorious=Белые победили
blackIsVictorious=Чёрные победили
playWithTheSameOpponentAgain=Сыграть с тем же игроком ещё раз
newOpponent=Новый соперник
playWithAnotherOpponent=Сыграть с другим соперником
yourOpponentWantsToPlayANewGameWithYou=Ваш соперник предлагает вам сыграть ещё раз
joinTheGame=Присоединиться к игре
whitePlays=Ход белых
blackPlays=Ход чёрных
theOtherPlayerHasLeftTheGameYouCanForceResignationOrWaitForHim=Ваш соперник покинул игру. Вы можете завершить партию от его имени, или подождать его возвращения
makeYourOpponentResign=Закончить игру от имени соперника
forceResignation=Вынудить соперника сдаться
talkInChat=Общайтесь в чате
theFirstPersonToComeOnThisUrlWillPlayWithYou=Первый, кто придёт по этой ссылке, будет играть с вами.
whiteCreatesTheGame=Белые создали новую игру
blackCreatesTheGame=Чёрные создали новую игру
whiteJoinsTheGame=Белые присоединились к игре
blackJoinsTheGame=Чёрные присоединились к игре
whiteResigned=Белые сдались
blackResigned=Чёрные сдались
whiteLeftTheGame=Белые вышли из игры
blackLeftTheGame=Чёрные вышли из игры
shareThisUrlToLetSpectatorsSeeTheGame=Поделитесь этой ссылкой с другими для просмотра игры
youAreViewingThisGameAsASpectator=Вы являетесь зрителем в этой партии
replayAndAnalyse=Повтор и анализ игры
viewGameStats=Посмотреть статистику игры
flipBoard=Развернуть доску
threefoldRepetition=Троекратное повторение ходов
claimADraw=Потребовать ничью
offerDraw=Предложить ничью
draw=Ничья
nbConnectedPlayers=%s игроков онлайн
talkAboutChessAndDiscussLichessFeaturesInTheForum=Разговоры о шахматах и обсуждение возможностей lichess на форуме
seeTheGamesBeingPlayedInRealTime=Посмотреть партии, играемые в данный момент
gamesBeingPlayedRightNow=Партии, которые играются прямо сейчас
viewAllNbGames=Посмотреть все %s игры
viewNbCheckmates=Посмотреть все партии, закончившиеся %s матом
nbBookmarks=%s закладки
nbPopularGames=%s популярные игры
nbAnalysedGames=%s проанализированных игр
bookmarkedByNbPlayers=Закладки игрока %s
viewInFullSize=Посмотреть в полном размере
logOut=Выйти
signIn=Войти
signUp=Регистрация
people=Люди
games=Игры
forum=Форум
searchInForum=Искать на форуме
chessPlayers=Шахматисты
minutesPerSide=Минут на партию
variant=Вариант
timeControl=Ограничение по времени
start=Начать
username=Имя пользователя
password=Пароль
haveAnAccount=Есть учётная запись?
allYouNeedIsAUsernameAndAPassword=Вам нужно только имя и пароль
learnMoreAboutLichess=Узнать больше о Lichess
rank=Уровень
gamesPlayed=Игр сыграно
declineInvitation=Отклонить приглашение
cancel=Отменить
timeOut=Время истекло
drawOfferSent=Предложение ничьи отправлено
drawOfferDeclined=Предложение ничьи отклонено
drawOfferAccepted=Предложение ничьи принято
drawOfferCanceled=Предложение ничьи отменено
yourOpponentOffersADraw=Ваш оппонент предлагает ничью
accept=Принять
decline=Отклонить
playingRightNow=Играется в данный момент
abortGame=Отменить игру
gameAborted=Игра отменена
standard=Классические шахматы
unlimited=Без лимита времени
mode=Режим
casual=Дружеская игра
rated=Рейтинговая
thisGameIsRated=Игра на рейтинг
rematch=Реванш
rematchOfferSent=Предложение реванша отправлено
rematchOfferAccepted=Предложение реванша принято
rematchOfferCanceled=Предложение реванша отклонено
rematchOfferDeclined=Предложение реванша отклонено
cancelRematchOffer=Отказаться от реванша
viewRematch=Посмотреть ответную игру
play=Играть
inbox=Входящие
chatRoom=Окно чата
spectatorRoom=Чат для зрителей
composeMessage=Написать сообщение
sentMessages=Отправленные сообщения
incrementInSeconds=Прибавка в секундах
freeOnlineChess=Бесплатные онлайн-шахматы
spectators=Зрители:
nbWins=%s выиграл
nbLosses=%s проиграл
nbDraws=%s сыграл вничью
exportGames=Экспорт игр
color=Цвет
eloRange=Диапазон Эло
giveNbSeconds=Дать %s секунд
searchAPlayer=Поиск игрока
whoIsOnline=Кто онлайн
allPlayers=Всего игроков
premoveEnabledClickAnywhereToCancel=Предварительный ход включен. Нажмите где угодно для отмены
thisPlayerUsesChessComputerAssistance=Этот игрок использует шахматную программу
opening=Дебют
takeback=Вернуть на ход назад
proposeATakeback=Предложить возврат на один ход
takebackPropositionSent=Предложение возврата отправлено
takebackPropositionDeclined=Предложение возврата отклонено
takebackPropositionAccepted=Предложение возврата принято
takebackPropositionCanceled=Предложение возврата отменено
yourOpponentProposesATakeback=Ваш оппонент предлагает возврат хода
bookmarkThisGame=Добавить игру в закладки
toggleBackground=Изменить цвет фона
advancedSearch=Поиск с параметрами
tournament=Турнир
tournamentPoints=Турнирные очки
viewTournament=Просмотр турнира
freeOnlineChessGamePlayChessNowInACleanInterfaceNoRegistrationNoAdsNoPluginRequiredPlayChessWithComputerFriendsOrRandomOpponents=Бесплатные онлайн-шахматы. Играй в шахматы прямо сейчас в понятном интерфейсе . Без регистрации, рекламы и дополнений. Играй в шахматы с компьютером, с друзьями или случайным соперником.
teams=Команды
nbMembers=%s участников
allTeams=Все команды
newTeam=Новая команда
myTeams=Мои команды
noTeamFound=Не найдена команда
joinTeam=Присоединиться к команде
quitTeam=Выйти из команды
anyoneCanJoin=Любой может присоединиться
aConfirmationIsRequiredToJoin=Требуется подтверждение для присоединения
joiningPolicy=Политика вступления (присоединения)
teamLeader=Лидер команды
teamBestPlayers=Лучшие игроки команды
teamRecentMembers=Недавние члены команды
searchATeam=поиск команды
averageElo=Среднее ЭЛО
location=Местоположение
settings=Настройки
filterGames=Фильтр партий
reset=Сбросить
apply=Применить
leaderboard=Таблица лидеров
pasteTheFenStringHere=Вставьте строку в формате FEN
pasteThePgnStringHere=Вставьте строку в формате PGN
fromPosition=в позиции
continueFromHere=продолжить с данного места
importGame=Импорт игры
nbImportedGames=%s Импортированные игры
|
# encoding: utf-8
require 'forwardable'
require 'virtus'
require 'json'
require_relative '../markdown_render'
require_relative './presenter'
require_relative './name_checker'
require_relative '../permission'
require_relative './relator'
require_relative './like'
require_relative '../table/privacy_manager'
require_relative '../../../services/minimal-validation/validator'
require_relative '../../helpers/embed_redis_cache'
require_dependency 'cartodb/redis_vizjson_cache'
# Every table has always at least one visualization (the "canonical visualization"), of type 'table',
# which shares the same privacy options as the table and gets synced.
# Users can create new visualizations, which will never be of type 'table',
# and those will use named maps when any source tables are private
module CartoDB
module Visualization
class Member
extend Forwardable
include Virtus.model
include CacheHelper
PRIVACY_PUBLIC = 'public' # published and listable in public user profile
PRIVACY_PRIVATE = 'private' # not published (viz.json and embed_map should return 404)
PRIVACY_LINK = 'link' # published but not listen in public profile
PRIVACY_PROTECTED = 'password' # published but password protected
TYPE_CANONICAL = 'table'
TYPE_DERIVED = 'derived'
TYPE_SLIDE = 'slide'
TYPE_REMOTE = 'remote'
KIND_GEOM = 'geom'
KIND_RASTER = 'raster'
PRIVACY_VALUES = [ PRIVACY_PUBLIC, PRIVACY_PRIVATE, PRIVACY_LINK, PRIVACY_PROTECTED ]
TEMPLATE_NAME_PREFIX = 'tpl_'
PERMISSION_READONLY = CartoDB::Permission::ACCESS_READONLY
PERMISSION_READWRITE = CartoDB::Permission::ACCESS_READWRITE
AUTH_DIGEST = '1211b3e77138f6e1724721f1ab740c9c70e66ba6fec5e989bb6640c4541ed15d06dbd5fdcbd3052b'
TOKEN_DIGEST = '6da98b2da1b38c5ada2547ad2c3268caa1eb58dc20c9144ead844a2eda1917067a06dcb54833ba2'
DEFAULT_OPTIONS_VALUE = '{}'
# Upon adding new attributes modify also:
# services/data-repository/spec/unit/backend/sequel_spec.rb -> before do
# spec/support/helpers.rb -> random_attributes_for_vis_member
# app/models/visualization/presenter.rb
attribute :id, String
attribute :name, String
attribute :display_name, String
attribute :map_id, String
attribute :active_layer_id, String
attribute :type, String
attribute :privacy, String
attribute :tags, Array[String], default: []
attribute :description, String
attribute :license, String
attribute :source, String
attribute :attributions, String
attribute :title, String
attribute :created_at, Time
attribute :updated_at, Time
attribute :encrypted_password, String, default: nil
attribute :password_salt, String, default: nil
attribute :user_id, String
attribute :permission_id, String
attribute :locked, Boolean, default: false
attribute :parent_id, String, default: nil
attribute :kind, String, default: KIND_GEOM
attribute :prev_id, String, default: nil
attribute :next_id, String, default: nil
attribute :bbox, String, default: nil
# Don't use directly, use instead getter/setter "transition_options"
attribute :slide_transition_options, String, default: DEFAULT_OPTIONS_VALUE
attribute :active_child, String, default: nil
def_delegators :validator, :errors, :full_errors
def_delegators :relator, *Relator::INTERFACE
# This get called not only when creating a new but also when populating from the Collection
def initialize(attributes={}, repository=Visualization.repository, name_checker=nil)
super(attributes)
@repository = repository
self.id ||= @repository.next_id
@name_checker = name_checker
@validator = MinimalValidator::Validator.new
@user_data = nil
self.permission_change_valid = true # Changes upon set of different permission_id
# this flag is passed to the table in case of canonical visualizations. It's used to say to the table to not touch the database and only change the metadata information, useful for ghost tables
self.register_table_only = false
@redis_vizjson_cache = RedisVizjsonCache.new()
@old_privacy = @privacy
end
def self.remote_member(name, user_id, privacy, description, tags, license, source, attributions, display_name)
Member.new({
name: name,
user_id: user_id,
privacy: privacy,
description: description,
tags: tags,
license: license,
source: source,
attributions: attributions,
display_name: display_name,
type: TYPE_REMOTE})
end
def update_remote_data(privacy, description, tags, license, source, attributions, display_name)
changed = false
if self.privacy != privacy
changed = true
self.privacy = privacy
end
if self.display_name != display_name
changed = true
self.display_name = display_name
end
if self.description != description
changed = true
self.description = description
end
if self.tags != tags
changed = true
self.tags = tags
end
if self.license != license
changed = true
self.license = license
end
if self.source != source
changed = true
self.source = source
end
if self.attributions != attributions
changed = true
self.attributions = attributions
end
changed
end
def transition_options
::JSON.parse(self.slide_transition_options).symbolize_keys
end
def transition_options=(value)
self.slide_transition_options = ::JSON.dump(value.nil? ? DEFAULT_OPTIONS_VALUE : value)
end
def ==(other_vis)
self.id == other_vis.id
end
def default_privacy(owner)
owner.try(:private_tables_enabled) ? PRIVACY_LINK : PRIVACY_PUBLIC
end
def store
raise CartoDB::InvalidMember.new(validator.errors) unless self.valid?
do_store
self
end
def store_from_map(fields)
self.map_id = fields[:map_id]
do_store(false)
self
end
def store_using_table(fields, table_privacy_changed = false)
if type == TYPE_CANONICAL
# Each table has a canonical visualization which must have privacy synced
self.privacy = fields[:privacy_text]
self.map_id = fields[:map_id]
end
# But as this method also notifies of changes in a table, must save always
do_store(false, table_privacy_changed)
self
end
def valid?
validator.validate_presence_of(name: name, privacy: privacy, type: type, user_id: user_id)
validator.validate_in(:privacy, privacy, PRIVACY_VALUES)
# do not validate names for slides, it's never used
validator.validate_uniqueness_of(:name, available_name?) unless type_slide?
if privacy == PRIVACY_PROTECTED
validator.validate_presence_of_with_custom_message(
{ encrypted_password: encrypted_password, password_salt: password_salt },
"password can't be blank")
end
# Allow only "maintaining" privacy link for everyone but not setting it
if privacy == PRIVACY_LINK && privacy_changed
validator.validate_expected_value(:private_tables_enabled, true, user.private_tables_enabled)
end
if type_slide?
if parent_id.nil?
validator.errors.store(:parent_id, "Type #{TYPE_SLIDE} must have a parent") if parent_id.nil?
else
begin
parent_member = Member.new(id:parent_id).fetch
if parent_member.type != TYPE_DERIVED
validator.errors.store(:parent_id, "Type #{TYPE_SLIDE} must have parent of type #{TYPE_DERIVED}")
end
rescue KeyError
validator.errors.store(:parent_id, "Type #{TYPE_SLIDE} has non-existing parent id")
end
end
else
validator.errors.store(:parent_id, "Type #{type} must not have parent") unless parent_id.nil?
end
unless permission_id.nil?
validator.errors.store(:permission_id, 'Cannot modify permission') unless permission_change_valid
end
if !license.nil? && !license.empty? && Carto::License.find(license.to_sym).nil?
validator.errors.store(:license, 'License should be an empty or a valid value')
end
validator.valid?
end
def fetch
data = repository.fetch(id)
raise KeyError if data.nil?
self.attributes = data
self.name_changed = false
@old_privacy = @privacy
self.privacy_changed = false
self.permission_change_valid = true
self.dirty = false
validator.reset
self
end
def delete(from_table_deletion = false)
# from_table_deletion would be enough for canonical viz-based deletes,
# but common data loading also calls this delete without the flag to true, causing a call without a Map
begin
if user.has_feature_flag?(Carto::VisualizationsExportService::FEATURE_FLAG_NAME) && map
Carto::VisualizationsExportService.new.export(id)
end
rescue => exception
# Don't break deletion flow
CartoDB.notify_error(exception.message, error: exception.inspect, user: user, visualization_id: id)
end
# Named map must be deleted before the map, or we lose the reference to it
Carto::NamedMaps::Api.new(carto_visualization).destroy
unlink_self_from_list!
support_tables.delete_all
invalidate_cache
overlays.map(&:destroy)
layers(:base).map(&:destroy)
layers(:cartodb).map(&:destroy)
safe_sequel_delete {
# "Mark" that this vis id is the destructor to avoid cycles: Vis -> Map -> relatedvis (Vis again)
related_map = map
related_map.being_destroyed_by_vis_id = id
related_map.destroy
} if map
safe_sequel_delete { table.destroy } if (type == TYPE_CANONICAL && table && !from_table_deletion)
safe_sequel_delete { children.map { |child|
# Refetch each item before removal so Relator reloads prev/next cursors
child.fetch.delete
}
}
safe_sequel_delete { permission.destroy_shared_entities } if permission
safe_sequel_delete { repository.delete(id) }
safe_sequel_delete { permission.destroy } if permission
attributes.keys.each { |key| send("#{key}=", nil) }
self
end
# A visualization is linked to a table when it uses that table in a layergroup (but is not the canonical table)
def unlink_from(table)
invalidate_cache
remove_layers_from(table)
end
def user_data=(user_data)
@user_data = user_data
end
def name=(name)
name = name.downcase if name && table?
self.name_changed = true if name != @name && !@name.nil?
self.old_name = @name
super(name)
end
def description=(description)
self.dirty = true if description != @description && !@description.nil?
super(description)
end
def description_clean
if description.present?
description_html_safe.strip_tags
end
end
def description_html_safe
if description.present?
renderer = Redcarpet::Render::Safe
markdown = Redcarpet::Markdown.new(renderer, extensions = {})
markdown.render description
end
end
def source_html_safe
if source.present?
renderer = Redcarpet::Render::Safe
markdown = Redcarpet::Markdown.new(renderer, extensions = {})
markdown.render source
end
end
def attributions=(value)
self.dirty = true if value != @attributions
self.attributions_changed = true if value != @attributions
super(value)
end
def permission_id=(permission_id)
self.permission_change_valid = false
self.permission_change_valid = true if (@permission_id.nil? || @permission_id == permission_id)
super(permission_id)
end
def privacy=(new_privacy)
new_privacy = new_privacy.downcase if new_privacy
if new_privacy != @privacy && !@privacy.nil?
self.privacy_changed = true
@old_privacy = @privacy
end
super(new_privacy)
end
def tags=(tags)
tags.reject!(&:blank?) if tags
super(tags)
end
def public?
privacy == PRIVACY_PUBLIC
end
def public_with_link?
privacy == PRIVACY_LINK
end
def private?
privacy == PRIVACY_PRIVATE and not organization?
end
def is_privacy_private?
privacy == PRIVACY_PRIVATE
end
def organization?
privacy == PRIVACY_PRIVATE and permission.acl.size > 0
end
def password_protected?
privacy == PRIVACY_PROTECTED
end
# Called by controllers upon rendering
def to_json(options={})
::JSON.dump(to_hash(options))
end
def to_hash(options={})
presenter = Presenter.new(self, options.merge(real_privacy: true))
options.delete(:public_fields_only) === true ? presenter.to_public_poro : presenter.to_poro
end
def to_vizjson(options={})
@redis_vizjson_cache.cached(id, options.fetch(:https_request, false)) do
calculate_vizjson(options)
end
end
def is_owner?(user)
user.id == user_id
end
# @param user ::User
# @param permission_type String PERMISSION_xxx
def has_permission?(user, permission_type)
return is_owner?(user) if permission_id.nil?
is_owner?(user) || permission.permitted?(user, permission_type)
end
def can_copy?(user)
!raster_kind? && has_permission?(user, PERMISSION_READONLY)
end
def raster_kind?
kind == KIND_RASTER
end
def users_with_permissions(permission_types)
permission.users_with_permissions(permission_types)
end
def all_users_with_read_permission
users_with_permissions([CartoDB::Visualization::Member::PERMISSION_READONLY,
CartoDB::Visualization::Member::PERMISSION_READWRITE]) + [user]
end
def varnish_key
sorted_table_names = related_tables.map{ |table|
"#{user.database_schema}.#{table.name}"
}.sort { |i, j|
i <=> j
}.join(',')
"#{user.database_name}:#{sorted_table_names},#{id}"
end
def surrogate_key
get_surrogate_key(CartoDB::SURROGATE_NAMESPACE_VISUALIZATION, self.id)
end
def varnish_vizjson_key
".*#{id}:vizjson"
end
def derived?
type == TYPE_DERIVED
end
def table?
type == TYPE_CANONICAL
end
# Used at Carto::Api::VisualizationPresenter
alias :canonical? :table?
def type_slide?
type == TYPE_SLIDE
end
def dependent?
derived? && single_data_layer?
end
def non_dependent?
derived? && !single_data_layer?
end
def invalidate_cache
invalidate_redis_cache
invalidate_varnish_vizjson_cache
parent.invalidate_cache unless parent_id.nil?
end
def has_private_tables?
has_private_tables = false
related_tables.each { |table|
has_private_tables |= table.private?
}
has_private_tables
end
# Despite storing always a named map, no need to retrieve it for "public" visualizations
def retrieve_named_map?
password_protected? || has_private_tables?
end
def password=(value)
if value && value.size > 0
@password_salt = generate_salt if @password_salt.nil?
@encrypted_password = password_digest(value, @password_salt)
self.dirty = true
end
end
def has_password?
( !@password_salt.nil? && !@encrypted_password.nil? )
end
def password_valid?(password)
raise CartoDB::InvalidMember unless ( privacy == PRIVACY_PROTECTED && has_password? )
( password_digest(password, @password_salt) == @encrypted_password )
end
def remove_password
@password_salt = nil
@encrypted_password = nil
end
# To be stored with the named map
def make_auth_token
digest = secure_digest(Time.now, (1..10).map{ rand.to_s })
10.times do
digest = secure_digest(digest, TOKEN_DIGEST)
end
digest
end
def get_auth_tokens
named_map = get_named_map
raise CartoDB::InvalidMember unless named_map
tokens = named_map.template[:template][:auth][:valid_tokens]
raise CartoDB::InvalidMember if tokens.size == 0
tokens
end
def supports_private_maps?
!user.nil? && user.private_maps_enabled?
end
# @param other_vis CartoDB::Visualization::Member|nil
# Note: Changes state both of self, other_vis and other affected list items, but only reloads self & other_vis
def set_next_list_item!(other_vis)
repository.transaction do
close_list_gap(other_vis)
# Now insert other_vis after self
unless other_vis.nil?
if self.next_id.nil?
other_vis.next_id = nil
else
other_vis.next_id = self.next_id
next_item = next_list_item
next_item.prev_id = other_vis.id
next_item.store
end
self.next_id = other_vis.id
other_vis.prev_id = self.id
other_vis.store
.fetch
end
store
end
fetch
end
# @param other_vis CartoDB::Visualization::Member|nil
# Note: Changes state both of self, other_vis and other affected list items, but only reloads self & other_vis
def set_prev_list_item!(other_vis)
repository.transaction do
close_list_gap(other_vis)
# Now insert other_vis after self
unless other_vis.nil?
if self.prev_id.nil?
other_vis.prev_id = nil
else
other_vis.prev_id = self.prev_id
prev_item = prev_list_item
prev_item.next_id = other_vis.id
prev_item.store
end
self.prev_id = other_vis.id
other_vis.next_id = self.id
other_vis.store
.fetch
end
store
end
fetch
end
def unlink_self_from_list!
repository.transaction do
unless self.prev_id.nil?
prev_item = prev_list_item
prev_item.next_id = self.next_id
prev_item.store
end
unless self.next_id.nil?
next_item = next_list_item
next_item.prev_id = self.prev_id
next_item.store
end
self.prev_id = nil
self.next_id = nil
end
end
# @param user_id String UUID of the actor that likes the visualization
# @throws AlreadyLikedError
def add_like_from(user_id)
Like.create(actor: user_id, subject: id)
reload_likes
self
rescue Sequel::DatabaseError => exception
if exception.message =~ /duplicate key/i
raise AlreadyLikedError
else
raise exception
end
end
def remove_like_from(user_id)
item = likes.select { |like| like.actor == user_id }
item.first.destroy unless item.first.nil?
reload_likes
self
end
def liked_by?(user_id)
!(likes.select { |like| like.actor == user_id }.first.nil?)
end
# @param viewer_user ::User
def qualified_name(viewer_user=nil)
if viewer_user.nil? || is_owner?(viewer_user)
name
else
"#{user.sql_safe_database_schema}.#{name}"
end
end
attr_accessor :register_table_only
def invalidate_redis_cache
@redis_vizjson_cache.invalidate(id)
embed_redis_cache.invalidate(self.id)
end
def save_named_map
return if type == TYPE_REMOTE
unless @updating_named_maps
Rails::Sequel.connection.after_commit do
@updating_named_maps = false
(get_named_map ? update_named_map : create_named_map) if carto_visualization
end
@updating_named_maps = true
end
end
def get_named_map
return false if type == TYPE_REMOTE
Carto::NamedMaps::Api.new(carto_visualization).show if carto_visualization
end
def license_info
if !license.nil?
Carto::License.find(license.to_sym)
end
end
def attributions_from_derived_visualizations
related_canonical_visualizations.map(&:attributions).reject {|attribution| attribution.blank?}
end
private
attr_reader :repository, :name_checker, :validator
attr_accessor :privacy_changed, :name_changed, :old_name, :permission_change_valid, :dirty, :attributions_changed
def embed_redis_cache
@embed_redis_cache ||= EmbedRedisCache.new($tables_metadata)
end
def calculate_vizjson(options={})
vizjson_options = {
full: false,
user_name: user.username,
user_api_key: user.api_key,
user: user,
viewer_user: user
}.merge(options)
VizJSON.new(self, vizjson_options, configuration).to_poro
end
def invalidate_varnish_vizjson_cache
CartoDB::Varnish.new.purge(varnish_vizjson_key)
end
def close_list_gap(other_vis)
reload_self = false
if other_vis.nil?
self.next_id = nil
old_prev = nil
old_next = nil
else
old_prev = other_vis.prev_list_item
old_next = other_vis.next_list_item
end
# First close gap left by other_vis
unless old_prev.nil?
old_prev.next_id = old_next.nil? ? nil : old_next.id
old_prev.store
reload_self |= old_prev.id == self.id
end
unless old_next.nil?
old_next.prev_id = old_prev.nil? ? nil : old_prev.id
old_next.store
reload_self |= old_next.id == self.id
end
fetch if reload_self
end
def do_store(propagate_changes = true, table_privacy_changed = false)
if password_protected?
raise CartoDB::InvalidMember.new('No password set and required') unless has_password?
else
remove_password
end
# Warning: imports create by default private canonical visualizations
if type != TYPE_CANONICAL && @privacy == PRIVACY_PRIVATE && privacy_changed && !supports_private_maps?
raise CartoDB::InvalidMember
end
perform_invalidations(table_privacy_changed)
set_timestamps
# Ensure a permission is set before saving the visualization
if permission.nil?
perm = CartoDB::Permission.new
perm.owner = user
perm.save
@permission_id = perm.id
end
repository.store(id, attributes.to_hash)
restore_previous_privacy unless save_named_map
propagate_attribution_change if table
if type == TYPE_REMOTE || type == TYPE_CANONICAL
propagate_privacy_and_name_to(table) if table and propagate_changes
else
propagate_name_to(table) if table and propagate_changes
end
end
def restore_previous_privacy
unless @old_privacy.nil?
self.privacy = @old_privacy
attributes[:privacy] = @old_privacy
repository.store(id, attributes.to_hash)
end
rescue => exception
CartoDB.notify_exception(exception, user: user, message: "Error restoring previous visualization privacy")
raise exception
end
def perform_invalidations(table_privacy_changed)
# previously we used 'invalidate_cache' but due to public_map displaying all the user public visualizations,
# now we need to purgue everything to avoid cached stale data or public->priv still showing scenarios
if name_changed || privacy_changed || table_privacy_changed || dirty
invalidate_cache
end
# When a table's relevant data is changed, propagate to all who use it or relate to it
if dirty && table
table.affected_visualizations.each do |affected_vis|
affected_vis.invalidate_cache
end
end
end
def create_named_map
Carto::NamedMaps::Api.new(carto_visualization).create
end
def update_named_map
Carto::NamedMaps::Api.new(carto_visualization).update
end
def propagate_privacy_and_name_to(table)
raise "Empty table sent to Visualization::Member propagate_privacy_and_name_to()" unless table
propagate_privacy_to(table) if privacy_changed
propagate_name_to(table) if name_changed
end
def propagate_privacy_to(table)
if type == TYPE_CANONICAL
CartoDB::TablePrivacyManager.new(table)
.set_from_visualization(self)
.update_cdb_tablemetadata
end
self
end
# @param table Table
def propagate_name_to(table)
table.name = self.name
table.register_table_only = self.register_table_only
table.update(name: self.name)
if name_changed
support_tables.rename(old_name, name, recreate_constraints=true, seek_parent_name=old_name)
end
self
rescue => exception
if name_changed && !(exception.to_s =~ /relation.*does not exist/)
revert_name_change(old_name)
end
raise CartoDB::InvalidMember.new(exception.to_s)
end
def propagate_attribution_change
return unless attributions_changed
# This includes both the canonical and derived visualizations
table.affected_visualizations.each do |affected_visualization|
affected_visualization.layers(:carto_and_torque).each do |layer|
if layer.options['table_name'] == table.name
layer.options['attribution'] = self.attributions
layer.save
end
end
end
end
def revert_name_change(previous_name)
self.name = previous_name
store
rescue => exception
raise CartoDB::InvalidMember.new(exception.to_s)
end
def set_timestamps
self.created_at ||= Time.now
self.updated_at = Time.now
self
end
def relator
Relator.new(attributes)
end
def name_checker
@name_checker || NameChecker.new(user)
end
def available_name?
return true unless user && name_changed
name_checker.available?(name)
end
def remove_layers_from(table)
related_layers_from(table).each { |layer|
map.remove_layer(layer)
layer.destroy
}
self.active_layer_id = layers(:cartodb).first.nil? ? nil : layers(:cartodb).first.id
store
end
def related_layers_from(table)
layers(:cartodb).select do |layer|
(layer.affected_tables.map(&:name) + [layer.options.fetch('table_name', nil)]).include?(table.name)
end
end
def configuration
return {} unless defined?(Cartodb)
Cartodb.config
end
def password_digest(password, salt)
digest = AUTH_DIGEST
10.times do
digest = secure_digest(digest, salt, password, AUTH_DIGEST)
end
digest
end
def generate_salt
secure_digest(Time.now, (1..10).map{ rand.to_s })
end
def secure_digest(*args)
#noinspection RubyArgCount
Digest::SHA256.hexdigest(args.flatten.join)
end
def safe_sequel_delete
yield
rescue Sequel::NoExistingObject => exception
# INFO: don't fail on nonexistant object delete
CartoDB.notify_exception(exception)
end
def carto_visualization
Carto::Visualization.where(id: id).first
end
end
end
end
Memoize visualization relator
# encoding: utf-8
require 'forwardable'
require 'virtus'
require 'json'
require_relative '../markdown_render'
require_relative './presenter'
require_relative './name_checker'
require_relative '../permission'
require_relative './relator'
require_relative './like'
require_relative '../table/privacy_manager'
require_relative '../../../services/minimal-validation/validator'
require_relative '../../helpers/embed_redis_cache'
require_dependency 'cartodb/redis_vizjson_cache'
# Every table has always at least one visualization (the "canonical visualization"), of type 'table',
# which shares the same privacy options as the table and gets synced.
# Users can create new visualizations, which will never be of type 'table',
# and those will use named maps when any source tables are private
module CartoDB
module Visualization
class Member
extend Forwardable
include Virtus.model
include CacheHelper
PRIVACY_PUBLIC = 'public' # published and listable in public user profile
PRIVACY_PRIVATE = 'private' # not published (viz.json and embed_map should return 404)
PRIVACY_LINK = 'link' # published but not listen in public profile
PRIVACY_PROTECTED = 'password' # published but password protected
TYPE_CANONICAL = 'table'
TYPE_DERIVED = 'derived'
TYPE_SLIDE = 'slide'
TYPE_REMOTE = 'remote'
KIND_GEOM = 'geom'
KIND_RASTER = 'raster'
PRIVACY_VALUES = [ PRIVACY_PUBLIC, PRIVACY_PRIVATE, PRIVACY_LINK, PRIVACY_PROTECTED ]
TEMPLATE_NAME_PREFIX = 'tpl_'
PERMISSION_READONLY = CartoDB::Permission::ACCESS_READONLY
PERMISSION_READWRITE = CartoDB::Permission::ACCESS_READWRITE
AUTH_DIGEST = '1211b3e77138f6e1724721f1ab740c9c70e66ba6fec5e989bb6640c4541ed15d06dbd5fdcbd3052b'
TOKEN_DIGEST = '6da98b2da1b38c5ada2547ad2c3268caa1eb58dc20c9144ead844a2eda1917067a06dcb54833ba2'
DEFAULT_OPTIONS_VALUE = '{}'
# Upon adding new attributes modify also:
# services/data-repository/spec/unit/backend/sequel_spec.rb -> before do
# spec/support/helpers.rb -> random_attributes_for_vis_member
# app/models/visualization/presenter.rb
attribute :id, String
attribute :name, String
attribute :display_name, String
attribute :map_id, String
attribute :active_layer_id, String
attribute :type, String
attribute :privacy, String
attribute :tags, Array[String], default: []
attribute :description, String
attribute :license, String
attribute :source, String
attribute :attributions, String
attribute :title, String
attribute :created_at, Time
attribute :updated_at, Time
attribute :encrypted_password, String, default: nil
attribute :password_salt, String, default: nil
attribute :user_id, String
attribute :permission_id, String
attribute :locked, Boolean, default: false
attribute :parent_id, String, default: nil
attribute :kind, String, default: KIND_GEOM
attribute :prev_id, String, default: nil
attribute :next_id, String, default: nil
attribute :bbox, String, default: nil
# Don't use directly, use instead getter/setter "transition_options"
attribute :slide_transition_options, String, default: DEFAULT_OPTIONS_VALUE
attribute :active_child, String, default: nil
def_delegators :validator, :errors, :full_errors
def_delegators :relator, *Relator::INTERFACE
# This get called not only when creating a new but also when populating from the Collection
def initialize(attributes={}, repository=Visualization.repository, name_checker=nil)
super(attributes)
@repository = repository
self.id ||= @repository.next_id
@name_checker = name_checker
@validator = MinimalValidator::Validator.new
@user_data = nil
self.permission_change_valid = true # Changes upon set of different permission_id
# this flag is passed to the table in case of canonical visualizations. It's used to say to the table to not touch the database and only change the metadata information, useful for ghost tables
self.register_table_only = false
@redis_vizjson_cache = RedisVizjsonCache.new()
@old_privacy = @privacy
end
def self.remote_member(name, user_id, privacy, description, tags, license, source, attributions, display_name)
Member.new({
name: name,
user_id: user_id,
privacy: privacy,
description: description,
tags: tags,
license: license,
source: source,
attributions: attributions,
display_name: display_name,
type: TYPE_REMOTE})
end
def update_remote_data(privacy, description, tags, license, source, attributions, display_name)
changed = false
if self.privacy != privacy
changed = true
self.privacy = privacy
end
if self.display_name != display_name
changed = true
self.display_name = display_name
end
if self.description != description
changed = true
self.description = description
end
if self.tags != tags
changed = true
self.tags = tags
end
if self.license != license
changed = true
self.license = license
end
if self.source != source
changed = true
self.source = source
end
if self.attributions != attributions
changed = true
self.attributions = attributions
end
changed
end
def transition_options
::JSON.parse(self.slide_transition_options).symbolize_keys
end
def transition_options=(value)
self.slide_transition_options = ::JSON.dump(value.nil? ? DEFAULT_OPTIONS_VALUE : value)
end
def ==(other_vis)
self.id == other_vis.id
end
def default_privacy(owner)
owner.try(:private_tables_enabled) ? PRIVACY_LINK : PRIVACY_PUBLIC
end
def store
raise CartoDB::InvalidMember.new(validator.errors) unless self.valid?
do_store
self
end
def store_from_map(fields)
self.map_id = fields[:map_id]
do_store(false)
self
end
def store_using_table(fields, table_privacy_changed = false)
if type == TYPE_CANONICAL
# Each table has a canonical visualization which must have privacy synced
self.privacy = fields[:privacy_text]
self.map_id = fields[:map_id]
end
# But as this method also notifies of changes in a table, must save always
do_store(false, table_privacy_changed)
self
end
def valid?
validator.validate_presence_of(name: name, privacy: privacy, type: type, user_id: user_id)
validator.validate_in(:privacy, privacy, PRIVACY_VALUES)
# do not validate names for slides, it's never used
validator.validate_uniqueness_of(:name, available_name?) unless type_slide?
if privacy == PRIVACY_PROTECTED
validator.validate_presence_of_with_custom_message(
{ encrypted_password: encrypted_password, password_salt: password_salt },
"password can't be blank")
end
# Allow only "maintaining" privacy link for everyone but not setting it
if privacy == PRIVACY_LINK && privacy_changed
validator.validate_expected_value(:private_tables_enabled, true, user.private_tables_enabled)
end
if type_slide?
if parent_id.nil?
validator.errors.store(:parent_id, "Type #{TYPE_SLIDE} must have a parent") if parent_id.nil?
else
begin
parent_member = Member.new(id:parent_id).fetch
if parent_member.type != TYPE_DERIVED
validator.errors.store(:parent_id, "Type #{TYPE_SLIDE} must have parent of type #{TYPE_DERIVED}")
end
rescue KeyError
validator.errors.store(:parent_id, "Type #{TYPE_SLIDE} has non-existing parent id")
end
end
else
validator.errors.store(:parent_id, "Type #{type} must not have parent") unless parent_id.nil?
end
unless permission_id.nil?
validator.errors.store(:permission_id, 'Cannot modify permission') unless permission_change_valid
end
if !license.nil? && !license.empty? && Carto::License.find(license.to_sym).nil?
validator.errors.store(:license, 'License should be an empty or a valid value')
end
validator.valid?
end
def fetch
data = repository.fetch(id)
raise KeyError if data.nil?
self.attributes = data
self.name_changed = false
@old_privacy = @privacy
self.privacy_changed = false
self.permission_change_valid = true
self.dirty = false
validator.reset
self
end
def delete(from_table_deletion = false)
# from_table_deletion would be enough for canonical viz-based deletes,
# but common data loading also calls this delete without the flag to true, causing a call without a Map
begin
if user.has_feature_flag?(Carto::VisualizationsExportService::FEATURE_FLAG_NAME) && map
Carto::VisualizationsExportService.new.export(id)
end
rescue => exception
# Don't break deletion flow
CartoDB.notify_error(exception.message, error: exception.inspect, user: user, visualization_id: id)
end
# Named map must be deleted before the map, or we lose the reference to it
Carto::NamedMaps::Api.new(carto_visualization).destroy
unlink_self_from_list!
support_tables.delete_all
invalidate_cache
overlays.map(&:destroy)
layers(:base).map(&:destroy)
layers(:cartodb).map(&:destroy)
safe_sequel_delete {
# "Mark" that this vis id is the destructor to avoid cycles: Vis -> Map -> relatedvis (Vis again)
related_map = map
related_map.being_destroyed_by_vis_id = id
related_map.destroy
} if map
safe_sequel_delete { table.destroy } if (type == TYPE_CANONICAL && table && !from_table_deletion)
safe_sequel_delete { children.map { |child|
# Refetch each item before removal so Relator reloads prev/next cursors
child.fetch.delete
}
}
safe_sequel_delete { permission.destroy_shared_entities } if permission
safe_sequel_delete { repository.delete(id) }
safe_sequel_delete { permission.destroy } if permission
attributes.keys.each { |key| send("#{key}=", nil) }
self
end
# A visualization is linked to a table when it uses that table in a layergroup (but is not the canonical table)
def unlink_from(table)
invalidate_cache
remove_layers_from(table)
end
def user_data=(user_data)
@user_data = user_data
end
def name=(name)
name = name.downcase if name && table?
self.name_changed = true if name != @name && !@name.nil?
self.old_name = @name
super(name)
end
def description=(description)
self.dirty = true if description != @description && !@description.nil?
super(description)
end
def description_clean
if description.present?
description_html_safe.strip_tags
end
end
def description_html_safe
if description.present?
renderer = Redcarpet::Render::Safe
markdown = Redcarpet::Markdown.new(renderer, extensions = {})
markdown.render description
end
end
def source_html_safe
if source.present?
renderer = Redcarpet::Render::Safe
markdown = Redcarpet::Markdown.new(renderer, extensions = {})
markdown.render source
end
end
def attributions=(value)
self.dirty = true if value != @attributions
self.attributions_changed = true if value != @attributions
super(value)
end
def permission_id=(permission_id)
self.permission_change_valid = false
self.permission_change_valid = true if (@permission_id.nil? || @permission_id == permission_id)
super(permission_id)
end
def privacy=(new_privacy)
new_privacy = new_privacy.downcase if new_privacy
if new_privacy != @privacy && !@privacy.nil?
self.privacy_changed = true
@old_privacy = @privacy
end
super(new_privacy)
end
def tags=(tags)
tags.reject!(&:blank?) if tags
super(tags)
end
def public?
privacy == PRIVACY_PUBLIC
end
def public_with_link?
privacy == PRIVACY_LINK
end
def private?
privacy == PRIVACY_PRIVATE and not organization?
end
def is_privacy_private?
privacy == PRIVACY_PRIVATE
end
def organization?
privacy == PRIVACY_PRIVATE and permission.acl.size > 0
end
def password_protected?
privacy == PRIVACY_PROTECTED
end
# Called by controllers upon rendering
def to_json(options={})
::JSON.dump(to_hash(options))
end
def to_hash(options={})
presenter = Presenter.new(self, options.merge(real_privacy: true))
options.delete(:public_fields_only) === true ? presenter.to_public_poro : presenter.to_poro
end
def to_vizjson(options={})
@redis_vizjson_cache.cached(id, options.fetch(:https_request, false)) do
calculate_vizjson(options)
end
end
def is_owner?(user)
user.id == user_id
end
# @param user ::User
# @param permission_type String PERMISSION_xxx
def has_permission?(user, permission_type)
return is_owner?(user) if permission_id.nil?
is_owner?(user) || permission.permitted?(user, permission_type)
end
def can_copy?(user)
!raster_kind? && has_permission?(user, PERMISSION_READONLY)
end
def raster_kind?
kind == KIND_RASTER
end
def users_with_permissions(permission_types)
permission.users_with_permissions(permission_types)
end
def all_users_with_read_permission
users_with_permissions([CartoDB::Visualization::Member::PERMISSION_READONLY,
CartoDB::Visualization::Member::PERMISSION_READWRITE]) + [user]
end
def varnish_key
sorted_table_names = related_tables.map{ |table|
"#{user.database_schema}.#{table.name}"
}.sort { |i, j|
i <=> j
}.join(',')
"#{user.database_name}:#{sorted_table_names},#{id}"
end
def surrogate_key
get_surrogate_key(CartoDB::SURROGATE_NAMESPACE_VISUALIZATION, self.id)
end
def varnish_vizjson_key
".*#{id}:vizjson"
end
def derived?
type == TYPE_DERIVED
end
def table?
type == TYPE_CANONICAL
end
# Used at Carto::Api::VisualizationPresenter
alias :canonical? :table?
def type_slide?
type == TYPE_SLIDE
end
def dependent?
derived? && single_data_layer?
end
def non_dependent?
derived? && !single_data_layer?
end
def invalidate_cache
invalidate_redis_cache
invalidate_varnish_vizjson_cache
parent.invalidate_cache unless parent_id.nil?
end
def has_private_tables?
has_private_tables = false
related_tables.each { |table|
has_private_tables |= table.private?
}
has_private_tables
end
# Despite storing always a named map, no need to retrieve it for "public" visualizations
def retrieve_named_map?
password_protected? || has_private_tables?
end
def password=(value)
if value && value.size > 0
@password_salt = generate_salt if @password_salt.nil?
@encrypted_password = password_digest(value, @password_salt)
self.dirty = true
end
end
def has_password?
( !@password_salt.nil? && !@encrypted_password.nil? )
end
def password_valid?(password)
raise CartoDB::InvalidMember unless ( privacy == PRIVACY_PROTECTED && has_password? )
( password_digest(password, @password_salt) == @encrypted_password )
end
def remove_password
@password_salt = nil
@encrypted_password = nil
end
# To be stored with the named map
def make_auth_token
digest = secure_digest(Time.now, (1..10).map{ rand.to_s })
10.times do
digest = secure_digest(digest, TOKEN_DIGEST)
end
digest
end
def get_auth_tokens
named_map = get_named_map
raise CartoDB::InvalidMember unless named_map
tokens = named_map.template[:template][:auth][:valid_tokens]
raise CartoDB::InvalidMember if tokens.size == 0
tokens
end
def supports_private_maps?
!user.nil? && user.private_maps_enabled?
end
# @param other_vis CartoDB::Visualization::Member|nil
# Note: Changes state both of self, other_vis and other affected list items, but only reloads self & other_vis
def set_next_list_item!(other_vis)
repository.transaction do
close_list_gap(other_vis)
# Now insert other_vis after self
unless other_vis.nil?
if self.next_id.nil?
other_vis.next_id = nil
else
other_vis.next_id = self.next_id
next_item = next_list_item
next_item.prev_id = other_vis.id
next_item.store
end
self.next_id = other_vis.id
other_vis.prev_id = self.id
other_vis.store
.fetch
end
store
end
fetch
end
# @param other_vis CartoDB::Visualization::Member|nil
# Note: Changes state both of self, other_vis and other affected list items, but only reloads self & other_vis
def set_prev_list_item!(other_vis)
repository.transaction do
close_list_gap(other_vis)
# Now insert other_vis after self
unless other_vis.nil?
if self.prev_id.nil?
other_vis.prev_id = nil
else
other_vis.prev_id = self.prev_id
prev_item = prev_list_item
prev_item.next_id = other_vis.id
prev_item.store
end
self.prev_id = other_vis.id
other_vis.next_id = self.id
other_vis.store
.fetch
end
store
end
fetch
end
def unlink_self_from_list!
repository.transaction do
unless self.prev_id.nil?
prev_item = prev_list_item
prev_item.next_id = self.next_id
prev_item.store
end
unless self.next_id.nil?
next_item = next_list_item
next_item.prev_id = self.prev_id
next_item.store
end
self.prev_id = nil
self.next_id = nil
end
end
# @param user_id String UUID of the actor that likes the visualization
# @throws AlreadyLikedError
def add_like_from(user_id)
Like.create(actor: user_id, subject: id)
reload_likes
self
rescue Sequel::DatabaseError => exception
if exception.message =~ /duplicate key/i
raise AlreadyLikedError
else
raise exception
end
end
def remove_like_from(user_id)
item = likes.select { |like| like.actor == user_id }
item.first.destroy unless item.first.nil?
reload_likes
self
end
def liked_by?(user_id)
!(likes.select { |like| like.actor == user_id }.first.nil?)
end
# @param viewer_user ::User
def qualified_name(viewer_user=nil)
if viewer_user.nil? || is_owner?(viewer_user)
name
else
"#{user.sql_safe_database_schema}.#{name}"
end
end
attr_accessor :register_table_only
def invalidate_redis_cache
@redis_vizjson_cache.invalidate(id)
embed_redis_cache.invalidate(self.id)
end
def save_named_map
return if type == TYPE_REMOTE
unless @updating_named_maps
Rails::Sequel.connection.after_commit do
@updating_named_maps = false
(get_named_map ? update_named_map : create_named_map) if carto_visualization
end
@updating_named_maps = true
end
end
def get_named_map
return false if type == TYPE_REMOTE
Carto::NamedMaps::Api.new(carto_visualization).show if carto_visualization
end
def license_info
if !license.nil?
Carto::License.find(license.to_sym)
end
end
def attributions_from_derived_visualizations
related_canonical_visualizations.map(&:attributions).reject {|attribution| attribution.blank?}
end
private
attr_reader :repository, :name_checker, :validator
attr_accessor :privacy_changed, :name_changed, :old_name, :permission_change_valid, :dirty, :attributions_changed
def embed_redis_cache
@embed_redis_cache ||= EmbedRedisCache.new($tables_metadata)
end
def calculate_vizjson(options={})
vizjson_options = {
full: false,
user_name: user.username,
user_api_key: user.api_key,
user: user,
viewer_user: user
}.merge(options)
VizJSON.new(self, vizjson_options, configuration).to_poro
end
def invalidate_varnish_vizjson_cache
CartoDB::Varnish.new.purge(varnish_vizjson_key)
end
def close_list_gap(other_vis)
reload_self = false
if other_vis.nil?
self.next_id = nil
old_prev = nil
old_next = nil
else
old_prev = other_vis.prev_list_item
old_next = other_vis.next_list_item
end
# First close gap left by other_vis
unless old_prev.nil?
old_prev.next_id = old_next.nil? ? nil : old_next.id
old_prev.store
reload_self |= old_prev.id == self.id
end
unless old_next.nil?
old_next.prev_id = old_prev.nil? ? nil : old_prev.id
old_next.store
reload_self |= old_next.id == self.id
end
fetch if reload_self
end
def do_store(propagate_changes = true, table_privacy_changed = false)
if password_protected?
raise CartoDB::InvalidMember.new('No password set and required') unless has_password?
else
remove_password
end
# Warning: imports create by default private canonical visualizations
if type != TYPE_CANONICAL && @privacy == PRIVACY_PRIVATE && privacy_changed && !supports_private_maps?
raise CartoDB::InvalidMember
end
perform_invalidations(table_privacy_changed)
set_timestamps
# Ensure a permission is set before saving the visualization
if permission.nil?
perm = CartoDB::Permission.new
perm.owner = user
perm.save
@permission_id = perm.id
end
repository.store(id, attributes.to_hash)
restore_previous_privacy unless save_named_map
propagate_attribution_change if table
if type == TYPE_REMOTE || type == TYPE_CANONICAL
propagate_privacy_and_name_to(table) if table and propagate_changes
else
propagate_name_to(table) if table and propagate_changes
end
end
def restore_previous_privacy
unless @old_privacy.nil?
self.privacy = @old_privacy
attributes[:privacy] = @old_privacy
repository.store(id, attributes.to_hash)
end
rescue => exception
CartoDB.notify_exception(exception, user: user, message: "Error restoring previous visualization privacy")
raise exception
end
def perform_invalidations(table_privacy_changed)
# previously we used 'invalidate_cache' but due to public_map displaying all the user public visualizations,
# now we need to purgue everything to avoid cached stale data or public->priv still showing scenarios
if name_changed || privacy_changed || table_privacy_changed || dirty
invalidate_cache
end
# When a table's relevant data is changed, propagate to all who use it or relate to it
if dirty && table
table.affected_visualizations.each do |affected_vis|
affected_vis.invalidate_cache
end
end
end
def create_named_map
Carto::NamedMaps::Api.new(carto_visualization).create
end
def update_named_map
Carto::NamedMaps::Api.new(carto_visualization).update
end
def propagate_privacy_and_name_to(table)
raise "Empty table sent to Visualization::Member propagate_privacy_and_name_to()" unless table
propagate_privacy_to(table) if privacy_changed
propagate_name_to(table) if name_changed
end
def propagate_privacy_to(table)
if type == TYPE_CANONICAL
CartoDB::TablePrivacyManager.new(table)
.set_from_visualization(self)
.update_cdb_tablemetadata
end
self
end
# @param table Table
def propagate_name_to(table)
table.name = self.name
table.register_table_only = self.register_table_only
table.update(name: self.name)
if name_changed
support_tables.rename(old_name, name, recreate_constraints=true, seek_parent_name=old_name)
end
self
rescue => exception
if name_changed && !(exception.to_s =~ /relation.*does not exist/)
revert_name_change(old_name)
end
raise CartoDB::InvalidMember.new(exception.to_s)
end
def propagate_attribution_change
return unless attributions_changed
# This includes both the canonical and derived visualizations
table.affected_visualizations.each do |affected_visualization|
affected_visualization.layers(:carto_and_torque).each do |layer|
if layer.options['table_name'] == table.name
layer.options['attribution'] = self.attributions
layer.save
end
end
end
end
def revert_name_change(previous_name)
self.name = previous_name
store
rescue => exception
raise CartoDB::InvalidMember.new(exception.to_s)
end
def set_timestamps
self.created_at ||= Time.now
self.updated_at = Time.now
self
end
def relator
@relator ||= Relator.new(attributes)
end
def name_checker
@name_checker || NameChecker.new(user)
end
def available_name?
return true unless user && name_changed
name_checker.available?(name)
end
def remove_layers_from(table)
related_layers_from(table).each { |layer|
map.remove_layer(layer)
layer.destroy
}
self.active_layer_id = layers(:cartodb).first.nil? ? nil : layers(:cartodb).first.id
store
end
def related_layers_from(table)
layers(:cartodb).select do |layer|
(layer.affected_tables.map(&:name) + [layer.options.fetch('table_name', nil)]).include?(table.name)
end
end
def configuration
return {} unless defined?(Cartodb)
Cartodb.config
end
def password_digest(password, salt)
digest = AUTH_DIGEST
10.times do
digest = secure_digest(digest, salt, password, AUTH_DIGEST)
end
digest
end
def generate_salt
secure_digest(Time.now, (1..10).map{ rand.to_s })
end
def secure_digest(*args)
#noinspection RubyArgCount
Digest::SHA256.hexdigest(args.flatten.join)
end
def safe_sequel_delete
yield
rescue Sequel::NoExistingObject => exception
# INFO: don't fail on nonexistant object delete
CartoDB.notify_exception(exception)
end
def carto_visualization
Carto::Visualization.where(id: id).first
end
end
end
end
|
class Conan < Formula
include Language::Python::Virtualenv
desc "Distributed, open source, package manager for C/C++"
homepage "https://github.com/conan-io/conan"
url "https://github.com/conan-io/conan/archive/1.20.1.tar.gz"
sha256 "6f5f2a75c50fda7fe6d87bee5187400a7c41939e7c2f5fd3489c9d99790db779"
head "https://github.com/conan-io/conan.git"
bottle do
cellar :any
sha256 "03fe6223dfa4d156419ae7820bbb77bd813e86951456c84ca8831218ffab2336" => :catalina
sha256 "359d90b40ee8f84ee97b1c0c1e67229f48c657729c87d318d5f5f75c3fc5d62d" => :mojave
sha256 "c0e3f2850eddaba19092c093273ddbb966e31ba3168cd35fc2e4f8da869e225f" => :high_sierra
end
depends_on "pkg-config" => :build
depends_on "libffi"
depends_on "openssl@1.1"
depends_on "python"
def install
venv = virtualenv_create(libexec, "python3")
system libexec/"bin/pip", "install", "-v", "--no-binary", ":all:",
"--ignore-installed", "PyYAML==3.13", buildpath
system libexec/"bin/pip", "uninstall", "-y", name
venv.pip_install_and_link buildpath
end
test do
system bin/"conan", "install", "zlib/1.2.11@conan/stable", "--build"
assert_predicate testpath/".conan/data/zlib/1.2.11", :exist?
end
end
conan 1.20.2
Closes #46400.
Signed-off-by: Rui Chen <5103e075d5305459d1efee7e3b0ff29fa7440564@meetup.com>
class Conan < Formula
include Language::Python::Virtualenv
desc "Distributed, open source, package manager for C/C++"
homepage "https://github.com/conan-io/conan"
url "https://github.com/conan-io/conan/archive/1.20.2.tar.gz"
sha256 "e54a1f670116e47f2a1fb95e17a1211439868661a0f8afc4ca3616e075e76070"
head "https://github.com/conan-io/conan.git"
bottle do
cellar :any
sha256 "03fe6223dfa4d156419ae7820bbb77bd813e86951456c84ca8831218ffab2336" => :catalina
sha256 "359d90b40ee8f84ee97b1c0c1e67229f48c657729c87d318d5f5f75c3fc5d62d" => :mojave
sha256 "c0e3f2850eddaba19092c093273ddbb966e31ba3168cd35fc2e4f8da869e225f" => :high_sierra
end
depends_on "pkg-config" => :build
depends_on "libffi"
depends_on "openssl@1.1"
depends_on "python"
def install
venv = virtualenv_create(libexec, "python3")
system libexec/"bin/pip", "install", "-v", "--no-binary", ":all:",
"--ignore-installed", "PyYAML==3.13", buildpath
system libexec/"bin/pip", "uninstall", "-y", name
venv.pip_install_and_link buildpath
end
test do
system bin/"conan", "install", "zlib/1.2.11@conan/stable", "--build"
assert_predicate testpath/".conan/data/zlib/1.2.11", :exist?
end
end
|
playWithAFriend=Сыграть с другом
playWithTheMachine=Партия с компьютером
toInviteSomeoneToPlayGiveThisUrl=Чтобы сыграть с другом, отправьте ему эту ссылку
gameOver=Игра окончена
waitingForOpponent=Ожидание противника
waiting=Ожидание
yourTurn=Ваш ход
aiNameLevelAiLevel=%s уровень %s
level=Уровень
toggleTheChat=Показывать окно чата
toggleSound=Вкл/выкл звук
chat=Чат
resign=Сдаться
checkmate=Мат
stalemate=Пат
white=Белые
black=Чёрные
randomColor=Случайный цвет
createAGame=Создать игру
whiteIsVictorious=Белые победили
blackIsVictorious=Черные победили
kingInTheCenter=Король в центре
threeChecks=Три шаха
variantEnding=Вариант окончен
playWithTheSameOpponentAgain=Сыграть с тем же игроком снова
newOpponent=Новый соперник
playWithAnotherOpponent=Сыграть с другим соперником
yourOpponentWantsToPlayANewGameWithYou=Ваш соперник предлагает вам сыграть ещё раз
joinTheGame=Присоединиться
whitePlays=Ход белых
blackPlays=Ход черных
theOtherPlayerHasLeftTheGameYouCanForceResignationOrWaitForHim=Ваш соперник покинул игру. Вы можете завершить партию от его имени или дождаться его возвращения.
makeYourOpponentResign=Объявить победу
forceResignation=Объявить проигравшим
forceDraw=Объявить ничью
talkInChat=Общайтесь в чате
theFirstPersonToComeOnThisUrlWillPlayWithYou=Первый, кто перейдёт по этой ссылке, будет играть с вами.
whiteCreatesTheGame=Белые создали новую игру
blackCreatesTheGame=Черные создали новую игру
whiteJoinsTheGame=Белые присоединились к игре
blackJoinsTheGame=Черные присоединились к игре
whiteResigned=Белые сдались
blackResigned=Черные сдались
whiteLeftTheGame=Белые вышли из игры
blackLeftTheGame=Черные вышли из игры
shareThisUrlToLetSpectatorsSeeTheGame=Поделитесь этой ссылкой с другими для просмотра игры
replayAndAnalyse=Повтор и анализ игры
computerAnalysisInProgress=Производится компьютерный анализ
theComputerAnalysisHasFailed=Произошёл сбой.
viewTheComputerAnalysis=Просмотреть компьютерный анализ
requestAComputerAnalysis=Запросить компьютерный анализ
computerAnalysis=Компьютерный анализ
analysis=Анализ
blunders=Грубая ошибка
mistakes=Ошибка
inaccuracies=Сомнительный ход
moveTimes=Время ходов
flipBoard=Развернуть доску
threefoldRepetition=Троекратное повторение ходов
claimADraw=Объявить ничью
offerDraw=Предложить ничью
draw=Ничья
nbConnectedPlayers=%s игроков онлайн
gamesBeingPlayedRightNow=Текущие партии
viewAllNbGames=Посмотреть все партии %s
viewNbCheckmates=Посмотреть все партии %s, закончившиеся матом
nbBookmarks=%s закладки
nbPopularGames=%s популярные игры
nbAnalysedGames=%s проанализированных игр
bookmarkedByNbPlayers=Добавило в закладки %s игроков
viewInFullSize=Посмотреть в полном размере
logOut=Выйти
signIn=Войти
newToLichess=Впервые на Lichess?
youNeedAnAccountToDoThat=Вам нужно зарегистрироваться, чтобы сделать это
signUp=Регистрация
computersAreNotAllowedToPlay=Создание учетных записей для компьютерных программ запрещено. Пожалуйста, во время игры не используйте шахматные программы, базы данных или подсказки от других игроков.
games=Игры
forum=Форум
xPostedInForumY=%s опубликовал на форуме %s
latestForumPosts=Последние сообщения на форуме
players=Игроки
minutesPerSide=Минут на партию
variant=Вариант
variants=Варианты
timeControl=Контроль времени
realTime=В реальном времени
correspondence=По переписке
daysPerTurn=Дней на ход
oneDay=Ежедневно
nbDays=%s дней
nbHours=%s часов
time=Время
rating=Рейтинг
username=Имя пользователя
password=Пароль
haveAnAccount=Есть учетная запись?
changePassword=Сменить пароль
changeEmail=Изменить электронную почту
email=Электронная почта
emailIsOptional=Указывать электронную почту не обязательно. Lichess будет использовать её для сброса пароля, если вы его забудете.
passwordReset=Сброс пароля
forgotPassword=Забыли пароль?
learnMoreAboutLichess=Узнать больше о Lichess
rank=Уровень
gamesPlayed=Партий сыграно
nbGamesWithYou=%s партий с вами
declineInvitation=Отклонить приглашение
cancel=Отменить
timeOut=Время истекло
drawOfferSent=Предложение ничьей отправлено
drawOfferDeclined=Предложение ничьей отклонено
drawOfferAccepted=Предложение ничьей принято
drawOfferCanceled=Предложение ничьей отменено
whiteOffersDraw=Белые предлагают ничью
blackOffersDraw=Черные предлагают ничью
whiteDeclinesDraw=Белые отказываются от ничьей
blackDeclinesDraw=Черные откладываются от ничьей
yourOpponentOffersADraw=Ваш оппонент предлагает ничью
accept=Принять
decline=Отклонить
playingRightNow=Активная партия
finished=Закончено
abortGame=Отменить игру
gameAborted=Игра отменена
standard=Классические шахматы
unlimited=Без лимита времени
mode=Режим
casual=Без рейтинга
rated=Рейтинговая
thisGameIsRated=Игра на рейтинг
rematch=Реванш
rematchOfferSent=Предложение реванша отправлено
rematchOfferAccepted=Предложение реванша принято
rematchOfferCanceled=Предложение реванша отменено
rematchOfferDeclined=Предложение реванша отклонено
cancelRematchOffer=Отказаться от реванша
viewRematch=Посмотреть ответную игру
play=Играть
inbox=Входящие
chatRoom=Окно чата
spectatorRoom=Чат для зрителей
composeMessage=Написать сообщение
noNewMessages=Нет новых сообщений
subject=Тема
recipient=Получатель
send=Послать
incrementInSeconds=Прибавка в секундах
freeOnlineChess=Бесплатные онлайн-шахматы
spectators=Зрители:
nbWins=%s выиграно
nbLosses=%s проиграно
nbDraws=%s сыграно вничью
exportGames=Экспорт игр
ratingRange=Диапазон рейтинга
giveNbSeconds=Дать %s секунд
premoveEnabledClickAnywhereToCancel=Предварительный ход включен. Для отмены кликните в любом месте
thisPlayerUsesChessComputerAssistance=Этот игрок использует шахматную программу
thisPlayerArtificiallyIncreasesTheirRating=Этот игрок искусственно увеличивает свой рейтинг
opening=Дебют
takeback=Вернуть ход
proposeATakeback=Попросить соперника вернуть ход
takebackPropositionSent=Предложение возврата отправлено
takebackPropositionDeclined=Предложение возврата отклонено
takebackPropositionAccepted=Предложение возврата принято
takebackPropositionCanceled=Предложение возврата отменено
yourOpponentProposesATakeback=Ваш оппонент просит вернуть ход
bookmarkThisGame=Добавить игру в закладки
search=Поиск
advancedSearch=Расширенный поиск
tournament=Турнир
tournaments=Турниры
tournamentPoints=Турнирные очки
viewTournament=Просмотр турнира
backToTournament=Обратно в турнир
backToGame=Возврат к игре
freeOnlineChessGamePlayChessNowInACleanInterfaceNoRegistrationNoAdsNoPluginRequiredPlayChessWithComputerFriendsOrRandomOpponents=Бесплатные онлайн-шахматы. Играйте в шахматы прямо сейчас в простом интерфейсе без рекламы. Не требует регистрации и скачивания программы. Играйте в шахматы с компьютером, друзьями или случайными соперниками.
teams=Команды
nbMembers=%s участников
allTeams=Все команды
newTeam=Новая команда
myTeams=Мои команды
noTeamFound=Команда не найдена
joinTeam=Присоединиться к команде
quitTeam=Выйти из команды
anyoneCanJoin=Любой может присоединиться
aConfirmationIsRequiredToJoin=Для присоединения требуется подтверждение
joiningPolicy=Условия членства
teamLeader=Лидер команды
teamBestPlayers=Лучшие игроки команды
teamRecentMembers=Новые члены команды
xJoinedTeamY=%s присоединился к команде %s
xCreatedTeamY=%s создал команду %s
averageElo=Средний рейтинг
location=Местоположение
settings=Настройки
filterGames=Фильтр партий
reset=Сбросить
apply=Применить
leaderboard=Лучшие игроки
pasteTheFenStringHere=Вставьте строку в формате FEN
pasteThePgnStringHere=Вставьте строку в формате PGN
fromPosition=С позиции
continueFromHere=Продолжить с данного места
importGame=Импорт игры
nbImportedGames=%s Импортированные игры
nbRelayedGames=%s Похожие игры
thisIsAChessCaptcha=Это шахматная CAPTCHA.
clickOnTheBoardToMakeYourMove=Кликните по доске, чтобы сделать ход и доказать, что вы человек.
notACheckmate=Это не мат
colorPlaysCheckmateInOne=%s начинают; мат в один ход
retry=Повторить
reconnecting=Переподключение
onlineFriends=Друзья онлайн
noFriendsOnline=Нет друзей онлайн
findFriends=Найти друзей
favoriteOpponents=Предпочтительные соперники
follow=Подписаться
following=Подписаны
unfollow=Отписаться
block=Заблокировать
blocked=Заблокированные
unblock=Разблокировать
followsYou=Подписаны на вас
xStartedFollowingY=%s подписался на %s
nbFollowers=%s подписчики
nbFollowing=%s подписан
more=Ещё
memberSince=Дата регистрации
lastLogin=Последнее посещение
challengeToPlay=Вызвать на игру
player=Игрок
list=Список
graph=График
lessThanNbMinutes=Менее %s минут
xToYMinutes=От %s до %s минут
textIsTooShort=Текст слишком короткий.
textIsTooLong=Текст слишком длинный.
required=Требуется заполнить.
openTournaments=Открытые турниры
duration=Длительность
winner=Победитель
standing=Турнирная таблица
createANewTournament=Создать новый турнир
join=Присоединиться
withdraw=Покинуть
points=Очки
wins=Победы
losses=Поражения
winStreak=Серия побед
createdBy=Создан
tournamentIsStarting=Турнир начинается
membersOnly=Только для зарегистрированных
boardEditor=Редактор доски
startPosition=Начальная позиция
clearBoard=Очистить доску
savePosition=Сохранить позицию
loadPosition=Загрузить позицию
isPrivate=Закрытый
reportXToModerators=Сообщить о %s модераторам
profile=Профиль
editProfile=Редактировать профиль
firstName=Имя
lastName=Фамилия
biography=Биография
country=Страна
preferences=Предпочтения
watchLichessTV=Смотреть Lichess TV
previouslyOnLichessTV=Ранее на Lichess TV
todaysLeaders=Сегодняшние лидеры
onlinePlayers=Игроки в сети
progressToday=Прогресс сегодня
progressThisWeek=Прогресс на этой неделе
progressThisMonth=Прогресс в этом месяце
leaderboardThisWeek=Лидеры на этой неделе
leaderboardThisMonth=Лидеры этого месяца
activeToday=Активные сегодня
activeThisWeek=Активные на этой неделе
activePlayers=Активные игроки
bewareTheGameIsRatedButHasNoClock=Внимание, это рейтинговая игра без ограничения по времени!
training=Задачи
yourPuzzleRatingX=Ваш рейтинг в решении задач: %s
findTheBestMoveForWhite=Найдите лучший ход за белых.
findTheBestMoveForBlack=Найдите лучший ход за чёрных.
toTrackYourProgress=Для отслеживания прогресса:
trainingSignupExplanation=Lichess подберет задачи для вашего уровня, что позволит повысить эффективность тренировок.
recentlyPlayedPuzzles=Недавно решенные задачи
puzzleId=Задача %s
puzzleOfTheDay=Шахматная задача дня
clickToSolve=Нажмите чтобы решить
goodMove=Хороший ход
butYouCanDoBetter=Но вы можете найти лучше.
bestMove=Лучший ход!
keepGoing=Продолжайте...
puzzleFailed=Задача не решена.
butYouCanKeepTrying=Но вы можете попробовать еще раз.
victory=Победа!
giveUp=Сдаться
puzzleSolvedInXSeconds=Задача решена за %s секунд
wasThisPuzzleAnyGood=Была ли задача интересной?
pleaseVotePuzzle=Помогите сделать lichess лучше, голосуя при помощи стрелок вверх или вниз.
thankYou=Спасибо!
ratingX=Рейтинг %s
playedXTimes=Решено %s раз
fromGameLink=Из игры %s
startTraining=Начать тренировку
continueTraining=Продолжить тренировку
retryThisPuzzle=Попробовать еще раз
thisPuzzleIsCorrect=Задача правильная и интересная
thisPuzzleIsWrong=Задача неправильная или неинтересная
youHaveNbSecondsToMakeYourFirstMove=У Вас %s секунд, чтобы сделать свой первый ход!
nbGamesInPlay=%s ведется партий
automaticallyProceedToNextGameAfterMoving=Автоматически переходить к следующей игре после хода
autoSwitch=Автосмена
openingId=Дебют %s
yourOpeningRatingX=Ваш дебютный рейтинг: %s
findNbStrongMoves=Найдите сильные ходы: %s
thisMoveGivesYourOpponentTheAdvantage=Этот ход даёт вашему сопернику преимущество
openingFailed=Дебют проигран
openingSolved=Дебют решён
recentlyPlayedOpenings=Недавно сыгранные дебюты
puzzles=Головоломки
coordinates=Координаты
openings=Дебюты
latestUpdates=Последние обновления
tournamentWinners=Победители турнира
name=Имя
description=Описание
no=Нет
yes=Да
help=Помощь
createANewTopic=Создать новую тему
topics=Темы
posts=Посты
lastPost=Последний пост
views=Прочитано
replies=Ответы
replyToThisTopic=Принять участие в обсуждении
reply=Ответ
message=Сообщение
createTheTopic=Создать тему
reportAUser=Пожаловаться на пользователя
user=Пользователь
reason=Причина
whatIsIheMatter=В чем дело?
cheat=Жульничество
insult=Оскорбление
troll=Троллинг
other=Другое
reportDescriptionHelp=Вставить ссылку на игру и объяснить, что неправильного в поведении пользователя.
by=опубликовал %s
thisTopicIsNowClosed=Эта тема сейчас закрыта.
theming=Настройка темы
donate=Сделать пожертвование
blog=Блог
map=Карта
realTimeWorldMapOfChessMoves=Карта шахматных ходов в реальном времени
questionsAndAnswers=Вопросы и Ответы
notes=Заметки
typePrivateNotesHere=Здесь вы можете оставить заметки об игре (доступно только вам)
gameDisplay=Игровой дисплей
pieceAnimation=Анимация фигур
materialDifference=Показывать разницу в материале
closeAccount=Удалить аккаунт
closeYourAccount=Удаление аккаунта
changedMindDoNotCloseAccount=Я передумал, не удаляйте мой аккаунт
closeAccountExplanation=Вы действительно желаете удалить свой аккаунт? Удаление аккаунта невозможно отменить. Вы больше не сможете зайти в игру, и ваша страница больше не будет доступна.
thisAccountIsClosed=Ваш аккаунт удален.
invalidUsernameOrPassword=Неправильное имя или пароль
emailMeALink=Выслать ссылку
currentPassword=Текущий пароль
newPassword=Новый пароль
newPasswordAgain=Новый пароль (повтор)
boardHighlights=Подсветка (последний ход и шах)
pieceDestinations=Показывать все возможные ходы
boardCoordinates=Координаты доски (A-H, 1-8)
moveListWhilePlaying=Показывать список ходов
chessClock=Часы
tenthsOfSeconds=Десятые секунд
never=Никогда
whenTimeRemainingLessThanTenSeconds=Когда остается меньше 10 секунд
horizontalGreenProgressBars=Горизонтальный зелёный индикатор прогресса
soundWhenTimeGetsCritical=Звук, когда время подходит к концу
gameBehavior=Настройки игры
premovesPlayingDuringOpponentTurn=Предварительный ход (пока ходит противник)
takebacksWithOpponentApproval=Возвраты (с согласия противника)
promoteToQueenAutomatically=Пешка превращается в Ферзя автоматически
claimDrawOnThreefoldRepetitionAutomatically=Объявлять ничью после %s%s трёхкратного повторения позиции
privacy=Приватность
letOtherPlayersFollowYou=Позволить другим наблюдать за мной
letOtherPlayersChallengeYou=Другие игроки могут пригласить меня на игру
sound=Звук
soundControlInTheTopBarOfEveryPage=Контроль звука в правом верхнем углу каждой страницы.
yourPreferencesHaveBeenSaved=Ваши настройки сохранены.
none=Нет
fast=Быстрая
normal=Нормальная
slow=Медленная
insideTheBoard=Внутри поля
outsideTheBoard=Вне поля
onSlowGames=В медленных играх
always=Всегда
inCasualGamesOnly=Только в играх без рейтинга
whenPremoving=Когда сделан предварительный ход
whenTimeRemainingLessThanThirtySeconds=Когда остается меньше 30 секунд
difficultyEasy=Легкий
difficultyNormal=Нормальный
difficultyHard=Сложный
xLeftANoteOnY=%s оставил заметку о %s
xCompetesInY=%s участвует в %s
xAskedY=%s спрашивает %s
xAnsweredY=%s ответил %s
xCommentedY=%s откомментировал %s
timeline=Дневник
seeAllTournaments=Видеть все турниры
starting=Начинается:
allInformationIsPublicAndOptional=Вся информация публична и опциональна.
yourCityRegionOrDepartment=Ваш город, область или округ.
biographyDescription=Расскажите о себе, что вы любите в шахматах, ваши любимые дебюты, партии, игроки...
maximumNbCharacters=Максимум: %s символов.
blocks=%s заблокировано
listBlockedPlayers=Список заблокированных вами игроков
human=Человек
computer=Компьютер
side=Сторона
clock=Часы
unauthorizedError=Неавторизованный доступ
noInternetConnection=Нет интернет соединения. Вы можете играть оффлайн из меню.
connectedToLichess=Сейчас вы подключены к lichess.org
signedOut=Вы вышли.
loginSuccessful=Войти успешный
playOnTheBoardOffline=Играйте оффлайн
playOfflineComputer=Играть с компьютером оффлайн
opponent=Соперник
learn=Обучение
community=Сообщество
tools=Инструменты
increment=Инкремент
board=Доска
pieces=Фигуры
sharePGN=Экспорт PGN
playOnline=Играть онлайн
playOffline=Играть офлайн
allowAnalytics=Разрешить сбор статистики
shareGameURL=Дать URL игры
error.required=Заполните это поле
error.email=Адрес электронной почты является недействительным
error.email_acceptable=Адрес электронной почты не является приемлемым
error.email_unique=Адрес электронной почты занят
blindfoldChess=Играть с завязанными глазами(невидимые части)
moveConfirmation=Подтвердить ход
inCorrespondenceGames=В игре по переписке
ifRatingIsPlusMinusX=Если рейтинг ± %s
onlyFriends=Только друзья
menu=Меню
castling=Рокировка
watchGames=Смотреть игры
watch=Смотреть
internationalEvents=Международные события
videoLibrary=Видеотека
mobileApp=Мобильное приложение
webmasters=Разработчики
contact=Контакт
simultaneousExhibitions=Сеанс одновременной игры
ru "русский язык" translation #14853. Author: Michael134096.
playWithAFriend=Сыграть с другом
playWithTheMachine=Партия с компьютером
toInviteSomeoneToPlayGiveThisUrl=Чтобы сыграть с другом, отправьте ему эту ссылку
gameOver=Игра окончена
waitingForOpponent=Ожидание противника
waiting=Ожидание
yourTurn=Ваш ход
aiNameLevelAiLevel=%s уровень %s
level=Уровень
toggleTheChat=Показывать окно чата
toggleSound=Вкл/выкл звук
chat=Чат
resign=Сдаться
checkmate=Мат
stalemate=Пат
white=Белые
black=Чёрные
randomColor=Случайный цвет
createAGame=Создать игру
whiteIsVictorious=Белые победили
blackIsVictorious=Черные победили
kingInTheCenter=Король в центре
threeChecks=Три шаха
variantEnding=Вариант окончен
playWithTheSameOpponentAgain=Сыграть с тем же игроком снова
newOpponent=Новый соперник
playWithAnotherOpponent=Сыграть с другим соперником
yourOpponentWantsToPlayANewGameWithYou=Ваш соперник предлагает вам сыграть ещё раз
joinTheGame=Присоединиться
whitePlays=Ход белых
blackPlays=Ход черных
theOtherPlayerHasLeftTheGameYouCanForceResignationOrWaitForHim=Ваш соперник покинул игру. Вы можете завершить партию от его имени или дождаться его возвращения.
makeYourOpponentResign=Объявить победу
forceResignation=Объявить проигравшим
forceDraw=Объявить ничью
talkInChat=Общайтесь в чате
theFirstPersonToComeOnThisUrlWillPlayWithYou=Первый, кто перейдёт по этой ссылке, будет играть с вами.
whiteCreatesTheGame=Белые создали новую игру
blackCreatesTheGame=Черные создали новую игру
whiteJoinsTheGame=Белые присоединились к игре
blackJoinsTheGame=Черные присоединились к игре
whiteResigned=Белые сдались
blackResigned=Черные сдались
whiteLeftTheGame=Белые вышли из игры
blackLeftTheGame=Черные вышли из игры
shareThisUrlToLetSpectatorsSeeTheGame=Поделитесь этой ссылкой с другими для просмотра игры
replayAndAnalyse=Повтор и анализ игры
computerAnalysisInProgress=Производится компьютерный анализ
theComputerAnalysisHasFailed=Произошёл сбой.
viewTheComputerAnalysis=Просмотреть компьютерный анализ
requestAComputerAnalysis=Запросить компьютерный анализ
computerAnalysis=Компьютерный анализ
analysis=Анализ
blunders=Грубая ошибка
mistakes=Ошибка
inaccuracies=Сомнительный ход
moveTimes=Время ходов
flipBoard=Развернуть доску
threefoldRepetition=Троекратное повторение ходов
claimADraw=Объявить ничью
offerDraw=Предложить ничью
draw=Ничья
nbConnectedPlayers=%s игроков онлайн
gamesBeingPlayedRightNow=Текущие партии
viewAllNbGames=Посмотреть все партии %s
viewNbCheckmates=Посмотреть все партии %s, закончившиеся матом
nbBookmarks=%s закладки
nbPopularGames=%s популярные игры
nbAnalysedGames=%s проанализированных игр
bookmarkedByNbPlayers=Добавило в закладки %s игроков
viewInFullSize=Посмотреть в полном размере
logOut=Выйти
signIn=Войти
newToLichess=Впервые на Lichess?
youNeedAnAccountToDoThat=Вам нужно зарегистрироваться, чтобы сделать это
signUp=Регистрация
computersAreNotAllowedToPlay=Создание учетных записей для компьютерных программ запрещено. Пожалуйста, во время игры не используйте шахматные программы, базы данных или подсказки от других игроков.
games=Игры
forum=Форум
xPostedInForumY=%s опубликовал на форуме %s
latestForumPosts=Последние сообщения на форуме
players=Игроки
minutesPerSide=Минут на партию
variant=Вариант
variants=Варианты
timeControl=Контроль времени
realTime=В реальном времени
correspondence=По переписке
daysPerTurn=Дней на ход
oneDay=Ежедневно
nbDays=%s дней
nbHours=%s часов
time=Время
rating=Рейтинг
username=Имя пользователя
password=Пароль
haveAnAccount=Есть учетная запись?
changePassword=Сменить пароль
changeEmail=Изменить электронную почту
email=Электронная почта
emailIsOptional=Указывать электронную почту не обязательно. Lichess будет использовать её для сброса пароля, если вы его забудете.
passwordReset=Сброс пароля
forgotPassword=Забыли пароль?
learnMoreAboutLichess=Узнать больше о Lichess
rank=Уровень
gamesPlayed=Партий сыграно
nbGamesWithYou=%s партий с вами
declineInvitation=Отклонить приглашение
cancel=Отменить
timeOut=Время истекло
drawOfferSent=Предложение ничьей отправлено
drawOfferDeclined=Предложение ничьей отклонено
drawOfferAccepted=Предложение ничьей принято
drawOfferCanceled=Предложение ничьей отменено
whiteOffersDraw=Белые предлагают ничью
blackOffersDraw=Черные предлагают ничью
whiteDeclinesDraw=Белые отказываются от ничьей
blackDeclinesDraw=Черные откладываются от ничьей
yourOpponentOffersADraw=Ваш оппонент предлагает ничью
accept=Принять
decline=Отклонить
playingRightNow=Активная партия
finished=Закончено
abortGame=Отменить игру
gameAborted=Игра отменена
standard=Классические шахматы
unlimited=Без лимита времени
mode=Режим
casual=Без рейтинга
rated=Рейтинговая
thisGameIsRated=Игра на рейтинг
rematch=Реванш
rematchOfferSent=Предложение реванша отправлено
rematchOfferAccepted=Предложение реванша принято
rematchOfferCanceled=Предложение реванша отменено
rematchOfferDeclined=Предложение реванша отклонено
cancelRematchOffer=Отказаться от реванша
viewRematch=Посмотреть ответную игру
play=Играть
inbox=Входящие
chatRoom=Окно чата
spectatorRoom=Чат для зрителей
composeMessage=Написать сообщение
noNewMessages=Нет новых сообщений
subject=Тема
recipient=Получатель
send=Послать
incrementInSeconds=Прибавка в секундах
freeOnlineChess=Бесплатные онлайн-шахматы
spectators=Зрители:
nbWins=%s выиграно
nbLosses=%s проиграно
nbDraws=%s сыграно вничью
exportGames=Экспорт игр
ratingRange=Диапазон рейтинга
giveNbSeconds=Дать %s секунд
premoveEnabledClickAnywhereToCancel=Предварительный ход включен. Для отмены кликните в любом месте
thisPlayerUsesChessComputerAssistance=Этот игрок использует шахматную программу
thisPlayerArtificiallyIncreasesTheirRating=Этот игрок искусственно увеличивает свой рейтинг
opening=Дебют
takeback=Вернуть ход
proposeATakeback=Попросить соперника вернуть ход
takebackPropositionSent=Предложение возврата отправлено
takebackPropositionDeclined=Предложение возврата отклонено
takebackPropositionAccepted=Предложение возврата принято
takebackPropositionCanceled=Предложение возврата отменено
yourOpponentProposesATakeback=Ваш оппонент просит вернуть ход
bookmarkThisGame=Добавить игру в закладки
search=Поиск
advancedSearch=Расширенный поиск
tournament=Турнир
tournaments=Турниры
tournamentPoints=Турнирные очки
viewTournament=Просмотр турнира
backToTournament=Обратно в турнир
backToGame=Возврат к игре
freeOnlineChessGamePlayChessNowInACleanInterfaceNoRegistrationNoAdsNoPluginRequiredPlayChessWithComputerFriendsOrRandomOpponents=Бесплатные онлайн-шахматы. Играйте в шахматы прямо сейчас в простом интерфейсе без рекламы. Не требует регистрации и скачивания программы. Играйте в шахматы с компьютером, друзьями или случайными соперниками.
teams=Команды
nbMembers=%s участников
allTeams=Все команды
newTeam=Новая команда
myTeams=Мои команды
noTeamFound=Команда не найдена
joinTeam=Присоединиться к команде
quitTeam=Выйти из команды
anyoneCanJoin=Любой может присоединиться
aConfirmationIsRequiredToJoin=Для присоединения требуется подтверждение
joiningPolicy=Условия членства
teamLeader=Лидер команды
teamBestPlayers=Лучшие игроки команды
teamRecentMembers=Новые члены команды
xJoinedTeamY=%s присоединился к команде %s
xCreatedTeamY=%s создал команду %s
averageElo=Средний рейтинг
location=Местоположение
settings=Настройки
filterGames=Фильтр партий
reset=Сбросить
apply=Применить
leaderboard=Лучшие игроки
pasteTheFenStringHere=Вставьте строку в формате FEN
pasteThePgnStringHere=Вставьте строку в формате PGN
fromPosition=С позиции
continueFromHere=Продолжить с данного места
importGame=Импорт игры
nbImportedGames=%s Импортированные игры
nbRelayedGames=%s Похожие игры
thisIsAChessCaptcha=Это шахматная CAPTCHA.
clickOnTheBoardToMakeYourMove=Кликните по доске, чтобы сделать ход и доказать, что вы человек.
notACheckmate=Это не мат
colorPlaysCheckmateInOne=%s начинают; мат в один ход
retry=Повторить
reconnecting=Переподключение
onlineFriends=Друзья онлайн
noFriendsOnline=Нет друзей онлайн
findFriends=Найти друзей
favoriteOpponents=Предпочтительные соперники
follow=Подписаться
following=Подписаны
unfollow=Отписаться
block=Заблокировать
blocked=Заблокированные
unblock=Разблокировать
followsYou=Подписаны на вас
xStartedFollowingY=%s подписался на %s
nbFollowers=%s подписчики
nbFollowing=%s подписан
more=Ещё
memberSince=Дата регистрации
lastLogin=Последнее посещение
challengeToPlay=Вызвать на игру
player=Игрок
list=Список
graph=График
lessThanNbMinutes=Менее %s минут
xToYMinutes=От %s до %s минут
textIsTooShort=Текст слишком короткий.
textIsTooLong=Текст слишком длинный.
required=Требуется заполнить.
openTournaments=Открытые турниры
duration=Длительность
winner=Победитель
standing=Турнирная таблица
createANewTournament=Создать новый турнир
join=Присоединиться
withdraw=Покинуть
points=Очки
wins=Победы
losses=Поражения
winStreak=Серия побед
createdBy=Создан
tournamentIsStarting=Турнир начинается
membersOnly=Только для зарегистрированных
boardEditor=Редактор доски
startPosition=Начальная позиция
clearBoard=Очистить доску
savePosition=Сохранить позицию
loadPosition=Загрузить позицию
isPrivate=Закрытый
reportXToModerators=Сообщить о %s модераторам
profile=Профиль
editProfile=Редактировать профиль
firstName=Имя
lastName=Фамилия
biography=Биография
country=Страна
preferences=Предпочтения
watchLichessTV=Смотреть Lichess TV
previouslyOnLichessTV=Ранее на Lichess TV
todaysLeaders=Сегодняшние лидеры
onlinePlayers=Игроки в сети
progressToday=Прогресс сегодня
progressThisWeek=Прогресс на этой неделе
progressThisMonth=Прогресс в этом месяце
leaderboardThisWeek=Лидеры на этой неделе
leaderboardThisMonth=Лидеры этого месяца
activeToday=Активные сегодня
activeThisWeek=Активные на этой неделе
activePlayers=Активные игроки
bewareTheGameIsRatedButHasNoClock=Внимание, это рейтинговая игра без ограничения по времени!
training=Задачи
yourPuzzleRatingX=Ваш рейтинг в решении задач: %s
findTheBestMoveForWhite=Найдите лучший ход за белых.
findTheBestMoveForBlack=Найдите лучший ход за чёрных.
toTrackYourProgress=Для отслеживания прогресса:
trainingSignupExplanation=Lichess подберет задачи для вашего уровня, что позволит повысить эффективность тренировок.
recentlyPlayedPuzzles=Недавно решенные задачи
puzzleId=Задача %s
puzzleOfTheDay=Шахматная задача дня
clickToSolve=Нажмите чтобы решить
goodMove=Хороший ход
butYouCanDoBetter=Но вы можете найти лучше.
bestMove=Лучший ход!
keepGoing=Продолжайте...
puzzleFailed=Задача не решена.
butYouCanKeepTrying=Но вы можете попробовать еще раз.
victory=Победа!
giveUp=Сдаться
puzzleSolvedInXSeconds=Задача решена за %s секунд
wasThisPuzzleAnyGood=Была ли задача интересной?
pleaseVotePuzzle=Помогите сделать lichess лучше, голосуя при помощи стрелок вверх или вниз.
thankYou=Спасибо!
ratingX=Рейтинг %s
playedXTimes=Решено %s раз
fromGameLink=Из игры %s
startTraining=Начать тренировку
continueTraining=Продолжить тренировку
retryThisPuzzle=Попробовать еще раз
thisPuzzleIsCorrect=Задача правильная и интересная
thisPuzzleIsWrong=Задача неправильная или неинтересная
youHaveNbSecondsToMakeYourFirstMove=У Вас %s секунд, чтобы сделать свой первый ход!
nbGamesInPlay=%s ведется партий
automaticallyProceedToNextGameAfterMoving=Автоматически переходить к следующей игре после хода
autoSwitch=Автосмена
openingId=Дебют %s
yourOpeningRatingX=Ваш дебютный рейтинг: %s
findNbStrongMoves=Найдите сильные ходы: %s
thisMoveGivesYourOpponentTheAdvantage=Этот ход даёт вашему сопернику преимущество
openingFailed=Дебют проигран
openingSolved=Дебют решён
recentlyPlayedOpenings=Недавно сыгранные дебюты
puzzles=Головоломки
coordinates=Координаты
openings=Дебюты
latestUpdates=Последние обновления
tournamentWinners=Победители турнира
name=Имя
description=Описание
no=Нет
yes=Да
help=Помощь
createANewTopic=Создать новую тему
topics=Темы
posts=Посты
lastPost=Последний пост
views=Прочитано
replies=Ответы
replyToThisTopic=Принять участие в обсуждении
reply=Ответ
message=Сообщение
createTheTopic=Создать тему
reportAUser=Пожаловаться на пользователя
user=Пользователь
reason=Причина
whatIsIheMatter=В чем дело?
cheat=Жульничество
insult=Оскорбление
troll=Троллинг
other=Другое
reportDescriptionHelp=Вставить ссылку на игру и объяснить, что неправильного в поведении пользователя.
by=опубликовал %s
thisTopicIsNowClosed=Эта тема сейчас закрыта.
theming=Настройка темы
donate=Сделать пожертвование
blog=Блог
map=Карта
realTimeWorldMapOfChessMoves=Карта шахматных ходов в реальном времени
questionsAndAnswers=Вопросы и Ответы
notes=Заметки
typePrivateNotesHere=Здесь вы можете оставить заметки об игре (доступно только вам)
gameDisplay=Игровой дисплей
pieceAnimation=Анимация фигур
materialDifference=Показывать разницу в материале
closeAccount=Удалить аккаунт
closeYourAccount=Удаление аккаунта
changedMindDoNotCloseAccount=Я передумал, не удаляйте мой аккаунт
closeAccountExplanation=Вы действительно желаете удалить свой аккаунт? Удаление аккаунта невозможно отменить. Вы больше не сможете зайти в игру, и ваша страница больше не будет доступна.
thisAccountIsClosed=Ваш аккаунт удален.
invalidUsernameOrPassword=Неправильное имя или пароль
emailMeALink=Выслать ссылку
currentPassword=Текущий пароль
newPassword=Новый пароль
newPasswordAgain=Новый пароль (повтор)
boardHighlights=Подсветка (последний ход и шах)
pieceDestinations=Показывать все возможные ходы
boardCoordinates=Координаты доски (A-H, 1-8)
moveListWhilePlaying=Показывать список ходов
chessClock=Часы
tenthsOfSeconds=Десятые секунд
never=Никогда
whenTimeRemainingLessThanTenSeconds=Когда остается меньше 10 секунд
horizontalGreenProgressBars=Горизонтальный зелёный индикатор прогресса
soundWhenTimeGetsCritical=Звук, когда время подходит к концу
gameBehavior=Настройки игры
premovesPlayingDuringOpponentTurn=Предварительный ход (пока ходит противник)
takebacksWithOpponentApproval=Возвраты (с согласия противника)
promoteToQueenAutomatically=Пешка превращается в Ферзя автоматически
claimDrawOnThreefoldRepetitionAutomatically=Объявлять ничью после %s%s трёхкратного повторения позиции
privacy=Приватность
letOtherPlayersFollowYou=Позволить другим наблюдать за мной
letOtherPlayersChallengeYou=Другие игроки могут пригласить меня на игру
sound=Звук
soundControlInTheTopBarOfEveryPage=Контроль звука в правом верхнем углу каждой страницы.
yourPreferencesHaveBeenSaved=Ваши настройки сохранены.
none=Нет
fast=Быстрая
normal=Нормальная
slow=Медленная
insideTheBoard=Внутри поля
outsideTheBoard=Вне поля
onSlowGames=В медленных играх
always=Всегда
inCasualGamesOnly=Только в играх без рейтинга
whenPremoving=Когда сделан предварительный ход
whenTimeRemainingLessThanThirtySeconds=Когда остается меньше 30 секунд
difficultyEasy=Легкий
difficultyNormal=Нормальный
difficultyHard=Сложный
xLeftANoteOnY=%s оставил заметку о %s
xCompetesInY=%s участвует в %s
xAskedY=%s спрашивает %s
xAnsweredY=%s ответил %s
xCommentedY=%s откомментировал %s
timeline=Дневник
seeAllTournaments=Видеть все турниры
starting=Начинается:
allInformationIsPublicAndOptional=Вся информация публична и опциональна.
yourCityRegionOrDepartment=Ваш город, область или округ.
biographyDescription=Расскажите о себе, что вы любите в шахматах, ваши любимые дебюты, партии, игроки...
maximumNbCharacters=Максимум: %s символов.
blocks=%s заблокировано
listBlockedPlayers=Список заблокированных вами игроков
human=Человек
computer=Компьютер
side=Сторона
clock=Часы
unauthorizedError=Неавторизованный доступ
noInternetConnection=Нет интернет соединения. Вы можете играть оффлайн из меню.
connectedToLichess=Сейчас вы подключены к lichess.org
signedOut=Вы вышли.
loginSuccessful=Войти успешный
playOnTheBoardOffline=Играйте оффлайн
playOfflineComputer=Играть с компьютером оффлайн
opponent=Соперник
learn=Обучение
community=Сообщество
tools=Инструменты
increment=Инкремент
board=Доска
pieces=Фигуры
sharePGN=Экспорт PGN
playOnline=Играть онлайн
playOffline=Играть офлайн
allowAnalytics=Разрешить сбор статистики
shareGameURL=Дать URL игры
error.required=Заполните это поле
error.email=Адрес электронной почты является недействительным
error.email_acceptable=Адрес электронной почты не является приемлемым
error.email_unique=Адрес электронной почты занят
blindfoldChess=Играть с завязанными глазами(невидимые части)
moveConfirmation=Подтвердить ход
inCorrespondenceGames=В игре по переписке
ifRatingIsPlusMinusX=Если рейтинг ± %s
onlyFriends=Только друзья
menu=Меню
castling=Рокировка
whiteCastlingKingside=Короткая рокировка белых
whiteCastlingQueenside=Длинная рокировка белых
blackCastlingKingside=Короткая рокировка черных
blackCastlingQueenside=Длинная рокировка черных
nbForumPosts=%s посты на форуме
tpTimeSpentPlaying=время игры: %s
watchGames=Смотреть игры
tpTimeSpentOnTV=время на ТВ: %s
watch=Смотреть
internationalEvents=Международные события
videoLibrary=Видеотека
mobileApp=Мобильное приложение
webmasters=Разработчики
contribute=Вклад
contact=Контакт
termsOfService=Тип работы
sourceCode=Исходный код
simultaneousExhibitions=Сеанс одновременной игры
host=Сеансер
createdSimuls=Недавно созданные сеансы одновременной игры
hostANewSimul=Создать новый сеанс одновременной игры
noSimulFound=Сеанс одновременной игры не найден
noSimulExplanation=Сеанс одновременной игры не создан.
returnToSimulHomepage=Вернуться на страницу сеансов
aboutSimul=Сеанс одновременной игры включает одного игрока против нескольких
aboutSimulImage=Против 50 противников, Фишер выиграл 47 игр, сыграл вничью 2 и проиграл 1.
aboutSimulRealLife=Идея взята из реальных мероприятий. В реальной жизни сеансер ходит от одной доски к другой делая по одному ходу.
aboutSimulRules=Когда сеанс одновременной игры начинается, каждый игрок начинает игру с сеансером, который играет белыми фигурами. Сеанс одновременной игры заканчивается, когда все игры завершены.
aboutSimulSettings=Сеансы всегда случайны. Повторные матчи, тайбрейки и доигрывания исключены.
create=Создавать
whenCreateSimul=Когда вы создаете сеанс одновременной игры, Вы играете с несколькими соперниками одновременно.
joinExistingSimul=С другой стороны, присоединяйтесь к существующему сеансу
simulVariantsHint=Если вы выбираете несколько вариантов, каждый игрок выбирает как играть.
simulClockHint=Настройки часов Фишера. Чем больше игроков вы приглашаете, тем больше времени вам надо.
simulAddExtraTime=Вы можете добавить дополнительное время на ваши часы чтобы справиться с сеансом.
simulHostExtraTime=Дополнительное время часов
lichessTournaments=Личесс турниры
tournamentFAQ=Арена турниры Часто задаваемые вопросы
tournamentOfficial=Официально
timeBeforeTournamentStarts=Время до начала турнира
|
class Ctags < Formula
desc "Reimplementation of ctags(1)"
homepage "https://ctags.sourceforge.io/"
revision 1
stable do
url "https://downloads.sourceforge.net/ctags/ctags-5.8.tar.gz"
sha256 "0e44b45dcabe969e0bbbb11e30c246f81abe5d32012db37395eb57d66e9e99c7"
# also fixes https://sourceforge.net/p/ctags/bugs/312/
# merged upstream but not yet in stable
patch :p2 do
url "https://gist.githubusercontent.com/naegelejd/9a0f3af61954ae5a77e7/raw/16d981a3d99628994ef0f73848b6beffc70b5db8/Ctags%20r782"
sha256 "26d196a75fa73aae6a9041c1cb91aca2ad9d9c1de8192fce8cdc60e4aaadbcbb"
end
end
bottle do
cellar :any_skip_relocation
sha256 "282071fe9d3d877b5c72a9477c5c3f6bae6d04d0d1d5f8acc23dac83f0c91292" => :sierra
sha256 "e1582f148434de71bfa2516f6fad0598b41115f21164ad59c847e3282d550586" => :el_capitan
sha256 "1ba38746fe55be78781dcf313977b60f242ed42d412bbaf96627daf24d9fd168" => :yosemite
sha256 "9904dcc6f32a8f52d900339ff11ba4c9cb3e67374e558bb2abcc777fe56d49b5" => :mavericks
sha256 "b3619b0231eb952ee7c768dbb82e2301ece1060f8c713e781767cc700f02b2f2" => :mountain_lion
end
head do
url "https://svn.code.sf.net/p/ctags/code/trunk"
depends_on "autoconf" => :build
end
# fixes https://sourceforge.net/p/ctags/bugs/312/
patch :p2, :DATA
def install
if build.head?
system "autoheader"
system "autoconf"
end
system "./configure", "--prefix=#{prefix}",
"--enable-macro-patterns",
"--mandir=#{man}",
"--with-readlib"
system "make", "install"
end
def caveats
<<-EOS.undent
Under some circumstances, emacs and ctags can conflict. By default,
emacs provides an executable `ctags` that would conflict with the
executable of the same name that ctags provides. To prevent this,
Homebrew removes the emacs `ctags` and its manpage before linking.
However, if you install emacs with the `--keep-ctags` option, then
the `ctags` emacs provides will not be removed. In that case, you
won't be able to install ctags successfully. It will build but not
link.
EOS
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <stdio.h>
#include <stdlib.h>
void func()
{
printf("Hello World!");
}
int main()
{
func();
return 0;
}
EOS
system "#{bin}/ctags", "-R", "."
assert_match /func.*test\.c/, File.read("tags")
end
end
__END__
diff -ur a/ctags-5.8/read.c b/ctags-5.8/read.c
--- a/ctags-5.8/read.c 2009-07-04 17:29:02.000000000 +1200
+++ b/ctags-5.8/read.c 2012-11-04 16:19:27.000000000 +1300
@@ -18,7 +18,6 @@
#include <string.h>
#include <ctype.h>
-#define FILE_WRITE
#include "read.h"
#include "debug.h"
#include "entry.h"
diff -ur a/ctags-5.8/read.h b/ctags-5.8/read.h
--- a/ctags-5.8/read.h 2008-04-30 13:45:57.000000000 +1200
+++ b/ctags-5.8/read.h 2012-11-04 16:19:18.000000000 +1300
@@ -11,12 +11,6 @@
#ifndef _READ_H
#define _READ_H
-#if defined(FILE_WRITE) || defined(VAXC)
-# define CONST_FILE
-#else
-# define CONST_FILE const
-#endif
-
/*
* INCLUDE FILES
*/
@@ -95,7 +89,7 @@
/*
* GLOBAL VARIABLES
*/
-extern CONST_FILE inputFile File;
+extern inputFile File;
/*
* FUNCTION PROTOTYPES
ctags: update 5.8_1 bottle.
class Ctags < Formula
desc "Reimplementation of ctags(1)"
homepage "https://ctags.sourceforge.io/"
revision 1
stable do
url "https://downloads.sourceforge.net/ctags/ctags-5.8.tar.gz"
sha256 "0e44b45dcabe969e0bbbb11e30c246f81abe5d32012db37395eb57d66e9e99c7"
# also fixes https://sourceforge.net/p/ctags/bugs/312/
# merged upstream but not yet in stable
patch :p2 do
url "https://gist.githubusercontent.com/naegelejd/9a0f3af61954ae5a77e7/raw/16d981a3d99628994ef0f73848b6beffc70b5db8/Ctags%20r782"
sha256 "26d196a75fa73aae6a9041c1cb91aca2ad9d9c1de8192fce8cdc60e4aaadbcbb"
end
end
bottle do
rebuild 1
sha256 "56bc233d09bc3591ad1f3a9c5282f9f9cf0729b0d5a0ee001d4ea6f68f2b0ab7" => :sierra
sha256 "a17ee0cd08909484aeeca9177b356e14655d5f75ecaa4b36a3bd2e2248d8ac91" => :el_capitan
end
head do
url "https://svn.code.sf.net/p/ctags/code/trunk"
depends_on "autoconf" => :build
end
# fixes https://sourceforge.net/p/ctags/bugs/312/
patch :p2, :DATA
def install
if build.head?
system "autoheader"
system "autoconf"
end
system "./configure", "--prefix=#{prefix}",
"--enable-macro-patterns",
"--mandir=#{man}",
"--with-readlib"
system "make", "install"
end
def caveats
<<-EOS.undent
Under some circumstances, emacs and ctags can conflict. By default,
emacs provides an executable `ctags` that would conflict with the
executable of the same name that ctags provides. To prevent this,
Homebrew removes the emacs `ctags` and its manpage before linking.
However, if you install emacs with the `--keep-ctags` option, then
the `ctags` emacs provides will not be removed. In that case, you
won't be able to install ctags successfully. It will build but not
link.
EOS
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <stdio.h>
#include <stdlib.h>
void func()
{
printf("Hello World!");
}
int main()
{
func();
return 0;
}
EOS
system "#{bin}/ctags", "-R", "."
assert_match /func.*test\.c/, File.read("tags")
end
end
__END__
diff -ur a/ctags-5.8/read.c b/ctags-5.8/read.c
--- a/ctags-5.8/read.c 2009-07-04 17:29:02.000000000 +1200
+++ b/ctags-5.8/read.c 2012-11-04 16:19:27.000000000 +1300
@@ -18,7 +18,6 @@
#include <string.h>
#include <ctype.h>
-#define FILE_WRITE
#include "read.h"
#include "debug.h"
#include "entry.h"
diff -ur a/ctags-5.8/read.h b/ctags-5.8/read.h
--- a/ctags-5.8/read.h 2008-04-30 13:45:57.000000000 +1200
+++ b/ctags-5.8/read.h 2012-11-04 16:19:18.000000000 +1300
@@ -11,12 +11,6 @@
#ifndef _READ_H
#define _READ_H
-#if defined(FILE_WRITE) || defined(VAXC)
-# define CONST_FILE
-#else
-# define CONST_FILE const
-#endif
-
/*
* INCLUDE FILES
*/
@@ -95,7 +89,7 @@
/*
* GLOBAL VARIABLES
*/
-extern CONST_FILE inputFile File;
+extern inputFile File;
/*
* FUNCTION PROTOTYPES
|
# frozen_string_literal: true
# Security rules for the public pages
# Note the method names here correspond with controller actions
class PublicPagePolicy < ApplicationPolicy
# rubocop:disable Lint/MissingSuper
def initialize(user, record = nil)
@user = user
@record = record
end
# rubocop:enable Lint/MissingSuper
def plan_index?
true
end
def template_index?
true
end
def template_export?
@user.present? && @record.published?
end
def plan_export?
@record.publicly_visible?
end
def plan_organisationally_exportable?
if @record.is_a?(Plan) && @user.is_a?(User)
return @record.publicly_visible? ||
(@record.organisationally_visible? && @record.owner.present? &&
@record.owner.org_id == @user.org_id)
end
false
end
end
fix rubocop
# frozen_string_literal: true
# Security rules for the public pages
# Note the method names here correspond with controller actions
class PublicPagePolicy < ApplicationPolicy
# rubocop:disable Lint/MissingSuper
def initialize(user, record = nil)
@user = user
@record = record
end
# rubocop:enable Lint/MissingSuper
def plan_index?
true
end
def template_index?
true
end
def template_export?
@user.present? && @record.published?
end
def plan_export?
@record.publicly_visible?
end
def plan_organisationally_exportable?
if @record.is_a?(Plan) && @user.is_a?(User)
return @record.publicly_visible? ||
(@record.organisationally_visible? && @record.owner.present? &&
@record.owner.org_id == @user.org_id)
end
false
end
end
|
class Dante < Formula
desc "SOCKS server and client, implementing RFC 1928 and related standards"
homepage "https://www.inet.no/dante/"
url "https://www.inet.no/dante/files/dante-1.4.2.tar.gz"
sha256 "baa25750633a7f9f37467ee43afdf7a95c80274394eddd7dcd4e1542aa75caad"
bottle do
cellar :any
sha256 "036442d258ec7128e6ac6a31f6862afe0aebf16fec6f268a96a32c438e706086" => :sierra
sha256 "78d19f01354b73e82ccc3a3eb59c45fddf65969b6bf36e307bb7813eeef7c8f1" => :el_capitan
sha256 "6bb94dda6feae85c407e7779c34f20dc10bd9b2fd377660af7d1c6467735053d" => :yosemite
end
depends_on "miniupnpc" => :optional
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--sysconfdir=#{etc}/dante"
system "make", "install"
end
test do
system "#{sbin}/sockd", "-v"
end
end
dante: update 1.4.2 bottle.
class Dante < Formula
desc "SOCKS server and client, implementing RFC 1928 and related standards"
homepage "https://www.inet.no/dante/"
url "https://www.inet.no/dante/files/dante-1.4.2.tar.gz"
sha256 "baa25750633a7f9f37467ee43afdf7a95c80274394eddd7dcd4e1542aa75caad"
bottle do
cellar :any
sha256 "a34bdf64962d79c16db11fa8c30254c1639258771278d665efdb11dc6cce9e5d" => :high_sierra
sha256 "036442d258ec7128e6ac6a31f6862afe0aebf16fec6f268a96a32c438e706086" => :sierra
sha256 "78d19f01354b73e82ccc3a3eb59c45fddf65969b6bf36e307bb7813eeef7c8f1" => :el_capitan
sha256 "6bb94dda6feae85c407e7779c34f20dc10bd9b2fd377660af7d1c6467735053d" => :yosemite
end
depends_on "miniupnpc" => :optional
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--sysconfdir=#{etc}/dante"
system "make", "install"
end
test do
system "#{sbin}/sockd", "-v"
end
end
|
class FinderPresenter
include ActionView::Helpers::FormOptionsHelper
include ActionView::Helpers::UrlHelper
attr_reader :content_item, :name, :slug, :organisations, :values, :keywords, :links
MOST_RECENT_FIRST = "-public_timestamp".freeze
def initialize(content_item, search_results, values = {})
@content_item = content_item
@search_results = search_results
@name = content_item['title']
@slug = content_item['base_path']
@links = content_item['links']
@organisations = content_item['links'].fetch('organisations', [])
@values = values
facets.values = values
@keywords = values["keywords"].presence
end
def phase_message
content_item['details']['beta_message'] || content_item['details']['alpha_message']
end
def phase
content_item['phase']
end
def show_phase_banner?
content_item['phase'].in?(%w[alpha beta])
end
def default_order
content_item['details']['default_order']
end
def document_noun
content_item['details']['document_noun']
end
def hide_facets_by_default
content_item['details']['hide_facets_by_default'] || false
end
def human_readable_finder_format
content_item['details']['human_readable_finder_format']
end
def filter
content_item['details']['filter']
end
def sort
content_item['details']['sort']
end
def logo_path
content_item['details']['logo_path']
end
def summary
content_item['details']['summary']
end
def pagination
documents_per_page = content_item['details']['default_documents_per_page']
return nil unless documents_per_page
start_offset = search_results['start']
total_results = search_results['total']
{
'current_page' => (start_offset / documents_per_page) + 1,
'total_pages' => (total_results / documents_per_page.to_f).ceil,
}
end
def email_alert_signup
if content_item['links']['email_alert_signup']
content_item['links']['email_alert_signup'].first
end
end
def email_alert_signup_url
signup_link = content_item['details']['signup_link']
return signup_link if signup_link.present?
"#{email_alert_signup['web_url']}#{alert_query_string}" if email_alert_signup
end
def facets
@facets ||= FacetCollection.new(
raw_facets.map do |facet|
FacetParser.parse(facet)
end
)
end
def raw_facets
@raw_facets ||= FacetExtractor.for(content_item).extract
end
def facet_details_lookup
return @facet_details_lookup if @facet_details_lookup
facet_hases = raw_facets.map do |facet|
facet_name = facet['name']
facet_key = facet['key']
facet.fetch('allowed_values', []).to_h do |value|
[value['content_id'], {
id: facet_key,
name: facet_name,
key: facet_key,
type: 'content_id'
}]
end
end
@facet_details_lookup = facet_hases.reduce({}, :merge)
end
def facet_value_lookup
return @facet_value_lookup if @facet_value_lookup
facet_values = raw_facets.map { |f| f['allowed_values'] || [] }
@facet_value_lookup = facet_values.flatten.to_h do |val|
[val['content_id'], val['value']]
end
end
def filters
facets.filters
end
def government?
slug.starts_with?("/government")
end
def government_content_section
slug.split('/')[2]
end
def display_metadata?
!eu_exit_finder
end
def metadata
facets.metadata
end
def date_metadata_keys
metadata.select { |f| f.type == "date" }.map(&:key)
end
def text_metadata_keys
metadata.select { |f| f.type == "text" }.map(&:key)
end
def default_sort_option
sort
&.detect { |option| option['default'] }
end
def default_sort_option_value
default_sort_option
&.dig('name')
&.parameterize
end
def default_sort_option_key
default_sort_option
&.dig('key')
end
def relevance_sort_option
sort
&.detect { |option| %w(relevance -relevance).include?(option['key']) }
end
def relevance_sort_option_value
relevance_sort_option
&.dig('name')
&.parameterize
end
def sort_options
return [] if sort.blank?
options = sort.collect do |option|
[
option['name'],
option['name'].parameterize,
{
'data-track-category' => 'dropDownClicked',
'data-track-action' => 'clicked',
'data-track-label' => option['name']
}
]
end
disabled_option = keywords.blank? ? relevance_sort_option_value : ''
selected_option = if values['order'].present? && sort.any? { |option| option['name'].parameterize == values['order'] }
values['order']
else
default_sort_option_value
end
options_for_select(options, selected: selected_option, disabled: disabled_option)
end
def show_keyword_search?
keywords.present? || facets.any? || results.total.positive?
end
def show_summaries?
content_item['details']['show_summaries']
end
def page_metadata
metadata = {
part_of: part_of,
from: from,
other: other,
}
metadata.reject { |_, links| links.blank? }
end
def related
related = content_item['links']['related'] || []
related.sort_by { |link| link['title'] }
end
def results
@results ||= ResultSetParser.parse(
search_results.fetch("results"),
search_results.fetch("total"),
self,
)
end
def label_for_metadata_key(key)
facet = metadata.find { |f| f.key == key }
facet.short_name || facet.key.humanize
end
def display_key_for_metadata_key(key)
if %w[organisations document_collections].include?(key)
'title'
else
'label'
end
end
def atom_feed_enabled?
if sort_options.present?
default_sort_option.blank? || default_sort_option_key == MOST_RECENT_FIRST
else
default_order.blank? || default_order == MOST_RECENT_FIRST
end
end
def atom_url
"#{slug}.atom#{alert_query_string}" if atom_feed_enabled?
end
def description
content_item['description']
end
def canonical_link?
content_item['details']['canonical_link']
end
private
attr_reader :search_results
def part_of
content_item['links']['part_of'] || []
end
def people
content_item['links']['people'] || []
end
def working_groups
content_item['links']['working_groups'] || []
end
def from
organisations + people + working_groups
end
def other
if applicable_nations_html_fragment
{ "Applies to" => applicable_nations_html_fragment }
end
end
def applicable_nations_html_fragment
nation_applicability = content_item['details']['nation_applicability']
if nation_applicability
applies_to = nation_applicability['applies_to'].map(&:titlecase)
alternative_policies = nation_applicability['alternative_policies'].map do |alternative|
link_to(alternative['nation'].titlecase, alternative['alt_policy_url'], ({ rel: 'external' } if is_external?(alternative['alt_policy_url'])))
end
if alternative_policies.any?
"#{applies_to.to_sentence} (see policy for #{alternative_policies.to_sentence})".html_safe
else
applies_to.to_sentence
end
end
end
def is_external?(href)
URI.parse(href).host != "www.gov.uk"
end
def alert_query_string
facets_with_filters = facets.select(&:has_filters?)
facets_with_values = facets_with_filters.reject { |facet|
facet.value.nil? ||
facet.value.is_a?(Hash) && facet.value.values.all?(&:blank?) ||
facet.value.is_a?(Array) && facet.value.empty?
}
filtered_values = facets_with_values.each_with_object({}) { |facet, hash|
hash[facet.key] = facet.value
}
query_string = filtered_values.to_query
query_string.blank? ? query_string : "?#{query_string}"
end
# FIXME: This should be removed once we have a way to determine
# whether to display metadata in the finder definition
def eu_exit_finder
slug == "/find-eu-exit-guidance-business"
end
end
Tidy methods and fix typo
class FinderPresenter
include ActionView::Helpers::FormOptionsHelper
include ActionView::Helpers::UrlHelper
attr_reader :content_item, :name, :slug, :organisations, :values, :keywords, :links
MOST_RECENT_FIRST = "-public_timestamp".freeze
def initialize(content_item, search_results, values = {})
@content_item = content_item
@search_results = search_results
@name = content_item['title']
@slug = content_item['base_path']
@links = content_item['links']
@organisations = content_item['links'].fetch('organisations', [])
@values = values
facets.values = values
@keywords = values["keywords"].presence
end
def phase_message
content_item['details']['beta_message'] || content_item['details']['alpha_message']
end
def phase
content_item['phase']
end
def show_phase_banner?
content_item['phase'].in?(%w[alpha beta])
end
def default_order
content_item['details']['default_order']
end
def document_noun
content_item['details']['document_noun']
end
def hide_facets_by_default
content_item['details']['hide_facets_by_default'] || false
end
def human_readable_finder_format
content_item['details']['human_readable_finder_format']
end
def filter
content_item['details']['filter']
end
def sort
content_item['details']['sort']
end
def logo_path
content_item['details']['logo_path']
end
def summary
content_item['details']['summary']
end
def pagination
documents_per_page = content_item['details']['default_documents_per_page']
return nil unless documents_per_page
start_offset = search_results['start']
total_results = search_results['total']
{
'current_page' => (start_offset / documents_per_page) + 1,
'total_pages' => (total_results / documents_per_page.to_f).ceil,
}
end
def email_alert_signup
if content_item['links']['email_alert_signup']
content_item['links']['email_alert_signup'].first
end
end
def email_alert_signup_url
signup_link = content_item['details']['signup_link']
return signup_link if signup_link.present?
"#{email_alert_signup['web_url']}#{alert_query_string}" if email_alert_signup
end
def facets
@facets ||= FacetCollection.new(
raw_facets.map do |facet|
FacetParser.parse(facet)
end
)
end
def raw_facets
@raw_facets ||= FacetExtractor.for(content_item).extract
end
def facet_details_lookup
@facet_details_lookup ||= begin
facet_hashes = raw_facets.map do |facet|
facet_name = facet['name']
facet_key = facet['key']
facet.fetch('allowed_values', []).to_h do |value|
[value['content_id'], {
id: facet_key,
name: facet_name,
key: facet_key,
type: 'content_id'
}]
end
end
facet_hashes.reduce({}, :merge)
end
end
def facet_value_lookup
@facet_value_lookup ||= begin
facet_values = raw_facets.map { |f| f['allowed_values'] || [] }
@facet_value_lookup = facet_values.flatten.to_h do |val|
[val['content_id'], val['value']]
end
end
end
def filters
facets.filters
end
def government?
slug.starts_with?("/government")
end
def government_content_section
slug.split('/')[2]
end
def display_metadata?
!eu_exit_finder
end
def metadata
facets.metadata
end
def date_metadata_keys
metadata.select { |f| f.type == "date" }.map(&:key)
end
def text_metadata_keys
metadata.select { |f| f.type == "text" }.map(&:key)
end
def default_sort_option
sort
&.detect { |option| option['default'] }
end
def default_sort_option_value
default_sort_option
&.dig('name')
&.parameterize
end
def default_sort_option_key
default_sort_option
&.dig('key')
end
def relevance_sort_option
sort
&.detect { |option| %w(relevance -relevance).include?(option['key']) }
end
def relevance_sort_option_value
relevance_sort_option
&.dig('name')
&.parameterize
end
def sort_options
return [] if sort.blank?
options = sort.collect do |option|
[
option['name'],
option['name'].parameterize,
{
'data-track-category' => 'dropDownClicked',
'data-track-action' => 'clicked',
'data-track-label' => option['name']
}
]
end
disabled_option = keywords.blank? ? relevance_sort_option_value : ''
selected_option = if values['order'].present? && sort.any? { |option| option['name'].parameterize == values['order'] }
values['order']
else
default_sort_option_value
end
options_for_select(options, selected: selected_option, disabled: disabled_option)
end
def show_keyword_search?
keywords.present? || facets.any? || results.total.positive?
end
def show_summaries?
content_item['details']['show_summaries']
end
def page_metadata
metadata = {
part_of: part_of,
from: from,
other: other,
}
metadata.reject { |_, links| links.blank? }
end
def related
related = content_item['links']['related'] || []
related.sort_by { |link| link['title'] }
end
def results
@results ||= ResultSetParser.parse(
search_results.fetch("results"),
search_results.fetch("total"),
self,
)
end
def label_for_metadata_key(key)
facet = metadata.find { |f| f.key == key }
facet.short_name || facet.key.humanize
end
def display_key_for_metadata_key(key)
if %w[organisations document_collections].include?(key)
'title'
else
'label'
end
end
def atom_feed_enabled?
if sort_options.present?
default_sort_option.blank? || default_sort_option_key == MOST_RECENT_FIRST
else
default_order.blank? || default_order == MOST_RECENT_FIRST
end
end
def atom_url
"#{slug}.atom#{alert_query_string}" if atom_feed_enabled?
end
def description
content_item['description']
end
def canonical_link?
content_item['details']['canonical_link']
end
private
attr_reader :search_results
def part_of
content_item['links']['part_of'] || []
end
def people
content_item['links']['people'] || []
end
def working_groups
content_item['links']['working_groups'] || []
end
def from
organisations + people + working_groups
end
def other
if applicable_nations_html_fragment
{ "Applies to" => applicable_nations_html_fragment }
end
end
def applicable_nations_html_fragment
nation_applicability = content_item['details']['nation_applicability']
if nation_applicability
applies_to = nation_applicability['applies_to'].map(&:titlecase)
alternative_policies = nation_applicability['alternative_policies'].map do |alternative|
link_to(alternative['nation'].titlecase, alternative['alt_policy_url'], ({ rel: 'external' } if is_external?(alternative['alt_policy_url'])))
end
if alternative_policies.any?
"#{applies_to.to_sentence} (see policy for #{alternative_policies.to_sentence})".html_safe
else
applies_to.to_sentence
end
end
end
def is_external?(href)
URI.parse(href).host != "www.gov.uk"
end
def alert_query_string
facets_with_filters = facets.select(&:has_filters?)
facets_with_values = facets_with_filters.reject { |facet|
facet.value.nil? ||
facet.value.is_a?(Hash) && facet.value.values.all?(&:blank?) ||
facet.value.is_a?(Array) && facet.value.empty?
}
filtered_values = facets_with_values.each_with_object({}) { |facet, hash|
hash[facet.key] = facet.value
}
query_string = filtered_values.to_query
query_string.blank? ? query_string : "?#{query_string}"
end
# FIXME: This should be removed once we have a way to determine
# whether to display metadata in the finder definition
def eu_exit_finder
slug == "/find-eu-exit-guidance-business"
end
end
|
class ReportPresenter < Burgundy::Item
def developments
item.results
end
def fields
[numeric_fields, boolean_fields].flatten
end
def numeric_fields
%i( tothu singfamhu twnhsmmult lgmultifam commsf
fa_ret fa_ofcmd fa_indmf fa_whs
fa_rnd fa_edinst fa_other fa_hotel hotelrms )
end
def boolean_fields
%i( rdv asofright phased cancelled
ovr55 clusteros stalled )
end
def projected
statuses.projected
end
def planning
statuses.planning
end
def in_construction
statuses.in_construction
end
def completed
statuses.completed
end
def status_keys
Development.status.values
end
def statuses
@statuses ||= OpenStruct.new(prepare_statuses)
end
def criteria
query
end
def to_csv
DevelopmentsSerializer.new(developments).to_csv
end
private
def prepare_statuses
statuses = {}
Development.status.values.each {|status|
statuses[status.to_sym] = prepare_values(status)
}
statuses
end
def prepare_values(status)
devs = developments.where(status: status)
attrs = [[:name, status.to_s.titleize], [:count, devs.size]]
numeric_fields.each do |attribute|
attrs << [attribute, devs.pluck(attribute).compact.sum]
end
boolean_fields.each do |attribute|
attrs << [attribute, devs.where(attribute => true).count]
end
Hash[attrs]
end
end
Limit exportable search results to 100. Doing significantly more than that causes the request to timeout and break Heroku. Let's avoid breaking the app for now, and add in background jobs later.
class ReportPresenter < Burgundy::Item
EXPORT_RESULT_LIMIT = 100
def developments
item.results
end
def fields
[numeric_fields, boolean_fields].flatten
end
def numeric_fields
%i( tothu singfamhu twnhsmmult lgmultifam commsf
fa_ret fa_ofcmd fa_indmf fa_whs
fa_rnd fa_edinst fa_other fa_hotel hotelrms )
end
def boolean_fields
%i( rdv asofright phased cancelled
ovr55 clusteros stalled )
end
def projected
statuses.projected
end
def planning
statuses.planning
end
def in_construction
statuses.in_construction
end
def completed
statuses.completed
end
def status_keys
Development.status.values
end
def statuses
@statuses ||= OpenStruct.new(prepare_statuses)
end
def criteria
query
end
def to_csv
DevelopmentsSerializer.new(developments.first(EXPORT_RESULT_LIMIT)).to_csv
end
private
def prepare_statuses
statuses = {}
Development.status.values.each {|status|
statuses[status.to_sym] = prepare_values(status)
}
statuses
end
def prepare_values(status)
devs = developments.where(status: status)
attrs = [[:name, status.to_s.titleize], [:count, devs.size]]
numeric_fields.each do |attribute|
attrs << [attribute, devs.pluck(attribute).compact.sum]
end
boolean_fields.each do |attribute|
attrs << [attribute, devs.where(attribute => true).count]
end
Hash[attrs]
end
end
|
class Dcraw < Formula
desc "Digital camera RAW photo decoding software"
homepage "https://www.cybercom.net/~dcoffin/dcraw/"
url "https://www.cybercom.net/~dcoffin/dcraw/archive/dcraw-9.27.0.tar.gz"
mirror "https://distfiles.macports.org/dcraw/dcraw-9.27.0.tar.gz"
mirror "https://mirror.csclub.uwaterloo.ca/MacPorts/mpdistfiles/dcraw/dcraw-9.27.0.tar.gz"
sha256 "c1d8cc4f19752a3d3aaab1fceb712ea85b912aa25f1f33f68c69cd42ef987099"
revision 1
bottle do
cellar :any
sha256 "fd86c81c35d07d7fc919b0835975cf2d09407c8d3802508092c2edf8aa1b76d1" => :sierra
sha256 "1bdb077f41630167865d8f9fdf08747c33fe429c4d09b8d1703791c1273accbd" => :el_capitan
sha256 "158f4c5794f21b39c2102b721425d9f69ffe78d0b86e28c73f6b36a4e84d44c8" => :yosemite
end
depends_on "jpeg"
depends_on "jasper"
depends_on "little-cms2"
def install
ENV.append_to_cflags "-I#{HOMEBREW_PREFIX}/include -L#{HOMEBREW_PREFIX}/lib"
system ENV.cc, "-o", "dcraw", ENV.cflags, "dcraw.c", "-lm", "-ljpeg", "-llcms2", "-ljasper"
bin.install "dcraw"
man1.install "dcraw.1"
end
test do
assert_match "\"dcraw\" v9", shell_output("#{bin}/dcraw", 1)
end
end
dcraw: revision for jpeg
class Dcraw < Formula
desc "Digital camera RAW photo decoding software"
homepage "https://www.cybercom.net/~dcoffin/dcraw/"
url "https://www.cybercom.net/~dcoffin/dcraw/archive/dcraw-9.27.0.tar.gz"
mirror "https://distfiles.macports.org/dcraw/dcraw-9.27.0.tar.gz"
mirror "https://mirror.csclub.uwaterloo.ca/MacPorts/mpdistfiles/dcraw/dcraw-9.27.0.tar.gz"
sha256 "c1d8cc4f19752a3d3aaab1fceb712ea85b912aa25f1f33f68c69cd42ef987099"
revision 2
bottle do
cellar :any
sha256 "fd86c81c35d07d7fc919b0835975cf2d09407c8d3802508092c2edf8aa1b76d1" => :sierra
sha256 "1bdb077f41630167865d8f9fdf08747c33fe429c4d09b8d1703791c1273accbd" => :el_capitan
sha256 "158f4c5794f21b39c2102b721425d9f69ffe78d0b86e28c73f6b36a4e84d44c8" => :yosemite
end
depends_on "jpeg"
depends_on "jasper"
depends_on "little-cms2"
def install
ENV.append_to_cflags "-I#{HOMEBREW_PREFIX}/include -L#{HOMEBREW_PREFIX}/lib"
system ENV.cc, "-o", "dcraw", ENV.cflags, "dcraw.c", "-lm", "-ljpeg", "-llcms2", "-ljasper"
bin.install "dcraw"
man1.install "dcraw.1"
end
test do
assert_match "\"dcraw\" v9", shell_output("#{bin}/dcraw", 1)
end
end
|
class Dcraw < Formula
desc "Digital camera RAW photo decoding software"
homepage "https://www.cybercom.net/~dcoffin/dcraw/"
url "https://www.cybercom.net/~dcoffin/dcraw/archive/dcraw-9.27.0.tar.gz"
mirror "https://distfiles.macports.org/dcraw/dcraw-9.27.0.tar.gz"
mirror "https://mirror.csclub.uwaterloo.ca/MacPorts/mpdistfiles/dcraw/dcraw-9.27.0.tar.gz"
sha256 "c1d8cc4f19752a3d3aaab1fceb712ea85b912aa25f1f33f68c69cd42ef987099"
revision 1
bottle do
cellar :any
sha256 "fd86c81c35d07d7fc919b0835975cf2d09407c8d3802508092c2edf8aa1b76d1" => :sierra
sha256 "1bdb077f41630167865d8f9fdf08747c33fe429c4d09b8d1703791c1273accbd" => :el_capitan
sha256 "158f4c5794f21b39c2102b721425d9f69ffe78d0b86e28c73f6b36a4e84d44c8" => :yosemite
end
depends_on "jpeg"
depends_on "jasper"
depends_on "little-cms2"
def install
ENV.append_to_cflags "-I#{HOMEBREW_PREFIX}/include -L#{HOMEBREW_PREFIX}/lib"
system ENV.cc, "-o", "dcraw", ENV.cflags, "dcraw.c", "-lm", "-ljpeg", "-llcms2", "-ljasper"
bin.install "dcraw"
man1.install "dcraw.1"
end
test do
assert_match "\"dcraw\" v9", shell_output("#{bin}/dcraw", 1)
end
end
dcraw: update 9.27.0_1 bottle for Linuxbrew.
Closes Linuxbrew/homebrew-core#3339.
Signed-off-by: Bob W. Hogg <c772a964fd55352a3510e5d535dd9ccc9ac30168@linux.com>
class Dcraw < Formula
desc "Digital camera RAW photo decoding software"
homepage "https://www.cybercom.net/~dcoffin/dcraw/"
url "https://www.cybercom.net/~dcoffin/dcraw/archive/dcraw-9.27.0.tar.gz"
mirror "https://distfiles.macports.org/dcraw/dcraw-9.27.0.tar.gz"
mirror "https://mirror.csclub.uwaterloo.ca/MacPorts/mpdistfiles/dcraw/dcraw-9.27.0.tar.gz"
sha256 "c1d8cc4f19752a3d3aaab1fceb712ea85b912aa25f1f33f68c69cd42ef987099"
revision 1
bottle do
cellar :any
sha256 "fd86c81c35d07d7fc919b0835975cf2d09407c8d3802508092c2edf8aa1b76d1" => :sierra
sha256 "1bdb077f41630167865d8f9fdf08747c33fe429c4d09b8d1703791c1273accbd" => :el_capitan
sha256 "158f4c5794f21b39c2102b721425d9f69ffe78d0b86e28c73f6b36a4e84d44c8" => :yosemite
sha256 "2aec484f9f354eef185dd0ace54f232c5f577a9656816ea1a0b8cc440bb90508" => :x86_64_linux
end
depends_on "jpeg"
depends_on "jasper"
depends_on "little-cms2"
def install
ENV.append_to_cflags "-I#{HOMEBREW_PREFIX}/include -L#{HOMEBREW_PREFIX}/lib"
system ENV.cc, "-o", "dcraw", ENV.cflags, "dcraw.c", "-lm", "-ljpeg", "-llcms2", "-ljasper"
bin.install "dcraw"
man1.install "dcraw.1"
end
test do
assert_match "\"dcraw\" v9", shell_output("#{bin}/dcraw", 1)
end
end
|
class Dirac < Formula
desc "General-purpose video codec aimed at a range of resolutions"
homepage "https://sourceforge.net/projects/dirac/"
url "https://downloads.sourceforge.net/project/dirac/dirac-codec/Dirac-1.0.2/dirac-1.0.2.tar.gz"
mirror "https://launchpad.net/ubuntu/+archive/primary/+files/dirac_1.0.2.orig.tar.gz"
mirror "https://mirrors.ocf.berkeley.edu/debian/pool/main/d/dirac/dirac_1.0.2.orig.tar.gz"
sha256 "816b16f18d235ff8ccd40d95fc5b4fad61ae47583e86607932929d70bf1f00fd"
bottle do
cellar :any
rebuild 1
sha256 "c018586bbfdeb10487adc1c62bdd74138b9d11195064bd2a07d458a55d770a06" => :mojave
sha256 "9413ec8e068d4c8e30d679a62af9779a09de385e2287acebacf9e5c56e80a50a" => :high_sierra
sha256 "09b846fe4069e971ec6d10668d97ac599cb555e5799f3ba3076d0d088e1f78cf" => :sierra
sha256 "8f4414614755f863d3ba0f43d6415684fbc00976ae24c7e45c88fe736be918d2" => :el_capitan
sha256 "1d3049d9dcdbd0116c65c54582601b20cdd17c8b89cf80e74efc79f71b641ca4" => :yosemite
sha256 "e7c407545085631c27c77f2d15abe84b3cc0a3645cf5e538aa15f0aacfe6de50" => :mavericks
end
# First two patches: the only two commits in the upstream repo not in 1.0.2
patch do
url "https://gist.githubusercontent.com/mistydemeo/da8a53abcf057c58b498/raw/bde69c5f07d871542dcb24792110e29e6418d2a3/unititialized-memory.patch"
sha256 "d5fcbb1b5c9f2f83935d71ebd312e98294121e579edbd7818e3865606da36e10"
end
patch do
url "https://gist.githubusercontent.com/mistydemeo/e729c459525d0d6e9e2d/raw/d9ff69c944b8bde006eef27650c0af36f51479f5/dirac-gcc-fixes.patch"
sha256 "52c40f2c8aec9174eba2345e6ba9689ced1b8f865c7ced23e7f7ee5fdd6502c3"
end
# HACK: the configure script, which assumes any compiler that
# starts with "cl" is a Microsoft compiler
patch :DATA
def install
# BSD cp doesn't have '-d'
inreplace "doc/Makefile.in", "cp -dR", "cp -R"
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make", "install"
end
end
__END__
diff --git a/configure b/configure
index 41329b9..8f5ed19 100755
--- a/configure
+++ b/configure
@@ -15903,30 +15903,8 @@ ACLOCAL_AMFLAGS="-I m4 $ACLOCAL_AMFLAGS"
use_msvc=no
-case "$CXX" in
- cl*|CL*)
- CXXFLAGS="-nologo -W1 -EHsc -DWIN32"
- if test x"$enable_shared" = "xyes"; then
- LIBEXT=".dll";
- LIBFLAGS="-DLL -INCREMENTAL:NO"
- CXXFLAGS="$CXXFLAGS -D_WINDLL"
- else
- LIBEXT=".lib";
- LIBFLAGS="-lib"
- fi
- RANLIB="echo"
- use_msvc=yes
- ;;
- *)
- ;;
-esac
- if test x"$use_msvc" = "xyes"; then
- USE_MSVC_TRUE=
- USE_MSVC_FALSE='#'
-else
USE_MSVC_TRUE='#'
USE_MSVC_FALSE=
-fi
@@ -22678,7 +22656,8 @@ $debug ||
if test -n "$CONFIG_FILES"; then
-ac_cr='
'
+ac_cr='
+'
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
ac_cs_awk_cr='\\r'
dirac: change mirror URL to deb.debian.org
class Dirac < Formula
desc "General-purpose video codec aimed at a range of resolutions"
homepage "https://sourceforge.net/projects/dirac/"
url "https://downloads.sourceforge.net/project/dirac/dirac-codec/Dirac-1.0.2/dirac-1.0.2.tar.gz"
mirror "https://launchpad.net/ubuntu/+archive/primary/+files/dirac_1.0.2.orig.tar.gz"
mirror "https://deb.debian.org/debian/pool/main/d/dirac/dirac_1.0.2.orig.tar.gz"
sha256 "816b16f18d235ff8ccd40d95fc5b4fad61ae47583e86607932929d70bf1f00fd"
bottle do
cellar :any
rebuild 1
sha256 "c018586bbfdeb10487adc1c62bdd74138b9d11195064bd2a07d458a55d770a06" => :mojave
sha256 "9413ec8e068d4c8e30d679a62af9779a09de385e2287acebacf9e5c56e80a50a" => :high_sierra
sha256 "09b846fe4069e971ec6d10668d97ac599cb555e5799f3ba3076d0d088e1f78cf" => :sierra
sha256 "8f4414614755f863d3ba0f43d6415684fbc00976ae24c7e45c88fe736be918d2" => :el_capitan
sha256 "1d3049d9dcdbd0116c65c54582601b20cdd17c8b89cf80e74efc79f71b641ca4" => :yosemite
sha256 "e7c407545085631c27c77f2d15abe84b3cc0a3645cf5e538aa15f0aacfe6de50" => :mavericks
end
# First two patches: the only two commits in the upstream repo not in 1.0.2
patch do
url "https://gist.githubusercontent.com/mistydemeo/da8a53abcf057c58b498/raw/bde69c5f07d871542dcb24792110e29e6418d2a3/unititialized-memory.patch"
sha256 "d5fcbb1b5c9f2f83935d71ebd312e98294121e579edbd7818e3865606da36e10"
end
patch do
url "https://gist.githubusercontent.com/mistydemeo/e729c459525d0d6e9e2d/raw/d9ff69c944b8bde006eef27650c0af36f51479f5/dirac-gcc-fixes.patch"
sha256 "52c40f2c8aec9174eba2345e6ba9689ced1b8f865c7ced23e7f7ee5fdd6502c3"
end
# HACK: the configure script, which assumes any compiler that
# starts with "cl" is a Microsoft compiler
patch :DATA
def install
# BSD cp doesn't have '-d'
inreplace "doc/Makefile.in", "cp -dR", "cp -R"
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make", "install"
end
end
__END__
diff --git a/configure b/configure
index 41329b9..8f5ed19 100755
--- a/configure
+++ b/configure
@@ -15903,30 +15903,8 @@ ACLOCAL_AMFLAGS="-I m4 $ACLOCAL_AMFLAGS"
use_msvc=no
-case "$CXX" in
- cl*|CL*)
- CXXFLAGS="-nologo -W1 -EHsc -DWIN32"
- if test x"$enable_shared" = "xyes"; then
- LIBEXT=".dll";
- LIBFLAGS="-DLL -INCREMENTAL:NO"
- CXXFLAGS="$CXXFLAGS -D_WINDLL"
- else
- LIBEXT=".lib";
- LIBFLAGS="-lib"
- fi
- RANLIB="echo"
- use_msvc=yes
- ;;
- *)
- ;;
-esac
- if test x"$use_msvc" = "xyes"; then
- USE_MSVC_TRUE=
- USE_MSVC_FALSE='#'
-else
USE_MSVC_TRUE='#'
USE_MSVC_FALSE=
-fi
@@ -22678,7 +22656,8 @@ $debug ||
if test -n "$CONFIG_FILES"; then
-ac_cr='
'
+ac_cr='
+'
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
ac_cs_awk_cr='\\r'
|
require 'formula'
class Disco < Formula
homepage 'http://discoproject.org/'
url 'https://github.com/discoproject/disco/archive/0.5.tar.gz'
sha1 '2728d2cc9ea398ddf1e4420e5c75750aa74fe0e2'
# Periods in the install path cause disco-worker to complain so change to underscores.
version '0_5_0'
depends_on :python
depends_on 'erlang'
depends_on 'simplejson' => :python if MacOS.version <= :leopard
depends_on 'libcmph'
def patches
# Modifies config for single-node operation
DATA
end
def install
inreplace "Makefile" do |s|
s.change_make_var! "prefix", prefix
s.change_make_var! "sysconfdir", etc
s.change_make_var! "localstatedir", var
end
# Disco's "rebar" build tool refuses to build unless it's in a git repo, so
# make a dummy one
system "git init && git add master/rebar && git commit -a -m 'dummy commit'"
system "make"
system "make install"
prefix.install %w[contrib doc examples]
# Fix the config file to point at the linked files, not in to cellar
# This isn't ideal - if there's a settings.py file left over from a previous disco
# installation, it'll issue a Warning
inreplace "#{etc}/disco/settings.py" do |s|
s.gsub!("Cellar/disco/"+version+"/", "")
end
end
def caveats
<<-EOS.undent
Please copy #{etc}/disco/settings.py to ~/.disco and edit it if necessary.
The DDFS_*_REPLICA settings have been set to 1 assuming a single-machine install.
Please see http://discoproject.org/doc/disco/start/install.html for further instructions.
EOS
end
end
__END__
diff -rupN disco-0.4.5/conf/gen.settings.sh my-edits/disco-0.4.5/conf/gen.settings.sh
--- disco-0.4.5/conf/gen.settings.sh 2013-03-28 12:21:30.000000000 -0400
+++ my-edits/disco-0.4.5/conf/gen.settings.sh 2013-04-10 23:10:00.000000000 -0400
@@ -23,8 +23,11 @@ DISCO_PORT = 8989
# DISCO_PROXY_ENABLED = "on"
# DISCO_HTTPD = "/usr/sbin/varnishd -a 0.0.0.0:\$DISCO_PROXY_PORT -f \$DISCO_PROXY_CONFIG -P \$DISCO_PROXY_PID -n/tmp -smalloc"
-DDFS_TAG_MIN_REPLICAS = 3
-DDFS_TAG_REPLICAS = 3
-DDFS_BLOB_REPLICAS = 3
+# Settings appropriate for single-node operation
+DDFS_TAG_MIN_REPLICAS = 1
+DDFS_TAG_REPLICAS = 1
+DDFS_BLOB_REPLICAS = 1
+
+DISCO_MASTER_HOST = "localhost"
EOF
disco: use patch DSL
require 'formula'
class Disco < Formula
homepage 'http://discoproject.org/'
url 'https://github.com/discoproject/disco/archive/0.5.tar.gz'
sha1 '2728d2cc9ea398ddf1e4420e5c75750aa74fe0e2'
# Periods in the install path cause disco-worker to complain so change to underscores.
version '0_5_0'
depends_on :python
depends_on 'erlang'
depends_on 'simplejson' => :python if MacOS.version <= :leopard
depends_on 'libcmph'
# Modifies config for single-node operation
patch :DATA
def install
inreplace "Makefile" do |s|
s.change_make_var! "prefix", prefix
s.change_make_var! "sysconfdir", etc
s.change_make_var! "localstatedir", var
end
# Disco's "rebar" build tool refuses to build unless it's in a git repo, so
# make a dummy one
system "git init && git add master/rebar && git commit -a -m 'dummy commit'"
system "make"
system "make install"
prefix.install %w[contrib doc examples]
# Fix the config file to point at the linked files, not in to cellar
# This isn't ideal - if there's a settings.py file left over from a previous disco
# installation, it'll issue a Warning
inreplace "#{etc}/disco/settings.py" do |s|
s.gsub!("Cellar/disco/"+version+"/", "")
end
end
def caveats
<<-EOS.undent
Please copy #{etc}/disco/settings.py to ~/.disco and edit it if necessary.
The DDFS_*_REPLICA settings have been set to 1 assuming a single-machine install.
Please see http://discoproject.org/doc/disco/start/install.html for further instructions.
EOS
end
end
__END__
diff -rupN disco-0.4.5/conf/gen.settings.sh my-edits/disco-0.4.5/conf/gen.settings.sh
--- disco-0.4.5/conf/gen.settings.sh 2013-03-28 12:21:30.000000000 -0400
+++ my-edits/disco-0.4.5/conf/gen.settings.sh 2013-04-10 23:10:00.000000000 -0400
@@ -23,8 +23,11 @@ DISCO_PORT = 8989
# DISCO_PROXY_ENABLED = "on"
# DISCO_HTTPD = "/usr/sbin/varnishd -a 0.0.0.0:\$DISCO_PROXY_PORT -f \$DISCO_PROXY_CONFIG -P \$DISCO_PROXY_PID -n/tmp -smalloc"
-DDFS_TAG_MIN_REPLICAS = 3
-DDFS_TAG_REPLICAS = 3
-DDFS_BLOB_REPLICAS = 3
+# Settings appropriate for single-node operation
+DDFS_TAG_MIN_REPLICAS = 1
+DDFS_TAG_REPLICAS = 1
+DDFS_BLOB_REPLICAS = 1
+
+DISCO_MASTER_HOST = "localhost"
EOF
|
require 'formula'
class Ditaa < Formula
url 'http://downloads.sourceforge.net/project/ditaa/ditaa/0.9/ditaa0_9.zip'
homepage 'http://ditaa.sourceforge.net/'
md5 '23f2e5ede60ef7763309c08addca071a'
def jar
'ditaa0_9.jar'
end
def script
<<-EOS
#!/bin/sh
# A wrapper for ditaa.
java -jar #{prefix}/#{jar} "$@"
EOS
end
def install
prefix.install jar
(bin+'ditaa').write script
end
end
ditaa: simplify
require 'formula'
class Ditaa < Formula
url 'http://downloads.sourceforge.net/project/ditaa/ditaa/0.9/ditaa0_9.zip'
homepage 'http://ditaa.sourceforge.net/'
md5 '23f2e5ede60ef7763309c08addca071a'
def install
prefix.install "ditaa0_9.jar"
(bin+'ditaa').write <<-EOS.undent
#!/bin/sh
java -jar "#{prefix}/ditaa0_9.jar" "$@"
EOS
end
end
|
class Doctl < Formula
desc "Command-line tool for DigitalOcean"
homepage "https://github.com/digitalocean/doctl"
url "https://github.com/digitalocean/doctl/archive/v1.68.0.tar.gz"
sha256 "63bf2c754cc6da01eeacf43c139cab3dd04458d16be4047f5a1f238b9e0e5cb9"
license "Apache-2.0"
head "https://github.com/digitalocean/doctl.git", branch: "main"
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "a4030122905cd98a819e91e15996d0cc3077f655061c40bbe9b46ec809c2d836"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "486e01ea4f99c67149a1268f4f4c9d37150152ccd967ac7b6667d94fcd2da302"
sha256 cellar: :any_skip_relocation, monterey: "7f627d402d3f0d8790d43ed31b6fcba7831c4537895432c7d7d0d04a01cda87c"
sha256 cellar: :any_skip_relocation, big_sur: "5708fee1340122a6489efc688d94628146ffc16c504c471202f795ac661e05e5"
sha256 cellar: :any_skip_relocation, catalina: "bff41e64b2e8640720e142e6285c8e2b488c676968c90e4d21b8bfa963059e91"
sha256 cellar: :any_skip_relocation, x86_64_linux: "bd91fcdc19af6ec4111f6c6e1c53dfb5b362f1cbf47839a41173e5eb92626858"
end
depends_on "go" => :build
def install
base_flag = "-X github.com/digitalocean/doctl"
ldflags = %W[
#{base_flag}.Major=#{version.major}
#{base_flag}.Minor=#{version.minor}
#{base_flag}.Patch=#{version.patch}
#{base_flag}.Label=release
]
system "go", "build", *std_go_args(ldflags: ldflags), "./cmd/doctl"
(bash_completion/"doctl").write `#{bin}/doctl completion bash`
(zsh_completion/"_doctl").write `#{bin}/doctl completion zsh`
(fish_completion/"doctl.fish").write `#{bin}/doctl completion fish`
end
test do
assert_match "doctl version #{version}-release", shell_output("#{bin}/doctl version")
end
end
doctl 1.69.0
Closes #93168.
Signed-off-by: Nanda H Krishna <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@nandahkrishna.com>
Signed-off-by: BrewTestBot <8a898ee6867e4f2028e63d2a6319b2224641c06c@users.noreply.github.com>
class Doctl < Formula
desc "Command-line tool for DigitalOcean"
homepage "https://github.com/digitalocean/doctl"
url "https://github.com/digitalocean/doctl/archive/v1.69.0.tar.gz"
sha256 "4ffbfe07ba2ea7d830855eb302f605c006bc5721c8c3288ed9b974d8c44e4fc6"
license "Apache-2.0"
head "https://github.com/digitalocean/doctl.git", branch: "main"
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "a4030122905cd98a819e91e15996d0cc3077f655061c40bbe9b46ec809c2d836"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "486e01ea4f99c67149a1268f4f4c9d37150152ccd967ac7b6667d94fcd2da302"
sha256 cellar: :any_skip_relocation, monterey: "7f627d402d3f0d8790d43ed31b6fcba7831c4537895432c7d7d0d04a01cda87c"
sha256 cellar: :any_skip_relocation, big_sur: "5708fee1340122a6489efc688d94628146ffc16c504c471202f795ac661e05e5"
sha256 cellar: :any_skip_relocation, catalina: "bff41e64b2e8640720e142e6285c8e2b488c676968c90e4d21b8bfa963059e91"
sha256 cellar: :any_skip_relocation, x86_64_linux: "bd91fcdc19af6ec4111f6c6e1c53dfb5b362f1cbf47839a41173e5eb92626858"
end
depends_on "go" => :build
def install
base_flag = "-X github.com/digitalocean/doctl"
ldflags = %W[
#{base_flag}.Major=#{version.major}
#{base_flag}.Minor=#{version.minor}
#{base_flag}.Patch=#{version.patch}
#{base_flag}.Label=release
]
system "go", "build", *std_go_args(ldflags: ldflags), "./cmd/doctl"
(bash_completion/"doctl").write `#{bin}/doctl completion bash`
(zsh_completion/"_doctl").write `#{bin}/doctl completion zsh`
(fish_completion/"doctl.fish").write `#{bin}/doctl completion fish`
end
test do
assert_match "doctl version #{version}-release", shell_output("#{bin}/doctl version")
end
end
|
class Doctl < Formula
desc "Command-line tool for DigitalOcean"
homepage "https://github.com/digitalocean/doctl"
url "https://github.com/digitalocean/doctl/archive/v1.25.0.tar.gz"
sha256 "bb4bd38cf70b1f8c666d54cdc78d62fb91181d69fc7bbfc2ab91a12e288d9fd4"
head "https://github.com/digitalocean/doctl.git"
bottle do
cellar :any_skip_relocation
sha256 "bc2bb104568272af5c3b89bc34a562f10285c93ab9d04e360e64a29aeb745d94" => :mojave
sha256 "9b161886fd015a34e1d1a50cd68e2387912250f92bb57aa0a693e83d6d4dc0bc" => :high_sierra
sha256 "3024104fd6ad896ebd95a8756c78350d6879df25b4a2b1e204143bc3680f1aeb" => :sierra
end
depends_on "go" => :build
def install
ENV["GO111MODULE"] = "on"
ENV["GOPATH"] = buildpath
doctl_version = version.to_s.split(/\./)
src = buildpath/"src/github.com/digitalocean/doctl"
src.install buildpath.children
src.cd do
base_flag = "-X github.com/digitalocean/doctl"
ldflags = %W[
#{base_flag}.Major=#{doctl_version[0]}
#{base_flag}.Minor=#{doctl_version[1]}
#{base_flag}.Patch=#{doctl_version[2]}
#{base_flag}.Label=release
].join(" ")
system "go", "build", "-ldflags", ldflags, "-o", bin/"doctl", "github.com/digitalocean/doctl/cmd/doctl"
end
(bash_completion/"doctl").write `#{bin}/doctl completion bash`
(zsh_completion/"doctl").write `#{bin}/doctl completion zsh`
end
test do
assert_match "doctl version #{version}-release", shell_output("#{bin}/doctl version")
end
end
doctl 1.26.0
Closes #42686.
Signed-off-by: Chongyu Zhu <042dc4512fa3d391c5170cf3aa61e6a638f84342@lembacon.com>
class Doctl < Formula
desc "Command-line tool for DigitalOcean"
homepage "https://github.com/digitalocean/doctl"
url "https://github.com/digitalocean/doctl/archive/v1.26.0.tar.gz"
sha256 "162194cae487c03a47c9a580683628c12b372a7fd8acf42fc2f18fefa1ff0e1c"
head "https://github.com/digitalocean/doctl.git"
bottle do
cellar :any_skip_relocation
sha256 "bc2bb104568272af5c3b89bc34a562f10285c93ab9d04e360e64a29aeb745d94" => :mojave
sha256 "9b161886fd015a34e1d1a50cd68e2387912250f92bb57aa0a693e83d6d4dc0bc" => :high_sierra
sha256 "3024104fd6ad896ebd95a8756c78350d6879df25b4a2b1e204143bc3680f1aeb" => :sierra
end
depends_on "go" => :build
def install
ENV["GO111MODULE"] = "on"
ENV["GOPATH"] = buildpath
doctl_version = version.to_s.split(/\./)
src = buildpath/"src/github.com/digitalocean/doctl"
src.install buildpath.children
src.cd do
base_flag = "-X github.com/digitalocean/doctl"
ldflags = %W[
#{base_flag}.Major=#{doctl_version[0]}
#{base_flag}.Minor=#{doctl_version[1]}
#{base_flag}.Patch=#{doctl_version[2]}
#{base_flag}.Label=release
].join(" ")
system "go", "build", "-ldflags", ldflags, "-o", bin/"doctl", "github.com/digitalocean/doctl/cmd/doctl"
end
(bash_completion/"doctl").write `#{bin}/doctl completion bash`
(zsh_completion/"doctl").write `#{bin}/doctl completion zsh`
end
test do
assert_match "doctl version #{version}-release", shell_output("#{bin}/doctl version")
end
end
|
class Doctl < Formula
desc "Command-line tool for DigitalOcean"
homepage "https://github.com/digitalocean/doctl"
url "https://github.com/digitalocean/doctl/archive/v1.28.0.tar.gz"
sha256 "eafb41457c4fb279762b1a81606130bd8f02f0390df77b032d11108666daff49"
head "https://github.com/digitalocean/doctl.git"
bottle do
cellar :any_skip_relocation
sha256 "dc51495bdf2fccbc3a612bb786b650cf6678ea7a2ef7238fd8a99f0e2b07a814" => :mojave
sha256 "8f4557ba7e80e279077cde38a9d507f70a3a2713b645880f5f06aa5c0dc46c61" => :high_sierra
sha256 "a23c2a755e42e5c155dac4e6b4844095e550a694537dd64748023eefd7b2bbcd" => :sierra
end
depends_on "go" => :build
def install
ENV["GO111MODULE"] = "on"
ENV["GOPATH"] = buildpath
doctl_version = version.to_s.split(/\./)
src = buildpath/"src/github.com/digitalocean/doctl"
src.install buildpath.children
src.cd do
base_flag = "-X github.com/digitalocean/doctl"
ldflags = %W[
#{base_flag}.Major=#{doctl_version[0]}
#{base_flag}.Minor=#{doctl_version[1]}
#{base_flag}.Patch=#{doctl_version[2]}
#{base_flag}.Label=release
].join(" ")
system "go", "build", "-ldflags", ldflags, "-o", bin/"doctl", "github.com/digitalocean/doctl/cmd/doctl"
end
(bash_completion/"doctl").write `#{bin}/doctl completion bash`
(zsh_completion/"doctl").write `#{bin}/doctl completion zsh`
end
test do
assert_match "doctl version #{version}-release", shell_output("#{bin}/doctl version")
end
end
doctl: update 1.28.0 bottle.
class Doctl < Formula
desc "Command-line tool for DigitalOcean"
homepage "https://github.com/digitalocean/doctl"
url "https://github.com/digitalocean/doctl/archive/v1.28.0.tar.gz"
sha256 "eafb41457c4fb279762b1a81606130bd8f02f0390df77b032d11108666daff49"
head "https://github.com/digitalocean/doctl.git"
bottle do
cellar :any_skip_relocation
sha256 "0a01d082d153d1d7c705b1dcf6ea8077554d6ede9003b38337c0c8256c994c5d" => :mojave
sha256 "8a44b08591471addb194cbcefc3a7b109a7a5d1ac72421a5a3e079d87901625c" => :high_sierra
sha256 "dae9b623b2d28084b5ef86a65bdd5e79af1d29294513540d1d5b7066be57f485" => :sierra
end
depends_on "go" => :build
def install
ENV["GO111MODULE"] = "on"
ENV["GOPATH"] = buildpath
doctl_version = version.to_s.split(/\./)
src = buildpath/"src/github.com/digitalocean/doctl"
src.install buildpath.children
src.cd do
base_flag = "-X github.com/digitalocean/doctl"
ldflags = %W[
#{base_flag}.Major=#{doctl_version[0]}
#{base_flag}.Minor=#{doctl_version[1]}
#{base_flag}.Patch=#{doctl_version[2]}
#{base_flag}.Label=release
].join(" ")
system "go", "build", "-ldflags", ldflags, "-o", bin/"doctl", "github.com/digitalocean/doctl/cmd/doctl"
end
(bash_completion/"doctl").write `#{bin}/doctl completion bash`
(zsh_completion/"doctl").write `#{bin}/doctl completion zsh`
end
test do
assert_match "doctl version #{version}-release", shell_output("#{bin}/doctl version")
end
end
|
class Druid < Formula
desc "High-performance, column-oriented, distributed data store"
homepage "https://druid.apache.org/"
url "https://www.apache.org/dyn/closer.lua?path=druid/0.21.0/apache-druid-0.21.0-bin.tar.gz"
mirror "https://archive.apache.org/dist/druid/0.21.0/apache-druid-0.21.0-bin.tar.gz"
sha256 "3e886e51834b03876ad088a5212747ed7f671d50f651413dd9cee11bd4129a69"
license "Apache-2.0"
livecheck do
url "https://druid.apache.org/downloads.html"
regex(/href=.*?druid[._-]v?(\d+(?:\.\d+)+)-bin\.t/i)
end
bottle do
sha256 cellar: :any_skip_relocation, all: "5cbde4502719b8fbd2adc70388b355c560dde2921a512d507df0f7f0068ec6b7"
end
depends_on "zookeeper" => :test
depends_on arch: :x86_64
depends_on "openjdk@8"
resource "mysql-metadata-storage" do
url "http://static.druid.io/artifacts/releases/mysql-metadata-storage-0.12.3.tar.gz"
sha256 "8ee27e3c7906abcd401cfd59072602bd1f83828b66397ae2cf2c3ff0e1860162"
end
def install
libexec.install Dir["*"]
%w[
broker.sh
coordinator.sh
historical.sh
middleManager.sh
overlord.sh
].each do |sh|
inreplace libexec/"bin/#{sh}", "./bin/node.sh", libexec/"bin/node.sh"
end
inreplace libexec/"bin/node.sh" do |s|
s.gsub! "nohup $JAVA", "nohup $JAVA -Ddruid.extensions.directory=\"#{libexec}/extensions\""
s.gsub! ":=lib", ":=#{libexec}/lib"
s.gsub! ":=conf/druid", ":=#{libexec}/conf/druid"
s.gsub! ":=log", ":=#{var}/druid/log"
s.gsub! ":=var/druid/pids", ":=#{var}/druid/pids"
end
resource("mysql-metadata-storage").stage do
(libexec/"extensions/mysql-metadata-storage").install Dir["*"]
end
bin.install Dir["#{libexec}/bin/*.sh"]
bin.env_script_all_files libexec/"bin", Language::Java.overridable_java_home_env("1.8")
Pathname.glob("#{bin}/*.sh") do |file|
mv file, bin/"druid-#{file.basename}"
end
end
def post_install
%w[
druid/hadoop-tmp
druid/indexing-logs
druid/log
druid/pids
druid/segments
druid/task
].each do |dir|
(var/dir).mkpath
end
end
test do
ENV["DRUID_CONF_DIR"] = libexec/"conf/druid/single-server/nano-quickstart"
ENV["DRUID_LOG_DIR"] = testpath
ENV["DRUID_PID_DIR"] = testpath
ENV["ZOO_LOG_DIR"] = testpath
system Formula["zookeeper"].opt_bin/"zkServer", "start"
begin
pid = fork { exec bin/"druid-broker.sh", "start" }
sleep 40
output = shell_output("curl -s http://localhost:8082/status")
assert_match "version", output
ensure
system bin/"druid-broker.sh", "stop"
Process.wait pid
end
end
end
druid: force stop zookeeper in test (#77614)
class Druid < Formula
desc "High-performance, column-oriented, distributed data store"
homepage "https://druid.apache.org/"
url "https://www.apache.org/dyn/closer.lua?path=druid/0.21.0/apache-druid-0.21.0-bin.tar.gz"
mirror "https://archive.apache.org/dist/druid/0.21.0/apache-druid-0.21.0-bin.tar.gz"
sha256 "3e886e51834b03876ad088a5212747ed7f671d50f651413dd9cee11bd4129a69"
license "Apache-2.0"
livecheck do
url "https://druid.apache.org/downloads.html"
regex(/href=.*?druid[._-]v?(\d+(?:\.\d+)+)-bin\.t/i)
end
bottle do
sha256 cellar: :any_skip_relocation, all: "5cbde4502719b8fbd2adc70388b355c560dde2921a512d507df0f7f0068ec6b7"
end
depends_on "zookeeper" => :test
depends_on arch: :x86_64
depends_on "openjdk@8"
resource "mysql-metadata-storage" do
url "http://static.druid.io/artifacts/releases/mysql-metadata-storage-0.12.3.tar.gz"
sha256 "8ee27e3c7906abcd401cfd59072602bd1f83828b66397ae2cf2c3ff0e1860162"
end
def install
libexec.install Dir["*"]
%w[
broker.sh
coordinator.sh
historical.sh
middleManager.sh
overlord.sh
].each do |sh|
inreplace libexec/"bin/#{sh}", "./bin/node.sh", libexec/"bin/node.sh"
end
inreplace libexec/"bin/node.sh" do |s|
s.gsub! "nohup $JAVA", "nohup $JAVA -Ddruid.extensions.directory=\"#{libexec}/extensions\""
s.gsub! ":=lib", ":=#{libexec}/lib"
s.gsub! ":=conf/druid", ":=#{libexec}/conf/druid"
s.gsub! ":=log", ":=#{var}/druid/log"
s.gsub! ":=var/druid/pids", ":=#{var}/druid/pids"
end
resource("mysql-metadata-storage").stage do
(libexec/"extensions/mysql-metadata-storage").install Dir["*"]
end
bin.install Dir["#{libexec}/bin/*.sh"]
bin.env_script_all_files libexec/"bin", Language::Java.overridable_java_home_env("1.8")
Pathname.glob("#{bin}/*.sh") do |file|
mv file, bin/"druid-#{file.basename}"
end
end
def post_install
%w[
druid/hadoop-tmp
druid/indexing-logs
druid/log
druid/pids
druid/segments
druid/task
].each do |dir|
(var/dir).mkpath
end
end
test do
ENV["DRUID_CONF_DIR"] = libexec/"conf/druid/single-server/nano-quickstart"
ENV["DRUID_LOG_DIR"] = testpath
ENV["DRUID_PID_DIR"] = testpath
ENV["ZOO_LOG_DIR"] = testpath
system Formula["zookeeper"].opt_bin/"zkServer", "start"
begin
pid = fork { exec bin/"druid-broker.sh", "start" }
sleep 40
output = shell_output("curl -s http://localhost:8082/status")
assert_match "version", output
ensure
system bin/"druid-broker.sh", "stop"
# force zookeeper stop since it is sometimes still alive after druid-broker.sh finishes
system Formula["zookeeper"].opt_bin/"zkServer", "stop"
Process.wait pid
end
end
end
|
require File.expand_path("../../language/php", __FILE__)
require File.expand_path("../../Requirements/php-meta-requirement", __FILE__)
class Drush < Formula
include Language::PHP::Composer
desc "Command-line shell and scripting interface for Drupal"
homepage "https://github.com/drush-ops/drush"
url "https://github.com/drush-ops/drush/archive/8.1.12.tar.gz"
sha256 "55b9f78f3bf29907e93a898619618795d788db9ce5995eee4c3e33787d3a1404"
head "https://github.com/drush-ops/drush.git"
bottle do
cellar :any_skip_relocation
sha256 "04606dd17301b6298fd03b6603ef434ae9d662e87b8bb797317a8503bce509fe" => :sierra
sha256 "ed4945a8beccb75f5daa77b43ca709d1dcedbf7c39106b71f67c683fa752a3f0" => :el_capitan
sha256 "24ac2ae967469376dc50f33a9e7ec3e2f6cff7ad035f19a2b523eff7f7fec899" => :yosemite
end
depends_on PhpMetaRequirement
depends_on "php55" if Formula["php55"].linked_keg.exist?
depends_on "php56" if Formula["php56"].linked_keg.exist?
def install
composer_install
prefix.install_metafiles
libexec.install Dir["*"]
(bin+"drush").write <<-EOS.undent
#!/bin/sh
export ETC_PREFIX=${ETC_PREFIX:=#{HOMEBREW_PREFIX}}
export SHARE_PREFIX=${SHARE_PREFIX:=#{HOMEBREW_PREFIX}}
exec "#{libexec}/drush" "$@"
EOS
bash_completion.install libexec/"drush.complete.sh" => "drush"
end
test do
system "#{bin}/drush", "version"
end
end
drush: update 8.1.12 bottle.
require File.expand_path("../../language/php", __FILE__)
require File.expand_path("../../Requirements/php-meta-requirement", __FILE__)
class Drush < Formula
include Language::PHP::Composer
desc "Command-line shell and scripting interface for Drupal"
homepage "https://github.com/drush-ops/drush"
url "https://github.com/drush-ops/drush/archive/8.1.12.tar.gz"
sha256 "55b9f78f3bf29907e93a898619618795d788db9ce5995eee4c3e33787d3a1404"
head "https://github.com/drush-ops/drush.git"
bottle do
cellar :any_skip_relocation
sha256 "b1d4a50d4ca3595817e5e05f5ee40ba8f8fcfa369e26a9dde3f3e51c7acf16e5" => :sierra
sha256 "5d7d8c05bda0b9d786b1cf07f8173c06d5ea27d821e2dcb4779a52781d3735d6" => :el_capitan
sha256 "e349c4b81035a0877f1ed1e56492b2e3da92f8574702918406216d5c1ee5f95f" => :yosemite
end
depends_on PhpMetaRequirement
depends_on "php55" if Formula["php55"].linked_keg.exist?
depends_on "php56" if Formula["php56"].linked_keg.exist?
def install
composer_install
prefix.install_metafiles
libexec.install Dir["*"]
(bin+"drush").write <<-EOS.undent
#!/bin/sh
export ETC_PREFIX=${ETC_PREFIX:=#{HOMEBREW_PREFIX}}
export SHARE_PREFIX=${SHARE_PREFIX:=#{HOMEBREW_PREFIX}}
exec "#{libexec}/drush" "$@"
EOS
bash_completion.install libexec/"drush.complete.sh" => "drush"
end
test do
system "#{bin}/drush", "version"
end
end
|
dwarf 0.3.2
Closes #15058.
Signed-off-by: ilovezfs <fbd54dbbcf9e596abad4ccdc4dfc17f80ebeaee2@icloud.com>
class Dwarf < Formula
desc "Object file manipulation tool"
homepage "https://github.com/elboza/dwarf-ng/"
url "https://github.com/elboza/dwarf-ng/archive/dwarf-0.3.2.tar.gz"
sha256 "dc3db5273c02f0b05beedada0a3935af0c60c011d7213f37c39f43ce088f9436"
depends_on "flex"
depends_on "readline"
def install
%w[src/libdwarf.c doc/dwarf.man doc/xdwarf.man.html].each do |f|
inreplace f, "/etc/dwarfrc", etc/"dwarfrc"
end
system "make"
system "make", "install", "BINDIR=#{bin}", "MANDIR=#{man1}"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("hello world\\n");
}
EOS
system ENV.cc, "test.c", "-o", "test"
output = shell_output("#{bin}/dwarf -c 'print $mac' test")
assert_equal "magic: 0xfeedfacf (-17958193)", output.lines[1].chomp
end
end
|
require 'formula'
class Eigen <Formula
url 'http://bitbucket.org/eigen/eigen/get/2.0.12.tar.bz2'
homepage 'http://eigen.tuxfamily.org/'
md5 'd0195ac20bcd91602db8ca967a21e9ec'
depends_on 'cmake' => :build
def install
system "cmake . #{std_cmake_parameters}"
system "make install"
end
end
Updated eigen to 2.0.15
Latest stable version is 2.0.15. Additionally 2.0.12 download didn't
match md5 sum.
Signed-off-by: Adam Vandenberg <34c2b6407fd5a10249a15d699d40f9ed1782e98c@gmail.com>
require 'formula'
class Eigen <Formula
url 'http://bitbucket.org/eigen/eigen/get/2.0.15.tar.bz2'
homepage 'http://eigen.tuxfamily.org/'
md5 'a96fe69d652d7b3b1d990c99bbc518fb'
depends_on 'cmake' => :build
def install
system "cmake . #{std_cmake_parameters}"
system "make install"
end
end
|
class Eigen < Formula
desc "C++ template library for linear algebra"
homepage "https://eigen.tuxfamily.org/"
url "https://gitlab.com/libeigen/eigen/-/archive/3.3.8/eigen-3.3.8.tar.gz"
sha256 "146a480b8ed1fb6ac7cd33fec9eb5e8f8f62c3683b3f850094d9d5c35a92419a"
license "MPL-2.0"
revision 1
head "https://gitlab.com/libeigen/eigen"
bottle do
cellar :any_skip_relocation
sha256 "2903f6439e0f52e371f6d0a3a8f167a35ce4c07662b04a2e86b26243f19d24ba" => :catalina
sha256 "39ab24e3cd9d515b34f220eae5489e4effa732871d36c8e11daa588265ed89d3" => :mojave
sha256 "3288da7047cf65b70c315806e97443743273d27fbcfeace9c1061ecbc2faeb4c" => :high_sierra
sha256 "c99f668c4b1a6725d956845a9a33549dbde601c6490bf49a5eccbf00852ab61b" => :x86_64_linux
end
depends_on "cmake" => :build
conflicts_with "freeling", because: "freeling ships its own copy of eigen"
# Emergency fix for build failures with OpenMP. Remove with the next release.
patch do
url "https://gitlab.com/libeigen/eigen/-/commit/ef3cc72cb65e2d500459c178c63e349bacfa834f.diff"
sha256 "b8877a84c4338f08ab8a6bb8b274c768e93d36ac05b733b078745198919a74bf"
end
def install
mkdir "eigen-build" do
args = std_cmake_args
args << "-Dpkg_config_libdir=#{lib}" << ".."
system "cmake", *args
system "make", "install"
end
(share/"cmake/Modules").install "cmake/FindEigen3.cmake"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <iostream>
#include <Eigen/Dense>
using Eigen::MatrixXd;
int main()
{
MatrixXd m(2,2);
m(0,0) = 3;
m(1,0) = 2.5;
m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1);
std::cout << m << std::endl;
}
EOS
system ENV.cxx, "test.cpp", "-I#{include}/eigen3", "-o", "test"
assert_equal %w[3 -1 2.5 1.5], shell_output("./test").split
end
end
eigen: fix patch URL
class Eigen < Formula
desc "C++ template library for linear algebra"
homepage "https://eigen.tuxfamily.org/"
url "https://gitlab.com/libeigen/eigen/-/archive/3.3.8/eigen-3.3.8.tar.gz"
sha256 "146a480b8ed1fb6ac7cd33fec9eb5e8f8f62c3683b3f850094d9d5c35a92419a"
license "MPL-2.0"
revision 1
head "https://gitlab.com/libeigen/eigen"
bottle do
cellar :any_skip_relocation
sha256 "2903f6439e0f52e371f6d0a3a8f167a35ce4c07662b04a2e86b26243f19d24ba" => :catalina
sha256 "39ab24e3cd9d515b34f220eae5489e4effa732871d36c8e11daa588265ed89d3" => :mojave
sha256 "3288da7047cf65b70c315806e97443743273d27fbcfeace9c1061ecbc2faeb4c" => :high_sierra
sha256 "c99f668c4b1a6725d956845a9a33549dbde601c6490bf49a5eccbf00852ab61b" => :x86_64_linux
end
depends_on "cmake" => :build
conflicts_with "freeling", because: "freeling ships its own copy of eigen"
# Emergency fix for build failures with OpenMP. Remove with the next release.
patch do
url "https://gitlab.com/libeigen/eigen/-/commit/ef3cc72cb65e2d500459c178c63e349bacfa834f.patch?full_index=1"
sha256 "c04d624d550b119be0f810786baba7e0d7809edefd4854a2db6dbd98a7da5a7d"
end
def install
mkdir "eigen-build" do
args = std_cmake_args
args << "-Dpkg_config_libdir=#{lib}" << ".."
system "cmake", *args
system "make", "install"
end
(share/"cmake/Modules").install "cmake/FindEigen3.cmake"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <iostream>
#include <Eigen/Dense>
using Eigen::MatrixXd;
int main()
{
MatrixXd m(2,2);
m(0,0) = 3;
m(1,0) = 2.5;
m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1);
std::cout << m << std::endl;
}
EOS
system ENV.cxx, "test.cpp", "-I#{include}/eigen3", "-o", "test"
assert_equal %w[3 -1 2.5 1.5], shell_output("./test").split
end
end
|
class Eject < Formula
desc "Generate swift code from Interface Builder xibs"
homepage "https://github.com/Raizlabs/Eject"
url "https://github.com/Raizlabs/Eject/archive/0.1.12.tar.gz"
sha256 "a4dae3d37f780d274f53ed25d9dc1a27d5245289f9b8cbaaf8be71bc9334de18"
bottle do
cellar :any
sha256 "7354ff78be9395237c0fb704e6fea0f51720ef7c55f020e1a4dbf60b09d6eb7b" => :sierra
sha256 "91d45bc0bee9092525505528cbd77d457e5728c1f4ab3e8c94c3ecf69284adb0" => :el_capitan
end
depends_on :xcode => ["8.0", :build]
def install
xcodebuild
bin.install "build/Release/eject.app/Contents/MacOS/eject"
frameworks_path = "build/Release/eject.app/Contents/Frameworks"
mv frameworks_path, frameworks
end
test do
(testpath/"view.xib").write <<-EOS.undent
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</objects>
</document>
EOS
swift = <<-EOS.undent
// Create Views
let view = UIView()
view.frame = CGRect(x: 0, y: 0, width: 375, height: 667)
view.autoresizingMask = [.flexibleHeight, .flexibleWidth]
view.backgroundColor = UIColor(red: 1, green: 1, blue: 1, alpha: 1)
EOS
assert_equal swift, shell_output("#{bin}/eject --file view.xib")
end
end
eject 0.1.23
class Eject < Formula
desc "Generate swift code from Interface Builder xibs"
homepage "https://github.com/Raizlabs/Eject"
url "https://github.com/Raizlabs/Eject/archive/0.1.23.tar.gz"
sha256 "6edd4bd393981f8e1a7b5b7b8f29b5594d17ecf7f55a3e81098a88191c02ae71"
bottle do
cellar :any
sha256 "7354ff78be9395237c0fb704e6fea0f51720ef7c55f020e1a4dbf60b09d6eb7b" => :sierra
sha256 "91d45bc0bee9092525505528cbd77d457e5728c1f4ab3e8c94c3ecf69284adb0" => :el_capitan
end
depends_on :xcode => ["8.0", :build]
def install
xcodebuild
bin.install "build/Release/eject.app/Contents/MacOS/eject"
frameworks_path = "build/Release/eject.app/Contents/Frameworks"
mv frameworks_path, frameworks
end
test do
(testpath/"view.xib").write <<-EOS.undent
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</objects>
</document>
EOS
swift = <<-EOS.undent
// Create Views
let view = UIView()
view.autoresizingMask = [.flexibleHeight, .flexibleWidth]
view.backgroundColor = UIColor(red: 1, green: 1, blue: 1, alpha: 1)
EOS
assert_equal swift, shell_output("#{bin}/eject --file view.xib")
end
end
|
class ExVi < Formula
desc "UTF8-friendly version of tradition vi"
homepage "http://ex-vi.sourceforge.net/"
url "https://downloads.sourceforge.net/project/ex-vi/ex-vi/050325/ex-050325.tar.bz2"
sha256 "da4be7cf67e94572463b19e56850aa36dc4e39eb0d933d3688fe8574bb632409"
bottle do
sha256 "2719bdb0715bd327745b0b4c6829492115336314a921d0b66f2f1a2609c949b0" => :sierra
sha256 "e3f68edff7a526463ae6a217b9292c2a6025489df848372abe777da141be14ef" => :el_capitan
sha256 "6e3195cd61b05a482e13162a5559ca90d65b1805b8559c006ffc960b56cbe935" => :yosemite
sha256 "e0ff9cadf9bc20d222ebc0fceada33db977a5b044346e7930e8349a46e8e6915" => :mavericks
end
conflicts_with "vim",
:because => "ex-vi and vim both install bin/ex and bin/view"
def install
system "make", "install", "INSTALL=/usr/bin/install",
"PREFIX=#{prefix}",
"PRESERVEDIR=/var/tmp/vi.recover",
"TERMLIB=ncurses"
end
end
ex-vi: fix audit --warning
class ExVi < Formula
desc "UTF8-friendly version of tradition vi"
homepage "https://ex-vi.sourceforge.io/"
url "https://downloads.sourceforge.net/project/ex-vi/ex-vi/050325/ex-050325.tar.bz2"
sha256 "da4be7cf67e94572463b19e56850aa36dc4e39eb0d933d3688fe8574bb632409"
bottle do
sha256 "2719bdb0715bd327745b0b4c6829492115336314a921d0b66f2f1a2609c949b0" => :sierra
sha256 "e3f68edff7a526463ae6a217b9292c2a6025489df848372abe777da141be14ef" => :el_capitan
sha256 "6e3195cd61b05a482e13162a5559ca90d65b1805b8559c006ffc960b56cbe935" => :yosemite
sha256 "e0ff9cadf9bc20d222ebc0fceada33db977a5b044346e7930e8349a46e8e6915" => :mavericks
end
conflicts_with "vim",
:because => "ex-vi and vim both install bin/ex and bin/view"
def install
system "make", "install", "INSTALL=/usr/bin/install",
"PREFIX=#{prefix}",
"PRESERVEDIR=/var/tmp/vi.recover",
"TERMLIB=ncurses"
end
end
|
class Fabio < Formula
desc "Zero-conf load balancing HTTP(S) router"
homepage "https://github.com/eBay/fabio"
url "https://github.com/eBay/fabio/archive/v1.4.tar.gz"
sha256 "e595778c325eb79b5fc2c17f409a53d73c4cfa3d5a53083092bf72edf113f947"
head "https://github.com/eBay/fabio.git"
bottle do
cellar :any_skip_relocation
sha256 "b22bbf0d6ff957ff1e5d447daf5bf1a494c0521a7e708f5a3ef280f5ea44ef56" => :sierra
sha256 "b52fbe26fd05730dfeecf7189c884ca5b27fe32b63c22f8a5c2ac30bcb4ef055" => :el_capitan
sha256 "e565453d669349d7fe40390776a5de34c008fbdcce7c9daf7e9ec06ee20bd6dc" => :yosemite
end
depends_on "go" => :build
depends_on "consul" => :recommended
def install
mkdir_p buildpath/"src/github.com/eBay"
ln_s buildpath, buildpath/"src/github.com/eBay/fabio"
ENV["GOPATH"] = buildpath.to_s
system "go", "install", "github.com/eBay/fabio"
bin.install "#{buildpath}/bin/fabio"
end
test do
require "socket"
require "timeout"
CONSUL_DEFAULT_PORT = 8500
FABIO_DEFAULT_PORT = 9999
LOCALHOST_IP = "127.0.0.1".freeze
def port_open?(ip, port, seconds = 1)
Timeout.timeout(seconds) do
begin
TCPSocket.new(ip, port).close
true
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
false
end
end
rescue Timeout::Error
false
end
if !port_open?(LOCALHOST_IP, FABIO_DEFAULT_PORT)
if !port_open?(LOCALHOST_IP, CONSUL_DEFAULT_PORT)
fork do
exec "consul agent -dev -bind 127.0.0.1"
puts "consul started"
end
sleep 15
else
puts "Consul already running"
end
fork do
exec "#{bin}/fabio &>fabio-start.out&"
puts "fabio started"
end
sleep 5
assert_equal true, port_open?(LOCALHOST_IP, FABIO_DEFAULT_PORT)
system "killall", "fabio" # fabio forks off from the fork...
system "consul", "leave"
else
puts "Fabio already running or Consul not available or starting fabio failed."
false
end
end
end
fabio 1.4.1
Closes #12048.
Signed-off-by: FX Coudert <c329953660db96eae534be5bbf1a735c2baf69b5@gmail.com>
class Fabio < Formula
desc "Zero-conf load balancing HTTP(S) router"
homepage "https://github.com/eBay/fabio"
url "https://github.com/eBay/fabio/archive/v1.4.1.tar.gz"
sha256 "7ca28cc76bfe3cf2705adc29eca77e328d5fd5c94fa453eb26fd961d04881efe"
head "https://github.com/eBay/fabio.git"
bottle do
cellar :any_skip_relocation
sha256 "b22bbf0d6ff957ff1e5d447daf5bf1a494c0521a7e708f5a3ef280f5ea44ef56" => :sierra
sha256 "b52fbe26fd05730dfeecf7189c884ca5b27fe32b63c22f8a5c2ac30bcb4ef055" => :el_capitan
sha256 "e565453d669349d7fe40390776a5de34c008fbdcce7c9daf7e9ec06ee20bd6dc" => :yosemite
end
depends_on "go" => :build
depends_on "consul" => :recommended
def install
mkdir_p buildpath/"src/github.com/eBay"
ln_s buildpath, buildpath/"src/github.com/eBay/fabio"
ENV["GOPATH"] = buildpath.to_s
system "go", "install", "github.com/eBay/fabio"
bin.install "#{buildpath}/bin/fabio"
end
test do
require "socket"
require "timeout"
CONSUL_DEFAULT_PORT = 8500
FABIO_DEFAULT_PORT = 9999
LOCALHOST_IP = "127.0.0.1".freeze
def port_open?(ip, port, seconds = 1)
Timeout.timeout(seconds) do
begin
TCPSocket.new(ip, port).close
true
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
false
end
end
rescue Timeout::Error
false
end
if !port_open?(LOCALHOST_IP, FABIO_DEFAULT_PORT)
if !port_open?(LOCALHOST_IP, CONSUL_DEFAULT_PORT)
fork do
exec "consul agent -dev -bind 127.0.0.1"
puts "consul started"
end
sleep 15
else
puts "Consul already running"
end
fork do
exec "#{bin}/fabio &>fabio-start.out&"
puts "fabio started"
end
sleep 5
assert_equal true, port_open?(LOCALHOST_IP, FABIO_DEFAULT_PORT)
system "killall", "fabio" # fabio forks off from the fork...
system "consul", "leave"
else
puts "Fabio already running or Consul not available or starting fabio failed."
false
end
end
end
|
class Fb303 < Formula
desc "Thrift functions for querying information from a service"
homepage "https://github.com/facebook/fb303"
url "https://github.com/facebook/fb303/archive/v2022.08.29.00.tar.gz"
sha256 "7771f0b81a991748a46a3d9fc52df5ecbc19af01b05c327d52bacf804eef0edd"
license "Apache-2.0"
head "https://github.com/facebook/fb303.git", branch: "main"
bottle do
sha256 cellar: :any, arm64_monterey: "6d72101eba60bd12f717d3a315c14559efb63bd928fc5c0d89564cc004b29258"
sha256 cellar: :any, arm64_big_sur: "ffc3f8cef6410fe688ee50d3921daa02cf78afb80231c0cd675c0fbe1713775d"
sha256 cellar: :any, monterey: "d0179374581a3f162a005ab7ac691db73c3df34e0464f1cb3501083814eb4781"
sha256 cellar: :any, big_sur: "f7c237a5b11959783f5f28a06bc986d4d4cf4e5bd0cd6a98604e6acac0da2982"
sha256 cellar: :any, catalina: "d0a1fa1713f251748b8f871a7491cfdb4129f61c6c62d3fee32eea90a1dfcff7"
sha256 cellar: :any_skip_relocation, x86_64_linux: "212f3486036b3951baf294e04274d0e3a812f2409c2f3896dd2b2eef7059bdb6"
end
depends_on "cmake" => :build
depends_on "fbthrift"
depends_on "fizz"
depends_on "fmt"
depends_on "folly"
depends_on "gflags"
depends_on "glog"
depends_on "openssl@1.1"
depends_on "wangle"
on_linux do
depends_on "gcc"
end
fails_with gcc: "5" # C++17
def install
system "cmake", "-S", ".", "-B", "build",
"-DPYTHON_EXTENSIONS=OFF",
"-DBUILD_SHARED_LIBS=ON",
"-DCMAKE_INSTALL_RPATH=#{rpath}",
*std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end
test do
(testpath/"test.cpp").write <<~EOS
#include "fb303/thrift/gen-cpp2/BaseService.h"
#include <iostream>
int main() {
auto service = facebook::fb303::cpp2::BaseServiceSvIf();
std::cout << service.getGeneratedName() << std::endl;
return 0;
}
EOS
if Tab.for_formula(Formula["folly"]).built_as_bottle
ENV.remove_from_cflags "-march=native"
ENV.append_to_cflags "-march=#{Hardware.oldest_cpu}" if Hardware::CPU.intel?
end
ENV.append "CXXFLAGS", "-std=c++17"
system ENV.cxx, *ENV.cxxflags.split, "test.cpp", "-o", "test",
"-I#{include}", "-I#{Formula["openssl@1.1"].opt_include}",
"-L#{lib}", "-lfb303_thrift_cpp",
"-L#{Formula["folly"].opt_lib}", "-lfolly",
"-L#{Formula["glog"].opt_lib}", "-lglog",
"-L#{Formula["fbthrift"].opt_lib}", "-lthriftprotocol", "-lthriftcpp2",
"-L#{Formula["boost"].opt_lib}", "-lboost_context-mt",
"-ldl"
assert_equal "BaseService", shell_output("./test").strip
end
end
fb303 2022.09.05.00
Signed-off-by: Rui Chen <907c7afd57be493757f13ccd1dd45dddf02db069@chenrui.dev>
class Fb303 < Formula
desc "Thrift functions for querying information from a service"
homepage "https://github.com/facebook/fb303"
url "https://github.com/facebook/fb303/archive/v2022.09.05.00.tar.gz"
sha256 "59fa35558500f7de152b8c353c1466ebe01d5b5008619c17097051b7362e3e2d"
license "Apache-2.0"
head "https://github.com/facebook/fb303.git", branch: "main"
bottle do
sha256 cellar: :any, arm64_monterey: "6d72101eba60bd12f717d3a315c14559efb63bd928fc5c0d89564cc004b29258"
sha256 cellar: :any, arm64_big_sur: "ffc3f8cef6410fe688ee50d3921daa02cf78afb80231c0cd675c0fbe1713775d"
sha256 cellar: :any, monterey: "d0179374581a3f162a005ab7ac691db73c3df34e0464f1cb3501083814eb4781"
sha256 cellar: :any, big_sur: "f7c237a5b11959783f5f28a06bc986d4d4cf4e5bd0cd6a98604e6acac0da2982"
sha256 cellar: :any, catalina: "d0a1fa1713f251748b8f871a7491cfdb4129f61c6c62d3fee32eea90a1dfcff7"
sha256 cellar: :any_skip_relocation, x86_64_linux: "212f3486036b3951baf294e04274d0e3a812f2409c2f3896dd2b2eef7059bdb6"
end
depends_on "cmake" => :build
depends_on "fbthrift"
depends_on "fizz"
depends_on "fmt"
depends_on "folly"
depends_on "gflags"
depends_on "glog"
depends_on "openssl@1.1"
depends_on "wangle"
on_linux do
depends_on "gcc"
end
fails_with gcc: "5" # C++17
def install
system "cmake", "-S", ".", "-B", "build",
"-DPYTHON_EXTENSIONS=OFF",
"-DBUILD_SHARED_LIBS=ON",
"-DCMAKE_INSTALL_RPATH=#{rpath}",
*std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end
test do
(testpath/"test.cpp").write <<~EOS
#include "fb303/thrift/gen-cpp2/BaseService.h"
#include <iostream>
int main() {
auto service = facebook::fb303::cpp2::BaseServiceSvIf();
std::cout << service.getGeneratedName() << std::endl;
return 0;
}
EOS
if Tab.for_formula(Formula["folly"]).built_as_bottle
ENV.remove_from_cflags "-march=native"
ENV.append_to_cflags "-march=#{Hardware.oldest_cpu}" if Hardware::CPU.intel?
end
ENV.append "CXXFLAGS", "-std=c++17"
system ENV.cxx, *ENV.cxxflags.split, "test.cpp", "-o", "test",
"-I#{include}", "-I#{Formula["openssl@1.1"].opt_include}",
"-L#{lib}", "-lfb303_thrift_cpp",
"-L#{Formula["folly"].opt_lib}", "-lfolly",
"-L#{Formula["glog"].opt_lib}", "-lglog",
"-L#{Formula["fbthrift"].opt_lib}", "-lthriftprotocol", "-lthriftcpp2",
"-L#{Formula["boost"].opt_lib}", "-lboost_context-mt",
"-ldl"
assert_equal "BaseService", shell_output("./test").strip
end
end
|
class Ffmbc < Formula
desc "FFmpeg customized for broadcast and professional usage"
homepage "https://code.google.com/p/ffmbc/"
url "https://drive.google.com/uc?export=download&id=0B0jxxycBojSwTEgtbjRZMXBJREU"
version "0.7.2"
sha256 "caaae2570c747077142db34ce33262af0b6d0a505ffbed5c4bdebce685d72e42"
revision 4
bottle do
sha256 "93018afba1f0661d6e6a539b189eea0692932a7af0a30b4c81aebadc79332657" => :high_sierra
sha256 "5923eee01026353f52122bdc3576a94da1d0315a1838cb19d20af07f66ec9566" => :sierra
sha256 "118b7d823df82d0b9eb27544dfe0246f8119aac8f48431e814119448dc47b936" => :el_capitan
end
option "without-x264", "Disable H.264 encoder"
option "without-lame", "Disable MP3 encoder"
option "without-xvid", "Disable Xvid MPEG-4 video encoder"
# manpages won't be built without texi2html
depends_on "texi2html" => :build if MacOS.version >= :mountain_lion
depends_on "yasm" => :build
depends_on "x264" => :recommended
depends_on "faac" => :recommended
depends_on "lame" => :recommended
depends_on "xvid" => :recommended
depends_on "freetype" => :optional
depends_on "theora" => :optional
depends_on "libvorbis" => :optional
depends_on "libogg" => :optional
depends_on "libvpx" => :optional
patch :DATA # fix man page generation, fixed in upstream ffmpeg
def install
args = ["--prefix=#{prefix}",
"--disable-debug",
"--disable-shared",
"--enable-gpl",
"--enable-nonfree",
"--cc=#{ENV.cc}"]
args << "--enable-libx264" if build.with? "x264"
args << "--enable-libfaac" if build.with? "faac"
args << "--enable-libmp3lame" if build.with? "lame"
args << "--enable-libxvid" if build.with? "xvid"
args << "--enable-libfreetype" if build.with? "freetype"
args << "--enable-libtheora" if build.with? "theora"
args << "--enable-libvorbis" if build.with? "libvorbis"
args << "--enable-libogg" if build.with? "libogg"
args << "--enable-libvpx" if build.with? "libvpx"
system "./configure", *args
system "make"
# ffmbc's lib and bin names conflict with ffmpeg and libav
# This formula will only install the commandline tools
mv "ffprobe", "ffprobe-bc"
mv "doc/ffprobe.1", "doc/ffprobe-bc.1"
bin.install "ffmbc", "ffprobe-bc"
man.mkpath
man1.install "doc/ffmbc.1", "doc/ffprobe-bc.1"
end
def caveats
<<~EOS
Due to naming conflicts with other FFmpeg forks, this formula installs
only static binaries - no shared libraries are built.
The `ffprobe` program has been renamed to `ffprobe-bc` to avoid name
conflicts with the FFmpeg executable of the same name.
EOS
end
test do
system "#{bin}/ffmbc", "-h"
end
end
__END__
diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl
index 18531be..88b0a3f 100755
--- a/doc/texi2pod.pl
+++ b/doc/texi2pod.pl
@@ -297,6 +297,8 @@ $inf = pop @instack;
die "No filename or title\n" unless defined $fn && defined $tl;
+print "=encoding utf8\n\n";
+
$sects{NAME} = "$fn \- $tl\n";
$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES};
ffmbc: avoid jack opportunistic linkage
Closes #25966.
Signed-off-by: FX Coudert <c329953660db96eae534be5bbf1a735c2baf69b5@gmail.com>
class Ffmbc < Formula
desc "FFmpeg customized for broadcast and professional usage"
homepage "https://code.google.com/p/ffmbc/"
url "https://drive.google.com/uc?export=download&id=0B0jxxycBojSwTEgtbjRZMXBJREU"
version "0.7.2"
sha256 "caaae2570c747077142db34ce33262af0b6d0a505ffbed5c4bdebce685d72e42"
revision 5
bottle do
sha256 "93018afba1f0661d6e6a539b189eea0692932a7af0a30b4c81aebadc79332657" => :high_sierra
sha256 "5923eee01026353f52122bdc3576a94da1d0315a1838cb19d20af07f66ec9566" => :sierra
sha256 "118b7d823df82d0b9eb27544dfe0246f8119aac8f48431e814119448dc47b936" => :el_capitan
end
depends_on "texi2html" => :build
depends_on "yasm" => :build
depends_on "faac"
depends_on "lame"
depends_on "x264"
depends_on "xvid"
depends_on "libvorbis" => :optional
depends_on "libvpx" => :optional
depends_on "theora" => :optional
patch :DATA # fix man page generation, fixed in upstream ffmpeg
def install
args = ["--prefix=#{prefix}",
"--disable-debug",
"--disable-shared",
"--enable-gpl",
"--enable-libfaac",
"--enable-libmp3lame",
"--enable-libx264",
"--enable-libxvid",
"--enable-nonfree",
"--cc=#{ENV.cc}"]
args << "--enable-libtheora" if build.with? "theora"
args << "--enable-libvorbis" if build.with? "libvorbis"
args << "--enable-libvpx" if build.with? "libvpx"
system "./configure", *args
system "make"
# ffmbc's lib and bin names conflict with ffmpeg and libav
# This formula will only install the commandline tools
mv "ffprobe", "ffprobe-bc"
mv "doc/ffprobe.1", "doc/ffprobe-bc.1"
bin.install "ffmbc", "ffprobe-bc"
man.mkpath
man1.install "doc/ffmbc.1", "doc/ffprobe-bc.1"
end
def caveats
<<~EOS
Due to naming conflicts with other FFmpeg forks, this formula installs
only static binaries - no shared libraries are built.
The `ffprobe` program has been renamed to `ffprobe-bc` to avoid name
conflicts with the FFmpeg executable of the same name.
EOS
end
test do
system "#{bin}/ffmbc", "-h"
end
end
__END__
diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl
index 18531be..88b0a3f 100755
--- a/doc/texi2pod.pl
+++ b/doc/texi2pod.pl
@@ -297,6 +297,8 @@ $inf = pop @instack;
die "No filename or title\n" unless defined $fn && defined $tl;
+print "=encoding utf8\n\n";
+
$sects{NAME} = "$fn \- $tl\n";
$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES};
|
class Flank < Formula
desc "Massively parallel Android and iOS test runner for Firebase Test Lab"
homepage "https://github.com/Flank/flank"
url "https://github.com/Flank/flank/releases/download/v22.05.0/flank.jar"
sha256 "9fa48fe91228c1f36bdec499dcd34c1fafd325419351e7a87cb216d751618205"
license "Apache-2.0"
livecheck do
url :stable
strategy :github_latest
end
bottle do
sha256 cellar: :any_skip_relocation, all: "3cae087dd0a64467c9c190d4a738e8896e5a2bea2755e2e5bcef8f4eda580e7f"
end
depends_on "openjdk"
def install
libexec.install "flank.jar"
bin.write_jar_script libexec/"flank.jar", "flank"
end
test do
(testpath/"flank.yml").write <<~EOS
gcloud:
device:
- model: Pixel2
version: "29"
locale: en
orientation: portrait
EOS
output = shell_output("#{bin}/flank android doctor")
assert_match "Valid yml file", output
end
end
flank: update 22.05.0 bottle.
class Flank < Formula
desc "Massively parallel Android and iOS test runner for Firebase Test Lab"
homepage "https://github.com/Flank/flank"
url "https://github.com/Flank/flank/releases/download/v22.05.0/flank.jar"
sha256 "9fa48fe91228c1f36bdec499dcd34c1fafd325419351e7a87cb216d751618205"
license "Apache-2.0"
livecheck do
url :stable
strategy :github_latest
end
bottle do
sha256 cellar: :any_skip_relocation, all: "3cfa4d0bce6d88b5bb8946b15daeac3a28a6ec9112c61973ac7bd15545c094c0"
end
depends_on "openjdk"
def install
libexec.install "flank.jar"
bin.write_jar_script libexec/"flank.jar", "flank"
end
test do
(testpath/"flank.yml").write <<~EOS
gcloud:
device:
- model: Pixel2
version: "29"
locale: en
orientation: portrait
EOS
output = shell_output("#{bin}/flank android doctor")
assert_match "Valid yml file", output
end
end
|
# Doubtfire will deprecate ActiveModelSerializer in the future.
# Instead, write a serialize method on the model.
require 'unit_role_serializer'
class ShallowUnitSerializer < ActiveModel::Serializer
attributes :code, :id, :name, :teaching_period_id, :start_date, :end_date, :active
end
class UnitSerializer < ActiveModel::Serializer
attributes :code, :id, :name, :my_role, :main_convenor_id, :description, :teaching_period_id, :start_date, :end_date, :active, :convenors, :ilos, :auto_apply_extension_before_deadline, :send_notifications, :enable_sync_enrolments, :enable_sync_timetable, :group_memberships, :draft_task_definition_id
def start_date
object.start_date.to_date
end
def end_date
object.end_date.to_date
end
def my_role_obj
object.role_for(Thread.current[:user]) if Thread.current[:user]
end
def my_user_role
Thread.current[:user].role if Thread.current[:user]
end
def role
role = my_role_obj
role.name unless role.nil?
end
def my_role
role
end
def ilos
object.learning_outcomes
end
def main_convenor_id
object.main_convenor.id
end
has_many :tutorial_streams
has_many :tutorials
has_many :tutorial_enrolments
has_many :task_definitions
has_many :convenors, serializer: UserUnitRoleSerializer
has_many :staff, serializer: UserUnitRoleSerializer
has_many :group_sets, serializer: GroupSetSerializer
has_many :ilos, serializer: LearningOutcomeSerializer
has_many :task_outcome_alignments, serializer: LearningOutcomeTaskLinkSerializer
has_many :groups, serializer: GroupSerializer
def group_memberships
ActiveModel::ArraySerializer.new(object.group_memberships.where(active: true), each_serializer: GroupMembershipSerializer)
end
def include_convenors?
([ Role.convenor, :convenor ].include? my_role_obj) || (my_user_role == Role.admin)
end
def include_staff?
([ Role.convenor, :convenor, Role.tutor, :tutor ].include? my_role_obj) || (my_user_role == Role.admin)
end
def include_groups?
([ Role.convenor, :convenor, Role.tutor, :tutor ].include? my_role_obj) || (my_user_role == Role.admin)
end
def include_enrolments?
([ Role.convenor, :convenor, Role.tutor, :tutor ].include? my_role_obj) || (my_user_role == Role.admin)
end
def filter(keys)
keys.delete :groups unless include_groups?
keys.delete :convenors unless include_convenors?
keys.delete :staff unless include_staff?
keys.delete :tutorial_enrolments unless include_enrolments?
keys
end
end
ENHANCE: Add new details to unit serialiser
# Doubtfire will deprecate ActiveModelSerializer in the future.
# Instead, write a serialize method on the model.
require 'unit_role_serializer'
class ShallowUnitSerializer < ActiveModel::Serializer
attributes :code, :id, :name, :teaching_period_id, :start_date, :end_date, :active
end
class UnitSerializer < ActiveModel::Serializer
attributes :code, :id, :name, :my_role, :main_convenor_id, :description, :teaching_period_id, :start_date, :end_date, :active, :convenors, :ilos, :auto_apply_extension_before_deadline, :send_notifications, :enable_sync_enrolments, :enable_sync_timetable, :group_memberships, :draft_task_definition_id, :allow_student_extension_requests, :extension_weeks_on_resubmit_request
def start_date
object.start_date.to_date
end
def end_date
object.end_date.to_date
end
def my_role_obj
object.role_for(Thread.current[:user]) if Thread.current[:user]
end
def my_user_role
Thread.current[:user].role if Thread.current[:user]
end
def role
role = my_role_obj
role.name unless role.nil?
end
def my_role
role
end
def ilos
object.learning_outcomes
end
def main_convenor_id
object.main_convenor.id
end
has_many :tutorial_streams
has_many :tutorials
has_many :tutorial_enrolments
has_many :task_definitions
has_many :convenors, serializer: UserUnitRoleSerializer
has_many :staff, serializer: UserUnitRoleSerializer
has_many :group_sets, serializer: GroupSetSerializer
has_many :ilos, serializer: LearningOutcomeSerializer
has_many :task_outcome_alignments, serializer: LearningOutcomeTaskLinkSerializer
has_many :groups, serializer: GroupSerializer
def group_memberships
ActiveModel::ArraySerializer.new(object.group_memberships.where(active: true), each_serializer: GroupMembershipSerializer)
end
def include_convenors?
([ Role.convenor, :convenor ].include? my_role_obj) || (my_user_role == Role.admin)
end
def include_staff?
([ Role.convenor, :convenor, Role.tutor, :tutor ].include? my_role_obj) || (my_user_role == Role.admin)
end
def include_groups?
([ Role.convenor, :convenor, Role.tutor, :tutor ].include? my_role_obj) || (my_user_role == Role.admin)
end
def include_enrolments?
([ Role.convenor, :convenor, Role.tutor, :tutor ].include? my_role_obj) || (my_user_role == Role.admin)
end
def filter(keys)
keys.delete :groups unless include_groups?
keys.delete :convenors unless include_convenors?
keys.delete :staff unless include_staff?
keys.delete :tutorial_enrolments unless include_enrolments?
keys
end
end
|
class Folly < Formula
desc "Collection of reusable C++ library artifacts developed at Facebook"
homepage "https://github.com/facebook/folly"
url "https://github.com/facebook/folly/archive/v2018.04.23.00.tar.gz"
sha256 "93acfc450f3c1fa54c9217353184b515fd646b5afb58ba6b51a79cfd62bedca2"
head "https://github.com/facebook/folly.git"
bottle do
cellar :any
sha256 "3a629f67583c5bb72789a43eb0694e8d2063db90c778caa7e6c2281d8d44a849" => :high_sierra
sha256 "00b32db370203998106ce076d3fbbfa614b07d92fc08fe342005843476334c69" => :sierra
sha256 "8352ada9c96905541fec3e0bc2e270456a8e0add93a45875c6c620299a31c2e3" => :el_capitan
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
depends_on "double-conversion"
depends_on "glog"
depends_on "gflags"
depends_on "boost"
depends_on "libevent"
depends_on "xz"
depends_on "snappy"
depends_on "lz4"
depends_on "openssl"
depends_on "python" unless OS.mac?
# https://github.com/facebook/folly/issues/451
depends_on :macos => :el_capitan unless OS.mac?
needs :cxx11
# Known issue upstream. They're working on it:
# https://github.com/facebook/folly/pull/445
fails_with :gcc => "6"
def install
# Reduce memory usage below 4 GB for Circle CI.
ENV["MAKEFLAGS"] = "-j8" if ENV["CIRCLECI"]
ENV.cxx11
cd "folly" do
system "autoreconf", "-fvi"
system "./configure", "--prefix=#{prefix}", "--disable-silent-rules",
"--disable-dependency-tracking",
"--with-boost-libdir=#{Formula["boost"].opt_lib}"
system "make"
system "make", "install"
end
end
test do
(testpath/"test.cc").write <<~EOS
#include <folly/FBVector.h>
int main() {
folly::fbvector<int> numbers({0, 1, 2, 3});
numbers.reserve(10);
for (int i = 4; i < 10; i++) {
numbers.push_back(i * 2);
}
assert(numbers[6] == 12);
return 0;
}
EOS
system ENV.cxx, "-std=c++11", "test.cc", "-I#{include}", "-L#{lib}",
"-lfolly", "-o", "test"
system "./test"
end
end
folly: update 2018.04.23.00 bottle for Linuxbrew.
Closes Linuxbrew/homebrew-core#7332.
Signed-off-by: Michka Popoff <7b0496f66f66ee22a38826c310c38b415671b832@gmail.com>
class Folly < Formula
desc "Collection of reusable C++ library artifacts developed at Facebook"
homepage "https://github.com/facebook/folly"
url "https://github.com/facebook/folly/archive/v2018.04.23.00.tar.gz"
sha256 "93acfc450f3c1fa54c9217353184b515fd646b5afb58ba6b51a79cfd62bedca2"
head "https://github.com/facebook/folly.git"
bottle do
cellar :any
sha256 "3a629f67583c5bb72789a43eb0694e8d2063db90c778caa7e6c2281d8d44a849" => :high_sierra
sha256 "00b32db370203998106ce076d3fbbfa614b07d92fc08fe342005843476334c69" => :sierra
sha256 "8352ada9c96905541fec3e0bc2e270456a8e0add93a45875c6c620299a31c2e3" => :el_capitan
sha256 "12dbda6c10ca7fb915077dfa4dc4611fd0d84de316a99ea3ea36b7994aaa1e88" => :x86_64_linux
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
depends_on "double-conversion"
depends_on "glog"
depends_on "gflags"
depends_on "boost"
depends_on "libevent"
depends_on "xz"
depends_on "snappy"
depends_on "lz4"
depends_on "openssl"
depends_on "python" unless OS.mac?
# https://github.com/facebook/folly/issues/451
depends_on :macos => :el_capitan unless OS.mac?
needs :cxx11
# Known issue upstream. They're working on it:
# https://github.com/facebook/folly/pull/445
fails_with :gcc => "6"
def install
# Reduce memory usage below 4 GB for Circle CI.
ENV["MAKEFLAGS"] = "-j8" if ENV["CIRCLECI"]
ENV.cxx11
cd "folly" do
system "autoreconf", "-fvi"
system "./configure", "--prefix=#{prefix}", "--disable-silent-rules",
"--disable-dependency-tracking",
"--with-boost-libdir=#{Formula["boost"].opt_lib}"
system "make"
system "make", "install"
end
end
test do
(testpath/"test.cc").write <<~EOS
#include <folly/FBVector.h>
int main() {
folly::fbvector<int> numbers({0, 1, 2, 3});
numbers.reserve(10);
for (int i = 4; i < 10; i++) {
numbers.push_back(i * 2);
}
assert(numbers[6] == 12);
return 0;
}
EOS
system ENV.cxx, "-std=c++11", "test.cc", "-I#{include}", "-L#{lib}",
"-lfolly", "-o", "test"
system "./test"
end
end
|
class MapExportService < Struct.new(:user, :map)
def json
# marshal_dump turns OpenStruct into a Hash
{
topics: exportable_topics.map(&:marshal_dump),
synapses: exportable_synapses.map(&:marshal_dump)
}
end
def csv(options = {})
CSV.generate(options) do |csv|
to_spreadsheet.each do |line|
csv << line
end
end
end
def xls
to_spreadsheet
end
private
def topic_headings
[:id, :name, :metacode, :x, :y, :description, :link, :user, :permission]
end
def synapse_headings
[:topic1, :topic2, :category, :description, :user, :permission]
end
def exportable_topics
visible_topics ||= Pundit.policy_scope!(user, map.topics)
topic_mappings = Mapping.includes(mappable: [:metacode, :user])
.where(mappable: visible_topics, map: map)
topic_mappings.map do |mapping|
topic = mapping.mappable
OpenStruct.new(
id: topic.id,
name: topic.name,
metacode: topic.metacode.name,
x: mapping.xloc,
y: mapping.yloc,
description: topic.desc,
link: topic.link,
user: topic.user.name,
permission: topic.permission
)
end
end
def exportable_synapses
visible_synapses = Pundit.policy_scope!(user, map.synapses)
visible_synapses.map do |synapse|
OpenStruct.new(
topic1: synapse.node1_id,
topic2: synapse.node2_id,
category: synapse.category,
description: synapse.desc,
user: synapse.user.name,
permission: synapse.permission
)
end
end
def to_spreadsheet
spreadsheet = []
spreadsheet << ['Topics']
spreadsheet << topic_headings.map(&:capitalize)
exportable_topics.each do |topics|
# convert exportable_topics into an array of arrays
spreadsheet << topic_headings.map { |h| topics.send(h) }
end
spreadsheet << []
spreadsheet << ['Synapses']
spreadsheet << synapse_headings.map(&:capitalize)
exportable_synapses.each do |synapse|
# convert exportable_synapses into an array of arrays
spreadsheet << synapse_headings.map { |h| synapse.send(h) }
end
spreadsheet
end
end
I think this fixes issue #566 but I'm not sure
class MapExportService < Struct.new(:user, :map)
def json
# marshal_dump turns OpenStruct into a Hash
{
topics: exportable_topics.map(&:marshal_dump),
synapses: exportable_synapses.map(&:marshal_dump)
}
end
def csv(options = {})
CSV.generate(options) do |csv|
to_spreadsheet.each do |line|
csv << line
end
end
end
def xls
to_spreadsheet
end
private
def topic_headings
[:id, :name, :metacode, :x, :y, :description, :link, :user, :permission]
end
def synapse_headings
[:topic1, :topic2, :category, :description, :user, :permission]
end
def exportable_topics
visible_topics ||= Pundit.policy_scope!(user, map.topics)
topic_mappings = Mapping.includes(mappable: [:metacode, :user])
.where(mappable: visible_topics, map: map)
topic_mappings.map do |mapping|
topic = mapping.mappable
next nil if topic.nil?
OpenStruct.new(
id: topic.id,
name: topic.name,
metacode: topic.metacode.name,
x: mapping.xloc,
y: mapping.yloc,
description: topic.desc,
link: topic.link,
user: topic.user.name,
permission: topic.permission
)
end.compact
end
def exportable_synapses
visible_synapses = Pundit.policy_scope!(user, map.synapses)
visible_synapses.map do |synapse|
next nil if synapse.nil?
OpenStruct.new(
topic1: synapse.node1_id,
topic2: synapse.node2_id,
category: synapse.category,
description: synapse.desc,
user: synapse.user.name,
permission: synapse.permission
)
end.compact
end
def to_spreadsheet
spreadsheet = []
spreadsheet << ['Topics']
spreadsheet << topic_headings.map(&:capitalize)
exportable_topics.each do |topics|
# convert exportable_topics into an array of arrays
spreadsheet << topic_headings.map { |h| topics.send(h) }
end
spreadsheet << []
spreadsheet << ['Synapses']
spreadsheet << synapse_headings.map(&:capitalize)
exportable_synapses.each do |synapse|
# convert exportable_synapses into an array of arrays
spreadsheet << synapse_headings.map { |h| synapse.send(h) }
end
spreadsheet
end
end
|
class Folly < Formula
desc "Collection of reusable C++ library artifacts developed at Facebook"
homepage "https://github.com/facebook/folly"
url "https://github.com/facebook/folly/archive/v2020.06.08.00.tar.gz"
sha256 "559d85113cb31085fc0bc3e8abbe6f696368a28b947510ef918dfd35972c6630"
head "https://github.com/facebook/folly.git"
bottle do
cellar :any
sha256 "09685ffb41d3ba00ae70383692adecc110bfb5deffff8ab532d967284e86a7ad" => :catalina
sha256 "575ec9e312aaeca6d27077c18d4c18ad821e80048602f78f4fd8584f42ff2f20" => :mojave
sha256 "f981183c1caece4ce5adbc5166c4f8f01a9db1b33e2cd1c7164fe85362759943" => :high_sierra
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "boost"
depends_on "double-conversion"
depends_on "fmt"
depends_on "gflags"
depends_on "glog"
depends_on "libevent"
depends_on "lz4"
# https://github.com/facebook/folly/issues/966
depends_on :macos => :high_sierra
depends_on "openssl@1.1"
depends_on "snappy"
depends_on "xz"
depends_on "zstd"
def install
mkdir "_build" do
args = std_cmake_args + %w[
-DFOLLY_USE_JEMALLOC=OFF
]
system "cmake", "..", *args, "-DBUILD_SHARED_LIBS=ON"
system "make"
system "make", "install"
system "make", "clean"
system "cmake", "..", *args, "-DBUILD_SHARED_LIBS=OFF"
system "make"
lib.install "libfolly.a", "folly/libfollybenchmark.a"
end
end
test do
(testpath/"test.cc").write <<~EOS
#include <folly/FBVector.h>
int main() {
folly::fbvector<int> numbers({0, 1, 2, 3});
numbers.reserve(10);
for (int i = 4; i < 10; i++) {
numbers.push_back(i * 2);
}
assert(numbers[6] == 12);
return 0;
}
EOS
system ENV.cxx, "-std=c++14", "test.cc", "-I#{include}", "-L#{lib}",
"-lfolly", "-o", "test"
system "./test"
end
end
folly 2020.06.15.00
Closes #56333.
Signed-off-by: BrewTestBot <8a898ee6867e4f2028e63d2a6319b2224641c06c@users.noreply.github.com>
class Folly < Formula
desc "Collection of reusable C++ library artifacts developed at Facebook"
homepage "https://github.com/facebook/folly"
url "https://github.com/facebook/folly/archive/v2020.06.15.00.tar.gz"
sha256 "f9d126ef068fab398ba2c0019567c08b21c4c15426d10ea44ef1418cde4a3b0f"
head "https://github.com/facebook/folly.git"
bottle do
cellar :any
sha256 "09685ffb41d3ba00ae70383692adecc110bfb5deffff8ab532d967284e86a7ad" => :catalina
sha256 "575ec9e312aaeca6d27077c18d4c18ad821e80048602f78f4fd8584f42ff2f20" => :mojave
sha256 "f981183c1caece4ce5adbc5166c4f8f01a9db1b33e2cd1c7164fe85362759943" => :high_sierra
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "boost"
depends_on "double-conversion"
depends_on "fmt"
depends_on "gflags"
depends_on "glog"
depends_on "libevent"
depends_on "lz4"
# https://github.com/facebook/folly/issues/966
depends_on :macos => :high_sierra
depends_on "openssl@1.1"
depends_on "snappy"
depends_on "xz"
depends_on "zstd"
def install
mkdir "_build" do
args = std_cmake_args + %w[
-DFOLLY_USE_JEMALLOC=OFF
]
system "cmake", "..", *args, "-DBUILD_SHARED_LIBS=ON"
system "make"
system "make", "install"
system "make", "clean"
system "cmake", "..", *args, "-DBUILD_SHARED_LIBS=OFF"
system "make"
lib.install "libfolly.a", "folly/libfollybenchmark.a"
end
end
test do
(testpath/"test.cc").write <<~EOS
#include <folly/FBVector.h>
int main() {
folly::fbvector<int> numbers({0, 1, 2, 3});
numbers.reserve(10);
for (int i = 4; i < 10; i++) {
numbers.push_back(i * 2);
}
assert(numbers[6] == 12);
return 0;
}
EOS
system ENV.cxx, "-std=c++14", "test.cc", "-I#{include}", "-L#{lib}",
"-lfolly", "-o", "test"
system "./test"
end
end
|
# A helper for more human-readable logic clauses to be used in permissions
class PermissionService < Service
def self.user_has_fewer_owned_universes_than_plan_limit?(user:)
user.universes.count < (user.active_billing_plans.map(&:universe_limit).max || 5)
end
def self.user_owns_content?(user:, content:)
content.user == user
end
def self.user_owns_any_containing_universe?(user:, content:)
content.universe.present? && user_owns_content?(user: user, content: content.universe)
end
def self.user_can_contribute_to_universe?(user:, universe:)
user.contributable_universes.pluck(:id).include?(universe.id)
end
def self.content_is_public?(content:)
content.respond_to?(:privacy) && content.privacy == 'public'
end
def self.content_is_in_a_public_universe?(content:)
content.respond_to?(:universe) && content.universe.present? && self.content_is_public?(content: content.universe)
end
def self.user_can_contribute_to_containing_universe?(user:, content:)
content.universe.present? && user.contributable_universes.pluck(:id).include?(content.universe.id)
end
def self.content_has_no_containing_universe?(content:)
content.universe.nil?
end
def self.user_is_on_premium_plan?(user:)
user.is_on_premium_plan?
end
def self.billing_plan_allows_core_content?(user:)
active_billing_plans = user.active_billing_plans
active_billing_plans.empty? || active_billing_plans.any?(&:allows_core_content)
end
def self.billing_plan_allows_extended_content?(user:)
# todo remove second clause will billing plans are fixed
user.active_billing_plans.any?(&:allows_extended_content) || BillingPlan::PREMIUM_IDS.include?(user.selected_billing_plan_id)
end
def self.user_can_collaborate_in_universe_that_allows_extended_content?(user:)
user.contributable_universes.any? do |universe|
billing_plan_allows_extended_content?(user: universe.user)
end
end
def self.billing_plan_allows_collective_content?(user:)
user.active_billing_plans.any?(&:allows_collective_content) || BillingPlan::PREMIUM_IDS.include?(user.selected_billing_plan_id)
end
def self.user_can_collaborate_in_universe_that_allows_collective_content?(user:)
user.contributable_universes.any? do |universe|
billing_plan_allows_collective_content?(user: universe.user)
end
end
end
Exclude attributefields from containing-universe checks
# A helper for more human-readable logic clauses to be used in permissions
class PermissionService < Service
def self.user_has_fewer_owned_universes_than_plan_limit?(user:)
user.universes.count < (user.active_billing_plans.map(&:universe_limit).max || 5)
end
def self.user_owns_content?(user:, content:)
content.user == user
end
def self.user_owns_any_containing_universe?(user:, content:)
content.respond_to?(:universe) && content.universe.present? && user_owns_content?(user: user, content: content.universe)
end
def self.user_can_contribute_to_universe?(user:, universe:)
user.contributable_universes.pluck(:id).include?(universe.id)
end
def self.content_is_public?(content:)
content.respond_to?(:privacy) && content.privacy == 'public'
end
def self.content_is_in_a_public_universe?(content:)
content.respond_to?(:universe) && content.universe.present? && self.content_is_public?(content: content.universe)
end
def self.user_can_contribute_to_containing_universe?(user:, content:)
content.universe.present? && user.contributable_universes.pluck(:id).include?(content.universe.id)
end
def self.content_has_no_containing_universe?(content:)
content.universe.nil?
end
def self.user_is_on_premium_plan?(user:)
user.is_on_premium_plan?
end
def self.billing_plan_allows_core_content?(user:)
active_billing_plans = user.active_billing_plans
active_billing_plans.empty? || active_billing_plans.any?(&:allows_core_content)
end
def self.billing_plan_allows_extended_content?(user:)
# todo remove second clause will billing plans are fixed
user.active_billing_plans.any?(&:allows_extended_content) || BillingPlan::PREMIUM_IDS.include?(user.selected_billing_plan_id)
end
def self.user_can_collaborate_in_universe_that_allows_extended_content?(user:)
user.contributable_universes.any? do |universe|
billing_plan_allows_extended_content?(user: universe.user)
end
end
def self.billing_plan_allows_collective_content?(user:)
user.active_billing_plans.any?(&:allows_collective_content) || BillingPlan::PREMIUM_IDS.include?(user.selected_billing_plan_id)
end
def self.user_can_collaborate_in_universe_that_allows_collective_content?(user:)
user.contributable_universes.any? do |universe|
billing_plan_allows_collective_content?(user: universe.user)
end
end
end
|
class Folly < Formula
desc "Collection of reusable C++ library artifacts developed at Facebook"
homepage "https://github.com/facebook/folly"
url "https://github.com/facebook/folly/archive/v2020.10.05.00.tar.gz"
sha256 "d2ba45bdedf837d93d98216e1464689b7eb646d1982eb58c44e89910bdca458c"
license "Apache-2.0"
head "https://github.com/facebook/folly.git"
bottle do
cellar :any
sha256 "61251d8fd2f6a6511a9cf86ca8611fc5c5befb71c0ae5a00b52c81f2f62bf72f" => :catalina
sha256 "3d77950da6d5ec604d1e6a24db28b0238a5192baf7ddc64b6ec869776ffd8207" => :mojave
sha256 "2cf47921908e386164c795b457db90d0ead62742e66ebf3cd05de341a6915ee4" => :high_sierra
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "boost"
depends_on "double-conversion"
depends_on "fmt"
depends_on "gflags"
depends_on "glog"
depends_on "libevent"
depends_on "lz4"
# https://github.com/facebook/folly/issues/966
depends_on macos: :high_sierra
depends_on "openssl@1.1"
depends_on "snappy"
depends_on "xz"
depends_on "zstd"
def install
mkdir "_build" do
args = std_cmake_args + %w[
-DFOLLY_USE_JEMALLOC=OFF
]
system "cmake", "..", *args, "-DBUILD_SHARED_LIBS=ON"
system "make"
system "make", "install"
system "make", "clean"
system "cmake", "..", *args, "-DBUILD_SHARED_LIBS=OFF"
system "make"
lib.install "libfolly.a", "folly/libfollybenchmark.a"
end
end
test do
(testpath/"test.cc").write <<~EOS
#include <folly/FBVector.h>
int main() {
folly::fbvector<int> numbers({0, 1, 2, 3});
numbers.reserve(10);
for (int i = 4; i < 10; i++) {
numbers.push_back(i * 2);
}
assert(numbers[6] == 12);
return 0;
}
EOS
system ENV.cxx, "-std=c++14", "test.cc", "-I#{include}", "-L#{lib}",
"-lfolly", "-o", "test"
system "./test"
end
end
folly: update 2020.10.05.00 bottle.
class Folly < Formula
desc "Collection of reusable C++ library artifacts developed at Facebook"
homepage "https://github.com/facebook/folly"
url "https://github.com/facebook/folly/archive/v2020.10.05.00.tar.gz"
sha256 "d2ba45bdedf837d93d98216e1464689b7eb646d1982eb58c44e89910bdca458c"
license "Apache-2.0"
head "https://github.com/facebook/folly.git"
bottle do
cellar :any
sha256 "4bebb959ecc64ef6ffe92848f192c5dbc1de1bf19bd587a81a8ad066d884f0a4" => :catalina
sha256 "f0aa59d002a601546525ccd07364427f9e2a00794556a52e8c332bcba929b370" => :mojave
sha256 "ce8dbb321abca51c4c16a46d2178d53dbfa50c6a948797ceb47375fb85f0ecce" => :high_sierra
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "boost"
depends_on "double-conversion"
depends_on "fmt"
depends_on "gflags"
depends_on "glog"
depends_on "libevent"
depends_on "lz4"
# https://github.com/facebook/folly/issues/966
depends_on macos: :high_sierra
depends_on "openssl@1.1"
depends_on "snappy"
depends_on "xz"
depends_on "zstd"
def install
mkdir "_build" do
args = std_cmake_args + %w[
-DFOLLY_USE_JEMALLOC=OFF
]
system "cmake", "..", *args, "-DBUILD_SHARED_LIBS=ON"
system "make"
system "make", "install"
system "make", "clean"
system "cmake", "..", *args, "-DBUILD_SHARED_LIBS=OFF"
system "make"
lib.install "libfolly.a", "folly/libfollybenchmark.a"
end
end
test do
(testpath/"test.cc").write <<~EOS
#include <folly/FBVector.h>
int main() {
folly::fbvector<int> numbers({0, 1, 2, 3});
numbers.reserve(10);
for (int i = 4; i < 10; i++) {
numbers.push_back(i * 2);
}
assert(numbers[6] == 12);
return 0;
}
EOS
system ENV.cxx, "-std=c++14", "test.cc", "-I#{include}", "-L#{lib}",
"-lfolly", "-o", "test"
system "./test"
end
end
|
class Folly < Formula
desc "Collection of reusable C++ library artifacts developed at Facebook"
homepage "https://github.com/facebook/folly"
url "https://github.com/facebook/folly/archive/v2022.03.14.00.tar.gz"
sha256 "458cbf249e92e82f17455748a4084f31e2aa3c0f03d69709414bf4b6417333d8"
license "Apache-2.0"
head "https://github.com/facebook/folly.git", branch: "main"
bottle do
sha256 cellar: :any, arm64_monterey: "024267f2c54b49f4e09aa9dfdd6c7dac3b5ab9204b9663b82a8af88893e1aff6"
sha256 cellar: :any, arm64_big_sur: "908b874b1bdd7c5c2a8f69b9fdc9a5adfc6738adea28a3ceb0ac0f345732a7bc"
sha256 cellar: :any, monterey: "55b36a8b1bc43dc1dacf5bf7c5bfdb7aa9816dee7c89aa7a7fe616c73acb9855"
sha256 cellar: :any, big_sur: "6c47b9439ae426643b93fd28ef28a8e16f3f587378aec74ecdc679879428bad5"
sha256 cellar: :any, catalina: "2aa80de17c5657a2b6700801dabd60663bbfaf8d4ea24c6ac07275f8e45fc488"
sha256 cellar: :any_skip_relocation, x86_64_linux: "10fff8a0f032cb50938df68089ba3b99eb8d24a499e93b2bbceb3a3af1c6909b"
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "boost"
depends_on "double-conversion"
depends_on "fmt"
depends_on "gflags"
depends_on "glog"
depends_on "libevent"
depends_on "lz4"
depends_on "openssl@1.1"
depends_on "snappy"
depends_on "xz"
depends_on "zstd"
on_macos do
depends_on "llvm" if DevelopmentTools.clang_build_version <= 1100
end
on_linux do
depends_on "gcc"
end
fails_with :clang do
build 1100
# https://github.com/facebook/folly/issues/1545
cause <<-EOS
Undefined symbols for architecture x86_64:
"std::__1::__fs::filesystem::path::lexically_normal() const"
EOS
end
fails_with gcc: "5"
def install
ENV.llvm_clang if OS.mac? && (DevelopmentTools.clang_build_version <= 1100)
args = std_cmake_args + %w[
-DFOLLY_USE_JEMALLOC=OFF
]
system "cmake", "-S", ".", "-B", "build/shared",
"-DBUILD_SHARED_LIBS=ON",
"-DCMAKE_INSTALL_RPATH=#{rpath}",
*args
system "cmake", "--build", "build/shared"
system "cmake", "--install", "build/shared"
system "cmake", "-S", ".", "-B", "build/static",
"-DBUILD_SHARED_LIBS=OFF",
*args
system "cmake", "--build", "build/static"
lib.install "build/static/libfolly.a", "build/static/folly/libfollybenchmark.a"
end
test do
# Force use of Clang rather than LLVM Clang
ENV.clang if OS.mac?
(testpath/"test.cc").write <<~EOS
#include <folly/FBVector.h>
int main() {
folly::fbvector<int> numbers({0, 1, 2, 3});
numbers.reserve(10);
for (int i = 4; i < 10; i++) {
numbers.push_back(i * 2);
}
assert(numbers[6] == 12);
return 0;
}
EOS
system ENV.cxx, "-std=c++14", "test.cc", "-I#{include}", "-L#{lib}",
"-lfolly", "-o", "test"
system "./test"
end
end
folly: update 2022.03.14.00 bottle.
class Folly < Formula
desc "Collection of reusable C++ library artifacts developed at Facebook"
homepage "https://github.com/facebook/folly"
url "https://github.com/facebook/folly/archive/v2022.03.14.00.tar.gz"
sha256 "458cbf249e92e82f17455748a4084f31e2aa3c0f03d69709414bf4b6417333d8"
license "Apache-2.0"
head "https://github.com/facebook/folly.git", branch: "main"
bottle do
sha256 cellar: :any, arm64_monterey: "b6bd4c1033ac99a684122ac2adb129c00fa67bebdd6ba3411943eac5d00142a2"
sha256 cellar: :any, arm64_big_sur: "c587d7eb772a6bc622f69b908a3ce11b3e9a10ad3a5e474cb957fb0cd6ddf846"
sha256 cellar: :any, monterey: "baaae96df7648ba624a176fccbbfdf7b90761a7e4831b031f135a546f253e204"
sha256 cellar: :any, big_sur: "fd15bef2cdf5d2a29218d173d5f3d51b68fefae4326ef2ab582bda985b2cc5ce"
sha256 cellar: :any, catalina: "efc919290be95c2a138a62feb7c6c8b16fa40f991a492499ef0ea4806170ce96"
sha256 cellar: :any_skip_relocation, x86_64_linux: "e2c3897c4658d679a33d780228b8fd6ec283ca1643a117a3ac692e09d553503a"
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "boost"
depends_on "double-conversion"
depends_on "fmt"
depends_on "gflags"
depends_on "glog"
depends_on "libevent"
depends_on "lz4"
depends_on "openssl@1.1"
depends_on "snappy"
depends_on "xz"
depends_on "zstd"
on_macos do
depends_on "llvm" if DevelopmentTools.clang_build_version <= 1100
end
on_linux do
depends_on "gcc"
end
fails_with :clang do
build 1100
# https://github.com/facebook/folly/issues/1545
cause <<-EOS
Undefined symbols for architecture x86_64:
"std::__1::__fs::filesystem::path::lexically_normal() const"
EOS
end
fails_with gcc: "5"
def install
ENV.llvm_clang if OS.mac? && (DevelopmentTools.clang_build_version <= 1100)
args = std_cmake_args + %w[
-DFOLLY_USE_JEMALLOC=OFF
]
system "cmake", "-S", ".", "-B", "build/shared",
"-DBUILD_SHARED_LIBS=ON",
"-DCMAKE_INSTALL_RPATH=#{rpath}",
*args
system "cmake", "--build", "build/shared"
system "cmake", "--install", "build/shared"
system "cmake", "-S", ".", "-B", "build/static",
"-DBUILD_SHARED_LIBS=OFF",
*args
system "cmake", "--build", "build/static"
lib.install "build/static/libfolly.a", "build/static/folly/libfollybenchmark.a"
end
test do
# Force use of Clang rather than LLVM Clang
ENV.clang if OS.mac?
(testpath/"test.cc").write <<~EOS
#include <folly/FBVector.h>
int main() {
folly::fbvector<int> numbers({0, 1, 2, 3});
numbers.reserve(10);
for (int i = 4; i < 10; i++) {
numbers.push_back(i * 2);
}
assert(numbers[6] == 12);
return 0;
}
EOS
system ENV.cxx, "-std=c++14", "test.cc", "-I#{include}", "-L#{lib}",
"-lfolly", "-o", "test"
system "./test"
end
end
|
class GccAT5 < Formula
def arch
if Hardware::CPU.type == :intel
if MacOS.prefer_64_bit?
"x86_64"
else
"i686"
end
elsif Hardware::CPU.type == :ppc
if MacOS.prefer_64_bit?
"powerpc64"
else
"powerpc"
end
end
end
def osmajor
`uname -r`.chomp
end
desc "The GNU Compiler Collection"
homepage "https://gcc.gnu.org"
url "https://ftpmirror.gnu.org/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2"
mirror "https://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2"
sha256 "608df76dec2d34de6558249d8af4cbee21eceddbcb580d666f7a5a583ca3303a"
revision 1
bottle do
sha256 "f3073ac59c0c7e519f66759df059d55e5c791d56777c842a52ff0eeffd44584b" => :sierra
sha256 "e04f4c2223e8ab1e94138e7a39ceaa8c5d73ab1185b8ea738b3731ee64cde4da" => :el_capitan
sha256 "632863a5b37ac8179455c88d8c069ca4098901b766492fe66fdd98344c0548b1" => :yosemite
end
# GCC's Go compiler is not currently supported on Mac OS X.
# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46986
option "with-java", "Build the gcj compiler"
option "with-all-languages", "Enable all compilers and languages, except Ada"
option "with-nls", "Build with native language support (localization)"
option "with-profiled-build", "Make use of profile guided optimization when bootstrapping GCC"
option "with-jit", "Build the jit compiler"
option "without-fortran", "Build without the gfortran compiler"
# enabling multilib on a host that can"t run 64-bit results in build failures
option "without-multilib", "Build without multilib support" if MacOS.prefer_64_bit?
depends_on "gmp"
depends_on "libmpc"
depends_on "mpfr"
depends_on "isl@0.14"
depends_on "ecj" if build.with?("java") || build.with?("all-languages")
if MacOS.version < :leopard
# The as that comes with Tiger isn't capable of dealing with the
# PPC asm that comes in libitm
depends_on "cctools" => :build
end
# The bottles are built on systems with the CLT installed, and do not work
# out of the box on Xcode-only systems due to an incorrect sysroot.
def pour_bottle?
MacOS::CLT.installed?
end
# GCC bootstraps itself, so it is OK to have an incompatible C++ stdlib
cxxstdlib_check :skip
# Fix for libgccjit.so linkage on Darwin.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64089
patch :DATA
def install
# GCC will suffer build errors if forced to use a particular linker.
ENV.delete "LD"
if MacOS.version < :leopard
ENV["AS"] = ENV["AS_FOR_TARGET"] = "#{Formula["cctools"].bin}/as"
end
if build.with? "all-languages"
# Everything but Ada, which requires a pre-existing GCC Ada compiler
# (gnat) to bootstrap. GCC 4.6.0 add go as a language option, but it is
# currently only compilable on Linux.
languages = %w[c c++ fortran java objc obj-c++ jit]
else
# C, C++, ObjC compilers are always built
languages = %w[c c++ objc obj-c++]
languages << "fortran" if build.with? "fortran"
languages << "java" if build.with? "java"
languages << "jit" if build.with? "jit"
end
version_suffix = version.to_s.slice(/\d/)
# Even when suffixes are appended, the info pages conflict when
# install-info is run so pretend we have an outdated makeinfo
# to prevent their build.
ENV["gcc_cv_prog_makeinfo_modern"] = "no"
args = [
"--build=#{arch}-apple-darwin#{osmajor}",
"--prefix=#{prefix}",
"--libdir=#{lib}/gcc/#{version_suffix}",
"--enable-languages=#{languages.join(",")}",
# Make most executables versioned to avoid conflicts.
"--program-suffix=-#{version_suffix}",
"--with-gmp=#{Formula["gmp"].opt_prefix}",
"--with-mpfr=#{Formula["mpfr"].opt_prefix}",
"--with-mpc=#{Formula["libmpc"].opt_prefix}",
"--with-isl=#{Formula["isl@0.14"].opt_prefix}",
"--with-system-zlib",
"--enable-libstdcxx-time=yes",
"--enable-stage1-checking",
"--enable-checking=release",
"--enable-lto",
# A no-op unless --HEAD is built because in head warnings will
# raise errors. But still a good idea to include.
"--disable-werror",
"--with-pkgversion=Homebrew GCC #{pkg_version} #{build.used_options*" "}".strip,
"--with-bugurl=https://github.com/Homebrew/homebrew-core/issues",
]
# "Building GCC with plugin support requires a host that supports
# -fPIC, -shared, -ldl and -rdynamic."
args << "--enable-plugin" if MacOS.version > :tiger
# Otherwise make fails during comparison at stage 3
# See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45248
args << "--with-dwarf2" if MacOS.version < :leopard
args << "--disable-nls" if build.without? "nls"
if build.with?("java") || build.with?("all-languages")
args << "--with-ecj-jar=#{Formula["ecj"].opt_share}/java/ecj.jar"
end
if !MacOS.prefer_64_bit? || build.without?("multilib")
args << "--disable-multilib"
else
args << "--enable-multilib"
end
args << "--enable-host-shared" if build.with?("jit") || build.with?("all-languages")
# Ensure correct install names when linking against libgcc_s;
# see discussion in https://github.com/Homebrew/homebrew/pull/34303
inreplace "libgcc/config/t-slibgcc-darwin", "@shlib_slibdir@", "#{HOMEBREW_PREFIX}/lib/gcc/#{version_suffix}"
mkdir "build" do
unless MacOS::CLT.installed?
# For Xcode-only systems, we need to tell the sysroot path.
# "native-system-headers" will be appended
args << "--with-native-system-header-dir=/usr/include"
args << "--with-sysroot=#{MacOS.sdk_path}"
end
system "../configure", *args
if build.with? "profiled-build"
# Takes longer to build, may bug out. Provided for those who want to
# optimise all the way to 11.
system "make", "profiledbootstrap"
else
system "make", "bootstrap"
end
# At this point `make check` could be invoked to run the testsuite. The
# deja-gnu and autogen formulae must be installed in order to do this.
system "make", "install"
end
# Handle conflicts between GCC formulae.
# Rename man7.
Dir.glob(man7/"*.7") { |file| add_suffix file, version_suffix }
# Even when we disable building info pages some are still installed.
info.rmtree
end
def add_suffix(file, suffix)
dir = File.dirname(file)
ext = File.extname(file)
base = File.basename(file, ext)
File.rename file, "#{dir}/#{base}-#{suffix}#{ext}"
end
test do
(testpath/"hello-c.c").write <<-EOS.undent
#include <stdio.h>
int main()
{
puts("Hello, world!");
return 0;
}
EOS
system bin/"gcc-5", "-o", "hello-c", "hello-c.c"
assert_equal "Hello, world!\n", `./hello-c`
end
end
__END__
--- a/gcc/jit/Make-lang.in 2015-02-03 17:19:58.000000000 +0000
+++ b/gcc/jit/Make-lang.in 2015-04-08 22:08:24.000000000 +0100
@@ -85,8 +85,7 @@
$(jit_OBJS) libbackend.a libcommon-target.a libcommon.a \
$(CPPLIB) $(LIBDECNUMBER) $(LIBS) $(BACKENDLIBS) \
$(EXTRA_GCC_OBJS) \
- -Wl,--version-script=$(srcdir)/jit/libgccjit.map \
- -Wl,-soname,$(LIBGCCJIT_SONAME)
+ -Wl,-install_name,$(LIBGCCJIT_SONAME)
$(LIBGCCJIT_SONAME_SYMLINK): $(LIBGCCJIT_FILENAME)
ln -sf $(LIBGCCJIT_FILENAME) $(LIBGCCJIT_SONAME_SYMLINK)
gcc@5: https in comment
class GccAT5 < Formula
def arch
if Hardware::CPU.type == :intel
if MacOS.prefer_64_bit?
"x86_64"
else
"i686"
end
elsif Hardware::CPU.type == :ppc
if MacOS.prefer_64_bit?
"powerpc64"
else
"powerpc"
end
end
end
def osmajor
`uname -r`.chomp
end
desc "The GNU Compiler Collection"
homepage "https://gcc.gnu.org/"
url "https://ftpmirror.gnu.org/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2"
mirror "https://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2"
sha256 "608df76dec2d34de6558249d8af4cbee21eceddbcb580d666f7a5a583ca3303a"
revision 1
bottle do
sha256 "f3073ac59c0c7e519f66759df059d55e5c791d56777c842a52ff0eeffd44584b" => :sierra
sha256 "e04f4c2223e8ab1e94138e7a39ceaa8c5d73ab1185b8ea738b3731ee64cde4da" => :el_capitan
sha256 "632863a5b37ac8179455c88d8c069ca4098901b766492fe66fdd98344c0548b1" => :yosemite
end
# GCC's Go compiler is not currently supported on Mac OS X.
# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46986
option "with-java", "Build the gcj compiler"
option "with-all-languages", "Enable all compilers and languages, except Ada"
option "with-nls", "Build with native language support (localization)"
option "with-profiled-build", "Make use of profile guided optimization when bootstrapping GCC"
option "with-jit", "Build the jit compiler"
option "without-fortran", "Build without the gfortran compiler"
# enabling multilib on a host that can"t run 64-bit results in build failures
option "without-multilib", "Build without multilib support" if MacOS.prefer_64_bit?
depends_on "gmp"
depends_on "libmpc"
depends_on "mpfr"
depends_on "isl@0.14"
depends_on "ecj" if build.with?("java") || build.with?("all-languages")
if MacOS.version < :leopard
# The as that comes with Tiger isn't capable of dealing with the
# PPC asm that comes in libitm
depends_on "cctools" => :build
end
# The bottles are built on systems with the CLT installed, and do not work
# out of the box on Xcode-only systems due to an incorrect sysroot.
def pour_bottle?
MacOS::CLT.installed?
end
# GCC bootstraps itself, so it is OK to have an incompatible C++ stdlib
cxxstdlib_check :skip
# Fix for libgccjit.so linkage on Darwin.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64089
patch :DATA
def install
# GCC will suffer build errors if forced to use a particular linker.
ENV.delete "LD"
if MacOS.version < :leopard
ENV["AS"] = ENV["AS_FOR_TARGET"] = "#{Formula["cctools"].bin}/as"
end
if build.with? "all-languages"
# Everything but Ada, which requires a pre-existing GCC Ada compiler
# (gnat) to bootstrap. GCC 4.6.0 add go as a language option, but it is
# currently only compilable on Linux.
languages = %w[c c++ fortran java objc obj-c++ jit]
else
# C, C++, ObjC compilers are always built
languages = %w[c c++ objc obj-c++]
languages << "fortran" if build.with? "fortran"
languages << "java" if build.with? "java"
languages << "jit" if build.with? "jit"
end
version_suffix = version.to_s.slice(/\d/)
# Even when suffixes are appended, the info pages conflict when
# install-info is run so pretend we have an outdated makeinfo
# to prevent their build.
ENV["gcc_cv_prog_makeinfo_modern"] = "no"
args = [
"--build=#{arch}-apple-darwin#{osmajor}",
"--prefix=#{prefix}",
"--libdir=#{lib}/gcc/#{version_suffix}",
"--enable-languages=#{languages.join(",")}",
# Make most executables versioned to avoid conflicts.
"--program-suffix=-#{version_suffix}",
"--with-gmp=#{Formula["gmp"].opt_prefix}",
"--with-mpfr=#{Formula["mpfr"].opt_prefix}",
"--with-mpc=#{Formula["libmpc"].opt_prefix}",
"--with-isl=#{Formula["isl@0.14"].opt_prefix}",
"--with-system-zlib",
"--enable-libstdcxx-time=yes",
"--enable-stage1-checking",
"--enable-checking=release",
"--enable-lto",
# A no-op unless --HEAD is built because in head warnings will
# raise errors. But still a good idea to include.
"--disable-werror",
"--with-pkgversion=Homebrew GCC #{pkg_version} #{build.used_options*" "}".strip,
"--with-bugurl=https://github.com/Homebrew/homebrew-core/issues",
]
# "Building GCC with plugin support requires a host that supports
# -fPIC, -shared, -ldl and -rdynamic."
args << "--enable-plugin" if MacOS.version > :tiger
# Otherwise make fails during comparison at stage 3
# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45248
args << "--with-dwarf2" if MacOS.version < :leopard
args << "--disable-nls" if build.without? "nls"
if build.with?("java") || build.with?("all-languages")
args << "--with-ecj-jar=#{Formula["ecj"].opt_share}/java/ecj.jar"
end
if !MacOS.prefer_64_bit? || build.without?("multilib")
args << "--disable-multilib"
else
args << "--enable-multilib"
end
args << "--enable-host-shared" if build.with?("jit") || build.with?("all-languages")
# Ensure correct install names when linking against libgcc_s;
# see discussion in https://github.com/Homebrew/homebrew/pull/34303
inreplace "libgcc/config/t-slibgcc-darwin", "@shlib_slibdir@", "#{HOMEBREW_PREFIX}/lib/gcc/#{version_suffix}"
mkdir "build" do
unless MacOS::CLT.installed?
# For Xcode-only systems, we need to tell the sysroot path.
# "native-system-headers" will be appended
args << "--with-native-system-header-dir=/usr/include"
args << "--with-sysroot=#{MacOS.sdk_path}"
end
system "../configure", *args
if build.with? "profiled-build"
# Takes longer to build, may bug out. Provided for those who want to
# optimise all the way to 11.
system "make", "profiledbootstrap"
else
system "make", "bootstrap"
end
# At this point `make check` could be invoked to run the testsuite. The
# deja-gnu and autogen formulae must be installed in order to do this.
system "make", "install"
end
# Handle conflicts between GCC formulae.
# Rename man7.
Dir.glob(man7/"*.7") { |file| add_suffix file, version_suffix }
# Even when we disable building info pages some are still installed.
info.rmtree
end
def add_suffix(file, suffix)
dir = File.dirname(file)
ext = File.extname(file)
base = File.basename(file, ext)
File.rename file, "#{dir}/#{base}-#{suffix}#{ext}"
end
test do
(testpath/"hello-c.c").write <<-EOS.undent
#include <stdio.h>
int main()
{
puts("Hello, world!");
return 0;
}
EOS
system bin/"gcc-5", "-o", "hello-c", "hello-c.c"
assert_equal "Hello, world!\n", `./hello-c`
end
end
__END__
--- a/gcc/jit/Make-lang.in 2015-02-03 17:19:58.000000000 +0000
+++ b/gcc/jit/Make-lang.in 2015-04-08 22:08:24.000000000 +0100
@@ -85,8 +85,7 @@
$(jit_OBJS) libbackend.a libcommon-target.a libcommon.a \
$(CPPLIB) $(LIBDECNUMBER) $(LIBS) $(BACKENDLIBS) \
$(EXTRA_GCC_OBJS) \
- -Wl,--version-script=$(srcdir)/jit/libgccjit.map \
- -Wl,-soname,$(LIBGCCJIT_SONAME)
+ -Wl,-install_name,$(LIBGCCJIT_SONAME)
$(LIBGCCJIT_SONAME_SYMLINK): $(LIBGCCJIT_FILENAME)
ln -sf $(LIBGCCJIT_FILENAME) $(LIBGCCJIT_SONAME_SYMLINK)
|
class Gdal2 < Formula
desc "GDAL: Geospatial Data Abstraction Library"
homepage "http://www.gdal.org/"
url "http://download.osgeo.org/gdal/2.1.2/gdal-2.1.2.tar.gz"
sha256 "69761c38acac8c6d3ea71304341f6982b5d66125a1a80d9088b6bfd2019125c9"
revision 1
head do
url "https://svn.osgeo.org/gdal/trunk/gdal"
depends_on "doxygen" => :build
end
def plugins_subdirectory
gdal_ver_list = version.to_s.split(".")
"gdalplugins/#{gdal_ver_list[0]}.#{gdal_ver_list[1]}"
end
keg_only "Older version of gdal is in main tap and installs similar components"
option "with-complete", "Use additional Homebrew libraries to provide more drivers."
option "with-qhull", "Build with internal qhull libary support"
option "with-opencl", "Build with OpenCL acceleration."
option "with-armadillo", "Build with Armadillo accelerated TPS transforms."
option "with-unsupported", "Allow configure to drag in any library it can find. Invoke this at your own risk."
option "with-mdb", "Build with Access MDB driver (requires Java 1.6+ JDK/JRE, from Apple or Oracle)."
option "with-libkml", "Build with Google's libkml driver (requires libkml --HEAD or >= 1.3)"
option "with-swig-java", "Build the swig java bindings"
deprecated_option "enable-opencl" => "with-opencl"
deprecated_option "enable-armadillo" => "with-armadillo"
deprecated_option "enable-unsupported" => "with-unsupported"
deprecated_option "enable-mdb" => "with-mdb"
deprecated_option "complete" => "with-complete"
depends_on "libpng"
depends_on "jpeg"
depends_on "giflib"
depends_on "libtiff"
depends_on "libgeotiff"
depends_on "proj"
depends_on "geos"
depends_on "sqlite" # To ensure compatibility with SpatiaLite.
depends_on "freexl"
depends_on "libspatialite"
depends_on "postgresql" => :optional
depends_on "mysql" => :optional
depends_on "homebrew/science/armadillo" if build.with? "armadillo"
if build.with? "libkml"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
if build.with? "complete"
# Raster libraries
depends_on "homebrew/science/netcdf" # Also brings in HDF5
depends_on "jasper"
depends_on "webp"
depends_on "homebrew/science/cfitsio"
depends_on "epsilon"
depends_on "libdap"
depends_on "libxml2"
depends_on "openjpeg"
# Vector libraries
depends_on "unixodbc" # OS X version is not complete enough
depends_on "xerces-c"
# Other libraries
depends_on "xz" # get liblzma compression algorithm library from XZutils
depends_on "poppler"
depends_on "podofo"
depends_on "json-c"
end
depends_on :java => ["1.7+", :optional, :build]
if build.with? "swig-java"
depends_on "ant" => :build
depends_on "swig" => :build
end
resource "libkml" do
# Until 1.3 is stable, use master branch
url "https://github.com/google/libkml.git",
:revision => "9b50572641f671194e523ad21d0171ea6537426e"
version "1.3-dev"
end
def configure_args
args = [
# Base configuration.
"--prefix=#{prefix}",
"--mandir=#{man}",
"--disable-debug",
"--with-local=#{prefix}",
"--with-threads",
"--with-libtool",
# GDAL native backends.
"--with-pcraster=internal",
"--with-pcidsk=internal",
"--with-bsb",
"--with-grib",
"--with-pam",
# Backends supported by OS X.
"--with-libiconv-prefix=/usr",
"--with-libz=/usr",
"--with-png=#{Formula["libpng"].opt_prefix}",
"--with-expat=/usr",
"--with-curl=/usr/bin/curl-config",
# Default Homebrew backends.
"--with-jpeg=#{HOMEBREW_PREFIX}",
"--without-jpeg12", # Needs specially configured JPEG and TIFF libraries.
"--with-gif=#{HOMEBREW_PREFIX}",
"--with-libtiff=#{HOMEBREW_PREFIX}",
"--with-geotiff=#{HOMEBREW_PREFIX}",
"--with-sqlite3=#{Formula["sqlite"].opt_prefix}",
"--with-freexl=#{HOMEBREW_PREFIX}",
"--with-spatialite=#{HOMEBREW_PREFIX}",
"--with-geos=#{HOMEBREW_PREFIX}/bin/geos-config",
"--with-static-proj4=#{HOMEBREW_PREFIX}",
"--with-libjson-c=#{Formula["json-c"].opt_prefix}",
# GRASS backend explicitly disabled. Creates a chicken-and-egg problem.
# Should be installed separately after GRASS installation using the
# official GDAL GRASS plugin.
"--without-grass",
"--without-libgrass",
]
# Optional Homebrew packages supporting additional formats.
supported_backends = %w[
liblzma
cfitsio
hdf5
netcdf
jasper
xerces
odbc
dods-root
epsilon
webp
openjpeg
podofo
pdfium
]
if build.with? "complete"
supported_backends.delete "liblzma"
args << "--with-liblzma=yes"
supported_backends.delete "pdfium"
args << "--with-pdfium=yes"
args.concat supported_backends.map { |b| "--with-" + b + "=" + HOMEBREW_PREFIX }
elsif build.without? "unsupported"
args.concat supported_backends.map { |b| "--without-" + b }
end
# The following libraries are either proprietary, not available for public
# download or have no stable version in the Homebrew core that is
# compatible with GDAL. Interested users will have to install such software
# manually and most likely have to tweak the install routine.
#
# Podofo is disabled because Poppler provides the same functionality and
# then some.
unsupported_backends = %w[
gta
ogdi
fme
hdf4
fgdb
ecw
kakadu
mrsid
jp2mrsid
mrsid_lidar
msg
oci
ingres
dwgdirect
idb
sde
rasdaman
sosi
]
args.concat unsupported_backends.map { |b| "--without-" + b } if build.without? "unsupported"
# Database support.
args << (build.with?("postgresql") ? "--with-pg=#{HOMEBREW_PREFIX}/bin/pg_config" : "--without-pg")
args << (build.with?("mysql") ? "--with-mysql=#{HOMEBREW_PREFIX}/bin/mysql_config" : "--without-mysql")
if build.with? "mdb"
args << "--with-java=yes"
# The rpath is only embedded for Oracle (non-framework) installs
args << "--with-jvm-lib-add-rpath=yes"
args << "--with-mdb=yes"
end
args << "--with-libkml=#{libexec}" if build.with? "libkml"
args << "--with-qhull=#{build.with?("qhull") ? "internal" : "no"}"
# Python is installed manually to ensure everything is properly sandboxed.
# see
args << "--without-python"
# Scripting APIs that have not been re-worked to respect Homebrew prefixes.
#
# Currently disabled as they install willy-nilly into locations outside of
# the Homebrew prefix. Enable if you feel like it, but uninstallation may be
# a manual affair.
#
# TODO: Fix installation of script bindings so they install into the
# Homebrew prefix.
args << "--without-perl"
args << "--without-php"
args << "--without-ruby"
args << (build.with?("opencl") ? "--with-opencl" : "--without-opencl")
args << (build.with?("armadillo") ? "--with-armadillo=#{Formula["armadillo"].opt_prefix}" : "--with-armadillo=no")
args
end
def install
if build.with? "complete"
# patch to "Handle prefix renaming in jasper 1.900.28" (not yet reported)
# use inreplace due to CRLF patching issue
inreplace "frmts/jpeg2000/jpeg2000_vsil_io.cpp" do |s|
# replace order matters here!
s.gsub! "uchar", "jas_uchar"
s.gsub! "unsigned char", "jas_uchar"
end
inreplace "frmts/jpeg2000/jpeg2000_vsil_io.h" do |s|
s.sub! %r{(<jasper/jasper\.h>)}, "\\1\n\n" + <<-EOS.undent
/* Handle prefix renaming in jasper 1.900.28 */
#ifndef jas_uchar
#define jas_uchar unsigned char
#endif
EOS
end
end
if build.with? "libkml"
resource("libkml").stage do
# See main `libkml` formula for info on patches
inreplace "configure.ac", "-Werror", ""
inreplace "third_party/Makefile.am" do |s|
s.sub! /(lib_LTLIBRARIES =) libminizip.la liburiparser.la/, "\\1"
s.sub! /(noinst_LTLIBRARIES = libgtest.la libgtest_main.la)/,
"\\1 libminizip.la liburiparser.la"
s.sub! /(libminizip_la_LDFLAGS =)/, "\\1 -static"
s.sub! /(liburiparser_la_LDFLAGS =)/, "\\1 -static"
end
system "./autogen.sh"
system "./configure", "--prefix=#{libexec}"
system "make", "install"
end
end
# Linking flags for SQLite are not added at a critical moment when the GDAL
# library is being assembled. This causes the build to fail due to missing
# symbols. Also, ensure Homebrew SQLite is used so that Spatialite is
# functional.
#
# Fortunately, this can be remedied using LDFLAGS.
sqlite = Formula["sqlite"]
ENV.append "LDFLAGS", "-L#{sqlite.opt_lib} -lsqlite3"
ENV.append "CFLAGS", "-I#{sqlite.opt_include}"
# Reset ARCHFLAGS to match how we build.
ENV["ARCHFLAGS"] = "-arch #{MacOS.preferred_arch}"
# Fix hardcoded mandir: http://trac.osgeo.org/gdal/ticket/5092
inreplace "configure", %r[^mandir='\$\{prefix\}/man'$], ""
# These libs are statically linked in vendored libkml and libkml formula
inreplace "configure", " -lminizip -luriparser", "" if build.with? "libkml"
system "./configure", *configure_args
system "make"
system "make", "install"
# Create versioned plugins path for other formulae
(HOMEBREW_PREFIX/"lib/#{plugins_subdirectory}").mkpath
if build.with? "swig-java"
cd "swig/java" do
inreplace "java.opt", "linux", "darwin"
inreplace "java.opt", "#JAVA_HOME = /usr/lib/jvm/java-6-openjdk/", "JAVA_HOME=$(shell echo $$JAVA_HOME)"
system "make"
system "make", "install"
# Install the jar that complements the native JNI bindings
system "ant"
lib.install "gdal.jar"
end
end
system "make", "man" if build.head?
system "make", "install-man"
# Clean up any stray doxygen files.
Dir.glob("#{bin}/*.dox") { |p| rm p }
end
def caveats
s = <<-EOS.undent
Plugins for this version of GDAL/OGR, generated by other formulae, should
be symlinked to the following directory:
#{HOMEBREW_PREFIX}/lib/#{plugins_subdirectory}
You may need to set the following enviroment variable:
export GDAL_DRIVER_PATH=#{HOMEBREW_PREFIX}/lib/gdalplugins
PYTHON BINDINGS are now built in a separate formula: gdal2-python
EOS
if build.with? "mdb"
s += <<-EOS.undent
To have a functional MDB driver, install supporting .jar files in:
`/Library/Java/Extensions/`
See: `http://www.gdal.org/ogr/drv_mdb.html`
EOS
end
s
end
test do
# basic tests to see if third-party dylibs are loading OK
system "#{bin}/gdalinfo", "--formats"
system "#{bin}/ogrinfo", "--formats"
end
end
gdal2: add sierra bottle
[ci skip]
class Gdal2 < Formula
desc "GDAL: Geospatial Data Abstraction Library"
homepage "http://www.gdal.org/"
url "http://download.osgeo.org/gdal/2.1.2/gdal-2.1.2.tar.gz"
sha256 "69761c38acac8c6d3ea71304341f6982b5d66125a1a80d9088b6bfd2019125c9"
revision 1
bottle do
root_url "http://qgis.dakotacarto.com/bottles"
sha256 "c160660d067c38c9882d24d20f101a2a5a39ec9700eaaefbb04e3945726b400c" => :sierra
end
head do
url "https://svn.osgeo.org/gdal/trunk/gdal"
depends_on "doxygen" => :build
end
def plugins_subdirectory
gdal_ver_list = version.to_s.split(".")
"gdalplugins/#{gdal_ver_list[0]}.#{gdal_ver_list[1]}"
end
keg_only "Older version of gdal is in main tap and installs similar components"
option "with-complete", "Use additional Homebrew libraries to provide more drivers."
option "with-qhull", "Build with internal qhull libary support"
option "with-opencl", "Build with OpenCL acceleration."
option "with-armadillo", "Build with Armadillo accelerated TPS transforms."
option "with-unsupported", "Allow configure to drag in any library it can find. Invoke this at your own risk."
option "with-mdb", "Build with Access MDB driver (requires Java 1.6+ JDK/JRE, from Apple or Oracle)."
option "with-libkml", "Build with Google's libkml driver (requires libkml --HEAD or >= 1.3)"
option "with-swig-java", "Build the swig java bindings"
deprecated_option "enable-opencl" => "with-opencl"
deprecated_option "enable-armadillo" => "with-armadillo"
deprecated_option "enable-unsupported" => "with-unsupported"
deprecated_option "enable-mdb" => "with-mdb"
deprecated_option "complete" => "with-complete"
depends_on "libpng"
depends_on "jpeg"
depends_on "giflib"
depends_on "libtiff"
depends_on "libgeotiff"
depends_on "proj"
depends_on "geos"
depends_on "sqlite" # To ensure compatibility with SpatiaLite.
depends_on "freexl"
depends_on "libspatialite"
depends_on "postgresql" => :optional
depends_on "mysql" => :optional
depends_on "homebrew/science/armadillo" if build.with? "armadillo"
if build.with? "libkml"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
if build.with? "complete"
# Raster libraries
depends_on "homebrew/science/netcdf" # Also brings in HDF5
depends_on "jasper"
depends_on "webp"
depends_on "homebrew/science/cfitsio"
depends_on "epsilon"
depends_on "libdap"
depends_on "libxml2"
depends_on "openjpeg"
# Vector libraries
depends_on "unixodbc" # OS X version is not complete enough
depends_on "xerces-c"
# Other libraries
depends_on "xz" # get liblzma compression algorithm library from XZutils
depends_on "poppler"
depends_on "podofo"
depends_on "json-c"
end
depends_on :java => ["1.7+", :optional, :build]
if build.with? "swig-java"
depends_on "ant" => :build
depends_on "swig" => :build
end
resource "libkml" do
# Until 1.3 is stable, use master branch
url "https://github.com/google/libkml.git",
:revision => "9b50572641f671194e523ad21d0171ea6537426e"
version "1.3-dev"
end
def configure_args
args = [
# Base configuration.
"--prefix=#{prefix}",
"--mandir=#{man}",
"--disable-debug",
"--with-local=#{prefix}",
"--with-threads",
"--with-libtool",
# GDAL native backends.
"--with-pcraster=internal",
"--with-pcidsk=internal",
"--with-bsb",
"--with-grib",
"--with-pam",
# Backends supported by OS X.
"--with-libiconv-prefix=/usr",
"--with-libz=/usr",
"--with-png=#{Formula["libpng"].opt_prefix}",
"--with-expat=/usr",
"--with-curl=/usr/bin/curl-config",
# Default Homebrew backends.
"--with-jpeg=#{HOMEBREW_PREFIX}",
"--without-jpeg12", # Needs specially configured JPEG and TIFF libraries.
"--with-gif=#{HOMEBREW_PREFIX}",
"--with-libtiff=#{HOMEBREW_PREFIX}",
"--with-geotiff=#{HOMEBREW_PREFIX}",
"--with-sqlite3=#{Formula["sqlite"].opt_prefix}",
"--with-freexl=#{HOMEBREW_PREFIX}",
"--with-spatialite=#{HOMEBREW_PREFIX}",
"--with-geos=#{HOMEBREW_PREFIX}/bin/geos-config",
"--with-static-proj4=#{HOMEBREW_PREFIX}",
"--with-libjson-c=#{Formula["json-c"].opt_prefix}",
# GRASS backend explicitly disabled. Creates a chicken-and-egg problem.
# Should be installed separately after GRASS installation using the
# official GDAL GRASS plugin.
"--without-grass",
"--without-libgrass",
]
# Optional Homebrew packages supporting additional formats.
supported_backends = %w[
liblzma
cfitsio
hdf5
netcdf
jasper
xerces
odbc
dods-root
epsilon
webp
openjpeg
podofo
pdfium
]
if build.with? "complete"
supported_backends.delete "liblzma"
args << "--with-liblzma=yes"
supported_backends.delete "pdfium"
args << "--with-pdfium=yes"
args.concat supported_backends.map { |b| "--with-" + b + "=" + HOMEBREW_PREFIX }
elsif build.without? "unsupported"
args.concat supported_backends.map { |b| "--without-" + b }
end
# The following libraries are either proprietary, not available for public
# download or have no stable version in the Homebrew core that is
# compatible with GDAL. Interested users will have to install such software
# manually and most likely have to tweak the install routine.
#
# Podofo is disabled because Poppler provides the same functionality and
# then some.
unsupported_backends = %w[
gta
ogdi
fme
hdf4
fgdb
ecw
kakadu
mrsid
jp2mrsid
mrsid_lidar
msg
oci
ingres
dwgdirect
idb
sde
rasdaman
sosi
]
args.concat unsupported_backends.map { |b| "--without-" + b } if build.without? "unsupported"
# Database support.
args << (build.with?("postgresql") ? "--with-pg=#{HOMEBREW_PREFIX}/bin/pg_config" : "--without-pg")
args << (build.with?("mysql") ? "--with-mysql=#{HOMEBREW_PREFIX}/bin/mysql_config" : "--without-mysql")
if build.with? "mdb"
args << "--with-java=yes"
# The rpath is only embedded for Oracle (non-framework) installs
args << "--with-jvm-lib-add-rpath=yes"
args << "--with-mdb=yes"
end
args << "--with-libkml=#{libexec}" if build.with? "libkml"
args << "--with-qhull=#{build.with?("qhull") ? "internal" : "no"}"
# Python is installed manually to ensure everything is properly sandboxed.
# see
args << "--without-python"
# Scripting APIs that have not been re-worked to respect Homebrew prefixes.
#
# Currently disabled as they install willy-nilly into locations outside of
# the Homebrew prefix. Enable if you feel like it, but uninstallation may be
# a manual affair.
#
# TODO: Fix installation of script bindings so they install into the
# Homebrew prefix.
args << "--without-perl"
args << "--without-php"
args << "--without-ruby"
args << (build.with?("opencl") ? "--with-opencl" : "--without-opencl")
args << (build.with?("armadillo") ? "--with-armadillo=#{Formula["armadillo"].opt_prefix}" : "--with-armadillo=no")
args
end
def install
if build.with? "complete"
# patch to "Handle prefix renaming in jasper 1.900.28" (not yet reported)
# use inreplace due to CRLF patching issue
inreplace "frmts/jpeg2000/jpeg2000_vsil_io.cpp" do |s|
# replace order matters here!
s.gsub! "uchar", "jas_uchar"
s.gsub! "unsigned char", "jas_uchar"
end
inreplace "frmts/jpeg2000/jpeg2000_vsil_io.h" do |s|
s.sub! %r{(<jasper/jasper\.h>)}, "\\1\n\n" + <<-EOS.undent
/* Handle prefix renaming in jasper 1.900.28 */
#ifndef jas_uchar
#define jas_uchar unsigned char
#endif
EOS
end
end
if build.with? "libkml"
resource("libkml").stage do
# See main `libkml` formula for info on patches
inreplace "configure.ac", "-Werror", ""
inreplace "third_party/Makefile.am" do |s|
s.sub! /(lib_LTLIBRARIES =) libminizip.la liburiparser.la/, "\\1"
s.sub! /(noinst_LTLIBRARIES = libgtest.la libgtest_main.la)/,
"\\1 libminizip.la liburiparser.la"
s.sub! /(libminizip_la_LDFLAGS =)/, "\\1 -static"
s.sub! /(liburiparser_la_LDFLAGS =)/, "\\1 -static"
end
system "./autogen.sh"
system "./configure", "--prefix=#{libexec}"
system "make", "install"
end
end
# Linking flags for SQLite are not added at a critical moment when the GDAL
# library is being assembled. This causes the build to fail due to missing
# symbols. Also, ensure Homebrew SQLite is used so that Spatialite is
# functional.
#
# Fortunately, this can be remedied using LDFLAGS.
sqlite = Formula["sqlite"]
ENV.append "LDFLAGS", "-L#{sqlite.opt_lib} -lsqlite3"
ENV.append "CFLAGS", "-I#{sqlite.opt_include}"
# Reset ARCHFLAGS to match how we build.
ENV["ARCHFLAGS"] = "-arch #{MacOS.preferred_arch}"
# Fix hardcoded mandir: http://trac.osgeo.org/gdal/ticket/5092
inreplace "configure", %r[^mandir='\$\{prefix\}/man'$], ""
# These libs are statically linked in vendored libkml and libkml formula
inreplace "configure", " -lminizip -luriparser", "" if build.with? "libkml"
system "./configure", *configure_args
system "make"
system "make", "install"
# Create versioned plugins path for other formulae
(HOMEBREW_PREFIX/"lib/#{plugins_subdirectory}").mkpath
if build.with? "swig-java"
cd "swig/java" do
inreplace "java.opt", "linux", "darwin"
inreplace "java.opt", "#JAVA_HOME = /usr/lib/jvm/java-6-openjdk/", "JAVA_HOME=$(shell echo $$JAVA_HOME)"
system "make"
system "make", "install"
# Install the jar that complements the native JNI bindings
system "ant"
lib.install "gdal.jar"
end
end
system "make", "man" if build.head?
system "make", "install-man"
# Clean up any stray doxygen files.
Dir.glob("#{bin}/*.dox") { |p| rm p }
end
def caveats
s = <<-EOS.undent
Plugins for this version of GDAL/OGR, generated by other formulae, should
be symlinked to the following directory:
#{HOMEBREW_PREFIX}/lib/#{plugins_subdirectory}
You may need to set the following enviroment variable:
export GDAL_DRIVER_PATH=#{HOMEBREW_PREFIX}/lib/gdalplugins
PYTHON BINDINGS are now built in a separate formula: gdal2-python
EOS
if build.with? "mdb"
s += <<-EOS.undent
To have a functional MDB driver, install supporting .jar files in:
`/Library/Java/Extensions/`
See: `http://www.gdal.org/ogr/drv_mdb.html`
EOS
end
s
end
test do
# basic tests to see if third-party dylibs are loading OK
system "#{bin}/gdalinfo", "--formats"
system "#{bin}/ogrinfo", "--formats"
end
end
|
gimme 0.2.4 (new formula)
Closes Homebrew/homebrew#42208.
Signed-off-by: Baptiste Fontaine <bfee279af59f3e3f71f7ce1fa037ea7b90f93cbf@yahoo.fr>
class Gimme < Formula
desc "A shell script to install any Go version"
homepage "https://github.com/travis-ci/gimme"
url "https://github.com/travis-ci/gimme/archive/v0.2.4.tar.gz"
sha256 "feb9c25d96cc6a4e735200a180070ec3458fea7d1795439abf8acad45edfc194"
def install
bin.install "gimme"
end
test do
system "#{bin}/gimme", "-l"
end
end
|
class Gitql < Formula
desc "Git query language"
homepage "https://github.com/filhodanuvem/gitql"
url "https://github.com/filhodanuvem/gitql/archive/2.1.0.tar.gz"
sha256 "bf82ef116220389029ae38bae7147008371e4fc94af747eba6f7dedcd5613010"
license "MIT"
bottle do
cellar :any_skip_relocation
sha256 "fbeb1c5d3f24eab8d0cb038fbba6f2900cab2dac9541826f301038f30656b6dd" => :catalina
sha256 "362e70cce840cb4fd4df93de474047957e08bc5e522801d74756840caf3846f9" => :mojave
sha256 "d382fa5dd8e22697cb6aea88970c532a2e8c6919d25ed5ed2a0c7ba5fea61eaf" => :high_sierra
end
depends_on "go" => :build
def install
system "go", "build", *std_go_args
end
test do
system "git", "init"
assert_match "author", shell_output("#{bin}/gitql 'SELECT * FROM commits'")
end
end
gitql: update 2.1.0 bottle.
class Gitql < Formula
desc "Git query language"
homepage "https://github.com/filhodanuvem/gitql"
url "https://github.com/filhodanuvem/gitql/archive/2.1.0.tar.gz"
sha256 "bf82ef116220389029ae38bae7147008371e4fc94af747eba6f7dedcd5613010"
license "MIT"
bottle do
cellar :any_skip_relocation
sha256 "cdb95fabef4aa65a6868b9f7967eae64eb2dfea636f66a1c078e54332840324c" => :big_sur
sha256 "fbeb1c5d3f24eab8d0cb038fbba6f2900cab2dac9541826f301038f30656b6dd" => :catalina
sha256 "362e70cce840cb4fd4df93de474047957e08bc5e522801d74756840caf3846f9" => :mojave
sha256 "d382fa5dd8e22697cb6aea88970c532a2e8c6919d25ed5ed2a0c7ba5fea61eaf" => :high_sierra
end
depends_on "go" => :build
def install
system "go", "build", *std_go_args
end
test do
system "git", "init"
assert_match "author", shell_output("#{bin}/gitql 'SELECT * FROM commits'")
end
end
|
require 'formula'
class Gitsh < Formula
SYSTEM_RUBY_PATH = '/usr/bin/ruby'
HOMEBREW_RUBY_PATH = "#{HOMEBREW_PREFIX}/bin/ruby"
homepage 'https://github.com/thoughtbot/gitsh/'
url 'http://thoughtbot.github.io/gitsh/gitsh-0.11.tar.gz'
sha256 '9a2323b7677c4f8f496e3a62913c219654703370ce96efbdb4f12c3192f6218e'
def self.old_system_ruby?
system_ruby_version = `#{SYSTEM_RUBY_PATH} -e "puts RUBY_VERSION"`.chomp
system_ruby_version < '2.0.0'
end
if old_system_ruby?
depends_on 'Ruby'
end
depends_on 'readline'
def install
set_ruby_path
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
end
test do
system "#{bin}/gitsh", "--version"
end
private
def set_ruby_path
if self.class.old_system_ruby? || File.exist?(HOMEBREW_RUBY_PATH)
ENV['RUBY'] = HOMEBREW_RUBY_PATH
else
ENV['RUBY'] = SYSTEM_RUBY_PATH
end
end
end
gitsh: Use env=std by default.
This causes Homebrew to set the appropriate LDFLAGS for Readline, which
is a keg only formula.
Without this, gitsh can't build against system Ruby (although it still
worked on systems where Homebrew's ruby formula was installed).
I couldn't find good documentation for the difference between `env=std` and
`env=superenv`, but this is where the necessary LDFLAGS value is set:
https://github.com/Homebrew/brew/blob/89fd34b/Library/Homebrew/build.rb#L100
require 'formula'
class Gitsh < Formula
SYSTEM_RUBY_PATH = '/usr/bin/ruby'
HOMEBREW_RUBY_PATH = "#{HOMEBREW_PREFIX}/bin/ruby"
env :std
homepage 'https://github.com/thoughtbot/gitsh/'
url 'http://thoughtbot.github.io/gitsh/gitsh-0.11.tar.gz'
sha256 '9a2323b7677c4f8f496e3a62913c219654703370ce96efbdb4f12c3192f6218e'
def self.old_system_ruby?
system_ruby_version = `#{SYSTEM_RUBY_PATH} -e "puts RUBY_VERSION"`.chomp
system_ruby_version < '2.0.0'
end
if old_system_ruby?
depends_on 'Ruby'
end
depends_on 'readline'
def install
set_ruby_path
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
end
test do
system "#{bin}/gitsh", "--version"
end
private
def set_ruby_path
if self.class.old_system_ruby? || File.exist?(HOMEBREW_RUBY_PATH)
ENV['RUBY'] = HOMEBREW_RUBY_PATH
else
ENV['RUBY'] = SYSTEM_RUBY_PATH
end
end
end
|
require 'formula'
class Gitsh < Formula
homepage 'http://thoughtbot.github.io/gitsh/'
url 'http://thoughtbot.github.io/gitsh/gitsh-0.3.tar.gz'
sha1 '7f3a4e41f8bf20da3c6e7f7309dd1cba902be957'
system_ruby_version = `/usr/bin/ruby -e "puts RUBY_VERSION"`.chomp
if system_ruby_version < '2.0.0'
depends_on 'Ruby'
end
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
end
test do
system "#{bin}/gitsh", "--version"
end
end
gitsh: Mountain Lion compatibility fixes
Details here: https://github.com/thoughtbot/gitsh/commit/4fd3027
require 'formula'
class Gitsh < Formula
SYSTEM_RUBY_PATH = '/usr/bin/ruby'
homepage 'http://thoughtbot.github.io/gitsh/'
url 'http://thoughtbot.github.io/gitsh/gitsh-0.3.tar.gz'
sha1 '7f3a4e41f8bf20da3c6e7f7309dd1cba902be957'
def self.old_system_ruby?
system_ruby_version = `#{SYSTEM_RUBY_PATH} -e "puts RUBY_VERSION"`.chomp
system_ruby_version < '2.0.0'
end
if old_system_ruby?
depends_on 'Ruby'
end
def install
set_ruby_path
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
end
test do
system "#{bin}/gitsh", "--version"
end
private
def set_ruby_path
if self.class.old_system_ruby?
ENV['RUBY'] = "#{HOMEBREW_PREFIX}/bin/ruby"
else
ENV['RUBY'] = SYSTEM_RUBY_PATH
end
end
end
|
require 'formula'
class Gloox < Formula
homepage 'http://camaya.net/gloox/'
url 'http://camaya.net/download/gloox-1.0.9.tar.bz2'
sha1 '0f408d25b8e8ba8dea69832b4c49ad02d74a6695'
depends_on 'pkg-config' => :build
# signed/unsigned conversion error, reported upstream:
# http://bugs.camaya.net/ticket/?id=223
patch :DATA
def install
system "./configure", "--disable-debug",
"--prefix=#{prefix}",
"--with-openssl",
"--without-gnutls",
"--with-zlib"
system "make install"
end
end
__END__
diff --git a/src/atomicrefcount.cpp b/src/atomicrefcount.cpp
index 58a3887..599a818 100644
--- a/src/atomicrefcount.cpp
+++ b/src/atomicrefcount.cpp
@@ -76,7 +76,7 @@ namespace gloox
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
::InterlockedExchange( (volatile LONG*)&m_count, (volatile LONG)0 );
#elif defined( __APPLE__ )
- OSAtomicAnd32Barrier( (int32_t)0, (volatile int32_t*)&m_count );
+ OSAtomicAnd32Barrier( (int32_t)0, (volatile uint32_t*)&m_count );
#elif defined( HAVE_GCC_ATOMIC_BUILTINS )
// Use the gcc intrinsic for atomic decrement if supported.
__sync_fetch_and_and( &m_count, 0 );
gloox 1.0.12
Version bump, system OpenSSL linkage fix, patch removed due to being
fixed upstream, links updated to SSL/TLS, strict audit fixes.
Closes Homebrew/homebrew#36385.
Signed-off-by: Jack Nagel <43386ce32af96f5c56f2a88e458cb94cebee3751@gmail.com>
class Gloox < Formula
homepage "https://camaya.net/gloox/"
url "https://camaya.net/download/gloox-1.0.12.tar.bz2"
mirror "https://mirrors.kernel.org/debian/pool/main/g/gloox/gloox_1.0.12.orig.tar.bz2"
sha1 "188ab51af7e410d4119a8dc3e1d96ca548dbd040"
depends_on "pkg-config" => :build
depends_on "openssl" => :recommended
depends_on "gnutls" => :optional
depends_on "libidn" => :optional
def install
args = %W[
--prefix=#{prefix}
--with-zlib
--disable-debug
]
if build.with? "gnutls"
args << "--with-gnutls=yes"
else
args << "--with-openssl=#{Formula["openssl"].opt_prefix}"
end
system "./configure", *args
system "make", "install"
end
test do
system bin/"gloox-config", "--cflags", "--libs", "--version"
end
end
|
class Gmime < Formula
desc "MIME mail utilities"
homepage "https://spruce.sourceforge.io/gmime/"
url "https://download.gnome.org/sources/gmime/2.6/gmime-2.6.23.tar.xz"
sha256 "7149686a71ca42a1390869b6074815106b061aaeaaa8f2ef8c12c191d9a79f6a"
bottle do
sha256 "05af2f1ac617529df02b43e6494c480cb442387a96702614ce3eba537d26989a" => :sierra
sha256 "5b97393ade91622508cd7902a50b2bbeab57d109da9211b6d80053186a84d86a" => :el_capitan
sha256 "a74503cf97b51a46a7b43f862c1b9cd1f2220b3fc38ba4b56f607b72371f28aa" => :yosemite
end
depends_on "pkg-config" => :build
depends_on "libgpg-error" => :build
depends_on "glib"
depends_on "gobject-introspection"
def install
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--enable-largefile",
"--enable-introspection",
"--disable-vala",
"--disable-mono",
"--disable-glibtest"
system "make", "install"
end
end
gmime: make gobject-introspection recommended (#12850)
class Gmime < Formula
desc "MIME mail utilities"
homepage "https://spruce.sourceforge.io/gmime/"
url "https://download.gnome.org/sources/gmime/2.6/gmime-2.6.23.tar.xz"
sha256 "7149686a71ca42a1390869b6074815106b061aaeaaa8f2ef8c12c191d9a79f6a"
bottle do
sha256 "05af2f1ac617529df02b43e6494c480cb442387a96702614ce3eba537d26989a" => :sierra
sha256 "5b97393ade91622508cd7902a50b2bbeab57d109da9211b6d80053186a84d86a" => :el_capitan
sha256 "a74503cf97b51a46a7b43f862c1b9cd1f2220b3fc38ba4b56f607b72371f28aa" => :yosemite
end
depends_on "pkg-config" => :build
depends_on "libgpg-error" => :build
depends_on "gobject-introspection" => :recommended
depends_on "glib"
def install
args = %W[
--disable-dependency-tracking
--prefix=#{prefix}
--enable-largefile
--disable-vala
--disable-mono
--disable-glibtest
]
if build.with? "gobject-introspection"
args << "--enable-introspection"
else
args << "--disable-introspection"
end
system "./configure", *args
system "make", "install"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <stdio.h>
#include <gmime/gmime.h>
int main (int argc, char **argv)
{
g_mime_init(0);
if (gmime_major_version>=2) {
return 0;
} else {
return 1;
}
}
EOS
flags = `pkg-config --cflags --libs gmime-2.6`.split
system ENV.cc, "-o", "test", "test.c", *(flags + ENV.cflags.to_s.split)
system "./test"
end
end
|
class GmtAT5 < Formula
desc "Tools for manipulating and plotting geographic and Cartesian data"
homepage "https://www.generic-mapping-tools.org/"
url "https://github.com/GenericMappingTools/gmt/releases/download/5.4.5/gmt-5.4.5-src.tar.gz"
mirror "https://mirrors.ustc.edu.cn/gmt/gmt-5.4.5-src.tar.gz"
mirror "https://fossies.org/linux/misc/GMT/gmt-5.4.5-src.tar.gz"
sha256 "225629c7869e204d5f9f1a384c4ada43e243f83e1ed28bdca4f7c2896bf39ef6"
revision 4
bottle do
sha256 "42047f5797aaec99cd71f4509bdbfa6842d284e0cd5fab09c5e6bed13a136952" => :catalina
sha256 "b2b9e02af2e7d18f62c93fdd8e70a876222abe9835cb6d190675fb249226c4d4" => :mojave
sha256 "fb5d8cef36d4d56d37e09ddac7fd16b1b03845e347393571571655d84eab3191" => :high_sierra
end
keg_only :versioned_formula
depends_on "cmake" => :build
depends_on "fftw"
depends_on "gdal"
depends_on "netcdf"
depends_on "pcre"
resource "gshhg" do
url "https://github.com/GenericMappingTools/gshhg-gmt/releases/download/2.3.7/gshhg-gmt-2.3.7.tar.gz"
mirror "https://mirrors.ustc.edu.cn/gmt/gshhg-gmt-2.3.7.tar.gz"
mirror "https://fossies.org/linux/misc/GMT/gshhg-gmt-2.3.7.tar.gz"
sha256 "9bb1a956fca0718c083bef842e625797535a00ce81f175df08b042c2a92cfe7f"
end
resource "dcw" do
url "https://github.com/GenericMappingTools/dcw-gmt/releases/download/1.1.4/dcw-gmt-1.1.4.tar.gz"
mirror "https://mirrors.ustc.edu.cn/gmt/dcw-gmt-1.1.4.tar.gz"
mirror "https://fossies.org/linux/misc/GMT/dcw-gmt-1.1.4.tar.gz"
sha256 "8d47402abcd7f54a0f711365cd022e4eaea7da324edac83611ca035ea443aad3"
end
# netcdf 4.7.4 compatibility
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/cdbf0de198531528db908a5d827f3d2e5b9618cc/gmt%405/netcdf-4.7.4.patch"
sha256 "d894869830f6e57b0670dc31df6b5c684e079418f8bf5c0cd0f7014b65c1981f"
end
def install
(buildpath/"gshhg").install resource("gshhg")
(buildpath/"dcw").install resource("dcw")
args = std_cmake_args.concat %W[
-DCMAKE_INSTALL_PREFIX=#{prefix}
-DGMT_DOCDIR=#{share}/doc/gmt
-DGMT_MANDIR=#{man}
-DGSHHG_ROOT=#{buildpath}/gshhg
-DCOPY_GSHHG:BOOL=TRUE
-DDCW_ROOT=#{buildpath}/dcw
-DCOPY_DCW:BOOL=TRUE
-DFFTW3_ROOT=#{Formula["fftw"].opt_prefix}
-DGDAL_ROOT=#{Formula["gdal"].opt_prefix}
-DNETCDF_ROOT=#{Formula["netcdf"].opt_prefix}
-DPCRE_ROOT=#{Formula["pcre"].opt_prefix}
-DFLOCK:BOOL=TRUE
-DGMT_INSTALL_MODULE_LINKS:BOOL=TRUE
-DGMT_INSTALL_TRADITIONAL_FOLDERNAMES:BOOL=FALSE
-DLICENSE_RESTRICTED:BOOL=FALSE
]
mkdir "build" do
system "cmake", "..", *args
system "make", "install"
end
end
def caveats
<<~EOS
GMT needs Ghostscript for the 'psconvert' command to convert PostScript files
to other formats. To use 'psconvert', please 'brew install ghostscript'.
EOS
end
test do
system "#{bin}/pscoast -R0/360/-70/70 -Jm1.2e-2i -Ba60f30/a30f15 -Dc -G240 -W1/0 -P > test.ps"
assert_predicate testpath/"test.ps", :exist?
end
end
gmt@5: update 5.4.5_4 bottle.
class GmtAT5 < Formula
desc "Tools for manipulating and plotting geographic and Cartesian data"
homepage "https://www.generic-mapping-tools.org/"
url "https://github.com/GenericMappingTools/gmt/releases/download/5.4.5/gmt-5.4.5-src.tar.gz"
mirror "https://mirrors.ustc.edu.cn/gmt/gmt-5.4.5-src.tar.gz"
mirror "https://fossies.org/linux/misc/GMT/gmt-5.4.5-src.tar.gz"
sha256 "225629c7869e204d5f9f1a384c4ada43e243f83e1ed28bdca4f7c2896bf39ef6"
revision 4
bottle do
sha256 "42047f5797aaec99cd71f4509bdbfa6842d284e0cd5fab09c5e6bed13a136952" => :catalina
sha256 "b2b9e02af2e7d18f62c93fdd8e70a876222abe9835cb6d190675fb249226c4d4" => :mojave
sha256 "fb5d8cef36d4d56d37e09ddac7fd16b1b03845e347393571571655d84eab3191" => :high_sierra
sha256 "ef4f28c1d4ec45ed3e4e54061b5645656c043cab39da647399f0ef9830da5842" => :x86_64_linux
end
keg_only :versioned_formula
depends_on "cmake" => :build
depends_on "fftw"
depends_on "gdal"
depends_on "netcdf"
depends_on "pcre"
resource "gshhg" do
url "https://github.com/GenericMappingTools/gshhg-gmt/releases/download/2.3.7/gshhg-gmt-2.3.7.tar.gz"
mirror "https://mirrors.ustc.edu.cn/gmt/gshhg-gmt-2.3.7.tar.gz"
mirror "https://fossies.org/linux/misc/GMT/gshhg-gmt-2.3.7.tar.gz"
sha256 "9bb1a956fca0718c083bef842e625797535a00ce81f175df08b042c2a92cfe7f"
end
resource "dcw" do
url "https://github.com/GenericMappingTools/dcw-gmt/releases/download/1.1.4/dcw-gmt-1.1.4.tar.gz"
mirror "https://mirrors.ustc.edu.cn/gmt/dcw-gmt-1.1.4.tar.gz"
mirror "https://fossies.org/linux/misc/GMT/dcw-gmt-1.1.4.tar.gz"
sha256 "8d47402abcd7f54a0f711365cd022e4eaea7da324edac83611ca035ea443aad3"
end
# netcdf 4.7.4 compatibility
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/cdbf0de198531528db908a5d827f3d2e5b9618cc/gmt%405/netcdf-4.7.4.patch"
sha256 "d894869830f6e57b0670dc31df6b5c684e079418f8bf5c0cd0f7014b65c1981f"
end
def install
(buildpath/"gshhg").install resource("gshhg")
(buildpath/"dcw").install resource("dcw")
args = std_cmake_args.concat %W[
-DCMAKE_INSTALL_PREFIX=#{prefix}
-DGMT_DOCDIR=#{share}/doc/gmt
-DGMT_MANDIR=#{man}
-DGSHHG_ROOT=#{buildpath}/gshhg
-DCOPY_GSHHG:BOOL=TRUE
-DDCW_ROOT=#{buildpath}/dcw
-DCOPY_DCW:BOOL=TRUE
-DFFTW3_ROOT=#{Formula["fftw"].opt_prefix}
-DGDAL_ROOT=#{Formula["gdal"].opt_prefix}
-DNETCDF_ROOT=#{Formula["netcdf"].opt_prefix}
-DPCRE_ROOT=#{Formula["pcre"].opt_prefix}
-DFLOCK:BOOL=TRUE
-DGMT_INSTALL_MODULE_LINKS:BOOL=TRUE
-DGMT_INSTALL_TRADITIONAL_FOLDERNAMES:BOOL=FALSE
-DLICENSE_RESTRICTED:BOOL=FALSE
]
mkdir "build" do
system "cmake", "..", *args
system "make", "install"
end
end
def caveats
<<~EOS
GMT needs Ghostscript for the 'psconvert' command to convert PostScript files
to other formats. To use 'psconvert', please 'brew install ghostscript'.
EOS
end
test do
system "#{bin}/pscoast -R0/360/-70/70 -Jm1.2e-2i -Ba60f30/a30f15 -Dc -G240 -W1/0 -P > test.ps"
assert_predicate testpath/"test.ps", :exist?
end
end
|
class Gnupg < Formula
desc "GNU Pretty Good Privacy (PGP) package"
homepage "https://www.gnupg.org/"
url "https://gnupg.org/ftp/gcrypt/gnupg/gnupg-2.1.19.tar.bz2"
mirror "https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/gnupg/gnupg-2.1.19.tar.bz2"
sha256 "46cced1f5641ce29cc28250f52fadf6e417e649b3bfdec49a5a0d0b22a639bf0"
bottle do
rebuild 1
sha256 "969a47bf31fd6c3832bf42201165037a121570f60497c7ba40042080a994db9d" => :sierra
sha256 "09ced5d5d38c4c517123e82f7c533ef55b1888498a0f355d70b24636dbe452e7" => :el_capitan
sha256 "87b9e6e02558be92528772c762db0f7e2dc8b9d275dd23d7a498210535109bce" => :yosemite
sha256 "f1521ac3df05904c32bdd52173f44d129e565edabdd935515519a087498575c4" => :mavericks
end
option "with-gpgsplit", "Additionally install the gpgsplit utility"
option "without-libusb", "Disable the internal CCID driver"
deprecated_option "without-libusb-compat" => "without-libusb"
depends_on "pkg-config" => :build
depends_on "sqlite" => :build if MacOS.version == :mavericks
depends_on "npth"
depends_on "gnutls"
depends_on "libgpg-error"
depends_on "libgcrypt"
depends_on "libksba"
depends_on "libassuan"
depends_on "pinentry"
depends_on "gettext"
depends_on "adns"
depends_on "libusb" => :recommended
depends_on "readline" => :optional
depends_on "homebrew/fuse/encfs" => :optional
# Remove for > 2.1.19
# ssh-import.scm fails during "make check" for sandboxed builds
# Reported 1 Mar 2017 https://bugs.gnupg.org/gnupg/issue2980
# Fixed 6 Mar 2017 in https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=patch;h=4ce4f2f683a17be3ddb93729f3f25014a97934ad
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/c0c54c6/gnupg/agent-handle-scdaemon-errors.patch"
sha256 "c2de625327c14b2c0538f45749f46c67169598c879dc81cf828bbb30677b7e59"
end
# Remove for > 2.1.19
# "make check" cannot run before "make install"
# Reported 1 Mar 2017 https://bugs.gnupg.org/gnupg/issue2979
# Fixed 15 Mar 2017 in https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=patch;h=a98459d3f4ec3d196fb0adb0e90dadf40abc8c81
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/f234026/gnupg/fix-using-tools-from-build-dir.patch"
sha256 "f36614537c75981c448d4c8b78e6040a40f867464c7828ed72a91a35cd2b577f"
end
def install
args = %W[
--disable-dependency-tracking
--disable-silent-rules
--prefix=#{prefix}
--sbindir=#{bin}
--sysconfdir=#{etc}
--enable-symcryptrun
--with-pinentry-pgm=#{Formula["pinentry"].opt_bin}/pinentry
]
args << "--disable-ccid-driver" if build.without? "libusb"
args << "--with-readline=#{Formula["readline"].opt_prefix}" if build.with? "readline"
system "./configure", *args
system "make"
system "make", "check"
system "make", "install"
# Add symlinks from gpg2 to unversioned executables, replacing gpg 1.x.
bin.install_symlink "gpg2" => "gpg"
bin.install_symlink "gpgv2" => "gpgv"
man1.install_symlink "gpg2.1" => "gpg.1"
man1.install_symlink "gpgv2.1" => "gpgv.1"
bin.install "tools/gpgsplit" => "gpgsplit2" if build.with? "gpgsplit"
end
def post_install
(var/"run").mkpath
quiet_system "killall", "gpg-agent"
end
def caveats; <<-EOS.undent
Once you run this version of gpg you may find it difficult to return to using
a prior 1.4.x or 2.0.x. Most notably the prior versions will not automatically
know about new secret keys created or imported by this version. We recommend
creating a backup of your `~/.gnupg` prior to first use.
For full details on each change and how it could impact you please see
https://www.gnupg.org/faq/whats-new-in-2.1.html
EOS
end
test do
(testpath/"batch.gpg").write <<-EOS.undent
Key-Type: RSA
Key-Length: 2048
Subkey-Type: RSA
Subkey-Length: 2048
Name-Real: Testing
Name-Email: testing@foo.bar
Expire-Date: 1d
%no-protection
%commit
EOS
begin
system bin/"gpg", "--batch", "--gen-key", "batch.gpg"
(testpath/"test.txt").write "Hello World!"
system bin/"gpg", "--detach-sign", "test.txt"
system bin/"gpg", "--verify", "test.txt.sig"
ensure
system bin/"gpgconf", "--kill", "gpg-agent"
end
end
end
gnupg: update 2.1.19 bottle.
class Gnupg < Formula
desc "GNU Pretty Good Privacy (PGP) package"
homepage "https://www.gnupg.org/"
url "https://gnupg.org/ftp/gcrypt/gnupg/gnupg-2.1.19.tar.bz2"
mirror "https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/gnupg/gnupg-2.1.19.tar.bz2"
sha256 "46cced1f5641ce29cc28250f52fadf6e417e649b3bfdec49a5a0d0b22a639bf0"
bottle do
sha256 "489c79922a572a68b98c8dcf3e55a657a8c745fd1e02a1b2b42aa781b1f07d91" => :sierra
sha256 "153fed441e24dbd501b338cd3872a9aeaabf646275aeae82d8172ef29e8d6802" => :el_capitan
sha256 "df23cf948ad165e8370d2617ca7ec3a90d583e220a1af00335b9e93fa57fa586" => :yosemite
end
option "with-gpgsplit", "Additionally install the gpgsplit utility"
option "without-libusb", "Disable the internal CCID driver"
deprecated_option "without-libusb-compat" => "without-libusb"
depends_on "pkg-config" => :build
depends_on "sqlite" => :build if MacOS.version == :mavericks
depends_on "npth"
depends_on "gnutls"
depends_on "libgpg-error"
depends_on "libgcrypt"
depends_on "libksba"
depends_on "libassuan"
depends_on "pinentry"
depends_on "gettext"
depends_on "adns"
depends_on "libusb" => :recommended
depends_on "readline" => :optional
depends_on "homebrew/fuse/encfs" => :optional
# Remove for > 2.1.19
# ssh-import.scm fails during "make check" for sandboxed builds
# Reported 1 Mar 2017 https://bugs.gnupg.org/gnupg/issue2980
# Fixed 6 Mar 2017 in https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=patch;h=4ce4f2f683a17be3ddb93729f3f25014a97934ad
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/c0c54c6/gnupg/agent-handle-scdaemon-errors.patch"
sha256 "c2de625327c14b2c0538f45749f46c67169598c879dc81cf828bbb30677b7e59"
end
# Remove for > 2.1.19
# "make check" cannot run before "make install"
# Reported 1 Mar 2017 https://bugs.gnupg.org/gnupg/issue2979
# Fixed 15 Mar 2017 in https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=patch;h=a98459d3f4ec3d196fb0adb0e90dadf40abc8c81
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/f234026/gnupg/fix-using-tools-from-build-dir.patch"
sha256 "f36614537c75981c448d4c8b78e6040a40f867464c7828ed72a91a35cd2b577f"
end
def install
args = %W[
--disable-dependency-tracking
--disable-silent-rules
--prefix=#{prefix}
--sbindir=#{bin}
--sysconfdir=#{etc}
--enable-symcryptrun
--with-pinentry-pgm=#{Formula["pinentry"].opt_bin}/pinentry
]
args << "--disable-ccid-driver" if build.without? "libusb"
args << "--with-readline=#{Formula["readline"].opt_prefix}" if build.with? "readline"
system "./configure", *args
system "make"
system "make", "check"
system "make", "install"
# Add symlinks from gpg2 to unversioned executables, replacing gpg 1.x.
bin.install_symlink "gpg2" => "gpg"
bin.install_symlink "gpgv2" => "gpgv"
man1.install_symlink "gpg2.1" => "gpg.1"
man1.install_symlink "gpgv2.1" => "gpgv.1"
bin.install "tools/gpgsplit" => "gpgsplit2" if build.with? "gpgsplit"
end
def post_install
(var/"run").mkpath
quiet_system "killall", "gpg-agent"
end
def caveats; <<-EOS.undent
Once you run this version of gpg you may find it difficult to return to using
a prior 1.4.x or 2.0.x. Most notably the prior versions will not automatically
know about new secret keys created or imported by this version. We recommend
creating a backup of your `~/.gnupg` prior to first use.
For full details on each change and how it could impact you please see
https://www.gnupg.org/faq/whats-new-in-2.1.html
EOS
end
test do
(testpath/"batch.gpg").write <<-EOS.undent
Key-Type: RSA
Key-Length: 2048
Subkey-Type: RSA
Subkey-Length: 2048
Name-Real: Testing
Name-Email: testing@foo.bar
Expire-Date: 1d
%no-protection
%commit
EOS
begin
system bin/"gpg", "--batch", "--gen-key", "batch.gpg"
(testpath/"test.txt").write "Hello World!"
system bin/"gpg", "--detach-sign", "test.txt"
system bin/"gpg", "--verify", "test.txt.sig"
ensure
system bin/"gpgconf", "--kill", "gpg-agent"
end
end
end
|
require 'brewkit'
class Gnupg <Formula
@url='ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.9.tar.bz2'
@homepage='http://www.gnupg.org/'
@sha1='826f4bef1effce61c3799c8f7d3cc8313b340b55'
def install
system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
system "make"
system "make check"
# amazingly even the GNU folks can bugger up their Makefiles, so we need
# to create these directories because the install target has the
# dependency order wrong
bin.mkpath
(libexec+'gnupg').mkpath
system "make install"
end
end
Update GnuPG formula to 1.4.10 and include --disable-asm to prevent breakage
require 'brewkit'
class Gnupg <Formula
@url='ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.10.tar.bz2'
@homepage='http://www.gnupg.org/'
@sha1='fd1b6a5f3b2dd836b598a1123ac257b8f105615d'
def install
system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking", "--disable-asm"
system "make"
system "make check"
# amazingly even the GNU folks can bugger up their Makefiles, so we need
# to create these directories because the install target has the
# dependency order wrong
bin.mkpath
(libexec+'gnupg').mkpath
system "make install"
end
end
|
class Godep < Formula
desc "Dependency tool for go"
homepage "https://godoc.org/github.com/tools/godep"
url "https://github.com/tools/godep/archive/v80.tar.gz"
sha256 "029adc1a0ce5c63cd40b56660664e73456648e5c031ba6c214ba1e1e9fc86cf6"
revision 10
head "https://github.com/tools/godep.git"
bottle do
cellar :any_skip_relocation
sha256 "58a13c8f7d8541999e9a1c4865e8f2426d6358fb76ba8b820c37947344673fc8" => :mojave
sha256 "c543d59aae41c3bc034a087d8c2cdd73e36f46e81fe63c5c894d87b473048012" => :high_sierra
sha256 "043951dcbb29bc7075ddb73e7285d735d75d534497bae0205445f67787992619" => :sierra
end
depends_on "go"
def install
ENV["GOPATH"] = buildpath
(buildpath/"src/github.com/tools/godep").install buildpath.children
cd "src/github.com/tools/godep" do
system "go", "build", "-o", bin/"godep"
prefix.install_metafiles
end
end
test do
ENV["GOPATH"] = testpath.realpath
(testpath/"Godeps/Godeps.json").write <<~EOS
{
"ImportPath": "github.com/tools/godep",
"GoVersion": "go1.8",
"Deps": [
{
"ImportPath": "golang.org/x/tools/cover",
"Rev": "3fe2afc9e626f32e91aff6eddb78b14743446865"
}
]
}
EOS
system bin/"godep", "restore"
assert_predicate testpath/"src/golang.org/x/tools/README", :exist?,
"Failed to find 'src/golang.org/x/tools/README!' file"
end
end
godep: revision for go
class Godep < Formula
desc "Dependency tool for go"
homepage "https://godoc.org/github.com/tools/godep"
url "https://github.com/tools/godep/archive/v80.tar.gz"
sha256 "029adc1a0ce5c63cd40b56660664e73456648e5c031ba6c214ba1e1e9fc86cf6"
revision 11
head "https://github.com/tools/godep.git"
bottle do
cellar :any_skip_relocation
sha256 "58a13c8f7d8541999e9a1c4865e8f2426d6358fb76ba8b820c37947344673fc8" => :mojave
sha256 "c543d59aae41c3bc034a087d8c2cdd73e36f46e81fe63c5c894d87b473048012" => :high_sierra
sha256 "043951dcbb29bc7075ddb73e7285d735d75d534497bae0205445f67787992619" => :sierra
end
depends_on "go"
def install
ENV["GOPATH"] = buildpath
(buildpath/"src/github.com/tools/godep").install buildpath.children
cd "src/github.com/tools/godep" do
system "go", "build", "-o", bin/"godep"
prefix.install_metafiles
end
end
test do
ENV["GOPATH"] = testpath.realpath
(testpath/"Godeps/Godeps.json").write <<~EOS
{
"ImportPath": "github.com/tools/godep",
"GoVersion": "go1.8",
"Deps": [
{
"ImportPath": "golang.org/x/tools/cover",
"Rev": "3fe2afc9e626f32e91aff6eddb78b14743446865"
}
]
}
EOS
system bin/"godep", "restore"
assert_predicate testpath/"src/golang.org/x/tools/README", :exist?,
"Failed to find 'src/golang.org/x/tools/README!' file"
end
end
|
class Gosec < Formula
desc "Golang security checker"
homepage "https://securego.io/"
url "https://github.com/securego/gosec/archive/v2.12.0.tar.gz"
sha256 "8aa8f417ef0aa029595a6990984f5b9b750ab1988a8f895f514c612764b59da4"
license "Apache-2.0"
head "https://github.com/securego/gosec.git", branch: "master"
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "805ffe790a0fba9168c8e00c678e9ebcd88fef92a491a1278e807084b9264301"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "7cae894417cedc864ae66e228173293d67704ea1fa47189d6ca0d1b3ebeba3e5"
sha256 cellar: :any_skip_relocation, monterey: "5f03546bdce5843d52d9d3478f0c27cfa8870ffdecfebf9690dc344dd7430a11"
sha256 cellar: :any_skip_relocation, big_sur: "47cb52e304ecfdbdb4544225c247133ec03223376cec59ce66d89a179ab6ba28"
sha256 cellar: :any_skip_relocation, catalina: "fe3641fd577521b61adf4e42c150d6a4e5ea8b592167e45eaecf76439b1c8477"
sha256 cellar: :any_skip_relocation, x86_64_linux: "2c50b26985752ef62a91329dade12a20e1fd1b316cd0d0d7babf2a028961aa7c"
end
depends_on "go"
def install
system "go", "build", *std_go_args(ldflags: "-X main.version=v#{version}"), "./cmd/gosec"
end
test do
(testpath/"test.go").write <<~EOS
package main
import "fmt"
func main() {
username := "admin"
var password = "f62e5bcda4fae4f82370da0c6f20697b8f8447ef"
fmt.Println("Doing something with: ", username, password)
}
EOS
output = shell_output("#{bin}/gosec ./...", 1)
assert_match "G101 (CWE-798)", output
assert_match "Issues : \e[1;31m1\e[0m", output
end
end
gosec 2.13.0
Closes #108432.
Signed-off-by: Carlo Cabrera <3ffc397d0e4bded29cb84b56167de54c01e3a55b@users.noreply.github.com>
Signed-off-by: BrewTestBot <8a898ee6867e4f2028e63d2a6319b2224641c06c@users.noreply.github.com>
class Gosec < Formula
desc "Golang security checker"
homepage "https://securego.io/"
url "https://github.com/securego/gosec/archive/v2.13.0.tar.gz"
sha256 "f78c9694f16ab1f64485c803c17cf0b9faefbe956f8d2a49108a95419696a3b9"
license "Apache-2.0"
head "https://github.com/securego/gosec.git", branch: "master"
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "805ffe790a0fba9168c8e00c678e9ebcd88fef92a491a1278e807084b9264301"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "7cae894417cedc864ae66e228173293d67704ea1fa47189d6ca0d1b3ebeba3e5"
sha256 cellar: :any_skip_relocation, monterey: "5f03546bdce5843d52d9d3478f0c27cfa8870ffdecfebf9690dc344dd7430a11"
sha256 cellar: :any_skip_relocation, big_sur: "47cb52e304ecfdbdb4544225c247133ec03223376cec59ce66d89a179ab6ba28"
sha256 cellar: :any_skip_relocation, catalina: "fe3641fd577521b61adf4e42c150d6a4e5ea8b592167e45eaecf76439b1c8477"
sha256 cellar: :any_skip_relocation, x86_64_linux: "2c50b26985752ef62a91329dade12a20e1fd1b316cd0d0d7babf2a028961aa7c"
end
depends_on "go"
def install
system "go", "build", *std_go_args(ldflags: "-X main.version=v#{version}"), "./cmd/gosec"
end
test do
(testpath/"test.go").write <<~EOS
package main
import "fmt"
func main() {
username := "admin"
var password = "f62e5bcda4fae4f82370da0c6f20697b8f8447ef"
fmt.Println("Doing something with: ", username, password)
}
EOS
output = shell_output("#{bin}/gosec ./...", 1)
assert_match "G101 (CWE-798)", output
assert_match "Issues : \e[1;31m1\e[0m", output
end
end
|
class Gotop < Formula
desc "Terminal based graphical activity monitor inspired by gtop and vtop"
homepage "https://github.com/xxxserxxx/gotop"
url "https://github.com/xxxserxxx/gotop/archive/v4.0.1.tar.gz"
sha256 "38a34543ed828ed8cedd93049d9634c2e578390543d4068c19f0d0c20aaf7ba0"
bottle do
cellar :any_skip_relocation
sha256 "5a61acb05457b28a32d342fc75376785873ec8f9fd73209f079550051851ea54" => :catalina
sha256 "c758b1001a0de9af2572871c05cd3ec78341e31e2e870a9a147cea493f85baa6" => :mojave
sha256 "194a6ee2f9ab9922b23a91d8868ac7802f611f238d56d10c79da4c9263a9afa4" => :high_sierra
end
depends_on "go" => :build
def install
time = `date +%Y%m%dT%H%M%S`.chomp
system "go", "build", *std_go_args, "-ldflags",
"-X main.Version=#{version} -X main.BuildDate=#{time}", "./cmd/gotop"
end
test do
assert_match version.to_s, shell_output("#{bin}/gotop --version").chomp
system bin/"gotop", "--write-config"
assert_predicate testpath/"Library/Application Support/gotop/gotop.conf", :exist?
end
end
gotop: fix test for Linuxbrew (#20555)
class Gotop < Formula
desc "Terminal based graphical activity monitor inspired by gtop and vtop"
homepage "https://github.com/xxxserxxx/gotop"
url "https://github.com/xxxserxxx/gotop/archive/v4.0.1.tar.gz"
sha256 "38a34543ed828ed8cedd93049d9634c2e578390543d4068c19f0d0c20aaf7ba0"
bottle do
cellar :any_skip_relocation
sha256 "5a61acb05457b28a32d342fc75376785873ec8f9fd73209f079550051851ea54" => :catalina
sha256 "c758b1001a0de9af2572871c05cd3ec78341e31e2e870a9a147cea493f85baa6" => :mojave
sha256 "194a6ee2f9ab9922b23a91d8868ac7802f611f238d56d10c79da4c9263a9afa4" => :high_sierra
end
depends_on "go" => :build
def install
time = `date +%Y%m%dT%H%M%S`.chomp
system "go", "build", *std_go_args, "-ldflags",
"-X main.Version=#{version} -X main.BuildDate=#{time}", "./cmd/gotop"
end
test do
assert_match version.to_s, shell_output("#{bin}/gotop --version").chomp
system bin/"gotop", "--write-config"
path = OS.mac? ? "Library/Application Support/gotop": ".config/gotop"
assert_predicate testpath/"#{path}/gotop.conf", :exist?
end
end
|
class Gotop < Formula
desc "Terminal based graphical activity monitor inspired by gtop and vtop"
homepage "https://github.com/xxxserxxx/gotop"
url "https://github.com/xxxserxxx/gotop/archive/v4.1.1.tar.gz"
sha256 "314dcfc4b0faa0bb735e5fa84b2406492bf94f7948af43e2b9d2982d69d542ed"
license "BSD-3-Clause"
bottle do
sha256 cellar: :any_skip_relocation, big_sur: "01ed715cd19b9ced52c17755df4666f6b16ec9252d9844b713e6381205f82c56"
sha256 cellar: :any_skip_relocation, catalina: "91732e8e1bf94c18b3c06a43a675aed959c0d87b6ec3e1930e9b06e7a9b6e2e5"
sha256 cellar: :any_skip_relocation, mojave: "06d7521db8a6b3d9a03aae4d246ed48908491d3d4f3ba7d9f5051165e4cb2fd8"
end
depends_on "go" => :build
def install
time = `date +%Y%m%dT%H%M%S`.chomp
system "go", "build", *std_go_args, "-ldflags",
"-X main.Version=#{version} -X main.BuildDate=#{time}", "./cmd/gotop"
end
test do
assert_match version.to_s, shell_output("#{bin}/gotop --version").chomp
system bin/"gotop", "--write-config"
assert_predicate testpath/"Library/Application Support/gotop/gotop.conf", :exist?
end
end
gotop: update 4.1.1 bottle.
class Gotop < Formula
desc "Terminal based graphical activity monitor inspired by gtop and vtop"
homepage "https://github.com/xxxserxxx/gotop"
url "https://github.com/xxxserxxx/gotop/archive/v4.1.1.tar.gz"
sha256 "314dcfc4b0faa0bb735e5fa84b2406492bf94f7948af43e2b9d2982d69d542ed"
license "BSD-3-Clause"
bottle do
sha256 cellar: :any_skip_relocation, big_sur: "5bd55068dd42b2aac57ed81c27a991491c1025e419f1a9a04fc8625ee6b052b9"
sha256 cellar: :any_skip_relocation, catalina: "20dcda60bff1a19a0aa266ac9171928435ed2f5100ef4737a9d7c0fc68b5e8d7"
sha256 cellar: :any_skip_relocation, mojave: "7292d06bb5efcbb61f919249c1c7ee5a1ab3547f2c791dc0ee18b80694baef47"
end
depends_on "go" => :build
def install
time = `date +%Y%m%dT%H%M%S`.chomp
system "go", "build", *std_go_args, "-ldflags",
"-X main.Version=#{version} -X main.BuildDate=#{time}", "./cmd/gotop"
end
test do
assert_match version.to_s, shell_output("#{bin}/gotop --version").chomp
system bin/"gotop", "--write-config"
assert_predicate testpath/"Library/Application Support/gotop/gotop.conf", :exist?
end
end
|
class Gpsim < Formula
homepage "http://gpsim.sourceforge.net/"
url "https://downloads.sourceforge.net/project/gpsim/gpsim/0.28.0/gpsim-0.28.1.tar.gz"
sha256 "d8d41fb530630e6df31db89a0ca630038395aed4d07c48859655468ed25658ed"
head "svn://svn.code.sf.net/p/gpsim/code/trunk"
depends_on "pkg-config" => :build
depends_on "gputils" => :build
depends_on "glib"
depends_on "popt"
def install
system "./configure", "--disable-dependency-tracking",
"--disable-gui",
"--disable-shared",
"--prefix=#{prefix}"
system "make", "all"
system "make", "install"
end
end
gpsim: add 0.28.1 bottle.
class Gpsim < Formula
homepage "http://gpsim.sourceforge.net/"
url "https://downloads.sourceforge.net/project/gpsim/gpsim/0.28.0/gpsim-0.28.1.tar.gz"
sha256 "d8d41fb530630e6df31db89a0ca630038395aed4d07c48859655468ed25658ed"
head "svn://svn.code.sf.net/p/gpsim/code/trunk"
bottle do
cellar :any
sha256 "78a225eb11338a6699ccdb4c23ad4c1682cfdc34f06cf2c4fbeb571b238b45c9" => :yosemite
sha256 "dfdf91a9f332b9880ec59934fe661bbc0d50b45d8f7c2cdde888f31bcaac9c40" => :mavericks
sha256 "2d0cc0cf61b5df08cce8f9795666228487876cfda9045be3e371b6cd15c70bee" => :mountain_lion
end
depends_on "pkg-config" => :build
depends_on "gputils" => :build
depends_on "glib"
depends_on "popt"
def install
system "./configure", "--disable-dependency-tracking",
"--disable-gui",
"--disable-shared",
"--prefix=#{prefix}"
system "make", "all"
system "make", "install"
end
end
|
class Grakn < Formula
desc "The distributed hyper-relational database for knowledge engineering"
homepage "https://grakn.ai"
url "https://github.com/graknlabs/grakn/releases/download/1.8.2/grakn-core-all-mac-1.8.2.zip"
sha256 "6e3c450e5d787f38b86697be48c99a4ce4489dd00fdb095b3a78286a7dc88fc2"
license "AGPL-3.0-or-later"
bottle :unneeded
depends_on java: "1.8"
def install
libexec.install Dir["*"]
bin.install libexec/"grakn"
bin.env_script_all_files(libexec, Language::Java.java_home_env("1.8"))
end
test do
assert_match /RUNNING/i, shell_output("#{bin}/grakn server status")
end
end
grakn 1.8.3 (#61275)
class Grakn < Formula
desc "The distributed hyper-relational database for knowledge engineering"
homepage "https://grakn.ai"
url "https://github.com/graknlabs/grakn/releases/download/1.8.3/grakn-core-all-mac-1.8.3.zip"
sha256 "e8d2a96c4b6144113ebd71781041168fe8dae2b115602b25aebe16960931434b"
license "AGPL-3.0-or-later"
bottle :unneeded
depends_on java: "1.8"
def install
libexec.install Dir["*"]
bin.install libexec/"grakn"
bin.env_script_all_files(libexec, Language::Java.java_home_env("1.8"))
end
test do
assert_match /RUNNING/i, shell_output("#{bin}/grakn server status")
end
end
|
class Gsoap < Formula
desc "SOAP stub and skeleton compiler for C and C++"
homepage "https://www.genivia.com/products.html"
url "https://downloads.sourceforge.net/project/gsoap2/gsoap-2.8/gsoap_2.8.55.zip"
sha256 "fe883f79e730b066ddc6917bc68248f5f785578ffddb7066ab83b09defb2a736"
bottle do
sha256 "303a0ae7b051003bd922f9e00417bfdaf7d3cda51c33cc1ad1f7cd54c39c2b01" => :high_sierra
sha256 "e40322714045a2128a9634a19754f9a48af0a2a6264ee9f2bca36d78cee89c29" => :sierra
sha256 "f834fc5ce7c461c7ad20a059bace745e34561947921a1441b371bb80d2b6476b" => :el_capitan
end
depends_on "openssl"
def install
# Contacted upstream by email and been told this should be fixed by 2.8.37,
# it is due to the compilation of symbol2.c and soapcpp2_yacc.h not being
# ordered correctly in parallel.
ENV.deparallelize
system "./configure", "--prefix=#{prefix}"
system "make"
system "make", "install"
end
test do
system "#{bin}/wsdl2h", "-o", "calc.h", "https://www.genivia.com/calc.wsdl"
system "#{bin}/soapcpp2", "calc.h"
assert_predicate testpath/"calc.add.req.xml", :exist?
end
end
gsoap 2.8.56
Closes #21452.
Signed-off-by: ilovezfs <fbd54dbbcf9e596abad4ccdc4dfc17f80ebeaee2@icloud.com>
class Gsoap < Formula
desc "SOAP stub and skeleton compiler for C and C++"
homepage "https://www.genivia.com/products.html"
url "https://downloads.sourceforge.net/project/gsoap2/gsoap-2.8/gsoap_2.8.56.zip"
sha256 "10374c8ba119cf37d77ad8609b384b5026be68f0d2ccefa5544bc65da3f39d4c"
bottle do
sha256 "303a0ae7b051003bd922f9e00417bfdaf7d3cda51c33cc1ad1f7cd54c39c2b01" => :high_sierra
sha256 "e40322714045a2128a9634a19754f9a48af0a2a6264ee9f2bca36d78cee89c29" => :sierra
sha256 "f834fc5ce7c461c7ad20a059bace745e34561947921a1441b371bb80d2b6476b" => :el_capitan
end
depends_on "openssl"
def install
# Contacted upstream by email and been told this should be fixed by 2.8.37,
# it is due to the compilation of symbol2.c and soapcpp2_yacc.h not being
# ordered correctly in parallel.
ENV.deparallelize
system "./configure", "--prefix=#{prefix}"
system "make"
system "make", "install"
end
test do
system "#{bin}/wsdl2h", "-o", "calc.h", "https://www.genivia.com/calc.wsdl"
system "#{bin}/soapcpp2", "calc.h"
assert_predicate testpath/"calc.add.req.xml", :exist?
end
end
|
class Gsoap < Formula
desc "SOAP stub and skeleton compiler for C and C++"
homepage "https://www.genivia.com/products.html"
url "https://downloads.sourceforge.net/project/gsoap2/gsoap-2.8/gsoap_2.8.110.zip"
sha256 "ec8826265faca3c59756f8b5d637e06b7f4ed4a984243caa3f53db4ec71e577a"
license any_of: ["GPL-2.0-or-later", "gSOAP-1.3b"]
livecheck do
url :stable
regex(%r{url=.*?/gsoap[._-]v?(\d+(?:\.\d+)+)\.zip}i)
end
bottle do
sha256 "c55587438262b398d433af85087de4ebc8f90b43cb797f0677f386d8506680d5" => :big_sur
sha256 "786cd2fafa7aecc09f78f5282372d77043b7c6203d5d565f58459f63dc2ef7f0" => :arm64_big_sur
sha256 "d961088f83353a43f77ce55fd0986e1402ecfe47626d06b73cc654b346b4a758" => :catalina
sha256 "2c76abc3cfdae87a6193e5de6dc0cb06c41affce2bf11b3284effca70f8c7ada" => :mojave
end
depends_on "autoconf" => :build
depends_on "openssl@1.1"
uses_from_macos "bison"
uses_from_macos "flex"
uses_from_macos "zlib"
def install
system "./configure", "--prefix=#{prefix}"
system "make"
system "make", "install"
end
test do
system "#{bin}/wsdl2h", "-o", "calc.h", "https://www.genivia.com/calc.wsdl"
system "#{bin}/soapcpp2", "calc.h"
assert_predicate testpath/"calc.add.req.xml", :exist?
end
end
gsoap 2.8.111
Closes #69557.
Signed-off-by: Carlo Cabrera <3ffc397d0e4bded29cb84b56167de54c01e3a55b@users.noreply.github.com>
Signed-off-by: BrewTestBot <8a898ee6867e4f2028e63d2a6319b2224641c06c@users.noreply.github.com>
class Gsoap < Formula
desc "SOAP stub and skeleton compiler for C and C++"
homepage "https://www.genivia.com/products.html"
url "https://downloads.sourceforge.net/project/gsoap2/gsoap-2.8/gsoap_2.8.111.zip"
sha256 "f1670c7e3aeaa66bc5658539fbd162e5099f022666855ef2b2c2bac07fec4bd3"
license any_of: ["GPL-2.0-or-later", "gSOAP-1.3b"]
livecheck do
url :stable
regex(%r{url=.*?/gsoap[._-]v?(\d+(?:\.\d+)+)\.zip}i)
end
bottle do
sha256 "c55587438262b398d433af85087de4ebc8f90b43cb797f0677f386d8506680d5" => :big_sur
sha256 "786cd2fafa7aecc09f78f5282372d77043b7c6203d5d565f58459f63dc2ef7f0" => :arm64_big_sur
sha256 "d961088f83353a43f77ce55fd0986e1402ecfe47626d06b73cc654b346b4a758" => :catalina
sha256 "2c76abc3cfdae87a6193e5de6dc0cb06c41affce2bf11b3284effca70f8c7ada" => :mojave
end
depends_on "autoconf" => :build
depends_on "openssl@1.1"
uses_from_macos "bison"
uses_from_macos "flex"
uses_from_macos "zlib"
def install
system "./configure", "--prefix=#{prefix}"
system "make"
system "make", "install"
end
test do
system "#{bin}/wsdl2h", "-o", "calc.h", "https://www.genivia.com/calc.wsdl"
system "#{bin}/soapcpp2", "calc.h"
assert_predicate testpath/"calc.add.req.xml", :exist?
end
end
|
class Gtkx3 < Formula
desc "Toolkit for creating graphical user interfaces"
homepage "https://gtk.org/"
url "https://download.gnome.org/sources/gtk+/3.22/gtk+-3.22.11.tar.xz"
sha256 "db440670cb6f3c098b076df3735fbc4e69359bd605385e87c90ee48344a804ca"
bottle do
sha256 "37356f6d632d1ba3645b30859806d9082cc2aebd6904f1116ceb3cc21d804beb" => :sierra
sha256 "709d1eddbbe107de1aa8fdf7826174b7701eb22c215bbce7e063b1586a26acca" => :el_capitan
sha256 "9ae80358c79627df484a6e5c144efb86f14cf63f36c52d89234f0853977007f0" => :yosemite
end
option "with-quartz-relocation", "Build with quartz relocation support"
depends_on "pkg-config" => :build
depends_on "gdk-pixbuf"
depends_on "atk"
depends_on "gobject-introspection"
depends_on "libepoxy"
depends_on "pango"
depends_on "glib"
depends_on "hicolor-icon-theme"
depends_on "gsettings-desktop-schemas" => :recommended
depends_on "jasper" => :optional
depends_on "cairo" unless OS.mac?
def install
args = %W[
--enable-debug=minimal
--disable-dependency-tracking
--prefix=#{prefix}
--disable-glibtest
--enable-introspection=yes
--disable-schemas-compile
]
if OS.mac?
args << "--enable-quartz-backend" << "--disable-x11-backend"
else
args << "--disable-quartz-backend" << "--enable-x11-backend"
end
args << "--enable-quartz-relocation" if build.with?("quartz-relocation")
system "./configure", *args
# necessary to avoid gtk-update-icon-cache not being found during make install
bin.mkpath
ENV.prepend_path "PATH", bin
system "make", "install"
# Prevent a conflict between this and Gtk+2
mv bin/"gtk-update-icon-cache", bin/"gtk3-update-icon-cache"
end
def post_install
system "#{Formula["glib"].opt_bin}/glib-compile-schemas", "#{HOMEBREW_PREFIX}/share/glib-2.0/schemas"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <gtk/gtk.h>
int main(int argc, char *argv[]) {
gtk_disable_setlocale();
return 0;
}
EOS
atk = Formula["atk"]
cairo = Formula["cairo"]
fontconfig = Formula["fontconfig"]
freetype = Formula["freetype"]
gdk_pixbuf = Formula["gdk-pixbuf"]
gettext = Formula["gettext"]
glib = Formula["glib"]
libepoxy = Formula["libepoxy"]
libpng = Formula["libpng"]
pango = Formula["pango"]
pixman = Formula["pixman"]
flags = %W[
-I#{atk.opt_include}/atk-1.0
-I#{cairo.opt_include}/cairo
-I#{fontconfig.opt_include}
-I#{freetype.opt_include}/freetype2
-I#{gdk_pixbuf.opt_include}/gdk-pixbuf-2.0
-I#{gettext.opt_include}
-I#{glib.opt_include}/gio-unix-2.0/
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{include}
-I#{include}/gtk-3.0
-I#{libepoxy.opt_include}
-I#{libpng.opt_include}/libpng16
-I#{pango.opt_include}/pango-1.0
-I#{pixman.opt_include}/pixman-1
-D_REENTRANT
-L#{atk.opt_lib}
-L#{cairo.opt_lib}
-L#{gdk_pixbuf.opt_lib}
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{lib}
-L#{pango.opt_lib}
-latk-1.0
-lcairo
-lcairo-gobject
-lgdk-3
-lgdk_pixbuf-2.0
-lgio-2.0
-lglib-2.0
-lgobject-2.0
-lgtk-3
-lpango-1.0
-lpangocairo-1.0
]
flags << "-lintl" if OS.mac?
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end
gtk+3: update 3.22.11 bottle for Linuxbrew
Closes Linuxbrew/homebrew-core#2368
Signed-off-by: Maxim Belkin <032baa6ccf1d4eaa4536fc4f9b83b9a1f593449a@gmail.com>
class Gtkx3 < Formula
desc "Toolkit for creating graphical user interfaces"
homepage "https://gtk.org/"
url "https://download.gnome.org/sources/gtk+/3.22/gtk+-3.22.11.tar.xz"
sha256 "db440670cb6f3c098b076df3735fbc4e69359bd605385e87c90ee48344a804ca"
bottle do
sha256 "37356f6d632d1ba3645b30859806d9082cc2aebd6904f1116ceb3cc21d804beb" => :sierra
sha256 "709d1eddbbe107de1aa8fdf7826174b7701eb22c215bbce7e063b1586a26acca" => :el_capitan
sha256 "9ae80358c79627df484a6e5c144efb86f14cf63f36c52d89234f0853977007f0" => :yosemite
sha256 "b33c31989bb71d137ed27a64bf3c9eaa3c0cf584450f19aa2f4781c87ab00ff7" => :x86_64_linux
end
option "with-quartz-relocation", "Build with quartz relocation support"
depends_on "pkg-config" => :build
depends_on "gdk-pixbuf"
depends_on "atk"
depends_on "gobject-introspection"
depends_on "libepoxy"
depends_on "pango"
depends_on "glib"
depends_on "hicolor-icon-theme"
depends_on "gsettings-desktop-schemas" => :recommended
depends_on "jasper" => :optional
depends_on "cairo" unless OS.mac?
def install
args = %W[
--enable-debug=minimal
--disable-dependency-tracking
--prefix=#{prefix}
--disable-glibtest
--enable-introspection=yes
--disable-schemas-compile
]
if OS.mac?
args << "--enable-quartz-backend" << "--disable-x11-backend"
else
args << "--disable-quartz-backend" << "--enable-x11-backend"
end
args << "--enable-quartz-relocation" if build.with?("quartz-relocation")
system "./configure", *args
# necessary to avoid gtk-update-icon-cache not being found during make install
bin.mkpath
ENV.prepend_path "PATH", bin
system "make", "install"
# Prevent a conflict between this and Gtk+2
mv bin/"gtk-update-icon-cache", bin/"gtk3-update-icon-cache"
end
def post_install
system "#{Formula["glib"].opt_bin}/glib-compile-schemas", "#{HOMEBREW_PREFIX}/share/glib-2.0/schemas"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <gtk/gtk.h>
int main(int argc, char *argv[]) {
gtk_disable_setlocale();
return 0;
}
EOS
atk = Formula["atk"]
cairo = Formula["cairo"]
fontconfig = Formula["fontconfig"]
freetype = Formula["freetype"]
gdk_pixbuf = Formula["gdk-pixbuf"]
gettext = Formula["gettext"]
glib = Formula["glib"]
libepoxy = Formula["libepoxy"]
libpng = Formula["libpng"]
pango = Formula["pango"]
pixman = Formula["pixman"]
flags = %W[
-I#{atk.opt_include}/atk-1.0
-I#{cairo.opt_include}/cairo
-I#{fontconfig.opt_include}
-I#{freetype.opt_include}/freetype2
-I#{gdk_pixbuf.opt_include}/gdk-pixbuf-2.0
-I#{gettext.opt_include}
-I#{glib.opt_include}/gio-unix-2.0/
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{include}
-I#{include}/gtk-3.0
-I#{libepoxy.opt_include}
-I#{libpng.opt_include}/libpng16
-I#{pango.opt_include}/pango-1.0
-I#{pixman.opt_include}/pixman-1
-D_REENTRANT
-L#{atk.opt_lib}
-L#{cairo.opt_lib}
-L#{gdk_pixbuf.opt_lib}
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{lib}
-L#{pango.opt_lib}
-latk-1.0
-lcairo
-lcairo-gobject
-lgdk-3
-lgdk_pixbuf-2.0
-lgio-2.0
-lglib-2.0
-lgobject-2.0
-lgtk-3
-lpango-1.0
-lpangocairo-1.0
]
flags << "-lintl" if OS.mac?
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end
|
require 'formula'
class Gtkx3 < Formula
homepage 'http://gtk.org/'
url 'http://ftp.gnome.org/pub/gnome/sources/gtk+/3.10/gtk+-3.10.2.tar.xz'
sha256 '93af12d28e5f6ccc373ea59f31147e2884c9b3c15dc4841ce3b5cee45b13814c'
depends_on :x11 => '2.5' # needs XInput2, introduced in libXi 1.3
depends_on 'pkg-config' => :build
depends_on 'xz' => :build
depends_on 'glib'
depends_on 'jpeg'
depends_on 'libtiff'
depends_on 'gdk-pixbuf'
depends_on 'pango'
depends_on 'cairo' => 'with-glib'
depends_on 'jasper' => :optional
depends_on 'atk'
depends_on 'at-spi2-atk'
depends_on 'gobject-introspection'
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
"--disable-glibtest",
"--enable-introspection=yes",
"--enable-x11-backend",
"--disable-schemas-compile"
system "make install"
# Prevent a conflict between this and Gtk+2
mv bin/'gtk-update-icon-cache', bin/'gtk3-update-icon-cache'
end
def test
system "#{bin}/gtk3-demo"
end
end
gtk+3 3.10.3
require 'formula'
class Gtkx3 < Formula
homepage 'http://gtk.org/'
url 'http://ftp.gnome.org/pub/gnome/sources/gtk+/3.10/gtk+-3.10.3.tar.xz'
sha256 '8fb41deb898ad00ee858d5c04e2f80d295fbd6a8e9688cd7c0ba56ab84c6b727'
depends_on :x11 => '2.5' # needs XInput2, introduced in libXi 1.3
depends_on 'pkg-config' => :build
depends_on 'xz' => :build
depends_on 'glib'
depends_on 'jpeg'
depends_on 'libtiff'
depends_on 'gdk-pixbuf'
depends_on 'pango'
depends_on 'cairo' => 'with-glib'
depends_on 'jasper' => :optional
depends_on 'atk'
depends_on 'at-spi2-atk'
depends_on 'gobject-introspection'
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
"--disable-glibtest",
"--enable-introspection=yes",
"--enable-x11-backend",
"--disable-schemas-compile"
system "make install"
# Prevent a conflict between this and Gtk+2
mv bin/'gtk-update-icon-cache', bin/'gtk3-update-icon-cache'
end
def test
system "#{bin}/gtk3-demo"
end
end
|
class Gtkx3 < Formula
desc "Toolkit for creating graphical user interfaces"
homepage "https://gtk.org/"
url "https://download.gnome.org/sources/gtk+/3.22/gtk+-3.22.30.tar.xz"
sha256 "a1a4a5c12703d4e1ccda28333b87ff462741dc365131fbc94c218ae81d9a6567"
bottle do
sha256 "bc0243c2284d6c7b45350f0530b704b8bbf3643ffc6f83eb247db94cc53a79b1" => :mojave
sha256 "ca8e625e7f00fca495c6724d46fac0b384b61d449d4f1e0a687ea86273a41dd7" => :high_sierra
sha256 "a0f6f6f21e84bf16e15b284bdac7c06ae0acbffccf076bfbfd0db96e39344cf0" => :sierra
sha256 "5949596413f77dcdc0e59087ca3b187272af4606011494c5357c481a8f92ce52" => :el_capitan
end
depends_on "gobject-introspection" => :build
depends_on "pkg-config" => :build
depends_on "atk"
depends_on "gdk-pixbuf"
depends_on "glib"
depends_on "hicolor-icon-theme"
depends_on "libepoxy"
depends_on "pango"
depends_on "gsettings-desktop-schemas" => :recommended
def install
args = %W[
--enable-debug=minimal
--disable-dependency-tracking
--prefix=#{prefix}
--disable-glibtest
--enable-introspection=yes
--disable-schemas-compile
--enable-quartz-backend
--disable-x11-backend
]
system "./configure", *args
# necessary to avoid gtk-update-icon-cache not being found during make install
bin.mkpath
ENV.prepend_path "PATH", bin
system "make", "install"
# Prevent a conflict between this and Gtk+2
mv bin/"gtk-update-icon-cache", bin/"gtk3-update-icon-cache"
end
def post_install
system "#{Formula["glib"].opt_bin}/glib-compile-schemas", "#{HOMEBREW_PREFIX}/share/glib-2.0/schemas"
end
test do
(testpath/"test.c").write <<~EOS
#include <gtk/gtk.h>
int main(int argc, char *argv[]) {
gtk_disable_setlocale();
return 0;
}
EOS
atk = Formula["atk"]
cairo = Formula["cairo"]
fontconfig = Formula["fontconfig"]
freetype = Formula["freetype"]
gdk_pixbuf = Formula["gdk-pixbuf"]
gettext = Formula["gettext"]
glib = Formula["glib"]
libepoxy = Formula["libepoxy"]
libpng = Formula["libpng"]
pango = Formula["pango"]
pixman = Formula["pixman"]
flags = %W[
-I#{atk.opt_include}/atk-1.0
-I#{cairo.opt_include}/cairo
-I#{fontconfig.opt_include}
-I#{freetype.opt_include}/freetype2
-I#{gdk_pixbuf.opt_include}/gdk-pixbuf-2.0
-I#{gettext.opt_include}
-I#{glib.opt_include}/gio-unix-2.0/
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{include}
-I#{include}/gtk-3.0
-I#{libepoxy.opt_include}
-I#{libpng.opt_include}/libpng16
-I#{pango.opt_include}/pango-1.0
-I#{pixman.opt_include}/pixman-1
-D_REENTRANT
-L#{atk.opt_lib}
-L#{cairo.opt_lib}
-L#{gdk_pixbuf.opt_lib}
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{lib}
-L#{pango.opt_lib}
-latk-1.0
-lcairo
-lcairo-gobject
-lgdk-3
-lgdk_pixbuf-2.0
-lgio-2.0
-lglib-2.0
-lgobject-2.0
-lgtk-3
-lintl
-lpango-1.0
-lpangocairo-1.0
]
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end
gtk+3 3.24.2
Closes #35041.
Signed-off-by: Thierry Moisan <8bf87a6c4caed0437859f8c8fafc6782533e4540@gmail.com>
class Gtkx3 < Formula
desc "Toolkit for creating graphical user interfaces"
homepage "https://gtk.org/"
url "https://download.gnome.org/sources/gtk+/3.24/gtk+-3.24.2.tar.xz"
sha256 "5b3b05e427cc928d103561ed2e91b2b2881fe88b1f167b0b1c9990da6aac8892"
bottle do
sha256 "bc0243c2284d6c7b45350f0530b704b8bbf3643ffc6f83eb247db94cc53a79b1" => :mojave
sha256 "ca8e625e7f00fca495c6724d46fac0b384b61d449d4f1e0a687ea86273a41dd7" => :high_sierra
sha256 "a0f6f6f21e84bf16e15b284bdac7c06ae0acbffccf076bfbfd0db96e39344cf0" => :sierra
sha256 "5949596413f77dcdc0e59087ca3b187272af4606011494c5357c481a8f92ce52" => :el_capitan
end
depends_on "gobject-introspection" => :build
depends_on "pkg-config" => :build
depends_on "atk"
depends_on "gdk-pixbuf"
depends_on "glib"
depends_on "hicolor-icon-theme"
depends_on "libepoxy"
depends_on "pango"
depends_on "gsettings-desktop-schemas" => :recommended
# see https://gitlab.gnome.org/GNOME/gtk/issues/1517
patch :DATA
# see https://gitlab.gnome.org/GNOME/gtk/issues/1518
patch do
url "https://gitlab.gnome.org/jralls/gtk/commit/efb3888af770937c6c2c184d9beea19fbc24bb4a.patch"
sha256 "d847d1b4659153f0d815189039776054bccc73f85cfb967c5cc2cf0e0061d0d7"
end
def install
args = %W[
--enable-debug=minimal
--disable-dependency-tracking
--prefix=#{prefix}
--disable-glibtest
--enable-introspection=yes
--disable-schemas-compile
--enable-quartz-backend
--disable-x11-backend
]
system "./configure", *args
# necessary to avoid gtk-update-icon-cache not being found during make install
bin.mkpath
ENV.prepend_path "PATH", bin
system "make", "install"
# Prevent a conflict between this and Gtk+2
mv bin/"gtk-update-icon-cache", bin/"gtk3-update-icon-cache"
end
def post_install
system "#{Formula["glib"].opt_bin}/glib-compile-schemas", "#{HOMEBREW_PREFIX}/share/glib-2.0/schemas"
end
test do
(testpath/"test.c").write <<~EOS
#include <gtk/gtk.h>
int main(int argc, char *argv[]) {
gtk_disable_setlocale();
return 0;
}
EOS
atk = Formula["atk"]
cairo = Formula["cairo"]
fontconfig = Formula["fontconfig"]
freetype = Formula["freetype"]
gdk_pixbuf = Formula["gdk-pixbuf"]
gettext = Formula["gettext"]
glib = Formula["glib"]
libepoxy = Formula["libepoxy"]
libpng = Formula["libpng"]
pango = Formula["pango"]
pixman = Formula["pixman"]
flags = %W[
-I#{atk.opt_include}/atk-1.0
-I#{cairo.opt_include}/cairo
-I#{fontconfig.opt_include}
-I#{freetype.opt_include}/freetype2
-I#{gdk_pixbuf.opt_include}/gdk-pixbuf-2.0
-I#{gettext.opt_include}
-I#{glib.opt_include}/gio-unix-2.0/
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{include}
-I#{include}/gtk-3.0
-I#{libepoxy.opt_include}
-I#{libpng.opt_include}/libpng16
-I#{pango.opt_include}/pango-1.0
-I#{pixman.opt_include}/pixman-1
-D_REENTRANT
-L#{atk.opt_lib}
-L#{cairo.opt_lib}
-L#{gdk_pixbuf.opt_lib}
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{lib}
-L#{pango.opt_lib}
-latk-1.0
-lcairo
-lcairo-gobject
-lgdk-3
-lgdk_pixbuf-2.0
-lgio-2.0
-lglib-2.0
-lgobject-2.0
-lgtk-3
-lintl
-lpango-1.0
-lpangocairo-1.0
]
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end
__END__
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
index 952d4a8189..642fe7f1ee 100644
--- a/gdk/quartz/gdkevents-quartz.c
+++ b/gdk/quartz/gdkevents-quartz.c
@@ -1551,8 +1551,10 @@ gdk_event_translate (GdkEvent *event,
grab = _gdk_display_get_last_device_grab (_gdk_display,
gdk_seat_get_pointer (seat));
}
- return_val = TRUE;
}
+
+ return_val = TRUE;
+
switch (event_type)
{
case GDK_QUARTZ_LEFT_MOUSE_DOWN:
|
class Gtkx3 < Formula
desc "Toolkit for creating graphical user interfaces"
homepage "https://gtk.org/"
url "https://download.gnome.org/sources/gtk+/3.22/gtk+-3.22.15.tar.xz"
sha256 "c8a012c2a99132629ab043f764a2b7cb6388483a015cd15c7a4288bec3590fdb"
bottle do
sha256 "37356f6d632d1ba3645b30859806d9082cc2aebd6904f1116ceb3cc21d804beb" => :sierra
sha256 "709d1eddbbe107de1aa8fdf7826174b7701eb22c215bbce7e063b1586a26acca" => :el_capitan
sha256 "9ae80358c79627df484a6e5c144efb86f14cf63f36c52d89234f0853977007f0" => :yosemite
end
# see https://bugzilla.gnome.org/show_bug.cgi?id=781118
patch :DATA
option "with-quartz-relocation", "Build with quartz relocation support"
depends_on "pkg-config" => :build
depends_on "gdk-pixbuf"
depends_on "atk"
depends_on "gobject-introspection"
depends_on "libepoxy"
depends_on "pango"
depends_on "glib"
depends_on "hicolor-icon-theme"
depends_on "gsettings-desktop-schemas" => :recommended
depends_on "jasper" => :optional
def install
args = %W[
--enable-debug=minimal
--disable-dependency-tracking
--prefix=#{prefix}
--disable-glibtest
--enable-introspection=yes
--disable-schemas-compile
--enable-quartz-backend
--disable-x11-backend
]
args << "--enable-quartz-relocation" if build.with?("quartz-relocation")
system "./configure", *args
# necessary to avoid gtk-update-icon-cache not being found during make install
bin.mkpath
ENV.prepend_path "PATH", bin
system "make", "install"
# Prevent a conflict between this and Gtk+2
mv bin/"gtk-update-icon-cache", bin/"gtk3-update-icon-cache"
end
def post_install
system "#{Formula["glib"].opt_bin}/glib-compile-schemas", "#{HOMEBREW_PREFIX}/share/glib-2.0/schemas"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <gtk/gtk.h>
int main(int argc, char *argv[]) {
gtk_disable_setlocale();
return 0;
}
EOS
atk = Formula["atk"]
cairo = Formula["cairo"]
fontconfig = Formula["fontconfig"]
freetype = Formula["freetype"]
gdk_pixbuf = Formula["gdk-pixbuf"]
gettext = Formula["gettext"]
glib = Formula["glib"]
libepoxy = Formula["libepoxy"]
libpng = Formula["libpng"]
pango = Formula["pango"]
pixman = Formula["pixman"]
flags = %W[
-I#{atk.opt_include}/atk-1.0
-I#{cairo.opt_include}/cairo
-I#{fontconfig.opt_include}
-I#{freetype.opt_include}/freetype2
-I#{gdk_pixbuf.opt_include}/gdk-pixbuf-2.0
-I#{gettext.opt_include}
-I#{glib.opt_include}/gio-unix-2.0/
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{include}
-I#{include}/gtk-3.0
-I#{libepoxy.opt_include}
-I#{libpng.opt_include}/libpng16
-I#{pango.opt_include}/pango-1.0
-I#{pixman.opt_include}/pixman-1
-D_REENTRANT
-L#{atk.opt_lib}
-L#{cairo.opt_lib}
-L#{gdk_pixbuf.opt_lib}
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{lib}
-L#{pango.opt_lib}
-latk-1.0
-lcairo
-lcairo-gobject
-lgdk-3
-lgdk_pixbuf-2.0
-lgio-2.0
-lglib-2.0
-lgobject-2.0
-lgtk-3
-lintl
-lpango-1.0
-lpangocairo-1.0
]
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end
__END__
diff --git a/gdk/quartz/gdkscreen-quartz.c b/gdk/quartz/gdkscreen-quartz.c
index 586f7af..d032643 100644
--- a/gdk/quartz/gdkscreen-quartz.c
+++ b/gdk/quartz/gdkscreen-quartz.c
@@ -79,7 +79,7 @@ gdk_quartz_screen_init (GdkQuartzScreen *quartz_screen)
NSDictionary *dd = [[[NSScreen screens] objectAtIndex:0] deviceDescription];
NSSize size = [[dd valueForKey:NSDeviceResolution] sizeValue];
- _gdk_screen_set_resolution (screen, size.width);
+ _gdk_screen_set_resolution (screen, 72.0);
gdk_quartz_screen_calculate_layout (quartz_screen);
@@ -334,11 +334,8 @@ gdk_quartz_screen_get_height (GdkScreen *screen)
static gint
get_mm_from_pixels (NSScreen *screen, int pixels)
{
- const float mm_per_inch = 25.4;
- NSDictionary *dd = [[[NSScreen screens] objectAtIndex:0] deviceDescription];
- NSSize size = [[dd valueForKey:NSDeviceResolution] sizeValue];
- float dpi = size.width;
- return (pixels / dpi) * mm_per_inch;
+ const float dpi = 72.0;
+ return (pixels / dpi) * 25.4;
}
static gchar *
gtk+3: update 3.22.15 bottle.
class Gtkx3 < Formula
desc "Toolkit for creating graphical user interfaces"
homepage "https://gtk.org/"
url "https://download.gnome.org/sources/gtk+/3.22/gtk+-3.22.15.tar.xz"
sha256 "c8a012c2a99132629ab043f764a2b7cb6388483a015cd15c7a4288bec3590fdb"
bottle do
sha256 "5ebc52a5731f83fdf0137a3acb8508a67453deabd47fd7b293600dbf3e40ad18" => :sierra
sha256 "dd4ef2c3f8d495389daaf257cb19b85f4d7c82c126d9ee8c6a74ad84b5120869" => :el_capitan
sha256 "1be3c9d2ff82bdfd97f27a4a90f3eb8080b9da7719bbcb0dc6baa06fb5d9bf53" => :yosemite
end
# see https://bugzilla.gnome.org/show_bug.cgi?id=781118
patch :DATA
option "with-quartz-relocation", "Build with quartz relocation support"
depends_on "pkg-config" => :build
depends_on "gdk-pixbuf"
depends_on "atk"
depends_on "gobject-introspection"
depends_on "libepoxy"
depends_on "pango"
depends_on "glib"
depends_on "hicolor-icon-theme"
depends_on "gsettings-desktop-schemas" => :recommended
depends_on "jasper" => :optional
def install
args = %W[
--enable-debug=minimal
--disable-dependency-tracking
--prefix=#{prefix}
--disable-glibtest
--enable-introspection=yes
--disable-schemas-compile
--enable-quartz-backend
--disable-x11-backend
]
args << "--enable-quartz-relocation" if build.with?("quartz-relocation")
system "./configure", *args
# necessary to avoid gtk-update-icon-cache not being found during make install
bin.mkpath
ENV.prepend_path "PATH", bin
system "make", "install"
# Prevent a conflict between this and Gtk+2
mv bin/"gtk-update-icon-cache", bin/"gtk3-update-icon-cache"
end
def post_install
system "#{Formula["glib"].opt_bin}/glib-compile-schemas", "#{HOMEBREW_PREFIX}/share/glib-2.0/schemas"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <gtk/gtk.h>
int main(int argc, char *argv[]) {
gtk_disable_setlocale();
return 0;
}
EOS
atk = Formula["atk"]
cairo = Formula["cairo"]
fontconfig = Formula["fontconfig"]
freetype = Formula["freetype"]
gdk_pixbuf = Formula["gdk-pixbuf"]
gettext = Formula["gettext"]
glib = Formula["glib"]
libepoxy = Formula["libepoxy"]
libpng = Formula["libpng"]
pango = Formula["pango"]
pixman = Formula["pixman"]
flags = %W[
-I#{atk.opt_include}/atk-1.0
-I#{cairo.opt_include}/cairo
-I#{fontconfig.opt_include}
-I#{freetype.opt_include}/freetype2
-I#{gdk_pixbuf.opt_include}/gdk-pixbuf-2.0
-I#{gettext.opt_include}
-I#{glib.opt_include}/gio-unix-2.0/
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{include}
-I#{include}/gtk-3.0
-I#{libepoxy.opt_include}
-I#{libpng.opt_include}/libpng16
-I#{pango.opt_include}/pango-1.0
-I#{pixman.opt_include}/pixman-1
-D_REENTRANT
-L#{atk.opt_lib}
-L#{cairo.opt_lib}
-L#{gdk_pixbuf.opt_lib}
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{lib}
-L#{pango.opt_lib}
-latk-1.0
-lcairo
-lcairo-gobject
-lgdk-3
-lgdk_pixbuf-2.0
-lgio-2.0
-lglib-2.0
-lgobject-2.0
-lgtk-3
-lintl
-lpango-1.0
-lpangocairo-1.0
]
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end
__END__
diff --git a/gdk/quartz/gdkscreen-quartz.c b/gdk/quartz/gdkscreen-quartz.c
index 586f7af..d032643 100644
--- a/gdk/quartz/gdkscreen-quartz.c
+++ b/gdk/quartz/gdkscreen-quartz.c
@@ -79,7 +79,7 @@ gdk_quartz_screen_init (GdkQuartzScreen *quartz_screen)
NSDictionary *dd = [[[NSScreen screens] objectAtIndex:0] deviceDescription];
NSSize size = [[dd valueForKey:NSDeviceResolution] sizeValue];
- _gdk_screen_set_resolution (screen, size.width);
+ _gdk_screen_set_resolution (screen, 72.0);
gdk_quartz_screen_calculate_layout (quartz_screen);
@@ -334,11 +334,8 @@ gdk_quartz_screen_get_height (GdkScreen *screen)
static gint
get_mm_from_pixels (NSScreen *screen, int pixels)
{
- const float mm_per_inch = 25.4;
- NSDictionary *dd = [[[NSScreen screens] objectAtIndex:0] deviceDescription];
- NSSize size = [[dd valueForKey:NSDeviceResolution] sizeValue];
- float dpi = size.width;
- return (pixels / dpi) * mm_per_inch;
+ const float dpi = 72.0;
+ return (pixels / dpi) * 25.4;
}
static gchar *
|
hayai 0.1.0 (new formula)
Closes Homebrew/homebrew#41721.
Signed-off-by: Alex Dunn <46952c1342d5ce1a4f5689855eda3c9064bca8f6@gmail.com>
class Hayai < Formula
desc "A C++ benchmarking framework inspired by the googletest framework"
homepage "http://nickbruun.dk/2012/02/07/easy-cpp-benchmarking"
url "https://github.com/nickbruun/hayai/archive/v0.1.0.tar.gz"
sha256 "739d6dc5126a0b3dfe6c944999f48e7ede823bfdbf1f8801f23af25bf355db65"
depends_on "cmake" => :build
def install
system "cmake", ".", *std_cmake_args
system "make", "install"
end
test do
(testpath/"test.cpp").write <<-EOS.undent
#include <hayai/hayai.hpp>
#include <iostream>
int main() {
hayai::Benchmarker::RunAllTests();
return 0;
}
BENCHMARK(HomebrewTest, TestBenchmark, 1, 1)
{
std::cout << "Hayai works!" << std::endl;
}
EOS
system ENV.cxx, "test.cpp", "-lhayai_main", "-o", "test"
system "./test"
end
end
|
require 'formula'
class Hbase < Formula
homepage 'http://hbase.apache.org'
url 'http://www.apache.org/dyn/closer.cgi?path=hbase/hbase-0.98.1/hbase-0.98.1-hadoop2-bin.tar.gz'
sha1 'a1bc4470975dd65f5804a31be6bf8761ca152de7'
depends_on 'hadoop'
def install
rm_f Dir["bin/*.cmd", "conf/*.cmd"]
libexec.install %w[bin conf docs lib hbase-webapps]
bin.write_exec_script Dir["#{libexec}/bin/*"]
inreplace "#{libexec}/conf/hbase-env.sh",
"# export JAVA_HOME=/usr/java/jdk1.6.0/",
"export JAVA_HOME=\"$(/usr/libexec/java_home)\""
end
def caveats; <<-EOS.undent
Requires Java 1.6.0 or greater.
You must also edit the configs in:
#{libexec}/conf
to reflect your environment.
For more details:
http://wiki.apache.org/hadoop/Hbase
EOS
end
end
hbase 0.98.3
Closes Homebrew/homebrew#30120.
Signed-off-by: Mike McQuaid <a17fed27eaa842282862ff7c1b9c8395a26ac320@mikemcquaid.com>
require 'formula'
class Hbase < Formula
homepage 'http://hbase.apache.org'
url 'http://www.apache.org/dyn/closer.cgi?path=hbase/hbase-0.98.3/hbase-0.98.3-hadoop2-bin.tar.gz'
sha1 'babbe880afc86783e3e5f659b65b046c1589d0c5'
depends_on 'hadoop'
def install
rm_f Dir["bin/*.cmd", "conf/*.cmd"]
libexec.install %w[bin conf docs lib hbase-webapps]
bin.write_exec_script Dir["#{libexec}/bin/*"]
inreplace "#{libexec}/conf/hbase-env.sh",
"# export JAVA_HOME=/usr/java/jdk1.6.0/",
"export JAVA_HOME=\"$(/usr/libexec/java_home)\""
end
def caveats; <<-EOS.undent
Requires Java 1.6.0 or greater.
You must also edit the configs in:
#{libexec}/conf
to reflect your environment.
For more details:
http://wiki.apache.org/hadoop/Hbase
EOS
end
end
|
require "formula"
class Hello < Formula
homepage "http://www.gnu.org/software/hello/"
url "http://ftpmirror.gnu.org/hello/hello-2.10.tar.gz"
sha1 "f7bebf6f9c62a2295e889f66e05ce9bfaed9ace3"
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
end
test do
system "#{bin}/hello", "--greeting=brew"
end
end
hello: add 2.10 bottle.
require "formula"
class Hello < Formula
homepage "http://www.gnu.org/software/hello/"
url "http://ftpmirror.gnu.org/hello/hello-2.10.tar.gz"
sha1 "f7bebf6f9c62a2295e889f66e05ce9bfaed9ace3"
bottle do
cellar :any
sha1 "91dbdb51264005a4b5be16dc34726c6ddd358e59" => :yosemite
sha1 "ce8368b741ae6c8ceda6eb8b570864cc4e9f4c45" => :mavericks
sha1 "31f4537c7c3d231bf48fa50a14c1d82a958066c4" => :mountain_lion
end
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
end
test do
system "#{bin}/hello", "--greeting=brew"
end
end
|
require "formula"
class Hevea < Formula
homepage "http://hevea.inria.fr/"
url "http://hevea.inria.fr/distri/hevea-2.19.tar.gz"
sha1 "59c0d35819c83b6558490b36f1113cdb4d49e919"
bottle do
revision 1
sha1 "c621f678b16b718d8bbc24470ca207d0fe4c0308" => :mavericks
sha1 "44b2489966166404d8fd2db1037481a56fa183e3" => :mountain_lion
sha1 "3e788ceb7a493edfd1c0fc2911e58fe39a55d6de" => :lion
end
depends_on "objective-caml"
depends_on "ghostscript" => :optional
def install
ENV["PREFIX"] = prefix
system "make"
system "make", "install"
end
test do
(testpath/"test.tex").write <<-EOS.undent
\\documentclass{article}
\\begin{document}
\\end{document}
EOS
system "#{bin}/hevea", "test.tex"
end
end
hevea: update 2.19 bottle.
require "formula"
class Hevea < Formula
homepage "http://hevea.inria.fr/"
url "http://hevea.inria.fr/distri/hevea-2.19.tar.gz"
sha1 "59c0d35819c83b6558490b36f1113cdb4d49e919"
bottle do
sha1 "85895fc6d991f57fe1a0e9ecbc083d335c7cf704" => :yosemite
sha1 "d45bb32ad08211b304ae6c87f49727505ad81d33" => :mavericks
sha1 "85d66fad38057feaa11c615dfdd7be4c921baca5" => :mountain_lion
end
depends_on "objective-caml"
depends_on "ghostscript" => :optional
def install
ENV["PREFIX"] = prefix
system "make"
system "make", "install"
end
test do
(testpath/"test.tex").write <<-EOS.undent
\\documentclass{article}
\\begin{document}
\\end{document}
EOS
system "#{bin}/hevea", "test.tex"
end
end
|
require "language/haskell"
class Hlint < Formula
include Language::Haskell::Cabal
desc "Haskell source code suggestions"
homepage "https://github.com/ndmitchell/hlint"
url "https://hackage.haskell.org/package/hlint-2.1.7/hlint-2.1.7.tar.gz"
sha256 "ee1b315e381084b05db4ddf83b0aee07d45968684e6c328a19e53032eb1ec9cc"
head "https://github.com/ndmitchell/hlint.git"
bottle do
sha256 "3b9d9cfe5f3a03697b7c897f275060804f34cbc929828d723b4ebe4f31410b0e" => :high_sierra
sha256 "cb1b08f86498c00c0ffc28b86629f872e72b4d2979f47e1afd191ec28bd93d98" => :sierra
sha256 "be9108264fe69cc7e2497a4b059bc2f417b681cf5ad4cb92858400a7fd92eaa6" => :el_capitan
end
depends_on "cabal-install" => :build
depends_on "ghc" => :build
def install
install_cabal_package :using => "happy"
man1.install "data/hlint.1"
end
test do
(testpath/"test.hs").write <<~EOS
main = do putStrLn "Hello World"
EOS
assert_match "Redundant do", shell_output("#{bin}/hlint test.hs", 1)
end
end
hlint: update 2.1.7 bottle for Linuxbrew.
require "language/haskell"
class Hlint < Formula
include Language::Haskell::Cabal
desc "Haskell source code suggestions"
homepage "https://github.com/ndmitchell/hlint"
url "https://hackage.haskell.org/package/hlint-2.1.7/hlint-2.1.7.tar.gz"
sha256 "ee1b315e381084b05db4ddf83b0aee07d45968684e6c328a19e53032eb1ec9cc"
head "https://github.com/ndmitchell/hlint.git"
bottle do
sha256 "3b9d9cfe5f3a03697b7c897f275060804f34cbc929828d723b4ebe4f31410b0e" => :high_sierra
sha256 "cb1b08f86498c00c0ffc28b86629f872e72b4d2979f47e1afd191ec28bd93d98" => :sierra
sha256 "be9108264fe69cc7e2497a4b059bc2f417b681cf5ad4cb92858400a7fd92eaa6" => :el_capitan
sha256 "34e203f791e492a4f54d31ea9ef478067d0d8ec87b5d50729f80c799a30cc8b3" => :x86_64_linux
end
depends_on "cabal-install" => :build
depends_on "ghc" => :build
def install
install_cabal_package :using => "happy"
man1.install "data/hlint.1"
end
test do
(testpath/"test.hs").write <<~EOS
main = do putStrLn "Hello World"
EOS
assert_match "Redundant do", shell_output("#{bin}/hlint test.hs", 1)
end
end
|
require "language/haskell"
class Hlint < Formula
include Language::Haskell::Cabal
desc "Haskell source code suggestions"
homepage "https://github.com/ndmitchell/hlint"
url "https://hackage.haskell.org/package/hlint-2.1.17/hlint-2.1.17.tar.gz"
sha256 "431a6de94f4636253ffc1def7a588fec0d30c5c7cf468f204ec178e9c6b2312f"
head "https://github.com/ndmitchell/hlint.git"
bottle do
sha256 "caf49a8b1ef732affcd024be46b1759232c85bdd552a1740e751b0aa28b4f21f" => :mojave
sha256 "ce751a897045abeb8bf35dbb90ca0f3133a681c62e17ba81ba72ef53fa0ee7d9" => :high_sierra
sha256 "5aa6962f99a01d1578fd2d20f9709653c7db2bfa31835e819cd3c3388751300a" => :sierra
end
depends_on "cabal-install" => :build
depends_on "ghc" => :build
def install
install_cabal_package :using => "happy"
man1.install "data/hlint.1"
end
test do
(testpath/"test.hs").write <<~EOS
main = do putStrLn "Hello World"
EOS
assert_match "Redundant do", shell_output("#{bin}/hlint test.hs", 1)
end
end
hlint 2.1.21
Closes #40070.
Signed-off-by: Izaak Beekman <63a262980226ea55b5aaaf5a7502ec30d6edcc7a@gmail.com>
require "language/haskell"
class Hlint < Formula
include Language::Haskell::Cabal
desc "Haskell source code suggestions"
homepage "https://github.com/ndmitchell/hlint"
url "https://hackage.haskell.org/package/hlint-2.1.21/hlint-2.1.21.tar.gz"
sha256 "447209a1781a65ec2a4502e04f7a3eb1979fc4100b32d7124986c7326fb688c6"
head "https://github.com/ndmitchell/hlint.git"
bottle do
sha256 "caf49a8b1ef732affcd024be46b1759232c85bdd552a1740e751b0aa28b4f21f" => :mojave
sha256 "ce751a897045abeb8bf35dbb90ca0f3133a681c62e17ba81ba72ef53fa0ee7d9" => :high_sierra
sha256 "5aa6962f99a01d1578fd2d20f9709653c7db2bfa31835e819cd3c3388751300a" => :sierra
end
depends_on "cabal-install" => :build
depends_on "ghc" => :build
def install
install_cabal_package :using => ["alex", "happy"]
man1.install "data/hlint.1"
end
test do
(testpath/"test.hs").write <<~EOS
main = do putStrLn "Hello World"
EOS
assert_match "Redundant do", shell_output("#{bin}/hlint test.hs", 1)
end
end
|
class Hmmer < Formula
desc "Build profile HMMs and scan against sequence databases"
homepage "http://hmmer.org/"
url "http://eddylab.org/software/hmmer3/3.1b2/hmmer-3.1b2.tar.gz"
sha256 "dd16edf4385c1df072c9e2f58c16ee1872d855a018a2ee6894205277017b5536"
revision 2
bottle do
cellar :any_skip_relocation
sha256 "763753541930d4092f6e50fbde1669d9862d0ba4b096d6c6b144eb325019ca44" => :high_sierra
sha256 "01707b89414c42564e60609e8a70f464a48bffa84278169cd3f467a885dd17a2" => :sierra
sha256 "0f0254bebd48ec9003e6f99e2277e04914073e5dee00e764f5b5fb2ed9a7f1c3" => :el_capitan
end
def install
system "./configure", "--prefix=#{prefix}"
# Fix error: install: hmmalign: No such file or directory
system "make"
system "make", "install"
doc.install "Userguide.pdf", "tutorial"
end
test do
output = shell_output("#{bin}/hmmstat #{doc}/tutorial/minifam")
assert_match "PF00069.17", output
end
end
hmmer: update 3.1b2_2 bottle.
class Hmmer < Formula
desc "Build profile HMMs and scan against sequence databases"
homepage "http://hmmer.org/"
url "http://eddylab.org/software/hmmer3/3.1b2/hmmer-3.1b2.tar.gz"
sha256 "dd16edf4385c1df072c9e2f58c16ee1872d855a018a2ee6894205277017b5536"
revision 2
bottle do
cellar :any_skip_relocation
sha256 "4f1756b17b1902b937df6761fe4f9d2f84af91e96655264854f204759b72bb0e" => :mojave
sha256 "763753541930d4092f6e50fbde1669d9862d0ba4b096d6c6b144eb325019ca44" => :high_sierra
sha256 "01707b89414c42564e60609e8a70f464a48bffa84278169cd3f467a885dd17a2" => :sierra
sha256 "0f0254bebd48ec9003e6f99e2277e04914073e5dee00e764f5b5fb2ed9a7f1c3" => :el_capitan
end
def install
system "./configure", "--prefix=#{prefix}"
# Fix error: install: hmmalign: No such file or directory
system "make"
system "make", "install"
doc.install "Userguide.pdf", "tutorial"
end
test do
output = shell_output("#{bin}/hmmstat #{doc}/tutorial/minifam")
assert_match "PF00069.17", output
end
end
|
class Hpack < Formula
desc "Modern format for Haskell packages"
homepage "https://github.com/sol/hpack"
url "https://github.com/sol/hpack/archive/0.35.0.tar.gz"
sha256 "5f92885b3609b87f499a5e8840c092aa76d8196275ef4abf68fa54e35f80ace1"
license "MIT"
head "https://github.com/sol/hpack.git", branch: "main"
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "5a3a2a22f4ec0040e49ea3c9f0cee6b0aa9088626b145c01db092364f951b87a"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "151c61eb08afd855006104db4ad884225afa63b562ef1b5261986c5ad67b85fd"
sha256 cellar: :any_skip_relocation, monterey: "b2ca3c047995f49715b8a9f5f7b8e18611d33699b9d910fe3f2c39955bf01be7"
sha256 cellar: :any_skip_relocation, big_sur: "9d3a127911fe1c275e37351611d5d8b35bf6009b6006c9df9a163072ee8d1c3c"
sha256 cellar: :any_skip_relocation, catalina: "35be3997828e2752693e8f02b80bfd918f3e9d3707364e8aa0f5db552504a104"
sha256 cellar: :any_skip_relocation, x86_64_linux: "758f4e3ebcfc75ff2d7a74c9c8a52d55664583e1286f15299cd8777f460be012"
end
depends_on "cabal-install" => :build
depends_on "ghc" => :build
uses_from_macos "zlib"
def install
system "cabal", "v2-update"
system "cabal", "v2-install", *std_cabal_v2_args
end
# Testing hpack is complicated by the fact that it is not guaranteed
# to produce the exact same output for every version. Hopefully
# keeping this test maintained will not require too much churn, but
# be aware that failures here can probably be fixed by tweaking the
# expected output a bit.
test do
(testpath/"package.yaml").write <<~EOS
name: homebrew
dependencies: base
library:
exposed-modules: Homebrew
EOS
expected = <<~EOS
name: homebrew
version: 0.0.0
build-type: Simple
library
exposed-modules:
Homebrew
other-modules:
Paths_homebrew
build-depends:
base
default-language: Haskell2010
EOS
system "#{bin}/hpack"
# Skip the first lines because they contain the hpack version number.
assert_equal expected, (testpath/"homebrew.cabal").read.lines[6..].join
end
end
hpack: update 0.35.0 bottle.
class Hpack < Formula
desc "Modern format for Haskell packages"
homepage "https://github.com/sol/hpack"
url "https://github.com/sol/hpack/archive/0.35.0.tar.gz"
sha256 "5f92885b3609b87f499a5e8840c092aa76d8196275ef4abf68fa54e35f80ace1"
license "MIT"
head "https://github.com/sol/hpack.git", branch: "main"
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "5a3a2a22f4ec0040e49ea3c9f0cee6b0aa9088626b145c01db092364f951b87a"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "151c61eb08afd855006104db4ad884225afa63b562ef1b5261986c5ad67b85fd"
sha256 cellar: :any_skip_relocation, ventura: "5c1891ae0a2c5fbbb3a41007cf1b4d08915af6470bf812178fe9f448daf47001"
sha256 cellar: :any_skip_relocation, monterey: "b2ca3c047995f49715b8a9f5f7b8e18611d33699b9d910fe3f2c39955bf01be7"
sha256 cellar: :any_skip_relocation, big_sur: "9d3a127911fe1c275e37351611d5d8b35bf6009b6006c9df9a163072ee8d1c3c"
sha256 cellar: :any_skip_relocation, catalina: "35be3997828e2752693e8f02b80bfd918f3e9d3707364e8aa0f5db552504a104"
sha256 cellar: :any_skip_relocation, x86_64_linux: "758f4e3ebcfc75ff2d7a74c9c8a52d55664583e1286f15299cd8777f460be012"
end
depends_on "cabal-install" => :build
depends_on "ghc" => :build
uses_from_macos "zlib"
def install
system "cabal", "v2-update"
system "cabal", "v2-install", *std_cabal_v2_args
end
# Testing hpack is complicated by the fact that it is not guaranteed
# to produce the exact same output for every version. Hopefully
# keeping this test maintained will not require too much churn, but
# be aware that failures here can probably be fixed by tweaking the
# expected output a bit.
test do
(testpath/"package.yaml").write <<~EOS
name: homebrew
dependencies: base
library:
exposed-modules: Homebrew
EOS
expected = <<~EOS
name: homebrew
version: 0.0.0
build-type: Simple
library
exposed-modules:
Homebrew
other-modules:
Paths_homebrew
build-depends:
base
default-language: Haskell2010
EOS
system "#{bin}/hpack"
# Skip the first lines because they contain the hpack version number.
assert_equal expected, (testpath/"homebrew.cabal").read.lines[6..].join
end
end
|
hpack 0.33.0 (new formula)
Closes #48055.
Signed-off-by: Rui Chen <5fd29470147430022ff146db88de16ee91dea376@gmail.com>
require "language/haskell"
class Hpack < Formula
include Language::Haskell::Cabal
desc "Modern format for Haskell packages"
homepage "https://github.com/sol/hpack"
url "https://github.com/sol/hpack/archive/0.33.0.tar.gz"
sha256 "954b02fd01ee3e1bc5fddff7ec625839ee4b64bef51efa02306fbcf33008081e"
head "https://github.com/sol/hpack.git"
depends_on "cabal-install" => :build
depends_on "ghc" => :build
def install
install_cabal_package
end
# Testing hpack is complicated by the fact that it is not guaranteed
# to produce the exact same output for every version. Hopefully
# keeping this test maintained will not require too much churn, but
# be aware that failures here can probably be fixed by tweaking the
# expected output a bit.
test do
(testpath/"package.yaml").write <<~EOS
name: homebrew
dependencies: base
library:
exposed-modules: Homebrew
EOS
expected = <<~EOS
name: homebrew
version: 0.0.0
build-type: Simple
library
exposed-modules:
Homebrew
other-modules:
Paths_homebrew
build-depends:
base
default-language: Haskell2010
EOS
system "#{bin}/hpack"
# Skip the first lines because they contain the hpack version number.
assert_equal expected, (testpath/"homebrew.cabal").read.lines[8..-1].join
end
end
|
class Hwloc < Formula
desc "Portable abstraction of the hierarchical topology of modern architectures"
homepage "https://www.open-mpi.org/projects/hwloc/"
url "https://www.open-mpi.org/software/hwloc/v1.11/downloads/hwloc-1.11.8.tar.bz2"
sha256 "ecef10265084d9123dc0b03d82ff5ee06fbf5ba755a912e7511ae590c9ee594d"
bottle do
cellar :any
sha256 "e640a44067de9f1d7f7b4b6095dc557f0e49257147f600ae23a81fed9eb52e7c" => :sierra
sha256 "4a4105e5afc225caddb404a96b0e1412d4f54f2bf8327c67c7f9b58361ae31cc" => :el_capitan
sha256 "6bb7c10ee374d13567853009bf376a97230b880aedde7e9bfce6a61441742c76" => :yosemite
end
head do
url "https://github.com/open-mpi/hwloc.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "pkg-config" => :build
depends_on "cairo" => :optional
def install
system "./autogen.sh" if build.head?
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--enable-shared",
"--enable-static",
"--prefix=#{prefix}",
"--without-x"
system "make", "install"
pkgshare.install "tests"
end
test do
system ENV.cc, pkgshare/"tests/hwloc_groups.c", "-I#{include}",
"-L#{lib}", "-lhwloc", "-o", "test"
system "./test"
end
end
hwloc: update 1.11.8 bottle for Linuxbrew.
class Hwloc < Formula
desc "Portable abstraction of the hierarchical topology of modern architectures"
homepage "https://www.open-mpi.org/projects/hwloc/"
url "https://www.open-mpi.org/software/hwloc/v1.11/downloads/hwloc-1.11.8.tar.bz2"
sha256 "ecef10265084d9123dc0b03d82ff5ee06fbf5ba755a912e7511ae590c9ee594d"
bottle do
cellar :any
sha256 "e640a44067de9f1d7f7b4b6095dc557f0e49257147f600ae23a81fed9eb52e7c" => :sierra
sha256 "4a4105e5afc225caddb404a96b0e1412d4f54f2bf8327c67c7f9b58361ae31cc" => :el_capitan
sha256 "6bb7c10ee374d13567853009bf376a97230b880aedde7e9bfce6a61441742c76" => :yosemite
sha256 "969cd17f6a3ee22acc150a05219ada4187a6b72c0689894b4722e071c59fe909" => :x86_64_linux
end
head do
url "https://github.com/open-mpi/hwloc.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "pkg-config" => :build
depends_on "cairo" => :optional
def install
system "./autogen.sh" if build.head?
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--enable-shared",
"--enable-static",
"--prefix=#{prefix}",
"--without-x"
system "make", "install"
pkgshare.install "tests"
end
test do
system ENV.cc, pkgshare/"tests/hwloc_groups.c", "-I#{include}",
"-L#{lib}", "-lhwloc", "-o", "test"
system "./test"
end
end
|
class Hyper < Formula
desc "Client for the Hyper_ cloud service"
homepage "https://hyper.sh"
url "https://github.com/hyperhq/hypercli.git",
:tag => "v1.10.2",
:revision => "302a6b530148f6a777cd6b8772f706ab5e3da46b"
head "https://github.com/hyperhq/hypercli.git"
bottle do
cellar :any_skip_relocation
sha256 "e0650959c86934476fa4749a852e5e17fb4d5b3299e7ed5f666b45551dcd9367" => :sierra
sha256 "376bc7d36f99af675639c7805702c8b39104de5016f93298e1af4066de21eea1" => :el_capitan
sha256 "853b5eb62fcab76298f6ae71b04e222f8e9807f95466920f3a1453ae62163c5c" => :yosemite
end
depends_on "go" => :build
def install
ENV["GOPATH"] = buildpath
mkdir_p "src/github.com/hyperhq"
ln_s buildpath, "src/github.com/hyperhq/hypercli"
system "./build.sh"
bin.install "hyper/hyper"
end
test do
system "#{bin}/hyper", "--help"
end
end
hyper 1.10.5
Closes #7496.
Signed-off-by: William Woodruff <c824fe0afe16857dd6f587aa7c4044d2642d60fb@tuffbizz.com>
class Hyper < Formula
desc "Client for the Hyper_ cloud service"
homepage "https://hyper.sh"
url "https://github.com/hyperhq/hypercli.git",
:tag => "v1.10.5",
:revision => "6b9a905077cbf561fadb87c2d470ad0cfcb49345"
head "https://github.com/hyperhq/hypercli.git"
bottle do
cellar :any_skip_relocation
sha256 "e0650959c86934476fa4749a852e5e17fb4d5b3299e7ed5f666b45551dcd9367" => :sierra
sha256 "376bc7d36f99af675639c7805702c8b39104de5016f93298e1af4066de21eea1" => :el_capitan
sha256 "853b5eb62fcab76298f6ae71b04e222f8e9807f95466920f3a1453ae62163c5c" => :yosemite
end
depends_on "go" => :build
def install
ENV["GOPATH"] = buildpath
mkdir_p "src/github.com/hyperhq"
ln_s buildpath, "src/github.com/hyperhq/hypercli"
system "./build.sh"
bin.install "hyper/hyper"
end
test do
system "#{bin}/hyper", "--help"
end
end
|
class Hyper < Formula
desc "Client for HyperHQ's cloud service"
homepage "https://hyper.sh"
url "https://github.com/hyperhq/hypercli.git",
:tag => "v1.10.13",
:revision => "5c432742f0f5ba2eda9186576f11e2a93e8ea91e"
head "https://github.com/hyperhq/hypercli.git"
bottle do
cellar :any_skip_relocation
sha256 "1ae87901488d4863857ea90f23548f8740b5d17f0473446e34379ae2c80ea312" => :sierra
sha256 "55ed18d787fd0971c037454fa1529e72b666fac9fb570a8d290448e462008778" => :el_capitan
sha256 "a0c8b853e922595c738cfa0c341f4f6decd9784f4b526769a5dddbf22cefaefd" => :yosemite
end
depends_on "go" => :build
def install
ENV["GOPATH"] = buildpath
mkdir_p "src/github.com/hyperhq"
ln_s buildpath, "src/github.com/hyperhq/hypercli"
system "./build.sh"
bin.install "hyper/hyper"
end
test do
system "#{bin}/hyper", "--help"
end
end
hyper: update 1.10.13 bottle.
class Hyper < Formula
desc "Client for HyperHQ's cloud service"
homepage "https://hyper.sh"
url "https://github.com/hyperhq/hypercli.git",
:tag => "v1.10.13",
:revision => "5c432742f0f5ba2eda9186576f11e2a93e8ea91e"
head "https://github.com/hyperhq/hypercli.git"
bottle do
cellar :any_skip_relocation
sha256 "2f1c422ba1380489ad7dbfe89fead091f2cf74bbc98089dac8cdf2b99fec9c40" => :sierra
sha256 "d0ae31119f783928c51e7dc6a39543c30dbb7a4b76462bf2546f2d45dc4c2d79" => :el_capitan
sha256 "2d80f8e5afbc5d66dad0b4aa650c48e944eac6ab8020763ec03b058c0bf0ab9e" => :yosemite
end
depends_on "go" => :build
def install
ENV["GOPATH"] = buildpath
mkdir_p "src/github.com/hyperhq"
ln_s buildpath, "src/github.com/hyperhq/hypercli"
system "./build.sh"
bin.install "hyper/hyper"
end
test do
system "#{bin}/hyper", "--help"
end
end
|
class Infer < Formula
desc "Static analyzer for Java, C and Objective-C"
homepage "http://fbinfer.com/"
url "https://github.com/facebook/infer/releases/download/v0.9.2/infer-osx-v0.9.2.tar.xz"
sha256 "3935f8be25982a023aba306b66804d73a7316ab833296277c1ec6c3694bfc7c7"
bottle do
cellar :any
sha256 "2b1dd1bdebf2550f01ad9c6d5e6ee463f24b740e28ece126787f2f08b2276818" => :el_capitan
sha256 "d65405a47ead42e33e751f33ba4766e90005ea0b59f7aeadf860828bfcf4a3ff" => :yosemite
sha256 "7ce4996fd1da93d8f325c3abb2bc6804fd5af12d09953f67f643fca5c6dc889e" => :mavericks
end
option "without-clang", "Build without C/Objective-C analyzer"
option "without-java", "Build without Java analyzer"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "opam" => :build
def install
if build.without?("clang") && build.without?("java")
odie "infer: --without-clang and --without-java are mutually exclusive"
end
opamroot = buildpath/"build"
opamroot.mkpath
ENV["OPAMROOT"] = opamroot
ENV["OPAMYES"] = "1"
# Some of the libraries installed by ./build-infer.sh do not
# support parallel builds, eg OCaml itself. ./build-infer.sh
# builds in its own parallelization logic to mitigate that.
ENV.deparallelize
ENV["INFER_CONFIGURE_OPTS"] = "--prefix=#{prefix} --disable-ocaml-annot --disable-ocaml-binannot"
target_platform = if build.without?("clang")
"java"
elsif build.without?("java")
"clang"
else
"all"
end
system "./build-infer.sh", target_platform, "--yes"
system "opam", "config", "exec", "--switch=infer-4.02.3", "--", "make", "install"
end
test do
(testpath/"FailingTest.c").write <<-EOS.undent
#include <stdio.h>
int main() {
int *s = NULL;
*s = 42;
return 0;
}
EOS
(testpath/"PassingTest.c").write <<-EOS.undent
#include <stdio.h>
int main() {
int *s = NULL;
if (s != NULL) {
*s = 42;
}
return 0;
}
EOS
shell_output("#{bin}/infer --fail-on-bug -- clang FailingTest.c", 2)
shell_output("#{bin}/infer --fail-on-bug -- clang PassingTest.c", 0)
(testpath/"FailingTest.java").write <<-EOS.undent
class FailingTest {
String mayReturnNull(int i) {
if (i > 0) {
return "Hello, Infer!";
}
return null;
}
int mayCauseNPE() {
String s = mayReturnNull(0);
return s.length();
}
}
EOS
(testpath/"PassingTest.java").write <<-EOS.undent
class PassingTest {
String mayReturnNull(int i) {
if (i > 0) {
return "Hello, Infer!";
}
return null;
}
int mayCauseNPE() {
String s = mayReturnNull(0);
return s == null ? 0 : s.length();
}
}
EOS
shell_output("#{bin}/infer --fail-on-bug -- javac FailingTest.java", 2)
shell_output("#{bin}/infer --fail-on-bug -- javac PassingTest.java", 0)
end
end
infer 0.9.4
Add `-no-graphics` to OPAM's configure options for OCaml to avoid build
failure when XQuartz is installed.
Closes #7057.
Signed-off-by: ilovezfs <fbd54dbbcf9e596abad4ccdc4dfc17f80ebeaee2@icloud.com>
class Infer < Formula
desc "Static analyzer for Java, C and Objective-C"
homepage "http://fbinfer.com/"
url "https://github.com/facebook/infer/releases/download/v0.9.4/infer-osx-v0.9.4.tar.xz"
sha256 "529d147bccf3285ddb7500c22e0c50d6e0cbdb2c7f9b11a84e8005873994b3e2"
bottle do
cellar :any
sha256 "2b1dd1bdebf2550f01ad9c6d5e6ee463f24b740e28ece126787f2f08b2276818" => :el_capitan
sha256 "d65405a47ead42e33e751f33ba4766e90005ea0b59f7aeadf860828bfcf4a3ff" => :yosemite
sha256 "7ce4996fd1da93d8f325c3abb2bc6804fd5af12d09953f67f643fca5c6dc889e" => :mavericks
end
option "without-clang", "Build without C/Objective-C analyzer"
option "without-java", "Build without Java analyzer"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "ocaml" => :build
depends_on "opam" => :build
def install
if build.without?("clang") && build.without?("java")
odie "infer: --without-clang and --without-java are mutually exclusive"
end
opamroot = buildpath/"opamroot"
opamroot.mkpath
ENV["OPAMROOT"] = opamroot
ENV["OPAMYES"] = "1"
# Some of the libraries installed by ./build-infer.sh do not
# support parallel builds, eg OCaml itself. ./build-infer.sh
# builds in its own parallelization logic to mitigate that.
ENV.deparallelize
ENV["INFER_CONFIGURE_OPTS"] = "--prefix=#{prefix} --disable-ocaml-annot --disable-ocaml-binannot"
target_platform = if build.without?("clang")
"java"
elsif build.without?("java")
"clang"
else
"all"
end
system "opam", "init", "--no-setup"
ocaml_version = File.read("build-infer.sh").match(/OCAML_VERSION=\"([0-9\.]+)\"/)[1]
inreplace "#{opamroot}/compilers/#{ocaml_version}/#{ocaml_version}/#{ocaml_version}.comp",
'["./configure"', '["./configure" "-no-graph"'
system "./build-infer.sh", target_platform, "--yes"
system "opam", "config", "exec", "--switch=infer-#{ocaml_version}", "--", "make", "install"
end
test do
(testpath/"FailingTest.c").write <<-EOS.undent
#include <stdio.h>
int main() {
int *s = NULL;
*s = 42;
return 0;
}
EOS
(testpath/"PassingTest.c").write <<-EOS.undent
#include <stdio.h>
int main() {
int *s = NULL;
if (s != NULL) {
*s = 42;
}
return 0;
}
EOS
shell_output("#{bin}/infer --fail-on-bug -- clang FailingTest.c", 2)
shell_output("#{bin}/infer --fail-on-bug -- clang PassingTest.c", 0)
(testpath/"FailingTest.java").write <<-EOS.undent
class FailingTest {
String mayReturnNull(int i) {
if (i > 0) {
return "Hello, Infer!";
}
return null;
}
int mayCauseNPE() {
String s = mayReturnNull(0);
return s.length();
}
}
EOS
(testpath/"PassingTest.java").write <<-EOS.undent
class PassingTest {
String mayReturnNull(int i) {
if (i > 0) {
return "Hello, Infer!";
}
return null;
}
int mayCauseNPE() {
String s = mayReturnNull(0);
return s == null ? 0 : s.length();
}
}
EOS
shell_output("#{bin}/infer --fail-on-bug -- javac FailingTest.java", 2)
shell_output("#{bin}/infer --fail-on-bug -- javac PassingTest.java", 0)
end
end
|
class Janet < Formula
desc "Dynamic language and bytecode vm"
homepage "https://janet-lang.org"
url "https://github.com/janet-lang/janet/archive/v1.16.1.tar.gz"
sha256 "ed9350ad7f0270e67f18a78dae4910b9534f19cd3f20f7183b757171e8cc79a5"
license "MIT"
head "https://github.com/janet-lang/janet.git"
bottle do
sha256 cellar: :any, arm64_big_sur: "c08b5f94e48fc9c7a3e534baf4c6475fd2d9403389a11c9d48d34a1cb8c99f5e"
sha256 cellar: :any, big_sur: "b4be0006c3cdac451667cd7105110b8daf9b528cffa4788661325b135caf4519"
sha256 cellar: :any, catalina: "3d47867722d9e8170126394c64b1682c0aadd1e0065736b701a24062f82f9a45"
sha256 cellar: :any, mojave: "c9b10f1796a14db553463faea625c9c16879ab8f1afa06bbf67f88924d01421a"
end
depends_on "meson" => :build
depends_on "ninja" => :build
def install
system "meson", "setup", "build", *std_meson_args
cd "build" do
system "ninja"
system "ninja", "install"
end
end
test do
assert_equal "12", shell_output("#{bin}/janet -e '(print (+ 5 7))'").strip
end
end
janet: update 1.16.1 bottle.
class Janet < Formula
desc "Dynamic language and bytecode vm"
homepage "https://janet-lang.org"
url "https://github.com/janet-lang/janet/archive/v1.16.1.tar.gz"
sha256 "ed9350ad7f0270e67f18a78dae4910b9534f19cd3f20f7183b757171e8cc79a5"
license "MIT"
head "https://github.com/janet-lang/janet.git"
bottle do
sha256 cellar: :any, arm64_big_sur: "c08b5f94e48fc9c7a3e534baf4c6475fd2d9403389a11c9d48d34a1cb8c99f5e"
sha256 cellar: :any, big_sur: "b4be0006c3cdac451667cd7105110b8daf9b528cffa4788661325b135caf4519"
sha256 cellar: :any, catalina: "3d47867722d9e8170126394c64b1682c0aadd1e0065736b701a24062f82f9a45"
sha256 cellar: :any, mojave: "c9b10f1796a14db553463faea625c9c16879ab8f1afa06bbf67f88924d01421a"
sha256 cellar: :any_skip_relocation, x86_64_linux: "61574740115f4a8d33eaefbb4e40c19d9431da5c310217d79c7d3761e25f33d9"
end
depends_on "meson" => :build
depends_on "ninja" => :build
def install
system "meson", "setup", "build", *std_meson_args
cd "build" do
system "ninja"
system "ninja", "install"
end
end
test do
assert_equal "12", shell_output("#{bin}/janet -e '(print (+ 5 7))'").strip
end
end
|
class Janet < Formula
desc "Dynamic language and bytecode vm"
homepage "https://janet-lang.org"
url "https://github.com/janet-lang/janet/archive/v1.17.0.tar.gz"
sha256 "45126be7274e0a298dcbe356b5310bd9328c94eb3a562316813fa9774ca34bcc"
license "MIT"
head "https://github.com/janet-lang/janet.git"
bottle do
sha256 cellar: :any, arm64_big_sur: "c08b5f94e48fc9c7a3e534baf4c6475fd2d9403389a11c9d48d34a1cb8c99f5e"
sha256 cellar: :any, big_sur: "b4be0006c3cdac451667cd7105110b8daf9b528cffa4788661325b135caf4519"
sha256 cellar: :any, catalina: "3d47867722d9e8170126394c64b1682c0aadd1e0065736b701a24062f82f9a45"
sha256 cellar: :any, mojave: "c9b10f1796a14db553463faea625c9c16879ab8f1afa06bbf67f88924d01421a"
sha256 cellar: :any_skip_relocation, x86_64_linux: "61574740115f4a8d33eaefbb4e40c19d9431da5c310217d79c7d3761e25f33d9"
end
depends_on "meson" => :build
depends_on "ninja" => :build
def install
system "meson", "setup", "build", *std_meson_args
cd "build" do
system "ninja"
system "ninja", "install"
end
end
test do
assert_equal "12", shell_output("#{bin}/janet -e '(print (+ 5 7))'").strip
end
end
janet: update 1.17.0 bottle.
class Janet < Formula
desc "Dynamic language and bytecode vm"
homepage "https://janet-lang.org"
url "https://github.com/janet-lang/janet/archive/v1.17.0.tar.gz"
sha256 "45126be7274e0a298dcbe356b5310bd9328c94eb3a562316813fa9774ca34bcc"
license "MIT"
head "https://github.com/janet-lang/janet.git"
bottle do
sha256 cellar: :any, arm64_big_sur: "501fbbf875eae97a5a58232b243cd18cbe5404c7bd2a04baf2d2f3e2f3e58ec2"
sha256 cellar: :any, big_sur: "37aae6c88efe0f3997ce26862e2bfbe703afb3d2aaa73f79cc927b49887671ee"
sha256 cellar: :any, catalina: "384b5d1efb1a6dfcd3f9a4d736ca5566a26f5b76baa42222b6113fcab988fdf5"
sha256 cellar: :any, mojave: "241ea940f9348e212f9c6a0325c44c186d86d9eec9df5ba4d69ad020bd08c4ec"
sha256 cellar: :any_skip_relocation, x86_64_linux: "3da4662b407a18ed000df67eef2cbac9c6e5c46f038de74c36ab3bc17262248f"
end
depends_on "meson" => :build
depends_on "ninja" => :build
def install
system "meson", "setup", "build", *std_meson_args
cd "build" do
system "ninja"
system "ninja", "install"
end
end
test do
assert_equal "12", shell_output("#{bin}/janet -e '(print (+ 5 7))'").strip
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.