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
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
test/controllers/mongoid_forums/admin/users_controller_test.rb
Ruby
mit
19
master
206
require 'test_helper' module MongoidForums class Admin::UsersControllerTest < ActionController::TestCase test "should get index" do get :index assert_response :success end end end
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
test/controllers/mongoid_forums/admin/groups_controller_test.rb
Ruby
mit
19
master
735
require 'test_helper' module MongoidForums class Admin::GroupsControllerTest < ActionController::TestCase test "should get index" do get :index assert_response :success end test "should get new" do get :new assert_response :success end test "should get create" do g...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
test/dummy/config/application.rb
Ruby
mit
19
master
1,164
require File.expand_path('../boot', __FILE__) # Pick the frameworks you want: # require "active_record/railtie" require "action_view/railtie" require "sprockets/railtie" require "action_controller/railtie" require "action_mailer/railtie" require "rails/test_unit/railtie" require "sprockets/railtie" # Uncomment this li...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
test/dummy/config/environments/development.rb
Ruby
mit
19
master
1,573
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 # since you don't have to restart the web serv...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
test/dummy/config/initializers/mongoid_forums.rb
Ruby
mit
19
master
270
MongoidForums.user_class = "User" MongoidForums.email_from_address = "please-change-me@example.com" # If you do not want to use gravatar for avatars then specify the method to use here: # MongoidForums.avatar_user_method = :custom_avatar_url MongoidForums.per_page = 20
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
test/dummy/config/initializers/devise.rb
Ruby
mit
19
master
12,744
# Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| # The secret key used by Devise. Devise uses this key to generate # random tokens. Changing this key will render invalid all existing # confirmat...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
test/dummy/config/initializers/kaminari_config.rb
Ruby
mit
19
master
255
Kaminari.configure do |config| # config.default_per_page = 25 # config.max_per_page = nil # config.window = 4 # config.outer_window = 0 # config.left = 0 # config.right = 0 # config.page_method_name = :page # config.param_name = :page end
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
test/dummy/app/models/user.rb
Ruby
mit
19
master
1,336
class User include Mongoid::Document # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable include ZeroOidFix ## Database authenticat...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
test/dummy/app/models/concerns/zero_oid_fix.rb
Ruby
mit
19
master
254
module ZeroOidFix extend ActiveSupport::Concern module ClassMethods def serialize_from_session(key, salt) record = to_adapter.get((key[0]["$oid"] rescue nil)) record if record && record.authenticatable_salt == salt end end end
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
test/dummy/app/controllers/application_controller.rb
Ruby
mit
19
master
292
class ApplicationController < ActionController::Base def mongoid_forums_user current_user end helper_method :mongoid_forums_user # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception end
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
config/routes.rb
Ruby
mit
19
master
1,755
MongoidForums::Engine.routes.draw do namespace :admin do root :to => 'base#index' resources :forums do post '/add_group' => 'forums#add_group', as: :add_group post '/rem_group' => 'forums#remove_group', as: :rem_group end resources :categories do post '/add_group' => 'categories#add...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/controllers/mongoid_forums/topics_controller.rb
Ruby
mit
19
master
2,497
require_dependency "mongoid_forums/application_controller" module MongoidForums class TopicsController < ApplicationController before_filter :find_forum, :except => [:my_subscriptions, :my_posts, :my_topics] def show if find_topic register_view @posts = @topic.posts.order_by([:created...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/controllers/mongoid_forums/redirect_controller.rb
Ruby
mit
19
master
810
require_dependency "mongoid_forums/application_controller" module MongoidForums class RedirectController < ApplicationController def forum return redirect_to forum_path(params[:forum_id]) end def topic return redirect_to topic_path(params[:topic_id]) end def posts post ...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/controllers/mongoid_forums/application_controller.rb
Ruby
mit
19
master
1,924
require 'cancan' class MongoidForums::ApplicationController < ApplicationController helper MongoidForums::Engine.helpers rescue_from CanCan::AccessDenied do redirect_to root_path, :alert => t("mongoid.access_denied") end def current_ability MongoidForums::Ability.new(mongoid_forums_user) end bef...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/controllers/mongoid_forums/forums_controller.rb
Ruby
mit
19
master
1,779
require_dependency "mongoid_forums/application_controller" module MongoidForums class ForumsController < ApplicationController load_and_authorize_resource :class => 'MongoidForums::Forum', :only => :show before_filter :authenticate_mongoid_forums_user, :only => [:create, :new] def index @categorie...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/controllers/mongoid_forums/posts_controller.rb
Ruby
mit
19
master
3,384
require_dependency "mongoid_forums/application_controller" module MongoidForums class PostsController < ApplicationController before_filter :find_topic before_filter :authenticate_mongoid_forums_user, except: :show before_filter :reject_locked_topic!, only: [:new, :create] def new authorize! :...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/controllers/mongoid_forums/admin/users_controller.rb
Ruby
mit
19
master
695
require_dependency "mongoid_forums/application_controller" module MongoidForums module Admin class UsersController < BaseController before_action :set_user, only: [:add_admin, :remove_admin] def index @admins = User.where(mongoid_admin: true) @non_admins = User.where(mongoid_admin: ...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/controllers/mongoid_forums/admin/categories_controller.rb
Ruby
mit
19
master
2,307
require_dependency "mongoid_forums/application_controller" module MongoidForums module Admin class CategoriesController < BaseController before_action :set_category, only: [:add_group, :remove_group] def index @forums = Forum.asc(:position) @categories = Category.asc(:position) ...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/controllers/mongoid_forums/admin/topics_controller.rb
Ruby
mit
19
master
1,320
module MongoidForums module Admin class TopicsController < BaseController before_filter :find_topic def edit end def update @topic.subject = params[:topic][:subject] @topic.pinned = params[:topic][:pinned] @topic.locked = params[:topic][:locked] @topi...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/controllers/mongoid_forums/admin/base_controller.rb
Ruby
mit
19
master
482
require_dependency "mongoid_forums/application_controller" module MongoidForums class Admin::BaseController < ApplicationController before_filter :authenticate_mongoid_forums_admin def index end def authenticate_mongoid_forums_admin if !mongoid_forums_user || !mongoid_forums_user.mongoid_foru...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/controllers/mongoid_forums/admin/forums_controller.rb
Ruby
mit
19
master
2,145
require_dependency "mongoid_forums/application_controller" module MongoidForums module Admin class Admin::ForumsController < BaseController before_action :set_forum, only: [:add_group, :remove_group] def index @forums = Forum.all end def new @forum = Forum.new end ...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/controllers/mongoid_forums/admin/groups_controller.rb
Ruby
mit
19
master
2,245
require_dependency "mongoid_forums/application_controller" module MongoidForums module Admin class GroupsController < BaseController def index @groups = Group.all end def new @group = Group.new end def create @group = Group.new(params.require(:group).perm...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/helpers/mongoid_forums/formatting_helper.rb
Ruby
mit
19
master
1,207
module MongoidForums module FormattingHelper # override with desired markup formatter, e.g. textile or markdown def as_formatted_html(text) if MongoidForums.formatter MongoidForums.formatter.format(as_sanitized_text(text)) else MongoidForums::Sanitizer.sanitize(text).html_safe ...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/helpers/mongoid_forums/forums_helper.rb
Ruby
mit
19
master
328
module MongoidForums module ForumsHelper def topics_count(forum) forum.topics.count end def posts_count(forum) if forum.posts_count == nil forum.posts_count = forum.topics.inject(0) {|sum, topic| topic.posts.count + sum } forum.save end forum.posts_count end ...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/helpers/mongoid_forums/application_helper.rb
Ruby
mit
19
master
549
module MongoidForums module ApplicationHelper include FormattingHelper # processes text with installed markup formatter def mongoid_forums_format(text, *options) emojify(as_formatted_html(text)) end def mongoid_forums_quote(text) as_quoted_text(text) end def mongoid_forums_ma...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/models/mongoid_forums/forum.rb
Ruby
mit
19
master
1,644
module MongoidForums class Forum include Mongoid::Document include MongoidForums::Concerns::Viewable belongs_to :category, :class_name => "MongoidForums::Category" validates :category, :presence => true has_many :topics, :class_name => "MongoidForums::Topic", dependent: :destroy # Caching ...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/models/mongoid_forums/ability.rb
Ruby
mit
19
master
2,238
module MongoidForums class Ability include CanCan::Ability class_attribute :abilities self.abilities = Set.new # Allows us to go beyond the standard cancan initialize method which makes it difficult for engines to # modify the default +Ability+ of an application. The +ability+ argument m...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/models/mongoid_forums/view.rb
Ruby
mit
19
master
754
module MongoidForums class View include Mongoid::Document include Mongoid::Timestamps field :current_viewed_at, :type => DateTime field :past_viewed_at, :type => DateTime before_create :set_viewed_at_to_now belongs_to :viewable, :polymorphic => true, :index => true belongs_to :user, :cl...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/models/mongoid_forums/alert.rb
Ruby
mit
19
master
2,701
=begin Copyright 2011 Ryan Bigg, Philip Arndt and Josh Adams This code was obtained from: https://github.com/kultus/forem-2/blob/master/app/models/forem/alert.rb Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal ...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/models/mongoid_forums/post.rb
Ruby
mit
19
master
1,023
module MongoidForums class Post include Mongoid::Document include Mongoid::Timestamps after_create :set_topic_last_post_at belongs_to :topic, :class_name => "MongoidForums::Topic" belongs_to :user, :class_name => MongoidForums.user_class.to_s belongs_to :reply_to, :class_name => "MongoidFo...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/models/mongoid_forums/group.rb
Ruby
mit
19
master
272
module MongoidForums class Group include Mongoid::Document validates :name, :moderator, :presence => true field :name, type: String field :moderator, type: Boolean field :members, type: Array, default: [] def to_s name end end end
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/models/mongoid_forums/subscription.rb
Ruby
mit
19
master
2,539
=begin Copyright 2011 Ryan Bigg, Philip Arndt and Josh Adams This code was obtained from: https://github.com/kultus/forem-2/blob/master/app/models/forem/subscription.rb Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), t...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/models/mongoid_forums/topic.rb
Ruby
mit
19
master
1,498
module MongoidForums class Topic include Mongoid::Document include Mongoid::Timestamps include MongoidForums::Concerns::Subscribable include MongoidForums::Concerns::Viewable after_create :subscribe_creator belongs_to :forum, :class_name => "MongoidForums::Forum" has_many :posts, :class_...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/models/mongoid_forums/category.rb
Ruby
mit
19
master
790
module MongoidForums class Category include Mongoid::Document has_many :forums, :class_name => "MongoidForums::Forum", dependent: :destroy has_and_belongs_to_many :moderator_groups, :class_name => "MongoidForums::Group", inverse_of: nil field :name validates :name, :presence => true field...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/models/mongoid_forums/concerns/subscribable.rb
Ruby
mit
19
master
2,750
=begin Copyright 2011 Ryan Bigg, Philip Arndt and Josh Adams This code was obtained from: https://github.com/kultus/forem-2/blob/master/app/models/forem/concerns/subscribable.rb Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Soft...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
app/models/mongoid_forums/concerns/viewable.rb
Ruby
mit
19
master
1,953
=begin Copyright 2011 Ryan Bigg, Philip Arndt and Josh Adams This code was obtained from: https://github.com/kultus/forem-2/blob/master/app/models/forem/concerns/viewable.rb Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
lib/mongoid_forums.rb
Ruby
mit
19
master
1,583
# Fix for #185 and build issues require 'active_support/core_ext/kernel/singleton_class' require 'decorators' require "mongoid_forums/engine" require 'mongoid_forums/sanitizer' require 'mongoid_forums/default_permissions' require 'sanitize' require 'haml' require "mongoid" module MongoidForums mattr_accessor :per_pa...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
lib/generators/mongoid_forums/install_generator.rb
Ruby
mit
19
master
3,169
# Thanks to radar/forem # The code used to inspire this generator! require 'mongoid_forums' require 'rails/generators' module MongoidForums module Generators class InstallGenerator < Rails::Generators::Base class_option "user-class", :type => :string class_option "current-user-helper", :type => :strin...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
lib/generators/mongoid_forums/views_generator.rb
Ruby
mit
19
master
778
# Thanks to plataformatec/devise # The code used to inspire this generator! require 'rails/generators' module MongoidForums module Generators class ViewsGenerator < Rails::Generators::Base #:nodoc: source_root File.expand_path("../../../../app/views/mongoid_forums", __FILE__) desc "Used to copy Mongoi...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
lib/generators/mongoid_forums/install/templates/initializer.rb
Ruby
mit
19
master
318
MongoidForums.user_class = "<%= user_class %>" MongoidForums.email_from_address = "please-change-me@example.com" # If you do not want to use gravatar for avatars then specify the method to use here: # MongoidForums.avatar_user_method = :custom_avatar_url MongoidForums.per_page = <%= MongoidForums.per_page.inspect %>
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
lib/mongoid_forums/sanitizer.rb
Ruby
mit
19
master
225
require 'sanitize' # This is exists so formatters can access it if it so pleases them. module MongoidForums class Sanitizer def self.sanitize(text) Sanitize.clean(text, Sanitize::Config::BASIC) end end end
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
lib/mongoid_forums/engine.rb
Ruby
mit
19
master
394
require 'simple_form' require 'kaminari' require 'emoji' module MongoidForums class Engine < ::Rails::Engine isolate_namespace MongoidForums class << self attr_accessor :root def root @root ||= Pathname.new(File.expand_path('../../../', __FILE__)) end end config.to_prepare...
github
NJayDevelopment/mongoid_forums
https://github.com/NJayDevelopment/mongoid_forums
lib/mongoid_forums/default_permissions.rb
Ruby
mit
19
master
1,647
module MongoidForums # Defines a whole bunch of permissions for mongoid_forums # Access (most) areas by default module DefaultPermissions extend ActiveSupport::Concern included do unless method_defined?(:can_read_mongoid_forums_category?) def can_read_mongoid_forums_category?(category) ...
github
factore/has_foreign_language
https://github.com/factore/has_foreign_language
spec_helper.rb
Ruby
mit
19
master
231
require 'rspec' class I18n class << self attr_accessor :locale, :default_locale end end require 'has_foreign_language' RSpec.configure do |config| config.color_enabled = true config.formatter = 'documentation' end
github
factore/has_foreign_language
https://github.com/factore/has_foreign_language
has_foreign_language.gemspec
Ruby
mit
19
master
473
Gem::Specification.new do |s| s.name = "has_foreign_language" s.version = '0.0.3' s.authors = ["Sean Roberts"] s.email = ["sean@factore.ca"] s.summary = "Easy database internationalization gem for Ruby on Rails" s.description = "Easy database internationalization gem for Ruby on Rails" ...
github
factore/has_foreign_language
https://github.com/factore/has_foreign_language
Rakefile
Ruby
mit
19
master
208
require 'rubygems' require 'rake' require 'rspec/core/rake_task' Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext } RSpec::Core::RakeTask.new desc "Run specs" task :default => :spec
github
factore/has_foreign_language
https://github.com/factore/has_foreign_language
lib/form_fix.rb
Ruby
mit
19
master
812
module ActionView module Helpers class InstanceTag class << self def value(object, method_name) method_name += "_#{I18n.locale}" if I18n.locale != I18n.default_locale && object.class.columns.select {|c| c.name == "#{method_name}_#{I18n.locale}"}.length > 0 object.send method_name...
github
factore/has_foreign_language
https://github.com/factore/has_foreign_language
lib/has_foreign_language.rb
Ruby
mit
19
master
1,489
# HasForeignLanguage module Factore module HasForeignLanguage def self.included(mod) mod.extend(ClassMethods) end module ClassMethods def has_foreign_language(*args) args.each do |field| # Define the Getter define_method(field.to_s) do if I18n.locale !...
github
factore/has_foreign_language
https://github.com/factore/has_foreign_language
spec/models/has_foreign_language_spec.rb
Ruby
mit
19
master
2,177
require 'spec_helper' require 'i18n' # Define some classes so we don't have to load Rails class Object def blank? respond_to?(:empty?) ? empty? : !self end end class Column attr_accessor :name def initialize(name) @name = name end end class FakeAR include Factore::HasForeignLanguage attr_access...
github
pelargir/uploadify
https://github.com/pelargir/uploadify
Rakefile
Ruby
mit
19
master
611
require 'rubygems' require 'rake' begin require 'jeweler' Jeweler::Tasks.new do |gemspec| gemspec.name = "uploadify" gemspec.summary = "Adds multi-file upload support to your Rails app." gemspec.description = "Adds multi-file upload support to your Rails application using Uploadify, a JQuery plugin." ...
github
pelargir/uploadify
https://github.com/pelargir/uploadify
uploadify.gemspec
Ruby
mit
19
master
2,015
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{uploadify} s.version = "0.5.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required...
github
pelargir/uploadify
https://github.com/pelargir/uploadify
lib/flash_session_cookie_middleware.rb
Ruby
mit
19
master
455
require 'rack/utils' class FlashSessionCookieMiddleware def initialize(app, session_key = '_session_id') @app = app @session_key = session_key end def call(env) if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/ req = Rack::Request.new(env) unless req.params[@session_key].nil...
github
pelargir/uploadify
https://github.com/pelargir/uploadify
lib/uploadify.rb
Ruby
mit
19
master
336
# Supports multi-file uploads via uploadify # http://railstips.org/blog/archives/2009/07/21/uploadify-and-rails23/ Rails.configuration.after_initialize do ActionController::Dispatcher.middleware.insert_before(ActionController::Session::CookieStore, FlashSessionCookieMiddleware, ActionController::Base.session_op...
github
pelargir/uploadify
https://github.com/pelargir/uploadify
generators/uploadify/uploadify_generator.rb
Ruby
mit
19
master
493
class UploadifyGenerator < Rails::Generator::Base def manifest record do |m| m.directory 'public/uploadify' %w( cancel.png jquery-1.3.2.min.js jquery.uploadify.v2.1.0.js jquery.uploadify.v2.1.0.min.js swfobject.js uploadify.allglyphs.swf uploadif...
github
brunobatista25/RubyGene
https://github.com/brunobatista25/RubyGene
rubygene.gemspec
Ruby
mit
19
master
1,237
lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'generate_ruby_tests/version' Gem::Specification.new do |spec| spec.name = 'rubygene' spec.version = GenerateRubyTests::VERSION spec.authors = ['brunobatista25'] spec.email = ...
github
brunobatista25/RubyGene
https://github.com/brunobatista25/RubyGene
spec/generate_ruby_teste_rspec_spec.rb
Ruby
mit
19
master
10,850
require 'fileutils' RSpec.describe GenerateRubyTests do describe 'Rubygene' do before(:each) do @project_name_web = 'web_automator_rspec' @project_name_api = 'api_automator_rspec' end after(:each) do FileUtils.rm_rf(@project_name_web) FileUtils.rm_rf(@project_name_api) end ...
github
brunobatista25/RubyGene
https://github.com/brunobatista25/RubyGene
spec/spec_helper.rb
Ruby
mit
19
master
411
require 'bundler/setup' require 'generate_ruby_tests' require 'simplecov' SimpleCov.start RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` config.dis...
github
brunobatista25/RubyGene
https://github.com/brunobatista25/RubyGene
spec/generate_ruby_tests_spec.rb
Ruby
mit
19
master
19,573
require 'fileutils' RSpec.describe GenerateRubyTests do it 'validar que nao esta nulo' do expect(GenerateRubyTests::VERSION).not_to be nil end describe 'Rubygene' do before(:each) do @project_name_web = 'web_automator' @project_name_api = 'api_automator' @project_name_mobile = 'mobile_...
github
brunobatista25/RubyGene
https://github.com/brunobatista25/RubyGene
lib/SkeletonRspecApi/specs/spec_helper.rb
Ruby
mit
19
master
4,158
require 'httparty' require 'httparty/request' require 'httparty/response/headers' RSpec.configure do |config| config.color = true config.formatter = :documentation # rspec-expectations config goes here. You can use an alternate # assertion/expectation library such as wrong or the stdlib/minitest # assertions...
github
brunobatista25/RubyGene
https://github.com/brunobatista25/RubyGene
lib/SkeletonRspecWeb/Gemfile
Ruby
mit
19
master
207
source 'http://rubygems.org' gem 'allure-rspec' gem 'capybara', '<3.3' gem 'chromedriver-helper' gem 'faker' gem 'rake' gem 'rspec' gem 'rubocop' gem 'selenium-webdriver', '~>3.4' gem 'site_prism', '2.15.1'
github
brunobatista25/RubyGene
https://github.com/brunobatista25/RubyGene
lib/SkeletonRspecWeb/specs/spec_helper.rb
Ruby
mit
19
master
2,405
# frozen_string_literal: true require 'allure-rspec' require 'capybara' require 'capybara/dsl' require 'capybara/rspec/matchers' require 'faker' require 'logger' require 'rspec' require 'rspec/expectations' require 'selenium-webdriver' require 'site_prism' require 'ostruct' require 'yaml' require_relative '../support/...
github
brunobatista25/RubyGene
https://github.com/brunobatista25/RubyGene
lib/SkeletonWeb/Rakefile
Ruby
mit
19
master
753
desc "Executar os testes em dev usando o Chrome" task :test_chrome_dev do puts "Executando test:chrome:dev" sh "bundle exec cucumber -p pretty -p html -p dev -p no_headless" end desc "Executar os testes em dev usando o Chrome headless" task :test_chrome_dev_headless do puts "Executando test:chrome:dev" sh "bun...
github
brunobatista25/RubyGene
https://github.com/brunobatista25/RubyGene
lib/SkeletonWeb/features/support/env.rb
Ruby
mit
19
master
1,083
require 'capybara' require 'capybara/cucumber' require 'byebug' require 'selenium-webdriver' require 'site_prism' require 'rspec' require_relative 'helper.rb' require_relative 'page_helper.rb' World(Pages) World(Helper) ENVIRONMENT_TYPE = ENV['ENVIRONMENT_TYPE'] HEADLESS = ENV['HEADLESS'] CONFIG = YAML.load_file(Fil...
github
brunobatista25/RubyGene
https://github.com/brunobatista25/RubyGene
lib/SkeletonWeb/features/support/helper.rb
Ruby
mit
19
master
594
# encoding: utf-8 # !/usr/bin/env ruby require 'fileutils' # metodo para tira screenshot e imbutir no relatorio html module Helper def take_screenshot(file_name, result) file_path = "results/screenshots/test_#{result}" screenshot = "#{file_path}/#{file_name}.png" page.save_screenshot(screenshot) embed...
github
brunobatista25/RubyGene
https://github.com/brunobatista25/RubyGene
lib/SkeletonWeb/features/support/hooks.rb
Ruby
mit
19
master
272
require_relative 'helper.rb' After do |scenario| scenario_name = scenario.name.gsub(/[^A-Za-z ]/, '').gsub(/\s+/, '_') if scenario.failed? take_screenshot(scenario_name.downcase!, 'failed') else take_screenshot(scenario_name.downcase!, 'passed') end end
github
brunobatista25/RubyGene
https://github.com/brunobatista25/RubyGene
lib/SkeletonApi/Rakefile
Ruby
mit
19
master
275
desc "Executar os testes em dev" task :test_dev do puts "Executando test:dev" sh "bundle exec cucumber -p pretty -p html -p dev" end desc "Executar os testes em hmg" task :test_hmg do puts "Executando test:hmg" sh "bundle exec cucumber -p pretty -p html -p hmg" end
github
brunobatista25/RubyGene
https://github.com/brunobatista25/RubyGene
lib/SkeletonApi/features/support/env.rb
Ruby
mit
19
master
369
require 'byebug' require 'cucumber' require 'httparty' require 'httparty/request' require 'httparty/response/headers' require 'rspec' ENVIRONMENT = ENV['ENVIRONMENT'] CONFIG = YAML.load_file(File.dirname(__FILE__) + "/config/#{ENVIRONMENT}.yml") Dir[File.join(File.dirname(__FILE__), '../services/*_serv...
github
brunobatista25/RubyGene
https://github.com/brunobatista25/RubyGene
lib/generate_ruby_tests/generate_ruby_test_helper.rb
Ruby
mit
19
master
3,242
#!/usr/bin/env ruby def create_feature_file(name) # opcoes usadas para gerar o arquivo na funcao de modelo opts = { name: camelize(name) } # Thor cria um arquivo com base no modelo templates/feature.tt template('feature', File.join(FileUtils.pwd, 'features', 'specifications', "#...
github
brunobatista25/RubyGene
https://github.com/brunobatista25/RubyGene
lib/SkeletonMobile/features/support/env.rb
Ruby
mit
19
master
514
require 'appium_lib' require 'yaml' require_relative 'page_helper.rb' require_relative 'helper.rb' SERVER_URL = 'http://localhost:4723/wd/hub'.freeze PORT = 4723 TWENTY_SECONDS = 20 World(Screens) World(Helper) Before do def opts { caps: { deviceName: 'Nexus 5X API 25', platformName: 'And...
github
brunobatista25/RubyGene
https://github.com/brunobatista25/RubyGene
lib/SkeletonMobile/features/support/hooks.rb
Ruby
mit
19
master
709
Before do @appium_driver = Appium::Driver.new(opts, true) Appium.promote_appium_methods Object @settings = YAML.load_file(File.expand_path('../../cucumber.yml', File.dirname(__FILE__))) @driver.start_driver @driver.set_wait(TWENTY_SECONDS) end def scroll_screen(x...
github
brunobatista25/RubyGene
https://github.com/brunobatista25/RubyGene
lib/SkeletonMobile/features/support/helper.rb
Ruby
mit
19
master
348
# encoding: utf-8 # !/usr/bin/env ruby # metodo para tira screenshot e imbutir no relatorio html module Helper def take_screenshot(file_name, result) file_path = "results/screenshots/test_#{result}" screenshot = "#{file_path}/#{file_name}.png" @driver.screenshot(screenshot) embed(screenshot, 'image/pn...
github
Warrenoo/fibman
https://github.com/Warrenoo/fibman
Rakefile
Ruby
mit
19
master
615
#!/usr/bin/env rake begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks.' end # === Bundler === Bundler::GemHelper.install_tasks # === RSpec === require 'rspec/core/rake_task' RSpec::Core::RakeTask.new :spec # === RuboCop === require 'ru...
github
Warrenoo/fibman
https://github.com/Warrenoo/fibman
fibman.gemspec
Ruby
mit
19
master
1,126
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'fibman/version' Gem::Specification.new do |spec| spec.name = 'fibman' spec.version = Fibman::VERSION spec.authors = ['Warrenoo'] spec.email = ['541991a@gmail....
github
Warrenoo/fibman
https://github.com/Warrenoo/fibman
lib/fibman.rb
Ruby
mit
19
master
641
require "forwardable" require "active_support/all" require "fibman/railtie" if defined? Rails require "fibman/config" require "fibman/container" require "fibman/element" require "fibman/element_package" require "fibman/error" require "fibman/fpa" require "fibman/permission" require "fibman/permissions_collection" req...
github
Warrenoo/fibman
https://github.com/Warrenoo/fibman
lib/fibman/container.rb
Ruby
mit
19
master
973
module Fibman class Container extend Forwardable attr_accessor :name, :key, :permissions, :config, :fpa def_delegator :permissions, :permissions_info def_delegator :config, :configure, :config_configure cattr_accessor(:containers) { [] } def initialize key, name @key = key @nam...
github
Warrenoo/fibman
https://github.com/Warrenoo/fibman
lib/fibman/fpa.rb
Ruby
mit
19
master
410
# Fibman Persistence Adapter module Fibman class Fpa attr_accessor :redis def initialize redis=nil @redis = redis end def save redis_key, content redis.sadd redis_key, content end def get redis_key return nil unless redis.exists(redis_key) redis.smembers(redis_key).m...
github
Warrenoo/fibman
https://github.com/Warrenoo/fibman
lib/fibman/element.rb
Ruby
mit
19
master
1,069
module Fibman class Element attr_reader :type, :core, :condition, :permission_key TYPE = %w(key action url).freeze def initialize type, core, condition=->(*args){} raise UnValidElementType, "current type -> #{type}, type need in (#{TYPE.join(", ")})!" unless TYPE.include? type @type = type ...
github
Warrenoo/fibman
https://github.com/Warrenoo/fibman
lib/fibman/error.rb
Ruby
mit
19
master
483
module Fibman class UnValidElementType < RuntimeError; end class UnDefinedModel < RuntimeError; end class MissParameter < RuntimeError; end class ParameterIsNotValid < RuntimeError; end class RoleIsNotFind < RuntimeError; end class UserClassIsNotFind < RuntimeError; end class PermissionIsNotFind < Runtime...
github
Warrenoo/fibman
https://github.com/Warrenoo/fibman
lib/fibman/permissions_collection.rb
Ruby
mit
19
master
4,149
module Fibman class PermissionsCollection extend Forwardable attr_reader :permissions, :package attr_accessor :container # 通过package 快速查询权限 def_delegators :package, :find_key, :find_url, :find_action def initialize @permissions = {} @package = Fibman::ElementPackage.new end ...
github
Warrenoo/fibman
https://github.com/Warrenoo/fibman
lib/fibman/permission.rb
Ruby
mit
19
master
1,494
# Permission Particle module Fibman class Permission extend Forwardable attr_reader :key, :name, :package, :bind, :display attr_accessor :container def_delegators :package, :append def initialize key, options={} @key = key.to_sym @name = options[:name] || key.to_s @package = o...
github
Warrenoo/fibman
https://github.com/Warrenoo/fibman
lib/fibman/railtie.rb
Ruby
mit
19
master
339
module Fibman class Railtie < Rails::Railtie initializer "fibman.initialize_dsl" do ActiveSupport.on_load(:action_controller) do include Fibman::Additions::ControllerDslAddition end ActiveSupport.on_load(:active_record) do include Fibman::Additions::TargeterDslAddition end...
github
Warrenoo/fibman
https://github.com/Warrenoo/fibman
lib/fibman/element_package.rb
Ruby
mit
19
master
2,718
# Element对象集合 # 将element的三种type拆分存储 # keys: key类型element hash # actions: action类型element {controller_name: hash} # urls: url类型element 以'/'分割的字典树 # 使用lazy_build方式生成keys actions urls,只在查询时构建 # mutex 为 true 时需要重新build module Fibman class ElementPackage attr_reader :keys, :actions, :urls, :origin_elements, :mutex ...
github
Warrenoo/fibman
https://github.com/Warrenoo/fibman
lib/fibman/trie.rb
Ruby
mit
19
master
624
module Fibman class Trie attr_accessor :key, :data, :subnode def initialize key, data, subnode={} @key = key @data = data @subnode = subnode end def dig *node_key return nil unless node_key.is_a? Array if node_key.size < 1 return data end current_k...
github
Warrenoo/fibman
https://github.com/Warrenoo/fibman
lib/fibman/additions/container_addition.rb
Ruby
mit
19
master
877
module Fibman module Additions module ContainerAddition extend ActiveSupport::Concern included do class_attribute :__fib_container, instance_writer: false class_attribute :__fib_inherit, instance_writer: false end def fib_container self.class.fib_container e...
github
Warrenoo/fibman
https://github.com/Warrenoo/fibman
lib/fibman/additions/targeter_addition.rb
Ruby
mit
19
master
1,914
module Fibman module Additions module TargeterAddition extend ActiveSupport::Concern include Fibman::Additions::ContainerAddition delegate :permissions_info, to: :permissions # 最终权限来源自于权限范围与持久化权限的并集 def permissions @permissions ||= permissions_scope & (get_persistence_permi...
github
Warrenoo/fibman
https://github.com/Warrenoo/fibman
lib/fibman/additions/rails_controller_addition.rb
Ruby
mit
19
master
2,119
module Fibman module Additions module RailsControllerAddition extend ActiveSupport::Concern include Fibman::Additions::ContainerAddition included do before_action :fib_include_validation helper_method :can?, :cannot? delegate :permissions, to: :current_user res...
github
Warrenoo/fibman
https://github.com/Warrenoo/fibman
lib/fibman/additions/dsl_addition.rb
Ruby
mit
19
master
615
module Fibman module Additions module ControllerDslAddition extend ActiveSupport::Concern class_methods do def fib_controller! key include Fibman::Additions::RailsControllerAddition self.fib_container = key end end end module TargeterDslAddition ...
github
joewilliams/drank
https://github.com/joewilliams/drank
drank.gemspec
Ruby
mit
19
master
1,150
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'drank/version' Gem::Specification.new do |spec| spec.name = "drank" spec.version = Drank::VERSION spec.authors = ["Joe Williams"] spec.email = ["williams.joe@...
github
joewilliams/drank
https://github.com/joewilliams/drank
examples/docker_start_stop.rb
Ruby
mit
19
master
646
#!/usr/bin/env ruby ## this is a crappy little tester script ## ## run zookeeper, docker and drank on the same machine ## ## run this script and you should see drank consume ## docker data and send it to zk, killing sessions when ## containers die loop do start_count = 5 stop_count = 5 start_count.times do ...
github
joewilliams/drank
https://github.com/joewilliams/drank
examples/dump_zk_docker_data.rb
Ruby
mit
19
master
1,094
#!/usr/bin/env ruby require 'rubygems' require 'zookeeper' require 'yajl/json_gem' CONTAINER_HOSTS = "/docker/container-hosts" SERVICES = "/docker/services" zk = Zookeeper.new("localhost:2181") container_hosts = zk.get_children(:path => CONTAINER_HOSTS) container_hosts[:children].each do |ch| data = zk.get(:pat...
github
joewilliams/drank
https://github.com/joewilliams/drank
lib/drank.rb
Ruby
mit
19
master
759
require 'rubygems' require 'socket' require 'uri' require 'excon' require 'zookeeper' require 'mixlib/cli' require 'mixlib/config' require 'mixlib/log' require 'yajl/json_gem' __DIR__ = File.dirname(__FILE__) $LOAD_PATH.unshift __DIR__ unless $LOAD_PATH.include?(__DIR__) || $LOAD_PATH.include?(File.expand_path(...
github
joewilliams/drank
https://github.com/joewilliams/drank
lib/drank/cli.rb
Ruby
mit
19
master
1,304
module Drank class CLI include Mixlib::CLI option :log_level, :short => "-l LEVEL", :long => "--log_level LEVEL", :description => "Set the log level (debug, info, warn, error, fatal)", :default => :info, :proc => Proc.new { |l| l.to_sym } option :uri, :short => "-u U...
github
joewilliams/drank
https://github.com/joewilliams/drank
lib/drank/zk.rb
Ruby
mit
19
master
1,482
module Drank class ZK def self.new() session = Zookeeper.new(Drank::Config.zookeeper) check_connection(session) # make sure we are connected to zk session end def self.create(session, options = {:recursive => true, :ephemeral => false}) if options[:recursive] create_path_...
github
joewilliams/drank
https://github.com/joewilliams/drank
lib/drank/utils.rb
Ruby
mit
19
master
627
module Drank class Utils def self.get_container_host_zk_path(path, hostname) File.join(path, hostname) end def self.get_container_zk_path(path, data) File.join(path, data["ID"]) end def self.get_container_service(data) service_name = "default" data["Config"]["Env"].each...
github
joewilliams/drank
https://github.com/joewilliams/drank
lib/drank/docker.rb
Ruby
mit
19
master
689
module Drank class Docker def self.get_version() path = "/version" get_request(path) end def self.get_containers() path = "/containers/json" get_request(path) end def self.get_container(id) path = "/containers/#{id}/json" get_request(path) end privat...
github
joewilliams/drank
https://github.com/joewilliams/drank
lib/drank/service.rb
Ruby
mit
19
master
3,998
module Drank class Service def self.run() @hostname = Socket.gethostbyname(Socket.gethostname).first.gsub(".", "_") @service_zk_path = File.join(Drank::Config.zk_prefix, "services") @container_host_zk_path = File.join(Drank::Config.zk_prefix, "container-hosts") Drank::Log.info("URI: #{Dr...
github
aerobase/omnibus-aerobase-server
https://github.com/aerobase/omnibus-aerobase-server
Gemfile
Ruby
apache-2.0
19
master
532
source 'https://rubygems.org' # Install omnibus # Any version higher then 6.1.4 break the 2nd build. gems are not placed in aerobase home gem 'omnibus', git: 'https://github.com/chef/omnibus.git', tag: '9.0.24' gem 'omnibus-software', git: 'https://github.com/aerobase/omnibus-software.git', tag: 'master' gem 'json' ...
github
aerobase/omnibus-aerobase-server
https://github.com/aerobase/omnibus-aerobase-server
omnibus_overrides.rb
Ruby
apache-2.0
19
master
1,519
override :chef, version: "v17.10.119" override :"chef-config", version: "v17.10.119" override :"chef-utils", version: "v17.10.119" override :ruby, version: "3.0.6" # rubygems / bundler should always have the same minor version e.g: x.3.18 override :rubygems, version: "3.3.18" override :bundler, version: "2.3.18" overri...
github
aerobase/omnibus-aerobase-server
https://github.com/aerobase/omnibus-aerobase-server
omnibus.rb
Ruby
apache-2.0
19
master
2,016
# # This file is used to configure the aerobase-server project. It contains # some minimal configuration examples for working with Omnibus. For a full list # of configurable options, please see the documentation for +omnibus/config.rb+. # # Build internally # ------------------------------ # By default, Omnibus uses s...
github
aerobase/omnibus-aerobase-server
https://github.com/aerobase/omnibus-aerobase-server
Berksfile
Ruby
apache-2.0
19
master
522
# ENV['BERKSHELF_PATH'] = File.expand_path('files/aerobase-cookbooks/', __FILE__) source 'https://supermarket.chef.io' # The apt cookbook is required to bring the apt cache up-to-date on Ubuntu # systems, since the cache can become stale on older boxes. cookbook 'apt', "= 7.3.0" cookbook 'ark', "= 5.0.0" cookbook 'yum...