source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20160616180001_add_collaborator_failure_and_feedback_to_cookbook_version.rb | Ruby | apache-2.0 | 214 | main | 243 | class AddCollaboratorFailureAndFeedbackToCookbookVersion < ActiveRecord::Migration[4.2]
def change
add_column :cookbook_versions, :collaborator_failure, :boolean
add_column :cookbook_versions, :collaborator_feedback, :text
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20160914223316_remove_foodcritic_failure_and_foodcritic_feedback_and_collaborator_failure_and_collaborator_feedback_from_cookbook_version.rb | Ruby | apache-2.0 | 214 | main | 441 | class RemoveFoodcriticFailureAndFoodcriticFeedbackAndCollaboratorFailureAndCollaboratorFeedbackFromCookbookVersion < ActiveRecord::Migration[4.2]
def change
remove_column :cookbook_versions, :foodcritic_failure, :boolean
remove_column :cookbook_versions, :foodcritic_feedback, :text
remove_column :cookbook... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140609130418_track_supported_platform_legacy_id_on_join.rb | Ruby | apache-2.0 | 214 | main | 363 | class TrackSupportedPlatformLegacyIdOnJoin < ActiveRecord::Migration[4.2]
def change
remove_index :supported_platforms, column: :legacy_id, unique: true
remove_column :supported_platforms, :legacy_id, :integer
add_column :cookbook_version_platforms, :legacy_id, :integer
add_index :cookbook_version_pla... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140401211226_create_cookbook_dependencies.rb | Ruby | apache-2.0 | 214 | main | 327 | class CreateCookbookDependencies < ActiveRecord::Migration[4.2]
def change
create_table :cookbook_dependencies do |t|
t.string :name, null: false
t.string :version_constraint, null: false, default: '>= 0.0.0'
t.references :cookbook_version, index: true, null: false
t.timestamps
end
e... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20131021233350_create_emails.rb | Ruby | apache-2.0 | 214 | main | 310 | class CreateEmails < ActiveRecord::Migration[4.2]
def change
create_table :emails do |t|
t.references :user, index: true
t.string :email, index: true, unique: true
# Emails must be confirmed
t.string :confirmation_token
t.datetime :confirmed_at
end
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140508191053_remove_unused_cookbook_versions_columns.rb | Ruby | apache-2.0 | 214 | main | 243 | class RemoveUnusedCookbookVersionsColumns < ActiveRecord::Migration[4.2]
def change
remove_column :cookbook_versions, :file_size
remove_column :cookbook_versions, :file_url
remove_column :cookbook_versions, :maintainer
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140310195012_cookbook_names_are_unique.rb | Ruby | apache-2.0 | 214 | main | 306 | class CookbookNamesAreUnique < ActiveRecord::Migration[4.2]
def up
change_table :cookbooks do |t|
t.string :lowercase_name
end
Cookbook.reset_column_information
Cookbook.update_all('lowercase_name = LOWER(name)')
add_index :cookbooks, :lowercase_name, unique: true
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20131021232655_create_users.rb | Ruby | apache-2.0 | 214 | main | 314 | class CreateUsers < ActiveRecord::Migration[4.2]
def change
create_table :users do |t|
t.string :prefix
t.string :first_name
t.string :middle_name
t.string :last_name
t.string :suffix
t.string :phone
t.integer :primary_email_id
t.timestamps
end
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140324144915_create_cookbook_followers.rb | Ruby | apache-2.0 | 214 | main | 311 | class CreateCookbookFollowers < ActiveRecord::Migration[4.2]
def change
create_table :cookbook_followers do |t|
t.integer :cookbook_id, null: false
t.integer :user_id, null: false
t.timestamps
end
add_index :cookbook_followers, [:cookbook_id, :user_id], unique: true
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140227202438_add_attributes_to_cookbook.rb | Ruby | apache-2.0 | 214 | main | 245 | class AddAttributesToCookbook < ActiveRecord::Migration[4.2]
def change
add_column :cookbooks, :category, :string
add_column :cookbooks, :external_url, :string
add_column :cookbooks, :deprecated, :boolean, default: false
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20150824210000_create_group_members.rb | Ruby | apache-2.0 | 214 | main | 220 | class CreateGroupMembers < ActiveRecord::Migration[4.2]
def change
create_table :group_members do |t|
t.integer :group_id
t.integer :user_id
t.boolean :admin
t.timestamps
end
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20141013212617_create_ownership_transfer_requests.rb | Ruby | apache-2.0 | 214 | main | 539 | class CreateOwnershipTransferRequests < ActiveRecord::Migration[4.2]
def change
create_table :ownership_transfer_requests do |t|
t.integer :cookbook_id, null: false
t.integer :recipient_id, null: false
t.integer :sender_id, null: false
t.string :token, null: false
t.boolean :accepted... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140226140858_create_cookbook_versions.rb | Ruby | apache-2.0 | 214 | main | 308 | class CreateCookbookVersions < ActiveRecord::Migration[4.2]
def change
create_table :cookbook_versions do |t|
t.integer :cookbook_id
t.text :description
t.string :license
t.string :version
t.string :file_url
t.string :file_size
t.timestamps
end
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20160121191223_add_chef_versions_and_ohai_versions_to_cookbook_version.rb | Ruby | apache-2.0 | 214 | main | 222 | class AddChefVersionsAndOhaiVersionsToCookbookVersion < ActiveRecord::Migration[4.2]
def change
add_column :cookbook_versions, :chef_versions, :json
add_column :cookbook_versions, :ohai_versions, :json
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140715141042_add_state_attribute_to_contributor_requests.rb | Ruby | apache-2.0 | 214 | main | 208 | class AddStateAttributeToContributorRequests < ActiveRecord::Migration[4.2]
def change
change_table :contributor_requests do |t|
t.string :state, null: false, default: 'pending'
end
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20151027205208_create_group_resources.rb | Ruby | apache-2.0 | 214 | main | 243 | class CreateGroupResources < ActiveRecord::Migration[4.2]
def change
create_table :group_resources do |t|
t.integer :group_id
t.integer :resourceable_id
t.string :resourceable_type
t.timestamps
end
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140207190943_remove_unused_columns_from_users.rb | Ruby | apache-2.0 | 214 | main | 364 | class RemoveUnusedColumnsFromUsers < ActiveRecord::Migration[4.2]
def change
remove_column :users, :prefix, :string
remove_column :users, :middle_name, :string
remove_column :users, :suffix, :string
remove_column :users, :phone, :string
remove_column :users, :primary_email_id, :integer
remove_... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140603201106_make_cookbook_version_optional.rb | Ruby | apache-2.0 | 214 | main | 269 | class MakeCookbookVersionOptional < ActiveRecord::Migration[4.2]
def up
change_column :supported_platforms, :cookbook_version_id, :integer, null: true
end
def down
change_column :supported_platforms, :cookbook_version_id, :integer, null: false
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140505141342_move_cookbook_maintainer_and_description_to_cookbook_versions.rb | Ruby | apache-2.0 | 214 | main | 328 | class MoveCookbookMaintainerAndDescriptionToCookbookVersions < ActiveRecord::Migration[4.2]
def change
remove_column :cookbooks, :maintainer, :string
remove_column :cookbooks, :description, :text
add_column :cookbook_versions, :maintainer, :string
add_column :cookbook_versions, :description, :text
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140707215332_create_hits.rb | Ruby | apache-2.0 | 214 | main | 235 | class CreateHits < ActiveRecord::Migration[4.2]
def change
create_table :hits do |t|
t.string :label, null: false
t.integer :total, null: false, default: 0
end
add_index :hits, :label, unique: true
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140616193006_enforce_cookbook_dependency_uniqueness.rb | Ruby | apache-2.0 | 214 | main | 291 | class EnforceCookbookDependencyUniqueness < ActiveRecord::Migration[4.2]
def change
add_index(
:cookbook_dependencies,
[:cookbook_version_id, :name, :version_constraint],
name: 'cookbook_dependencies_unique_by_name_and_constraint',
unique: true
)
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140723175211_adjust_cookbook_updated_at_dates.rb | Ruby | apache-2.0 | 214 | main | 397 | class AdjustCookbookUpdatedAtDates < ActiveRecord::Migration[4.2]
def change
Cookbook.all.each do |cookbook|
latest_version_creation_date = cookbook.cookbook_versions.
order('created_at DESC').first.try(:created_at)
next unless latest_version_creation_date
cookbook.updated_at = latest_... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20160511224519_add_add_owner_as_collaborator_attribute_to_ownership_transfer_request.rb | Ruby | apache-2.0 | 214 | main | 203 | class AddAddOwnerAsCollaboratorAttributeToOwnershipTransferRequest < ActiveRecord::Migration[4.2]
def change
add_column :ownership_transfer_requests, :add_owner_as_collaborator, :boolean
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20141007195503_remove_email_notifications_from_user.rb | Ruby | apache-2.0 | 214 | main | 223 | class RemoveEmailNotificationsFromUser < ActiveRecord::Migration[4.2]
def up
remove_column :users, :email_notifications
end
def down
add_column :users, :email_notifications, :boolean, default: true
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140714150938_create_tools.rb | Ruby | apache-2.0 | 214 | main | 292 | class CreateTools < ActiveRecord::Migration[4.2]
def change
create_table :tools do |t|
t.references :user, index: true
t.string :name
t.string :type
t.text :description
t.string :source_url
t.text :instructions
t.timestamps
end
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140805212826_add_changelog_columns_to_cookbook_versions.rb | Ruby | apache-2.0 | 214 | main | 235 | class AddChangelogColumnsToCookbookVersions < ActiveRecord::Migration[4.2]
def change
change_table :cookbook_versions do |t|
t.text :changelog
t.string :changelog_extension, null: false, default: ''
end
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140715221702_make_tool_name_unique.rb | Ruby | apache-2.0 | 214 | main | 276 | class MakeToolNameUnique < ActiveRecord::Migration[4.2]
def up
add_column :tools, :lowercase_name, :string
add_index :tools, :lowercase_name, unique: true
end
def down
remove_index :tools, :lowercase_name
remove_column :tools, :lowercase_name
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140505164715_track_legacy_ids.rb | Ruby | apache-2.0 | 214 | main | 879 | class TrackLegacyIds < ActiveRecord::Migration[4.2]
def change
change_table :cookbook_versions do |t|
t.integer :legacy_id
end
change_table :users do |t|
t.integer :legacy_id
end
change_table :supported_platforms do |t|
t.integer :legacy_id
end
change_table :cookbooks ... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20141124212519_make_category_optional.rb | Ruby | apache-2.0 | 214 | main | 226 | class MakeCategoryOptional < ActiveRecord::Migration[4.2]
def up
change_column :cookbooks, :category_id, :integer, null: true
end
def down
change_column :cookbooks, :category_id, :integer, null: false
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140603165708_create_cookbook_version_platforms.rb | Ruby | apache-2.0 | 214 | main | 385 | class CreateCookbookVersionPlatforms < ActiveRecord::Migration[4.2]
def change
create_table :cookbook_version_platforms do |t|
t.references :cookbook_version
t.references :supported_platform
t.timestamps
end
add_index :cookbook_version_platforms, [:cookbook_version_id, :supported_platfo... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140618135024_add_verification_state_column_to_cookbook_version.rb | Ruby | apache-2.0 | 214 | main | 255 | class AddVerificationStateColumnToCookbookVersion < ActiveRecord::Migration[4.2]
def change
add_column :cookbook_versions, :verification_state, :string, null: false, default: 'pending'
add_index :cookbook_versions, :verification_state
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140709140311_remove_data_import_columns.rb | Ruby | apache-2.0 | 214 | main | 502 | class RemoveDataImportColumns < ActiveRecord::Migration[4.2]
def change
%w(
cookbook_collaborators
cookbook_followers
cookbook_version_platforms
cookbooks
users
).each do |table|
remove_index table, column: :legacy_id, unique: true
remove_column table, :legacy_id, :in... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140616140833_mark_bad_imports_for_reimport.rb | Ruby | apache-2.0 | 214 | main | 338 | class MarkBadImportsForReimport < ActiveRecord::Migration[4.2]
def up
require 'supermarket/migration/mark_bad_readme_imports_for_reimport'
Supermarket::Migration::MarkBadReadmeImportsForReimport.call
rescue LoadError
Rails.logger.debug 'Silently skipping migration to mark bad README imports'
end
d... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140305170508_add_pg_search_associated_against_support_functions.rb | Ruby | apache-2.0 | 214 | main | 712 | class AddPgSearchAssociatedAgainstSupportFunctions < ActiveRecord::Migration[4.2]
def self.up
say_with_time("Adding support functions for pg_search :associated_against") do
if ActiveRecord::Base.connection.send(:postgresql_version) < 80400
execute <<-'SQL'
CREATE AGGREGATE array_agg(anyele... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140113195736_create_invitations.rb | Ruby | apache-2.0 | 214 | main | 296 | class CreateInvitations < ActiveRecord::Migration[4.2]
def change
create_table :invitations do |t|
t.references :organization, index: true
t.string :email
t.string :token
t.boolean :admin
t.boolean :accepted
t.timestamps
end
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20131021233950_create_addresses.rb | Ruby | apache-2.0 | 214 | main | 330 | class CreateAddresses < ActiveRecord::Migration[4.2]
def change
create_table :addresses do |t|
t.references :user, index: true
t.string :address_line_1
t.string :address_line_2
t.string :city
t.string :state
t.string :zip
t.string :country
end
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140407202135_create_cookbook_collaborators.rb | Ruby | apache-2.0 | 214 | main | 217 | class CreateCookbookCollaborators < ActiveRecord::Migration[4.2]
def change
create_table :cookbook_collaborators do |t|
t.references :cookbook
t.references :user
t.timestamps
end
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140616182942_remove_duplicate_cookbook_dependencies.rb | Ruby | apache-2.0 | 214 | main | 369 | class RemoveDuplicateCookbookDependencies < ActiveRecord::Migration[4.2]
def up
require 'supermarket/migration/remove_duplicate_cookbook_dependencies'
Supermarket::Migration::RemoveDuplicateCookbookDependencies.call
rescue LoadError
Rails.logger.debug "Silently skipping migration to remove duplicate co... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20151201232841_alter_cookbook_collaborators_index.rb | Ruby | apache-2.0 | 214 | main | 364 | class AlterCookbookCollaboratorsIndex < ActiveRecord::Migration[4.2]
def change
remove_index :collaborators, name: 'index_cookbook_collaborators_on_user_id_and_resourceable'
add_index :collaborators, [:user_id, :resourceable_type, :resourceable_id, :group_id], unique: true, name: 'index_collaborators_on_user_... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20210827062432_drop_ccla_icla_related_tables.rb | Ruby | apache-2.0 | 214 | main | 311 | class DropCclaIclaRelatedTables < ActiveRecord::Migration[6.1]
def change
drop_table :iclas, if_exists: true
drop_table :icla_signatures, if_exists: true
drop_table :cla_reports, if_exists: true
drop_table :cclas, if_exists: true
drop_table :ccla_signatures,if_exists: true
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20131022001046_create_accounts.rb | Ruby | apache-2.0 | 214 | main | 334 | class CreateAccounts < ActiveRecord::Migration[4.2]
def change
create_table :accounts do |t|
t.references :user, index: true
t.string :uid, index: true
t.string :username, index: true
t.string :oauth_token
t.string :oauth_secret
t.datetime :oauth_expires
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140603165912_track_web_download_counts.rb | Ruby | apache-2.0 | 214 | main | 229 | class TrackWebDownloadCounts < ActiveRecord::Migration[4.2]
def change
add_column :cookbooks, :web_download_count, :integer, default: 0
add_column :cookbook_versions, :web_download_count, :integer, default: 0
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20160914205216_create_metric_results.rb | Ruby | apache-2.0 | 214 | main | 281 | class CreateMetricResults < ActiveRecord::Migration[4.2]
def change
create_table :metric_results do |t|
t.references :cookbook_version
t.references :quality_metric
t.boolean :failure
t.string :feedback
t.timestamps null: false
end
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140603202553_remove_download_count.rb | Ruby | apache-2.0 | 214 | main | 224 | class RemoveDownloadCount < ActiveRecord::Migration[4.2]
def change
remove_column :cookbooks, :download_count, :integer, default: 0
remove_column :cookbook_versions, :download_count, :integer, default: 0
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140730192646_make_collaborators_polymorphic.rb | Ruby | apache-2.0 | 214 | main | 880 | class MakeCollaboratorsPolymorphic < ActiveRecord::Migration[4.2]
def up
remove_index :cookbook_collaborators, name: 'index_cookbook_collaborators_on_user_id_and_cookbook_id'
add_column :cookbook_collaborators, :resourceable_type, :string
rename_column :cookbook_collaborators, :cookbook_id, :resourceable_... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140224215236_create_cookbooks.rb | Ruby | apache-2.0 | 214 | main | 239 | class CreateCookbooks < ActiveRecord::Migration[4.2]
def change
create_table :cookbooks do |t|
t.string :name, null: false
t.string :maintainer, null: false
t.text :description
t.timestamps
end
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140813155831_add_food_critic_attributes_to_cookbook_versions.rb | Ruby | apache-2.0 | 214 | main | 258 | class AddFoodCriticAttributesToCookbookVersions < ActiveRecord::Migration[4.2]
def change
add_column :cookbook_versions, :foodcritic_failure, :boolean, default: nil
add_column :cookbook_versions, :foodcritic_feedback, :text, default: nil
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140603171633_track_api_download_counts.rb | Ruby | apache-2.0 | 214 | main | 229 | class TrackApiDownloadCounts < ActiveRecord::Migration[4.2]
def change
add_column :cookbooks, :api_download_count, :integer, default: 0
add_column :cookbook_versions, :api_download_count, :integer, default: 0
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20160815191201_ensure_new_generated_indexes_exist.rb | Ruby | apache-2.0 | 214 | main | 299 | class EnsureNewGeneratedIndexesExist < ActiveRecord::Migration[6.1]
def up
add_index "accounts", ["uid"], name: "index_accounts_on_uid", using: :btree, if_not_exists: true
add_index "accounts", ["username"], name: "index_accounts_on_username", using: :btree, if_not_exists: true
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140320152951_cookbook_version_readme_is_required.rb | Ruby | apache-2.0 | 214 | main | 262 | class CookbookVersionReadmeIsRequired < ActiveRecord::Migration[4.2]
def change
change_column :cookbook_versions, :readme, :text, null: false, default: ''
change_column :cookbook_versions, :readme_extension, :string, null: false, default: ''
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20141002205024_create_email_preferences.rb | Ruby | apache-2.0 | 214 | main | 405 | class CreateEmailPreferences < ActiveRecord::Migration[4.2]
def change
create_table :email_preferences do |t|
t.references :user, null: false
t.references :system_email, null: false
t.string :token, null: false
t.timestamps
end
add_index :email_preferences, :token, unique: true
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20220203125201_destroy_supported_platforms_metric.rb | Ruby | apache-2.0 | 214 | main | 240 | class DestroySupportedPlatformsMetric < ActiveRecord::Migration[6.1]
def change
if (supported_platforms_metric = QualityMetric.where(name: "Supported Platforms")).exists?
supported_platforms_metric.destroy_all
end
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140116202142_add_devise_to_users.rb | Ruby | apache-2.0 | 214 | main | 1,740 | class AddDeviseToUsers < ActiveRecord::Migration[4.2]
def self.up
change_table(:users) do |t|
## Database authenticatable
t.string :email, :null => false, :default => ""
t.string :encrypted_password, :null => false, :default => ""
## Recoverable
t.string :reset_passwo... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140604195117_ensure_platform_uniqueness.rb | Ruby | apache-2.0 | 214 | main | 375 | class EnsurePlatformUniqueness < ActiveRecord::Migration[4.2]
def up
add_index :supported_platforms, [:name, :version_constraint], unique: true
remove_column :supported_platforms, :cookbook_version_id
end
def down
add_column :supported_platforms, :cookbook_version_id, :integer
remove_index :suppo... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140716122101_create_contributor_request_responses.rb | Ruby | apache-2.0 | 214 | main | 353 | class CreateContributorRequestResponses < ActiveRecord::Migration[4.2]
def change
create_table :contributor_request_responses do |t|
t.integer :contributor_request_id, null: false
t.string :decision, null: false
t.timestamps
end
add_index :contributor_request_responses, :contributor_re... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140402221028_link_cookbook_to_cookbook_dependency.rb | Ruby | apache-2.0 | 214 | main | 206 | class LinkCookbookToCookbookDependency < ActiveRecord::Migration[4.2]
def change
add_column :cookbook_dependencies, :cookbook_id, :integer
add_index :cookbook_dependencies, :cookbook_id
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/lib/utils/file_format.rb | Ruby | apache-2.0 | 214 | main | 200 | module Utils
class FileFormat
class << self
def get_mime_type(file_path:)
IO.popen(["file", "--mime-type", "--brief", file_path]) { |io| io.read.chomp }
end
end
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/lib/tasks/cookbook.rake | Ruby | apache-2.0 | 214 | main | 322 | namespace :cookbook do
# Usage: rake cookbook:grant_partner_badge cookbook=<cookbook_name>
desc "Grant the Partner badge to a cookbook"
task grant_partner_badge: :environment do
grant_badge_result = GrantBadgeToCookbook.new(badge: "partner", cookbook: ENV["cookbook"]).call
puts grant_badge_result
end
en... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/lib/tasks/user.rake | Ruby | apache-2.0 | 214 | main | 295 | namespace :user do
# Usage: rake user:make_admin user="#{username of user to be made an admin}"
desc "Take a username, find the user, and make that user an admin"
task make_admin: :environment do
make_admin_user = MakeUserAdmin.new(ENV["user"]).call
puts make_admin_user
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/lib/tasks/update_spdx_license.rake | Ruby | apache-2.0 | 214 | main | 1,306 | namespace :update_spdx_license do
namespace :run do
desc "update spdx license for all the cookbook in system"
task all_cookbooks: :environment do
result, message = UpdateSpdxLicenseUrl.all_latest_cookbook_versions
puts "#{result.to_s.upcase}: #{message}"
end
desc "update spdx license url ... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/lib/tasks/setup.rake | Ruby | apache-2.0 | 214 | main | 1,708 | namespace :setup do
desc "Test all dependencies are installed and at minimum versions"
task :deps do
require "minitest/autorun"
class TestDependencies < Minitest::Test
def test_postgres_installed
pgver = Gem::Version.new(`postgres --version`.split.last)
valid = pgver >= Gem::Version.n... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/lib/tasks/quality_metrics.rake | Ruby | apache-2.0 | 214 | main | 3,234 | namespace :quality_metrics do
desc "List the names of quality metrics"
task list: :environment do
puts "Quality Metrics:"
QualityMetric.all.each do |qm|
puts "+ #{qm.name}"
end
end
namespace :run do
desc "Run quality metrics on latest version of all cookbooks"
task all_the_latest: :en... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/lib/tasks/run_quality_metrics.rake | Ruby | apache-2.0 | 214 | main | 1,271 | namespace :quality_metrics do
namespace :run do
desc "Run quality metrics on latest version of all cookbooks"
task all_the_latest: :environment do
result, message = RunQualityMetrics.all_the_latest
puts "#{result.to_s.upcase}: #{message}"
end
desc "Run quality metrics on latest version of... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/lib/tasks/spec/javascripts.rake | Ruby | apache-2.0 | 214 | main | 689 | # Rake tasks for JavaScript specs
namespace :spec do
namespace :javascripts do
task :deps do
system "cd #{Rails.root} && npm install" unless File.exist?(karma_bin)
end
task run: :deps do
raise unless system "#{karma_command} --singleRun=true --reporters=dots"
end
desc "Run JavaScript... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/application.rb | Ruby | apache-2.0 | 214 | main | 3,579 | require_relative "boot"
require "dotenv"
require "rails/all"
Dotenv.overload(".env", ".env.#{Rails.env}").tap do |env|
if env.empty?
raise "Cannot run Supermarket without a .env file."
end
end
%w{
active_record
action_controller
action_mailer
sprockets
}.each do |framework|
require "#{framework}/rai... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/sitemap.rb | Ruby | apache-2.0 | 214 | main | 1,079 | # Set the host name for URL creation
SitemapGenerator::Sitemap.default_host = if Rails.env.production?
Supermarket::Host.full_url
else
"http://www.example.com"
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/routes.rb | Ruby | apache-2.0 | 214 | main | 7,176 | Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
VERSION_PATTERN = /latest|([0-9_\-\.]+)/ unless defined?(VERSION_PATTERN)
mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development?
mount Fieri::Engine, at:... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/initializers/paperclip.rb | Ruby | apache-2.0 | 214 | main | 1,042 | require Rails.root.join("app/lib/supermarket/s3_config")
Paperclip.interpolates(:compatible_id) do |attachment, _style|
attachment.instance.try(:legacy_id) || attachment.instance.id
end
# Paperclip has a few remote-fetcher adapters for retrieving attachments from some other place.
# We don't want to use them. Remove... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/initializers/session_store.rb | Ruby | apache-2.0 | 214 | main | 345 | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store,
key: "_supermarket_session",
secure: Rails.env.production? && \
Supermarket::Hos... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/initializers/i18n.rb | Ruby | apache-2.0 | 214 | main | 343 | module I18n
class JustRaiseExceptionHandler < ExceptionHandler
def call(exception, locale, key, options)
if exception.is_a?(MissingTranslation)
raise exception.to_exception
else
super
end
end
end
end
unless Rails.env.production?
I18n.exception_handler = I18n::JustRaiseEx... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/initializers/datadog_tracer.rb | Ruby | apache-2.0 | 214 | main | 445 | # Disable/Enable and configure the datadog application tracer
# crf. http://www.rubydoc.info/gems/ddtrace/#Ruby_on_Rails
if ENV["DATADOG_TRACER_ENABLED"] && ENV["DATADOG_TRACER_ENABLED"] == "true"
require "ddtrace"
Rails.configuration.datadog_trace =
{
auto_instrument: true,
auto_instrument_redis: ... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/initializers/secret_token.rb | Ruby | apache-2.0 | 214 | main | 557 | # Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to diction... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/initializers/omniauth.rb | Ruby | apache-2.0 | 214 | main | 1,907 | # OmniAuth configuration
# Set the full_host for OmniAuth
#
# If this is not set correctly, OmniAuth may not generate redirect_uri
# parameters in requests correctly.
#
# We do not need to do this in the test environment, since it's using mock_auth
# there.
#
# See http://www.kbedell.com/2011/03/08/overriding-omniauth... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/initializers/sidekiq.rb | Ruby | apache-2.0 | 214 | main | 904 | redis_for_job_queue = ENV["REDIS_JOBQ_URL"].presence ||
ENV["REDIS_URL"].presence ||
"redis://localhost:6379/0/supermarket"
Sidekiq.configure_server do |config|
config.redis = { url: redis_for_job_queue }
# make Sidekiq load the schedule, because Redis
# probably reac... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/initializers/cookies_serializer.rb | Ruby | apache-2.0 | 214 | main | 618 | # Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
# NOTE - Changed the serializer from :hybrid to :json as the rails
# has been upgraded to version:5 around 4 years back.
# Changing this now as... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/initializers/fipsify.rb | Ruby | apache-2.0 | 214 | main | 873 | if ENV["OPENSSL_FIPS"] == "1"
# Ensure the Fips class is loaded before calling it
# Use a more Rails 7.1 compatible approach for autoloading
Rails.application.config.to_prepare do
Supermarket::Fips.enable!
Rails.logger.info "FIPS 140-2 mode is enabled and verified."
rescue OpenSSL::OpenSSLError => e
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/initializers/content_security_policy.rb | Ruby | apache-2.0 | 214 | main | 2,028 | # Be sure to restart your server when you modify this file.
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
Rails.application.config.content_security_policy do |policy|
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/initializers/form_helper_errors.rb | Ruby | apache-2.0 | 214 | main | 437 | # Instead of wrapping form fields with errors in a div (which messes up the grid
# layout), just add an error class to them.
#
# See http://stackoverflow.com/a/8380400/161787
ActionView::Base.field_error_proc = proc do |html_tag, _instance|
class_attr_index = html_tag.index 'class="'
if class_attr_index
html_... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/initializers/psych_initializer.rb | Ruby | apache-2.0 | 214 | main | 405 | Psych::ClassLoader::ALLOWED_PSYCH_CLASSES = [ Symbol, Time ].freeze
module Psych
class ClassLoader
ALLOWED_PSYCH_CLASSES = [].freeze unless defined? ALLOWED_PSYCH_CLASSES
class Restricted < ClassLoader
def initialize(classes, symbols)
@classes = classes + Psych::ClassLoader::ALLOWED_PSYCH_CLASS... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/environments/production.rb | Ruby | apache-2.0 | 214 | main | 5,327 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your applica... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/environments/development.rb | Ruby | apache-2.0 | 214 | main | 2,703 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/environments/test.rb | Ruby | apache-2.0 | 214 | main | 2,316 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your te... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/config/unicorn/development.rb | Ruby | apache-2.0 | 214 | main | 505 | worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
timeout 15
preload_app true
before_fork do |_server, _worker|
Signal.trap "TERM" do
Process.kill "QUIT", Process.pid
end
defined?(ActiveRecord::Base) &&
ActiveRecord::Base.connection.disconnect!
end
after_fork do |_server, _worker|
Signal.trap "TE... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/engines/fieri/Rakefile | Ruby | apache-2.0 | 214 | main | 942 | begin
require "bundler/setup"
rescue LoadError
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
end
require "rdoc/task"
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = "rdoc"
rdoc.title = "Fieri"
rdoc.options << "--line-numbers"
rdoc.rdoc_files.include("README.rdoc")
rdoc.... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/engines/fieri/fieri.gemspec | Ruby | apache-2.0 | 214 | main | 971 | $LOAD_PATH.push File.expand_path("lib", __dir__)
# Maintain your gem's version:
require "fieri/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "fieri"
s.version = Fieri::VERSION
s.authors = ["Supermarket Team"]
s.email = ["supermarket@chef... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/engines/fieri/Gemfile | Ruby | apache-2.0 | 214 | main | 804 | source "https://rubygems.org"
# Declare your gem's dependencies in fieri.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# Declare any dependencies that are still in development here instead of in
# y... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/engines/fieri/lib/quality_metric/cookstyle_helpers.rb | Ruby | apache-2.0 | 214 | main | 940 | require "mixlib/shellout"
require "dotenv-rails"
Dotenv.load(".env")
require "shellwords"
module CookstyleHelpers
def self.process_artifact(path)
path = path.shellescape
shell_out = Mixlib::ShellOut.new("cookstyle #{path} --only #{ENV["COOKSTYLE_COPS"]} --format json")
shell_out.run_command
parse_coo... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/engines/fieri/app/controllers/fieri/status_controller.rb | Ruby | apache-2.0 | 214 | main | 1,808 | require_dependency "fieri/application_controller"
module Fieri
class StatusController < ApplicationController
require "sidekiq/api"
REACHABLE = "REACHABLE".freeze
UNKNOWN = "UNKNOWN".freeze
UNREACHABLE = "UNREACHABLE".freeze
def show
redis_health = { status: REACHABLE }
sidekiq_heal... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/engines/fieri/app/controllers/fieri/application_controller.rb | Ruby | apache-2.0 | 214 | main | 350 | module Fieri
class ApplicationController < ActionController::Base
rescue_from ActionController::ParameterMissing, with: :param_missing_error
private
def param_missing_error(exception)
error = {
status: "error",
message: exception.message,
}
render status: :bad_request, ... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/engines/fieri/app/controllers/fieri/jobs_controller.rb | Ruby | apache-2.0 | 214 | main | 1,009 | require_dependency "fieri/application_controller"
module Fieri
class JobsController < ApplicationController
before_action :check_authorization
skip_before_action :verify_authenticity_token, \
if: proc { request.format.json? || action_name == "create" }, raise: false
def create
MetricsRunner.... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/engines/fieri/app/models/testing_file_worker.rb | Ruby | apache-2.0 | 214 | main | 1,155 | require "sidekiq"
require "net/http"
require "octokit"
class TestingFileWorker < SourceRepoWorker
include ::Sidekiq::Worker
def perform(cookbook_json, cookbook_name)
evaluate_result = evaluate(cookbook_json)
Net::HTTP.post_form(
URI.parse("#{ENV["FIERI_SUPERMARKET_ENDPOINT"]}/api/v1/quality_metrics... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/engines/fieri/app/models/source_repo_worker.rb | Ruby | apache-2.0 | 214 | main | 501 | require "sidekiq"
require "net/http"
require "octokit"
class SourceRepoWorker
private
def source_repo(cookbook_json)
url = source_repo_url(cookbook_json)
# https://rubular.com/r/uTLH7q6rJES5xW
url.match(%r{^(https?\://)?(github\.com/)(\w+/\w+)}).try(:[], 3).to_s
end
def source_repo_url(cookbook_j... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/engines/fieri/app/models/metrics_runner.rb | Ruby | apache-2.0 | 214 | main | 975 | require "sidekiq"
class MetricsRunner
include ::Sidekiq::Worker
def perform(cookbook)
cookbook_data = cookbook_api_response(cookbook)
CollaboratorWorker.perform_async(cookbook_data, cookbook["name"])
CookstyleWorker.perform_async(cookbook)
NoBinariesWorker.perform_async(cookbook)
# do not cal... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/engines/fieri/app/models/cookstyle_worker.rb | Ruby | apache-2.0 | 214 | main | 1,188 | require "sidekiq"
require "net/http"
class CookstyleWorker
include ::Sidekiq::Worker
def perform(params)
cookbook = CookbookArtifact.new(params["artifact_url"], jid)
feedback, status = cookbook.criticize
make_post(params, feedback, status)
cookbook.cleanup
rescue StandardError => e
log_error... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/engines/fieri/app/models/collaborator_worker.rb | Ruby | apache-2.0 | 214 | main | 1,389 | require "sidekiq"
require "net/http"
class CollaboratorWorker
include ::Sidekiq::Worker
SUFFICENT_COLLABORATORS = 2
def perform(cookbook_json, cookbook_name)
Net::HTTP.post_form(
URI.parse("#{ENV["FIERI_SUPERMARKET_ENDPOINT"]}/api/v1/quality_metrics/collaborators_evaluation"),
fieri_key: ENV["FI... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/engines/fieri/app/models/cookbook_artifact.rb | Ruby | apache-2.0 | 214 | main | 3,294 | require "open-uri" unless defined?(OpenURI)
require "rubygems/package" unless defined?(Gem::Package)
require "mixlib/archive" unless defined?(Mixlib::Archive)
require "quality_metric/cookstyle_helpers"
require "openssl"
class CookbookArtifact
#
# Accessors
#
attr_accessor :url, :job_id, :work_dir
FILE_SIZE_... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/engines/fieri/app/models/supermarket_api_runner.rb | Ruby | apache-2.0 | 214 | main | 700 | require "sidekiq"
require "net/http"
class SupermarketApiRunner
def cookbook_api_response(cookbook_name)
get_api_response(cookbook_api_uri(cookbook_name))
end
def cookbook_version_api_response(cookbook_name, version)
get_api_response(cookbook_version_api_uri(cookbook_name, version))
end
private
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/engines/fieri/app/models/no_binaries_worker.rb | Ruby | apache-2.0 | 214 | main | 1,147 | require "sidekiq"
require "net/http"
class NoBinariesWorker
include ::Sidekiq::Worker
def perform(params)
cookbook = CookbookArtifact.new(params["artifact_url"], jid)
binary_files = cookbook.binaries
failure = !binary_files.empty?
feedback = if failure
I18n.t("quality_metrics.no_... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/engines/fieri/app/models/contributing_file_worker.rb | Ruby | apache-2.0 | 214 | main | 1,330 | require "sidekiq"
require "net/http"
require "octokit"
class ContributingFileWorker < SourceRepoWorker
include ::Sidekiq::Worker
def perform(cookbook_json, cookbook_name)
evaluate_result = evaluate(cookbook_json)
Net::HTTP.post_form(
URI.parse("#{ENV["FIERI_SUPERMARKET_ENDPOINT"]}/api/v1/quality_me... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/engines/fieri/app/models/version_tag_worker.rb | Ruby | apache-2.0 | 214 | main | 1,489 | require "sidekiq"
require "net/http"
require "octokit"
class VersionTagWorker < SourceRepoWorker
include ::Sidekiq::Worker
def perform(cookbook_json, cookbook_name, cookbook_version)
evaluate_result = evaluate(cookbook_json, cookbook_version)
Net::HTTP.post_form(
URI.parse("#{ENV["FIERI_SUPERMARKET... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.