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
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/group.rb
Ruby
mit
45
main
8,328
# frozen_string_literal: true # rbs_inline: enabled module Huh # Group is a collection of fields displayed together as a page of the form. # # @example # group = Huh::Group.new( # Huh::Fields::Input.new.key("name").title("Name"), # Huh::Fields::Input.new.key("email").title("Email") # ).title...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/form_state.rb
Ruby
mit
45
main
286
# frozen_string_literal: true # rbs_inline: enabled module Huh # FormState represents the current state of a form. # # @example # form.state == Huh::FormState::COMPLETED # module FormState NORMAL = :normal COMPLETED = :completed ABORTED = :aborted end end
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/option.rb
Ruby
mit
45
main
2,170
# frozen_string_literal: true # rbs_inline: enabled module Huh # Option represents a selectable option in Select or MultiSelect fields. # # @example Creating options # opt = Huh::Option.new("Red", "#ff0000") # opt.key # => "Red" # opt.value # => "#ff0000" # # @example Creating options from v...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/accessor.rb
Ruby
mit
45
main
2,813
# frozen_string_literal: true # rbs_inline: enabled module Huh # Accessor provides read/write access to field values. # This allows fields to either store values internally or bind to external variables. # # @example Internal storage # accessor = Huh::Accessor.new("initial value") # accessor.get # =>...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/layout.rb
Ruby
mit
45
main
6,124
# frozen_string_literal: true # rbs_inline: enabled module Huh # Layout provides different layout strategies for displaying form groups. # module Layout # Default layout shows one group at a time. # class Default # Render the current group. # # @rbs form: Form -- the form containin...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/form.rb
Ruby
mit
45
main
11,485
# frozen_string_literal: true # rbs_inline: enabled module Huh # Form is the main container for a terminal form. # It manages groups of fields, navigation, and the form lifecycle. # # @example Basic form # form = Huh::Form.new( # Huh::Group.new( # Huh::Fields::Input.new.key("name").title("Na...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/key_map.rb
Ruby
mit
45
main
9,176
# frozen_string_literal: true # rbs_inline: enabled module Huh class InputKeyMap # @rbs @accept: Bubbles::Key::Binding -- key binding to accept the current input value # @rbs @prev: Bubbles::Key::Binding -- key binding to navigate to the previous field # @rbs @next: Bubbles::Key::Binding -- key binding ...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/echo_mode.rb
Ruby
mit
45
main
277
# frozen_string_literal: true # rbs_inline: enabled module Huh # EchoMode determines how text input is displayed. # # @example # input.echo_mode(Huh::EchoMode::PASSWORD) # module EchoMode NORMAL = :normal PASSWORD = :password NONE = :none end end
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/eval.rb
Ruby
mit
45
main
2,550
# frozen_string_literal: true # rbs_inline: enabled module Huh # Eval wraps a value that can be either static or dynamically computed. # This supports the *_func pattern from Go's huh library, allowing field # properties like title, description, options, etc. to be computed at runtime. # # @example Static v...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/field.rb
Ruby
mit
45
main
8,429
# frozen_string_literal: true # rbs_inline: enabled module Huh # Field is a module that defines the interface for all form fields. # Include this module in your field class to implement the required methods. # # Fields follow the Bubbletea Model pattern (init, update, view) and add # additional methods for ...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/dsl.rb
Ruby
mit
45
main
11,352
# frozen_string_literal: true # rbs_inline: enabled module Huh # DSL provides block-based builders for creating forms. # # @example Block-based form creation # form = Huh::Form.new do |f| # f.group do |g| # g.input do |i| # i.key("name") # i.title("What's your name?") # ...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/fields/input.rb
Ruby
mit
45
main
10,570
# frozen_string_literal: true # rbs_inline: enabled module Huh module Fields # Input is a single-line text input field. # It wraps Bubbles::TextInput and adds title, description, validation, and theming. # # @example Basic usage # input = Huh::Fields::Input.new # .key("name") # ...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/fields/file_picker.rb
Ruby
mit
45
main
10,100
# frozen_string_literal: true # rbs_inline: enabled module Huh module Fields # FilePicker is a file/directory selection field. # It wraps Bubbles::FilePicker and adds title, description, and theming. # # @example Basic usage # picker = Huh::Fields::FilePicker.new # .key("file") # ...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/fields/multi_select.rb
Ruby
mit
45
main
12,536
# frozen_string_literal: true # rbs_inline: enabled module Huh module Fields # MultiSelect is a multi-selection field with checkboxes. # Users can select multiple options from a list. # # @example Basic usage # multi = Huh::Fields::MultiSelect.new # .key("toppings") # .title("P...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/fields/text.rb
Ruby
mit
45
main
10,322
# frozen_string_literal: true # rbs_inline: enabled module Huh module Fields # Text is a multi-line text input field. # It wraps Bubbles::TextArea and adds title, description, validation, and theming. # # @example Basic usage # text = Huh::Fields::Text.new # .key("bio") # .titl...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/fields/spinner.rb
Ruby
mit
45
main
7,547
# frozen_string_literal: true # rbs_inline: enabled module Huh module Fields # Spinner displays an animated loading indicator while running an action. # It wraps Bubbles::Spinner and runs a background action. # # @example Basic usage # spinner = Huh::Fields::Spinner.new # .title("Loadin...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/fields/confirm.rb
Ruby
mit
45
main
7,881
# frozen_string_literal: true # rbs_inline: enabled module Huh module Fields # Confirm is a yes/no confirmation field. # It displays two buttons that can be toggled with arrow keys. # # @example Basic usage # confirm = Huh::Fields::Confirm.new # .key("subscribe") # .title("Subs...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/fields/select.rb
Ruby
mit
45
main
10,357
# frozen_string_literal: true # rbs_inline: enabled module Huh module Fields # Select is a single-selection dropdown field. # It adapts Bubbles::List for use as a form field. # # @example Basic usage # select = Huh::Fields::Select.new # .key("color") # .title("Pick a color") ...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/fields/note.rb
Ruby
mit
45
main
5,772
# frozen_string_literal: true # rbs_inline: enabled module Huh module Fields # Note is a read-only informational field. # It displays a title and description but doesn't collect user input. # # @example Basic usage # note = Huh::Fields::Note.new # .title("Welcome!") # .descript...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/themes/base.rb
Ruby
mit
45
main
4,438
# frozen_string_literal: true # rbs_inline: enabled module Huh module Themes # Base theme provides minimal styling as a foundation for other themes. # module Base class << self # Create the base theme. # # @rbs return: Theme -- the base theme with minimal styling configured...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/themes/base16.rb
Ruby
mit
45
main
5,124
# frozen_string_literal: true # rbs_inline: enabled module Huh module Themes # Base16 theme using standard terminal ANSI colors. # This theme works well in most terminals. # module Base16 # ANSI color numbers BLACK = "0" RED = "1" GREEN = "2" YELLOW = "3" BLUE = "...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/themes/dracula.rb
Ruby
mit
45
main
4,991
# frozen_string_literal: true # rbs_inline: enabled module Huh module Themes # Dracula theme with the classic dark purple color scheme. # module Dracula # Dracula color palette BACKGROUND = "#282a36" FOREGROUND = "#f8f8f2" SELECTION = "#44475a" COMMENT = "#6272a4" CYA...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/themes/catppuccin.rb
Ruby
mit
45
main
5,408
# frozen_string_literal: true # rbs_inline: enabled module Huh module Themes # Catppuccin theme with soft pastel colors. # Uses Mocha (dark) variant by default. # module Catppuccin # Catppuccin Mocha palette ROSEWATER = "#f5e0dc" FLAMINGO = "#f2cdcd" PINK = "#f5c2e7" MA...
github
marcoroth/huh-ruby
https://github.com/marcoroth/huh-ruby
lib/huh/themes/charm.rb
Ruby
mit
45
main
4,749
# frozen_string_literal: true # rbs_inline: enabled module Huh module Themes # Charm theme with indigo and fuchsia accent colors. # This is the signature Charm color scheme. # module Charm # Charm color palette INDIGO = "#5A56E0" FUCHSIA = "#EE6FF8" GREEN = "#02BA84" RE...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
Gemfile
Ruby
mit
45
master
2,323
source 'https://rubygems.org' # source 'http://mirror1.prod.rhcloud.com/mirror/ruby/' gem 'rails', '~> 4.2.5.2' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'turbolinks' gem 'nprogress-rails' gem 'jquery-turbolinks' gem 'will_paginate' gem 'pg' gem 'haml' gem 'rugged', '...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
Rakefile
Ruby
mit
45
master
274
#!/usr/bin/env rake # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically # be available to Rake. require File.expand_path('../config/application', __FILE__) Glitter::Application.load_tasks
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
Guardfile
Ruby
mit
45
master
2,674
# A sample Guardfile # More info at https://github.com/guard/guard#readme ## Uncomment and set this to only include directories you want to watch # directories %w(app lib config test spec feature) ## Uncomment to clear the screen before every task # clearing :on ## Guard internally checks for changes in the Guardfil...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/spec_helper.rb
Ruby
mit
45
master
2,532
# This file is copied to spec/ when you run 'rails generate rspec:install' # Load coveralls only in travis runs if ENV['TRAVIS'] require 'coveralls' Coveralls.wear!('rails') end ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rspec/rails' require 'capybara/rspec...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/models/rating_spec.rb
Ruby
mit
45
master
518
require 'spec_helper' describe ProjectFollower do before :each do @project = create(:project) @user = create(:user, email: 't@t.com', username: 'tester') end it 'adds rating to project' do @project.rate(3.0, @user, 'stars') expect(@project.rates('stars').first.stars).to eq(3) end it 'calcul...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/models/notification_spec.rb
Ruby
mit
45
master
5,897
require 'spec_helper' describe Notification do let(:notification) { create(:notification) } let(:project) { create(:project) } let(:issue) { create(:issue) } let(:user) { create(:user) } it 'has a valid factory' do expect(notification).to be_valid end it 'is invalid without an actor' do expect(...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/models/key_spec.rb
Ruby
mit
45
master
2,756
require 'spec_helper' describe Key do describe 'Associations' do it { is_expected.to belong_to(:user) } end describe 'Validation' do it { is_expected.to validate_presence_of(:title) } it { is_expected.to validate_presence_of(:key) } it { is_expected.to validate_length_of(:title) } it { is_ex...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/models/tree_spec.rb
Ruby
mit
45
master
780
require 'spec_helper' include FileHelper describe 'Tree' do let(:project) { create(:project) } let(:user) { create(:user) } let(:tree) { Tree.new(project) } describe '#traverse' do before do add_readme project add_image project, 'happypanda.png' project.create_directory( 'master'...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/models/issue_spec.rb
Ruby
mit
45
master
3,979
require 'spec_helper' describe Issue do let(:issue) { create(:issue) } it 'has a valid factory' do expect(issue).to be_valid end it 'is invalid without a title' do expect(build(:issue, title: '')).to_not be_valid end it 'is invalid without a description' do expect(build(:issue, description: ...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/models/project_follower_spec.rb
Ruby
mit
45
master
1,086
require 'spec_helper' describe ProjectFollower do before :each do @project = FactoryGirl.create(:project) @user = FactoryGirl.create(:user, email: 't@t.com', username: 'tester') end it 'makes a user follow a project' do ProjectFollower.make_follow @user, @project expect(@user.followed_projects.i...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/models/user_spec.rb
Ruby
mit
45
master
1,840
require 'spec_helper' describe 'User' do it 'has a valid factory' do expect(create(:user)).to be_valid end it 'is invalid without an email address' do expect(build(:user, email: nil)).to_not be_valid end it 'is invalid without a correct email address' do expect(build(:user, email: 'wrong@email,...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/models/comment_spec.rb
Ruby
mit
45
master
625
require 'spec_helper' describe Comment do let(:comment) { create(:comment) } it 'has a valid factory' do expect(comment).to be_valid end it 'is invalid without a body' do expect(build(:comment, body: '')).to_not be_valid end describe '#action' do shared_examples 'polycomment_type' do |type|...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/models/project_spec.rb
Ruby
mit
45
master
8,799
require 'spec_helper' include Models::RepositoryHelpers include FileHelper describe Project do let(:user) { create(:user) } let(:user1) { create(:user) } let(:project) { create(:project, user: user) } let(:repo_path) { Glitter::Application.config.repo_path } it 'has a valid factory' do expect(create(:pr...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/models/annotation_spec.rb
Ruby
mit
45
master
578
require 'spec_helper' describe Annotation do let(:annotation) { create(:annotation) } it 'has a valid factory' do expect(annotation).to be_valid end it 'is invalid without text' do expect(build(:annotation, text: '')).to_not be_valid end it 'is invalid without json' do expect(build(:annotati...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/models/project_member_spec.rb
Ruby
mit
45
master
2,138
require 'spec_helper' include Models::ProjectMembersHelper describe 'ProjectMember' do it 'has a valid factory' do expect(create(:project_member)).to be_valid end it 'is invalid for undefined roles' do expect(build(:project_member, role: 'rap_god')).to_not be_valid end it 'is invalid for duplicate ...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/models/ability_spec.rb
Ruby
mit
45
master
4,865
require 'spec_helper' require 'cancan/matchers' include Models::ProjectMembersHelper describe 'User' do describe 'Abilities' do subject(:ability){ Ability.new(user) } context 'user is guest' do let(:user){ nil } let(:comment) { create(:comment) } let(:issue) { create(:issue) } let(:p...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/models/notification_status_spec.rb
Ruby
mit
45
master
200
require 'spec_helper' describe NotificationStatus do let(:notification_status) { create(:notification_status) } it 'has a valid factory' do expect(notification_status).to be_valid end end
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/models/concerns/sortable_spec.rb
Ruby
mit
45
master
3,640
require 'spec_helper' include FileHelper describe 'sortable' do before do @project1 = create(:project, name: 'new_name') @project2 = create(:project, created_at: '2010-05-24 21:00:57') @project3 = create(:project, name: 'newer_name') end shared_examples 'private projects' do |sort| before { @pr...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/controllers/keys_controller_spec.rb
Ruby
mit
45
master
2,222
require 'spec_helper' describe KeysController, type: :controller do let(:user) { create(:user) } let(:key) { create(:key, user: user) } before { sign_in(user) } describe 'GET index' do it 'renders the index template' do get :index expect(response).to render_template('index') end end d...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/controllers/search_controller_spec.rb
Ruby
mit
45
master
721
require 'spec_helper' describe SearchController, type: :controller do let(:project) { create(:project) } context 'user searches website' do describe 'GET #search' do it 'renders website search template' do get :website_search, search: 'something' expect(response).to render_template('websi...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/controllers/relationships_controller_spec.rb
Ruby
mit
45
master
1,893
require 'spec_helper' describe RelationshipsController, type: :controller do context 'User is signed in' do describe 'follow and unfollow' do before do @user1 = FactoryGirl.create(:user) sign_in(@user1) @user2 = FactoryGirl.create(:user, email: 't@t.com', username: 'tester') e...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/controllers/rater_controller_spec.rb
Ruby
mit
45
master
519
require 'spec_helper' describe RaterController, type: :controller do describe 'POST #rate' do before do @user = FactoryGirl.create(:user) @project = FactoryGirl.create(:project) sign_in(@user) end it 'adds rating to project' do post :create, { id: @project.id, scor...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/controllers/comments_controller_spec.rb
Ruby
mit
45
master
7,126
require 'spec_helper' describe CommentsController, type: :controller do let(:project) { create(:project) } let(:user) { create(:user) } let(:issue) { create(:issue) } context 'project exists' do describe 'POST #create' do before { sign_in(project.user) } it 'adds comment to project' do ...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/controllers/annotations_controller_spec.rb
Ruby
mit
45
master
4,082
require 'spec_helper' describe AnnotationsController, type: :controller do let(:user) { create(:user) } let(:other_user) { create(:user) } let(:project) { create(:project) } let(:annotation) { create(:annotation, user: user) } let(:blob_oid) { 'fb82abfe99bb2be3b885b9cf72b7e05220dce165' } let(:annotation_pa...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/controllers/identities_controller_spec.rb
Ruby
mit
45
master
2,304
require 'spec_helper' describe IdentitiesController, type: :controller do describe 'POST #create' do before :each do request.env['omniauth.auth'] = OmniAuth.config.mock_auth[:facebook] end context "Identity doesn't exist" do context "User doesn't exist" do it 'creates new user' do ...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/controllers/notifications_controller_spec.rb
Ruby
mit
45
master
1,757
require 'spec_helper' describe NotificationsController, type: :controller do let(:user) { create(:user) } let(:project) { create(:project) } let(:notification) { create(:notification, victims: [user]) } context 'user is signed in' do before { sign_in(user) } describe 'GET #count' do it 'renders...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/controllers/users_controller_spec.rb
Ruby
mit
45
master
1,667
require 'spec_helper' describe UsersController, type: :controller do render_views context 'user is guest' do before do @user = create(:user) end describe 'GET #show' do it 'renders show template' do get :show, id: @user.username expect(response).to render_template('show') ...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/controllers/project_members_controller_spec.rb
Ruby
mit
45
master
3,027
require 'spec_helper' include Models::ProjectMembersHelper describe ProjectMembersController, type: :controller do let(:project) { create(:project) } let(:user) { create(:user) } context 'user is owner of project' do before { sign_in(project.user) } it 'adds project members' do post :create, user_...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/controllers/projects_controller_spec.rb
Ruby
mit
45
master
12,854
require 'spec_helper' include Models::ProjectMembersHelper include FileHelper describe ProjectsController, type: :controller do let(:tree) { Tree.new(project) } context 'user is guest' do let(:project) { create(:project) } it 'does not see new project page' do get :new expect(response).not_t...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/controllers/issues_controller_spec.rb
Ruby
mit
45
master
4,528
require 'spec_helper' include Models::ProjectMembersHelper describe IssuesController, type: :controller do let(:user) { create(:user) } let(:project) { create(:project) } let(:issue) { create(:issue, project: project) } context 'user is guest' do it 'does not see new issue template' do get :new, use...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/lib/image_processing_spec.rb
Ruby
mit
45
master
988
require 'spec_helper' include FileHelper describe Gg::ImageProcessing do let(:project) { create(:project) } describe 'file writes' do before do add_image project, 'logo.svg' @commit = project.branch_commit nil @write_path = project.image_for('logo.svg', 'mobile_inspire') @path = File.j...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/lib/git_access_spec.rb
Ruby
mit
45
master
1,686
require 'spec_helper' include Models::ProjectMembersHelper describe Gg::GitAccess do let(:user) { create(:user) } let(:project) { create(:project, private: true) } let(:access) { Gg::GitAccess.new(user, project) } context 'user is member' do describe 'push' do shared_examples 'has write access' d...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/lib/search_spec.rb
Ruby
mit
45
master
505
require 'spec_helper' include FileHelper describe Gg::Search do let(:project) { create(:project) } describe '.find_files' do before do add_image project, 'happypanda.png' add_image project, 'naruto.png' end it 'returns file matching query' do hashes = Gg::Search.find_files('happypan...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/lib/key_fingerprint_spec.rb
Ruby
mit
45
master
775
require 'spec_helper' describe Gg::KeyFingerprint do let(:key) do 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCx3ke+rnMT/ILY81K1un1CW' + 'f9ghcPglIlV7pMV2H5AwyC/Dx5x+DyKmNmhBmvCYJ+1we8f0pPXLx2QpyAXw8s0s+sBL/gk' + 'izsqqwrUzK9Rlkj58kvNFl8gLQk3qqs8dR6bODP9LQqCGhMFErQtDQTvBq91jhWuIIunumK' + '7T+0GWDMf7O9CNdr...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/lib/grack_auth_spec.rb
Ruby
mit
45
master
4,854
require 'spec_helper' describe Grack::Auth do let(:user) { create(:user) } let(:project) { create(:project) } let(:app) { ->(_env) { [200, {}, 'Success!'] } } let!(:auth) { Grack::Auth.new(app) } let(:env) do { 'rack.input' => '', 'REQUEST_METHOD' => 'GET', 'QUERY_STRING' => 'servi...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/lib/sanitize_filename_spec.rb
Ruby
mit
45
master
1,325
require 'spec_helper' include FileHelper describe Gg::SanitizeFilename do let(:project) { create(:project) } describe '.safe_filepath' do context 'without file upload' do before { allow(File).to receive(:exists?).and_return(true) } it 'removes illegal characters from filename' do file = ...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/lib/api_spec.rb
Ruby
mit
45
master
2,192
require 'spec_helper' include Models::ProjectMembersHelper describe API::API, type: :request do let(:user) { create(:user) } let(:key) { create(:key, user: user) } let(:project) { create(:project) } let(:secret_token) { '02eb56d97afc267a58e4a01e8a2f4c6a' } describe 'GET /internal/check', no_db: true do ...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/lib/popen_spec.rb
Ruby
mit
45
master
1,029
require 'spec_helper' describe 'Gg::Popen', no_db: true do let(:path) { Rails.root.join('tmp').to_s } before do @klass = Class.new(Object) @klass.send(:include, Gg::Popen) end context 'zero status' do before do @output, @status = @klass.new.popen(%W(ls), path) end it { expect(@stat...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/support/file_helper.rb
Ruby
mit
45
master
2,209
module FileHelper def file_upload(project, file_name) file = [ActionDispatch::Http::UploadedFile.new( tempfile: upload(file_name), filename: file_name )] post :file_upload, user_id: project.user.username, id: project.name, file: file end # up...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/support/rspec_rails_4_2_5_1.rb
Ruby
mit
45
master
265
# Fix for rspec-rails and rails 4.2.5.1 # Can be removed as soon as rspec-rails fixes this # Error: undefined method `cache' for nil:NilClass RSpec::Rails::ViewRendering::EmptyTemplatePathSetDecorator.class_eval do alias_method :find_all_anywhere, :find_all end
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/support/features/session_helpers.rb
Ruby
mit
45
master
610
module Features module SessionHelpers def sign_in_with(email, password) visit '/users/sign_in' fill_in 'user_email', with: email fill_in 'user_password', with: password click_button 'Login' end def sign_up_with(email, username, password, password_confirm = password) visit '/...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/support/features/wait_for_ajax.rb
Ruby
mit
45
master
242
module WaitForAjax def wait_for_ajax Timeout.timeout(Capybara.default_wait_time) do loop until finished_all_ajax_requests? end end def finished_all_ajax_requests? page.evaluate_script('jQuery.active').zero? end end
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/support/models/project_members_helper.rb
Ruby
mit
45
master
293
module Models module ProjectMembersHelper # defines relationship between user and project def make_member(project, user, role = 'collaborator') create( :project_member, member: user, member_project: project, role: role ) end end end
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/support/models/repository_helpers.rb
Ruby
mit
45
master
426
module Models module RepositoryHelpers # Initializes a dummy repo with 1 commit at the project repo path. def initialize_dummy_repo(project) dummy_repo_path = 'spec/factories/repos/dummy.git' repo = Rugged::Repository.new dummy_repo_path coll = Rugged::RemoteCollection.new repo bare =...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/features/issues_spec.rb
Ruby
mit
45
master
6,154
require 'spec_helper' feature 'Issues' do shared_examples 'issue services' do |type, fork| before :each do sign_up_with('t@test.com', 'test1', 'secret12345') click_button 'Create first project!' fill_in 'project_name', with: 'testproject1' if type == 'private' click_button 'Priva...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/features/users_spec.rb
Ruby
mit
45
master
3,167
require 'spec_helper' feature 'Users' do scenario 'Sees profiles' do sign_up_with('t@test.com', 'test1', 'secret12345') click_link 'test1' expect(page.current_path).to eq('/test1') expect(find('.user')).to have_content('@test1') click_link 'logout' sign_up_with('t2@test.com', 'test2', 'secret...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/features/search_spec.rb
Ruby
mit
45
master
1,338
require 'spec_helper' include FileHelper feature 'Search' do describe 'wesbite search' do before do @project1 = create(:project) @project2 = create(:project, name: 'fancy_project') visit '/' end scenario 'user search for projects', js: true do find('form>input').set('fancy' + "\n...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/features/projects_spec.rb
Ruby
mit
45
master
20,345
require 'spec_helper' include FileHelper feature 'Projects' do scenario 'User creates a public project' do @user = FactoryGirl.create( :user, password: 'secret12345', password_confirmation: 'secret12345' ) sign_in_with(@user.email, 'secret12345') expect(page.current_path).to eq('/da...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/features/project_members_spec.rb
Ruby
mit
45
master
1,186
require 'spec_helper' include Models::ProjectMembersHelper feature 'ProjectMembers' do let(:user) { create(:user) } let(:user2) { create(:user) } let(:project) { create(:project, user: user) } describe 'project owner actions' do before { login_as(user) } scenario 'adds members' do visit "/#{user...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/features/auth_spec.rb
Ruby
mit
45
master
911
require 'spec_helper' feature 'Authentication' do scenario 'New user signs up via email' do sign_up_with( 'sbanskota08@gmail.com', 'sarupbanskota', 'secret12345', 'secret12345' ) expect(page.current_path).to eq('/dashboard') end scenario 'New user signs up via omniauth' do ...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/features/comment_spec.rb
Ruby
mit
45
master
1,820
require 'spec_helper' include FileHelper feature 'Comments' do let(:project) { create(:project) } let(:user) { create(:user) } let(:issue) { create(:issue) } def fill_and_check_comment fill_in 'comment[body]', with: 'Lorem ipsum dolor sit amet' click_button 'Create Comment' expect(page).to have_co...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/features/projects/file_history_spec.rb
Ruby
mit
45
master
1,673
require 'spec_helper' include FileHelper feature 'History' do let(:user) { create(:user) } let(:project) { create(:project, user: user) } describe 'commits' do before do login_as(user) add_image project, 'happypanda.png' @commit1 = project.barerepo.head.target.oid update_image projec...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/routing/project_routing_spec.rb
Ruby
mit
45
master
1,764
require 'spec_helper' describe ProjectsController, type: :routing do context 'public' do it 'to #blob' do expect(get('tester/test/blob/master/icons/small/smiley.png')).to route_to( 'projects#blob', user_id: 'tester', id: 'test', oid: 'master', destination: 'icons/sma...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/helpers/application_helper_spec.rb
Ruby
mit
45
master
2,066
require 'spec_helper' describe ApplicationHelper, type: :helper do describe '#markdown' do it 'adds head tag to # text' do markdown = helper.markdown '# I am head' assert_equal "<h1>I am head</h1>\n", markdown end it 'adds strong and itallic tags' do markdown = helper.markdown 'I am **...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/helpers/projects_helper_spec.rb
Ruby
mit
45
master
1,278
require 'spec_helper' include FileHelper describe ProjectsHelper, type: :helper do let(:project) { create(:project) } let(:user1) { create(:user) } let(:user2) { create(:user) } let(:user3) { create(:user) } describe '#nested_projects' do before do (@child1 = project.create_fork_project).user = us...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/helpers/notifications_helper_spec.rb
Ruby
mit
45
master
363
require 'spec_helper' describe NotificationsHelper, type: :helper do let(:notification) { create(:notification) } describe '#notif_string' do it 'returns appeneded username and messageverb' do expected_string = notification.actor.username + notification.messageverb expect(notif_string notification...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/factories/annotation.rb
Ruby
mit
45
master
755
FactoryGirl.define do factory :annotation do text 'flying monkeys' blob_id '453bb23f7defbd153379a22284445dbfd8008295' json do { src: 'http://localhost:3000/some/path', text: 'flying monkeys', shapes: [{ type: 'rect', geometry: { x: 0.595, ...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/factories/projects.rb
Ruby
mit
45
master
283
FactoryGirl.define do factory :project do name 'testproject' association :user tag_list %w(bug feature improvement feedback discussion help) after(:create) do |project| create(:project_member, member_project: project, member: project.user) end end end
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/factories/users.rb
Ruby
mit
45
master
356
FactoryGirl.define do sequence :username do |n| "sarupbanskota#{n}" end sequence :email do |n| "sbanskota08#{n}@gmail.com" end factory :user do email username password 'secret12345' end factory :fb_user, class: User do email 'sbanskota08@gmail.com' username 'sarupbanskota' ...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/factories/keys.rb
Ruby
mit
45
master
616
FactoryGirl.define do factory :key do association :user sequence :key, (0..9).cycle do |n| 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCx3ke+rnMT/ILY81K1un1CWf9ghcPgl' + 'IlV7pMV2H5AwyC/Dx5x+DyKmNmhBmvCYJ+1we8f0pPXLx2QpyAXw8s0s+sBL/gkizsqqw' + 'rUzK9Rlkj58kvNFl8gLQk3qqs8dR6bODP9LQqCGhMFErQtDQTvB...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/factories/issues.rb
Ruby
mit
45
master
256
# Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :issue do title 'test issue' description 'I am a test' tag_list ['bug'] status 0 association :project association :user end end
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
spec/factories/notifications.rb
Ruby
mit
45
master
396
FactoryGirl.define do factory :notification do association :actor, factory: :user action 0 model_id 1 url 'http://domain.name/user/project' after(:create) do |notification| new_user = create(:user) notification.notification_statuses << create( :notification_status, not...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
lib/gg/git_access.rb
Ruby
mit
45
master
1,327
module Gg class GitAccess DOWNLOAD_COMMANDS = %w{ git-upload-pack git-upload-archive } PUSH_COMMANDS = %w{ git-receive-pack } attr_reader :actor, :project def initialize(actor, project) @actor = actor @project = project end def check(cmd) unless actor return b...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
lib/gg/sanitize_filename.rb
Ruby
mit
45
master
939
module Gg class SanitizeFilename attr_accessor :filename, :root_path def initialize(root_path, filename) @root_path = root_path @filename = filename end # Replaces characters in strings that are illegal/unsafe for filenames. # Illegal Characters on Various Operating Systems # ? ...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
lib/gg/diff.rb
Ruby
mit
45
master
2,357
module Gg class Diff attr_reader :rugged, :path def initialize(rugged, path) @rugged = rugged @path = path end # Return an array of log commits, given an SHA hash and a hash of # options. def build_log(sha) bloblist = [] # Instantiate a Walker and add the SHA hash ...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
lib/gg/git_access_status.rb
Ruby
mit
45
master
292
module Gg class GitAccessStatus attr_accessor :status, :message alias_method :allowed?, :status def initialize(status, message = '') @status = status @message = message end def to_json { status: @status, message: @message }.to_json end end end
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
lib/gg/sync.rb
Ruby
mit
45
master
3,280
# used to sync satellite and bare repo after push # triggerd by api call from post-recieve module Gg class Sync attr_reader :changes, :repo_path def initialize(repo_path, changes) @repo_path = repo_path @changes = changes end def sync_satellite refs = @changes.split(' ') bra...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
lib/gg/search.rb
Ruby
mit
45
master
628
module Gg module Search extend self # Find files in satellitedir of project which match the # given query (with ignore case). Allow delimiters are # space and comma. def find_files(query, project) images = [] dir = [] path = File.join project.satellitedir, '/**/*' files = ...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
lib/gg/key_fingerprint.rb
Ruby
mit
45
master
1,376
module Gg class KeyFingerprint include Gg::Popen attr_accessor :key def initialize(key) @key = key end def fingerprint cmd_status = 0 cmd_output = '' Tempfile.open('gitlab_key_file') do |file| file.puts key file.rewind cmd = [] cmd.push ...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
lib/gg/shell_env.rb
Ruby
mit
45
master
325
module Gg # This module provide 2 methods # to set specific ENV variables for GitLab Shell module ShellEnv extend self def set_env(user) # Set GL_ID env variable ENV['GL_ID'] = "user-#{user.id}" end def reset_env # Reset GL_ID env variable ENV['GL_ID'] = nil end end...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
lib/gg/image_processing.rb
Ruby
mit
45
master
2,500
# Class which take up task of reading and writing of images # Images can be read from both file and blob. ie read_path # can either be a path to file or a blob string module Gg class ImageProcessing attr_reader :read_path SUPPORTED_FILE_TYPES = ['.png', '.jpeg', '.jpg', '.svg', ''] # Only read_path is ...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
lib/gg/utils.rb
Ruby
mit
45
master
316
module Gg module Utils extend self # Run system command without outputting to stdout. # # @param cmd [Array<String>] # @return [Boolean] def system_silent(cmd) Popen::popen(cmd).last.zero? end def force_utf8(str) str.force_encoding(Encoding::UTF_8) end end end
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
lib/gg/shell.rb
Ruby
mit
45
master
670
module Gg class Shell class AccessDenied < StandardError; end class KeyAdder < Struct.new(:io) def add_key(id, key) io.puts("#{id}\t#{key.strip}") end end def self.add_key(key_id, key_content) Gg::Utils.system_silent([gg_shell_keys_path, 'add...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
lib/gg/popen.rb
Ruby
mit
45
master
823
require 'fileutils' require 'open3' module Gg module Popen extend self def popen(cmd, path=nil) unless cmd.is_a?(Array) raise 'System commands must be given as an array of strings' end path ||= Dir.pwd vars = { 'PWD' => path } options = { chdir: path } unless Fi...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
lib/rack/grack_auth.rb
Ruby
mit
45
master
2,610
module Grack class Auth < Rack::Auth::Basic attr_accessor :user, :project, :env def call(env) @env = env @request = Rack::Request.new(env) @auth = Request.new(env) auth! if project if authorized_request? @app.call(env) else unauthorized ...
github
glittergallery/GlitterGallery
https://github.com/glittergallery/GlitterGallery
lib/api/internal.rb
Ruby
mit
45
master
1,244
module API # Internal access API class Internal < Grape::API namespace 'internal' do # Check if git command is allowed to project # # Params: # key_id - ssh key id for Git over SSH # user_id - user id for Git over HTTP # project - project path with namespace # ...