repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
mohitsethi/chef-storm
recipes/default.rb
include_recipe "storm::dependencies" include_recipe "partial_search" # Get list of zookeeper hosts node.override['storm']['zookeeper']['hosts'] = search(:node, "chef_environment:#{node.chef_environment} AND role:#{node['storm']['storm_zookeeper_role']}", ...
mohitsethi/chef-storm
recipes/all_local.rb
<reponame>mohitsethi/chef-storm<filename>recipes/all_local.rb include_recipe "storm::default" bash "start_nimbus" do user node[:storm][:user] cwd "#{node[:storm][:data_dir]}" code <<-EOH #{node[:storm][:root_dir]}/apache-storm-#{node[:storm][:version]}/bin/storm nimbus >>nimbus.log 2>&1 & EOH end bash "...
mohitsethi/chef-storm
recipes/zookeeper.rb
package 'java-1.7.0-openjdk-devel' package 'bison' package 'flex' package 'gcc' package 'gcc-c++' package 'kernel-devel' package 'make' package 'm4' package 'patch' remote_file "#{Chef::Config[:file_cache_path]}/zookeeper-#{node[:zookeeper][:version]}.tar.gz" do source "#{node[:zookeeper][:download_url]}/zookeeper-#...
mohitsethi/chef-storm
attributes/default.rb
# zookeeper attributes default['zookeeper']['version'] = '3.4.6' default['zookeeper']['download_url'] = 'http://www.poolsaboveground.com/apache/zookeeper' default['zookeeper']['user'] = 'root' default['zookeeper']['group'] = 'root' default['zookeeper']['root_dir'] = '/opt/zookeeper' default['zookeeper']['data_dir'] = '...
mohitsethi/chef-storm
recipes/supervisor.rb
include_recipe "storm::default" bash "start_supervisor" do user node[:storm][:user] cwd "#{node[:storm][:data_dir]}" code <<-EOH #{node[:storm][:root_dir]}/apache-storm-#{node[:storm][:version]}/bin/storm supervisor >>supervisor.log 2>&1 & EOH end
mohitsethi/chef-storm
recipes/nimbus.rb
include_recipe "storm::default" bash "start_nimbus" do user node[:storm][:user] cwd "#{node[:storm][:data_dir]}" code <<-EOH pid=$(pgrep -f backtype.storm.daemon.nimbus) if [ -z $pid ]; then #{node[:storm][:root_dir]}/apache-storm-#{node[:storm][:version]}/bin/storm nimbus >>nimbus.log 2>&1 & fi EOH ...
ValentinAndreev/Relationship
lib/generators/relationship/install_generator.rb
<reponame>ValentinAndreev/Relationship require 'rails/generators' require 'rails/generators/active_record' module Relationship class InstallGenerator < Rails::Generators::Base include Rails::Generators::Migration source_root File.expand_path('../../generators/templates', __dir__) desc 'Generates migrat...
ValentinAndreev/Relationship
lib/relationship/version.rb
<gh_stars>0 module Relationship VERSION = '0.2.17' end
ValentinAndreev/Relationship
test/relationship_test.rb
require 'test_helper' class Relationship::Test < ActiveSupport::TestCase test "truth" do assert_kind_of Module, Relationship end end
ValentinAndreev/Relationship
lib/generators/templates/add_relation.rb
<filename>lib/generators/templates/add_relation.rb class AddRelation < <%= migration_class_name %> def change create_table :relations do |t| t.integer :follower_id t.integer :followed_id t.timestamps end add_index :relations, :follower_id add_index :relations, :followed_id add_...
ValentinAndreev/Relationship
lib/relationship.rb
<reponame>ValentinAndreev/Relationship module Relationship extend ActiveSupport::Concern included do has_many :active_relationships, class_name: 'Relation', foreign_key: 'follower_id', dependent: :destroy has_many :passive_relationships, class_name: 'Relation', foreign_key: 'followed_id', dependent: :destr...
grepsedawk/rich
config/routes.rb
Rich::Engine.routes.draw do resources :files, :controller => "files" end
grepsedawk/rich
test/dummy/config/initializers/rich.rb
<gh_stars>100-1000 require "rich" if Object.const_defined?("Rich") Rich.setup do |config| # Customize ckeditor by adding configuration to config.editor (you can use any ckeditor config directive) # Look at the Rich source for default settings. These settings can also be overridden per editor instance. ...
grepsedawk/rich
test/unit/helpers/rich/files_helper_test.rb
require 'test_helper' module Rich class FilesHelperTest < ActionView::TestCase end end
grepsedawk/rich
lib/rich/integrations/legacy_formtastic.rb
module Rich module Integrations module FormtasticBuilder def self.included(base) base.send(:include, InstanceMethods) end module InstanceMethods def rich_input(method, options) scope_type = object_name scope_id = object.id editor_options = Rich.opti...
grepsedawk/rich
app/helpers/rich/application_helper.rb
<filename>app/helpers/rich/application_helper.rb<gh_stars>100-1000 module Rich module ApplicationHelper end end
grepsedawk/rich
lib/rich/authorize.rb
<filename>lib/rich/authorize.rb<gh_stars>100-1000 module Rich module Authorize def authenticate_rich_user send(Rich.authentication_method) unless Rich.authentication_method == :none end end end
grepsedawk/rich
app/helpers/rich/files_helper.rb
module Rich module FilesHelper def thumb_for_file(file) if file.simplified_type == "image" file.rich_file.url(:rich_thumb) else asset_path "rich/document-thumb.png" end end end end
grepsedawk/rich
test/rich_test.rb
<reponame>grepsedawk/rich require 'test_helper' class RichTest < ActiveSupport::TestCase test "truth" do assert_kind_of Module, Rich end end
TuningYourCode/puppet-blackfire
spec/classes/init_spec.rb
require 'spec_helper' describe 'blackfire' do on_supported_os.each do |os, facts| context "on #{os}" do let(:facts) { facts } context 'with default parameters' do it do expect { is_expected.to compile }.to raise_error(%r{expects a value for parameter}) ...
deveye/eekk_view_tool
lib/eekk_view_tool.rb
<filename>lib/eekk_view_tool.rb require "eekk_view_tool/version" require "eekk_view_tool/renderer" module EekkViewTool # Your code goes here... end
noteflakes/lyp-server
ext.rb
<reponame>noteflakes/lyp-server Lyp.install_extension(__FILE__) require 'fileutils' require 'net/telnet' SERVER_CODE = <<EOF \\version "2.19.37" \\require "lys" #(lys:start-server) EOF module Lyp::Lilypond LYS_SERVER_PATH = File.join(Lyp::TMP_ROOT, "lys-server.ly") class << self alias_method :orig_parse_l...
createra-hoshino/MarqueeLabel
MarqueeLabel.podspec
<filename>MarqueeLabel.podspec Pod::Spec.new do |s| s.name = "MarqueeLabel" s.version = "3.2.0" s.summary = "A drop-in replacement for UILabel, which automatically adds a scrolling marquee effect when needed." s.homepage = "https://github.com/cbpowell/MarqueeLabel" s.license = { :ty...
adamb/rudeq
spec/rude_q_spec.rb
require File.dirname(__FILE__) + '/spec_helper' describe RudeQ::ClassMethods do # ProcessQueue extends ClassMethods before(:each) do ProcessQueue.delete_all ProcessQueue.raise_on_processed = false create_some_noise end def create_some_noise ProcessQueue.create!(:queue_name => "doNT use this in...
adamb/rudeq
rudeq.gemspec
Gem::Specification.new do |s| s.name = "rudeq" s.version = "0.1" s.date = "2008-06-21" s.summary = "ActiveRecord-based DB-queue" s.email = "<EMAIL>" s.homepage = "http://github.com/matthewrudy/rudeq" s.description = "A simple DB queueing library built on top of ActiveRecord, and designed for use with MySQ...
adamb/rudeq
spec/spec_helper.rb
require 'rubygems' require 'spec' require 'active_record' current_dir = File.dirname(__FILE__) require "#{current_dir}/../lib/rude_q" require "#{current_dir}/process_queue" config = YAML::load(IO.read(current_dir + '/database.yml')) ActiveRecord::Base.logger = Logger.new(current_dir + "/debug.log") ActiveRecord::Bas...
adamb/rudeq
lib/rude_q.rb
# RudeQ require 'digest/sha1' # simply doing; # class RudeQueue < ActiveRecord::Base # include RudeQ # end # will include RudeQ::ClassMethods # :get # :set module RudeQ def self.included(mod) # :nodoc: mod.extend(ClassMethods) mod.serialize(:data) end module ClassMethods # Cleanup old...
adamb/rudeq
spec/schema.rb
ActiveRecord::Schema.define(:version => 1) do create_table :process_queues, :force => true do |t| t.string :queue_name t.text :data t.string :token, :default => nil t.boolean :processed, :default => false, :null => false t.timestamps end add_index :process_queues, :processed add_index :proc...
carwow/rubydoc
config/puma.rb
puts "puma.rb" root = File.dirname(__FILE__) + '/../' directory root rackup root + 'config.ru' preload_app! threads 4, 16 workers 1 before_fork do require_relative '../lib/preload' AppPreloader.preload! end
carwow/rubydoc
scripts/update_remote_gems.rb
<filename>scripts/update_remote_gems.rb #!/bin/env ruby require_relative '../lib/gem_updater' GemUpdater.update_remote_gems display: true
carwow/rubydoc
app.rb
<reponame>carwow/rubydoc<filename>app.rb # frozen_string_literal: true require File.join(File.dirname(__FILE__), 'init') require 'yard' require 'sinatra' require 'json' require 'fileutils' require 'extensions' require 'gem_updater' require 'gems_router' require 'gem_store' require 'digest/sha2' require 'rack/etag' ...
carwow/rubydoc
templates/default/fulldoc/html/setup.rb
<reponame>carwow/rubydoc # @fixme should be able to use Object.extend(T('layout')).menu_lists but for # some reason it causes a crash. def menu_lists [{:type => 'class', :title => 'Classes', :search_title => 'Class List'}, {:type => 'method', :title => 'Methods', :search_title => 'Method List'}, {:type...
carwow/rubydoc
scripts/migrate_to_single_object_db.rb
#!/usr/bin/env ruby # Migrates .yardocs to --single-db require_relative '../init' include YARD [File.join(REPOS_PATH, '*', '*', '*'), File.join(REMOTE_GEMS_PATH, '*', '*', '*')].each do |dir| Dir[dir].each do |d| puts ">> Migrating .yardoc to single db for #{d}" Dir.chdir(d) Registry.load! Registry.s...
carwow/rubydoc
config.ru
$:.unshift('.') require 'app' run DocServer
carwow/rubydoc
scripts/clean_docs.rb
require_relative '../init' MAX_DOCS_PER_PROJECT = 4 # [REMOTE_GEMS_PATH, REPOS_PATH].each do |source_dir| [REPOS_PATH].each do |source_dir| Dir.glob("#{source_dir}/*/*") do |project_dir| puts ">> Checking #{project_dir}" candidate_dirs = {} dir_count = 0 Dir.glob("#{project_dir}/*").each do |...
carwow/rubydoc
lib/gems_router.rb
class GemsRouter < YARD::Server::Router def docs_prefix; 'gems' end def list_prefix; 'list/gems' end def search_prefix; 'search/gems' end def static_prefix; 'static/gems' end end
carwow/rubydoc
generate.rb
#!/usr/bin/env ruby require 'shellwords' if File.exist?('.yardopts') args = Shellwords.split(File.read('.yardopts').gsub(/^[ \t]*#.+/m, '')) args.each_with_index do |arg, i| next unless arg == '--plugin' next unless args[i + 1] cmd = "gem install --user-install yard-#{args[i + 1].inspect}" puts "[...
carwow/rubydoc
scripts/puma.rb
#!/usr/bin/env puma root = File.dirname(__FILE__) + '/../' directory root rackup root + 'config.ru' environment 'production' bind 'tcp://0.0.0.0:8080' pidfile root + 'tmp/pids/server.pid' # daemonize unless ENV['DOCKERIZED'] # unless ENV['DOCKERIZED'] # stdout_redirect root + 'log/puma.log', root + 'log...
carwow/rubydoc
scripts/clean_index_cache.rb
<filename>scripts/clean_index_cache.rb<gh_stars>10-100 #!/usr/bin/env ruby # Removes index pages (gems, github, home) require_relative '../init' require_relative '../lib/cache' Cache.invalidate *%w(/gems/~*/ /github/* /featured /github /gems /stdlib /)
carwow/rubydoc
lib/configuration.rb
<reponame>carwow/rubydoc<filename>lib/configuration.rb class Configuration < Hash def self.load Configuration.new( YAML.load(ERB.new(File.read(CONFIG_FILE)).result) ) end def initialize(hash) update(hash) update('environment' => 'production') if environment.nil? end def met...
carwow/rubydoc
lib/helpers.rb
require 'open3' module Helpers module_function def sh(command, title = "", write_error = true) puts(log = "#{Time.now}: #{title}: #{command}") if write_error result, out_data, err_data = 0, "", "" Open3.popen3(command) do |_, out, err, thr| out_data, err_data, result = out.read, err.r...
carwow/rubydoc
scripts/importer.rb
require 'rest_client' RUBYDOC_URL = 'http://localhost:9292' if ARGV[0].nil? puts "Usage: importer <import-file>" exit 0 end import_file = ARGV[0] File.open(import_file, "r") do |file| while (line = file.gets) url = line.chomp puts ">> Importing #{url}" RestClient.post "#{RUBYDOC_URL}/checkout", { :...
carwow/rubydoc
templates/default/layout/html/setup.rb
def javascripts super + %w(js/rubydoc_custom.js) end
carwow/rubydoc
scripts/setup_host_path.rb
require 'fileutils' FileUtils.mkdir_p(__dir__ + '/../data') File.open(__dir__ + '/../data/host_path', 'w') do |f| f.puts File.expand_path(__dir__ + '/..').gsub(/\A([A-Z]):/, '/\1') end
carwow/rubydoc
lib/source_cleaner.rb
<filename>lib/source_cleaner.rb class SourceCleaner attr_accessor :basepath def initialize(basepath) self.basepath = basepath end def clean(safe_mode = YARD::Config.options[:safe_mode]) if safe_mode puts "#{Time.now}: Cleaning #{basepath} (safemode=true)..." else puts "#{Time.now}: Not...
carwow/rubydoc
scripts/clean_repos.rb
<reponame>carwow/rubydoc #!/usr/bin/env ruby # Removes cached repositories (gems, github, home) require_relative '../init' require 'source_cleaner' [File.join(REPOS_PATH, '*', '*', '*'), File.join(REMOTE_GEMS_PATH, '*', '**')].each do |dir| Dir[dir].each do |d| puts ">> Deleting source files for #{d}" Source...
bonusly/cadooz
lib/cadooz/models/immutable/voucher_information.rb
<filename>lib/cadooz/models/immutable/voucher_information.rb class Cadooz::Immutable::VoucherInformation include Mixins attr_reader :response_state, :voucher_list def initialize(open_struct) @response_state = open_struct&.response_state @voucher_list = Array(open_struct&.voucher_list)&.each_with_object(...
bonusly/cadooz
lib/cadooz/models/immutable/catalog_product_variation.rb
class Cadooz::Immutable::CatalogProductVariation include Mixins attr_reader :currency, :name, :number, :value def initialize(open_struct) @currency = open_struct&.currency @name = open_struct&.name @number = open_struct&.number @value = Money.new((open_struct&.value.to_f * 100) || 0, @currency |...
bonusly/cadooz
lib/cadooz/services/business_order_service.rb
<gh_stars>1-10 class Cadooz::BusinessOrderService DEFAULT_TIMEOUT = 10 def initialize(open_timeout = DEFAULT_TIMEOUT, read_timeout = DEFAULT_TIMEOUT) @client = Savon.client( wsdl: Cadooz.configuration.wsdl, basic_auth: [ Cadooz.configuration.username, Cadooz.configuration.passwo...
bonusly/cadooz
lib/cadooz/models/immutable/greeting_card.rb
class Cadooz::Immutable::GreetingCard include Mixins attr_reader :subject, :text def initialize(open_struct) @subject = open_struct&.subject @text = open_struct&.text self.freeze end end
bonusly/cadooz
lib/cadooz/models/immutable/generation_profile_product.rb
<filename>lib/cadooz/models/immutable/generation_profile_product.rb<gh_stars>1-10 class Cadooz::Immutable::GenerationProfileProduct include Mixins attr_reader :cadooz_product_number, :custom_value, :external_product_number, :value def initialize(open_struct) @cadooz_product_number = open_struct&.cadooz_prod...
bonusly/cadooz
lib/cadooz/models/mutable/invoice_information.rb
class Cadooz::Mutable::InvoiceInformation include Mixins attr_accessor :debitor_number, :value def initialize(args={}) @debitor_number = args[:debitor_number] @value = args[:value] default_value_for_nil end end
bonusly/cadooz
lib/cadooz/models/immutable/catalog_product.rb
<filename>lib/cadooz/models/immutable/catalog_product.rb class Cadooz::Immutable::CatalogProduct include Mixins attr_reader :attributes, :categories, :mobile_shippable, :name, :number, :offline_shippable, :online_shippable, :type, :variations def initialize(open_struct) @attributes = Array(open_struct&.attr...
bonusly/cadooz
lib/cadooz/models/mutable/address.rb
class Cadooz::Mutable::Address include Mixins attr_accessor :city, :company, :country, :department, :email, :firstname, :lastname, :phone, :salutation, :state, :street, :street_addon, :zipcode def initialize(args={}) @company = args[:company] @country = args[:country] ...
bonusly/cadooz
spec/lib/cadooz/models_spec.rb
<reponame>bonusly/cadooz require 'spec_helper' RSpec::Matchers.define :mutable_block do match do |actual| actual.is_a? Proc actual.call == 'test' end def supports_block_expectations? true end end describe Cadooz do describe "immutable class attributes" do Dir.foreach('./lib/cadooz/models/i...
bonusly/cadooz
lib/cadooz/models/mutable/greeting_card.rb
<filename>lib/cadooz/models/mutable/greeting_card.rb class Cadooz::Mutable::GreetingCard include Mixins attr_accessor :subject, :text def initialize(args={}) @subject = args[:subject] @text = args[:text] default_value_for_nil end end
bonusly/cadooz
lib/cadooz/models/immutable/product_category.rb
class Cadooz::Immutable::ProductCategory include Mixins attr_reader :id, :description, :internal_name, :shop_name def initialize(open_struct) @id = open_struct&.id @description = open_struct&.description &.map_entries &.elements ...
bonusly/cadooz
lib/cadooz/models/immutable/invoice_information.rb
<reponame>bonusly/cadooz class Cadooz::Immutable::InvoiceInformation include Mixins attr_reader :debitor_number, :value def initialize(open_struct) @debitor_number = open_struct&.debitor_number @value = open_struct&.value self.freeze end end
bonusly/cadooz
lib/cadooz/models/mutable/order_position.rb
<gh_stars>1-10 class Cadooz::Mutable::OrderPosition include Mixins attr_accessor :amount, :attributes, :cadooz_product_number, :currency, :delivery_address, :external_reference_number, :greeting_card, :value, :voucher_address, :voucher_address_editable, :voucher_addr...
bonusly/cadooz
lib/cadooz/models/mutable/payment.rb
class Cadooz::Mutable::Payment include ::Mixins attr_accessor :attributes, :description, :paid, :type, :value, :verified def initialize(args={}) @attributes = args[:attributes] @description = args[:description] @paid = args[:paid] @type = args[:type] @value = args[:value] @verified = arg...
bonusly/cadooz
spec/lib/cadooz/services_spec.rb
<gh_stars>1-10 require 'spec_helper' describe Cadooz::BusinessOrderService do include CadoozHelpers, Savon::SpecHelper before(:all) { savon.mock! } after(:all) { savon.unmock! } before(:each) do wsdl = File.read('./spec/support/BusinessOrderService.wsdl') stub_request(:get, /wsdl/).to_return(:status ...
bonusly/cadooz
cadooz.gemspec
<reponame>bonusly/cadooz $:.push File.expand_path('../lib', __FILE__) require 'cadooz/version' Gem::Specification.new do |s| s.name = 'cadooz' s.version = Cadooz::VERSION s.authors = ['<NAME>'] s.email = ['<EMAIL>'] s.homepage = 'http://bonus.ly' s.license = 'MIT' ...
bonusly/cadooz
lib/cadooz/models/immutable/payment.rb
class Cadooz::Immutable::Payment include Mixins attr_reader :attributes, :description, :paid, :type, :value, :verified def initialize(open_struct) @attributes = open_struct&.attributes &.map_entries &.elements &.inject({}...
bonusly/cadooz
lib/cadooz/models/immutable/address.rb
<reponame>bonusly/cadooz class Cadooz::Immutable::Address include Mixins attr_reader :city, :company, :country, :department, :email, :firstname, :lastname, :phone, :salutation, :state, :street, :street_addon, :zip_code def initialize(open_struct) @city = open_struct&.city @co...
bonusly/cadooz
lib/cadooz/models/immutable/order.rb
<reponame>bonusly/cadooz class Cadooz::Immutable::Order include Mixins attr_reader :client, :commission, :cost_owner, :cost_unit, :credit_or_number, :customer_reference_number, :delivery_address, :generation_profile, :greeting_card, :invoice_address, :invoice_information, :language, ...
bonusly/cadooz
lib/cadooz/models/immutable/voucher.rb
<filename>lib/cadooz/models/immutable/voucher.rb class Cadooz::Immutable::Voucher include Mixins attr_reader :address, :code, :ecard_link, :evoucher_link, :pin, :product_name, :product_number, :product_variation_number, :serial_number, :value def initialize(open_struct) @address ...
bonusly/cadooz
lib/cadooz/models/mutable/order.rb
<reponame>bonusly/cadooz class Cadooz::Mutable::Order include ::Mixins attr_accessor :client, :commission, :cost_owner, :cost_unit, :credit_or_number, :customer_reference_number, :delivery_address, :generation_profile, :greeting_card, :invoice_address, :invoice_information, :languag...
bonusly/cadooz
lib/mixins.rb
<filename>lib/mixins.rb module Mixins def serialize(data_only = false) class_name = self.class.to_s.gsub(/Cadooz::[a-z]*::/i, '').underscore result = data_only ? {} : { class_name.to_sym => {} } hash_assign = ->name, value { data_only ? result[name] = value : result[class_name.to_sym][name] = value } ...
bonusly/cadooz
lib/cadooz/models/immutable/attributes.rb
class Cadooz::Immutable::Attributes include Mixins attr_reader :attribute, :values def initialize(open_struct) @attribute = open_struct&.attribute @values = open_struct&.values &.map_entries &.elements &.inject({}) { |hash, eleme...
bonusly/cadooz
lib/cadooz/models/immutable/order_position.rb
class Cadooz::Immutable::OrderPosition include Mixins attr_reader :amount, :attributes, :cadooz_product_number, :currency, :delivery_address, :external_reference_number, :greeting_card, :value, :voucher_address, :voucher_address_editable, :voucher_address_preset def ini...
bonusly/cadooz
lib/cadooz/models/immutable/order_status.rb
class Cadooz::Immutable::OrderStatus include Mixins attr_reader :delivery_state, :message, :order_number, :order_state, :packet_number, :return_reason, :shipping_provider def initialize(open_struct) @delivery_state = open_struct&.delivery_state @message = open_struct&.message @order_nu...
bonusly/cadooz
lib/cadooz.rb
<gh_stars>1-10 require 'json' require 'money' require 'ostruct' require 'savon' module Cadooz class Configuration attr_accessor :username, :password, :wsdl, :generation_profile, :program_id, :payment_username, :payment_password WSDL = 'https://webservices.cadooz.com/services/businessorder/1.5.2/BusinessOrde...
bonusly/cadooz
lib/cadooz/models/immutable/response.rb
<reponame>bonusly/cadooz class Cadooz::Immutable::Response include Mixins attr_reader :object, :raw def initialize(object, raw_response) @object = object @raw = raw_response self.freeze end end
bonusly/cadooz
lib/cadooz/models/immutable/catalog.rb
<reponame>bonusly/cadooz<filename>lib/cadooz/models/immutable/catalog.rb class Cadooz::Immutable::Catalog include Mixins attr_reader :id, :name, :description, :products def initialize(open_struct) @id = open_struct&.id @name = open_struct&.name @description = open_struct&.description @products =...
mitixx/abilitysheet
app/controllers/recommends_controller.rb
# frozen_string_literal: true class RecommendsController < ApplicationController before_action :load_color before_action :load_sheets def index @title = '地力値表' end private def load_sheets @sheets = Sheet.active.preload(:ability) end def load_color @color = Static::COLOR end end
mitixx/abilitysheet
db/migrate/20190428173620_change_column_bigint_fk.rb
class ChangeColumnBigintFk < ActiveRecord::Migration[5.2] def change change_column :abilities, :sheet_id, :bigint change_column :follows, :user_id, :bigint change_column :follows, :target_user_id, :bigint change_column :logs, :user_id, :bigint change_column :logs, :sheet_id, :bigint change_...
mitixx/abilitysheet
app/controllers/scores_controller.rb
# frozen_string_literal: true class ScoresController < ApplicationController before_action :authenticate_user! before_action :check_xhr before_action :load_score before_action :score_exists?, only: %w[edit] def edit @sheet = Sheet.find(params[:id]) @pre_score = current_user.scores.find_by(sheet_id: ...
mitixx/abilitysheet
app/helpers/application_helper.rb
# frozen_string_literal: true module ApplicationHelper def return_ability_rival(cnt) params[:action] == 'clear' ? @sheets[cnt].n_ability : @sheets[cnt].h_ability end def adsense(slot = 2) react_component_wrapper 'Adsense', slot: slot end def react_component_wrapper(component, props = {}) props[...
mitixx/abilitysheet
spec/systems/logs/sheet_spec.rb
# frozen_string_literal: true feature '推移ログ', type: :system, js: true do given(:user) { create(:user, id: 1) } context 'ログが存在しない場合' do context 'ログイン時' do background do login(user) visit sheet_log_path(user.iidxid) end scenario 'クリア推移表の文字列が存在する' do expect(page).to have_...
mitixx/abilitysheet
app/jobs/sync_sheets_job.rb
# frozen_string_literal: true require 'ist_client' class SyncSheetsJob < ApplicationJob queue_as :system def perform(date = Date.today - 2.days) client = IstClient.new sheets = client.get_musics( q: { charts_play_type_status_eq: 0, charts_level_eq: 12, charts_updated_at_gteq...
mitixx/abilitysheet
app/controllers/admin/messages_controller.rb
# frozen_string_literal: true class Admin::MessagesController < ApplicationController before_action :authenticate_user! before_action :admin_user! before_action :load_message, except: [:index] def index @search = Message.ransack(params[:q]) @messages = @search.result end def active @message.u...
mitixx/abilitysheet
app/jobs/version_up_job.rb
<filename>app/jobs/version_up_job.rb # frozen_string_literal: true class VersionUpJob < ApplicationJob queue_as :system def perform User.version_up! end end
mitixx/abilitysheet
spec/decorators/mail_decorator_spec.rb
# frozen_string_literal: true describe MailDecorator do end
mitixx/abilitysheet
lib/scrape/exh_collector.rb
# frozen_string_literal: true require 'open-uri' module Scrape class ExhCollector def initialize @url = 'https://www65.atwiki.jp/sp12ex-hard/pages/12.html' end def get_sheet text = URI.open(@url).read # rubocop:disable all html = Nokogiri::HTML.parse(text) parse(html) end ...
mitixx/abilitysheet
spec/decorators/message_decorator_spec.rb
<reponame>mitixx/abilitysheet<gh_stars>10-100 # frozen_string_literal: true describe MessageDecorator do before { create(:user, id: 1) } describe '#user_name' do context 'user_idが指定されていない' do it '匿名と表示' do message = build_stubbed(:message).decorate expect(message.user_name).to eq '匿名' ...
mitixx/abilitysheet
app/models/user.rb
<reponame>mitixx/abilitysheet # frozen_string_literal: true # == Schema Information # # Table name: users # # id :bigint(8) not null, primary key # email :string default(""), not null # username :string default(""), not null # encrypted_...
mitixx/abilitysheet
spec/services/clearing_transition_table_service_spec.rb
# frozen_string_literal: true describe ClearingTransitionTableService, type: :service do let(:user) { create(:user) } let(:sheet) { create(:sheet, active: true) } it 'ログの状態から正しく楽曲の推移hashが作れること' do user.logs.create!(sheet_id: sheet.id, pre_state: 4, new_state: 3, created_date: Date.today - 1.day) user.lo...
mitixx/abilitysheet
config/routes.rb
Rails.application.routes.draw do # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html devise_for :users, controllers: { registrations: 'users/registrations', passwords: '<PASSWORD>', omniauth_callbacks: 'users/omniauth_callbacks' } resources :google, ...
mitixx/abilitysheet
app/controllers/admin/users_controller.rb
# frozen_string_literal: true class Admin::UsersController < ApplicationController before_action :authenticate_user! before_action :admin_user! before_action :check_xhr, except: %i[index login] before_action :load_user, except: %i[index new create] def index @q = User.ransack(params[:q]) @q.sorts = ...
mitixx/abilitysheet
app/mailers/devise/mailer.rb
# frozen_string_literal: true class Devise::Mailer < Devise.parent_mailer.constantize include Devise::Mailers::Helpers def reset_password_instructions(record, token, opts = {}) @token = token devise_mail(record, :reset_password_instructions, opts) end def unlock_instructions(record, token, opts = {})...
mitixx/abilitysheet
spec/models/log_spec.rb
# frozen_string_literal: true # == Schema Information # # Table name: logs # # id :bigint(8) not null, primary key # user_id :bigint(8) # sheet_id :bigint(8) # pre_state :integer # new_state :integer # pre_score :integer # new_score :integer # pre_bp :integer # new_...
mitixx/abilitysheet
spec/systems/logs/list_spec.rb
# frozen_string_literal: true feature 'ログ一覧', type: :system do given(:user) { create(:user, id: 1) } background do login(user) visit list_log_path(user.iidxid) end scenario 'ログ一覧ページが閲覧できる' do expect(page).to have_content('更新履歴') end end
mitixx/abilitysheet
app/decorators/user_decorator.rb
<filename>app/decorators/user_decorator.rb # frozen_string_literal: true class UserDecorator < Draper::Decorator delegate_all def pref User::Static::PREF[object.pref] end def grade User::Static::GRADE[object.grade] end def belongs User::Static::PREF[object.pref] end def dan User::St...
mitixx/abilitysheet
app/controllers/sheets_controller.rb
<gh_stars>10-100 # frozen_string_literal: true class SheetsController < ApplicationController before_action :load_user before_action :check_action, except: %i[change_reverse detail] def show load_static unless params[:type] == 'power' # FIXME: params[:type]から判別できるのでpower以外はコントローラ通さなくて良い # フロント部分も結構変...
mitixx/abilitysheet
db/seeds.rb
<reponame>mitixx/abilitysheet uri = URI.parse('https://sp12.iidx.app/api/v1/sheets/list') sheets = JSON.parse(Net::HTTP.get(uri)) sheets['sheets'].each { |sheet| Sheet.create(sheet) }
mitixx/abilitysheet
app/controllers/messages_controller.rb
<filename>app/controllers/messages_controller.rb # frozen_string_literal: true require 'slack/message_dispatcher' class MessagesController < ApplicationController def new @message = Message.new end def create message = Message.new(message_params) message.user_id = current_user.id if user_signed_in?...
mitixx/abilitysheet
app/controllers/api/v1/users_controller.rb
# frozen_string_literal: true class Api::V1::UsersController < Api::V1::BaseController def status render json: { status: current_user.try(:iidxid) } end def me render json: { current_user: current_user.try(:schema) } end end
mitixx/abilitysheet
app/models/log.rb
# frozen_string_literal: true # == Schema Information # # Table name: logs # # id :bigint(8) not null, primary key # user_id :bigint(8) # sheet_id :bigint(8) # pre_state :integer # new_state :integer # pre_score :integer # new_score :integer # pre_bp :integer # new_...
mitixx/abilitysheet
app/controllers/rivals_controller.rb
<filename>app/controllers/rivals_controller.rb<gh_stars>10-100 # frozen_string_literal: true class RivalsController < ApplicationController before_action :authenticate_user! before_action :load_sheet, only: %i[clear hard] def list @users = current_user.follow_users load_rival end def reverse_list ...
mitixx/abilitysheet
spec/models/score_spec.rb
# frozen_string_literal: true # == Schema Information # # Table name: scores # # id :bigint(8) not null, primary key # state :integer default(7), not null # score :integer # bp :integer # sheet_id :bigint(8) not null # user_id :bigint(8) not null # ve...