repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
Radanisk/writeexcel
test/test_worksheet.rb
<reponame>Radanisk/writeexcel # -*- coding: utf-8 -*- require 'helper' require 'stringio' class TC_Worksheet < Test::Unit::TestCase TEST_DIR = File.expand_path(File.dirname(__FILE__)) PERL_OUTDIR = File.join(TEST_DIR, 'perl_output') def setup @test_file = StringIO.new @workbook = WriteExcel.new(@test...
Radanisk/writeexcel
test/test_workbook.rb
# -*- coding: utf-8 -*- require 'helper' require "stringio" class TC_Workbook < Test::Unit::TestCase def setup @test_file = StringIO.new @workbook = Workbook.new(@test_file) end def test_new assert_kind_of(Workbook, @workbook) end def test_add_worksheet sheetnames = ['sheet1', 'sheet2']...
Radanisk/writeexcel
examples/indent.rb
<filename>examples/indent.rb #!/usr/bin/ruby -w # -*- coding: utf-8 -*- ############################################################################## # # A simple formatting example using Spreadsheet::WriteExcel. # # This program demonstrates the indentation cell format. # # reverse('©'), May 2004, <NAME>, <EMAIL> # ...
Radanisk/writeexcel
lib/writeexcel/data_validations.rb
module Writeexcel class Worksheet < BIFFWriter require 'writeexcel/helper' class DataValidations < Array # # the count of the DV records to follow. # # Note, this could be wrapped into store_dv() but we may require separate # handling of the object id at a later stage. # def count_dv_r...
Radanisk/writeexcel
charts/demo2.rb
#!/usr/bin/ruby -w # -*- coding: utf-8 -*- ############################################################################### # # Simple example of how to add an externally created chart to a Spreadsheet:: # WriteExcel file. # # # This example adds a pie chart extracted from the file Chart2.xls as follows: # # perl cha...
Radanisk/writeexcel
charts/chartex.rb
<reponame>Radanisk/writeexcel<gh_stars>10-100 #!/usr/bin/ruby -w # -*- coding: utf-8 -*- ####################################################################### # # chartex - A utility to extract charts from an Excel file for # insertion into a WriteExcel file. # # reverse('ゥ'), September 2007, <NAME>, <EMAIL> # # ori...
Radanisk/writeexcel
test/test_biff.rb
# -*- coding: utf-8 -*- require 'helper' require 'stringio' class TC_BIFFWriter < Test::Unit::TestCase TEST_DIR = File.expand_path(File.dirname(__FILE__)) PERL_OUTDIR = File.join(TEST_DIR, 'perl_output') def setup @biff = BIFFWriter.new @ruby_file = StringIO.new end def test_append_no_error ...
Radanisk/writeexcel
examples/autofilter.rb
#!/usr/bin/ruby -w # -*- coding: utf-8 -*- ####################################################################### # # Example of how to create autofilters with WriteExcel. # # reverse('©'), September 2007, <NAME>, <EMAIL> # # original written in Perl by <NAME> # converted to Ruby by <NAME>, <EMAIL> # require 'writeex...
Radanisk/writeexcel
lib/writeexcel/excelformulaparser.rb
# -*- coding: utf-8 -*- # # DO NOT MODIFY!!!! # This file is automatically generated by Racc 1.4.11 # from Racc grammer file "". # require 'racc/parser.rb' class ExcelFormulaParser < Racc::Parser # :nodoc: ##### State transition tables begin ### racc_action_table = [ 16, 54, 26, 28, 30, 32, 34,...
Radanisk/writeexcel
lib/writeexcel/charts/pie.rb
# -*- coding: utf-8 -*- ############################################################################### # # Pie - A writer class for Excel Pie charts. # # Used in conjunction with WriteExcel::Chart. # # See formatting note in WriteExcel::Chart. # # Copyright 2000-2010, <NAME>, <EMAIL> # # original written in Perl by <N...
Radanisk/writeexcel
examples/row_wrap.rb
#!/usr/bin/ruby -w # -*- coding: utf-8 -*- ############################################################################## # # Demonstrates how to wrap data from one worksheet onto another. # # Excel has a row limit of 65536 rows. Sometimes the amount of row data to be # written to a file is greater than this limit. In...
Radanisk/writeexcel
test/test_29_process_jpg.rb
# -*- coding: utf-8 -*- ########################################################################## # test_29_process_jpg.rb # # Tests for the JPEG width and height processing. # # reverse('©'), September 2005, <NAME>, <EMAIL> # # original written in Perl by <NAME> # converted to Ruby by <NAME>, <EMAIL> # ##############...
Radanisk/writeexcel
charts/demo4.rb
<filename>charts/demo4.rb<gh_stars>10-100 #!/usr/bin/ruby -w # -*- coding: utf-8 -*- ############################################################################### # # Simple example of how to add an externally created chart to a Spreadsheet:: # WriteExcel file. # # # This example adds an "Open-high-low-close" stock ...
Radanisk/writeexcel
examples/demo.rb
<reponame>Radanisk/writeexcel #!/usr/bin/ruby -w # -*- coding: utf-8 -*- ####################################################################### # # Demo of some of the features of WriteExcel. # Used to create the project screenshot for Freshmeat. # # # reverse('©'), October 2001, <NAME>, <EMAIL> # # original written ...
Radanisk/writeexcel
test/test_example_match.rb
<filename>test/test_example_match.rb<gh_stars>10-100 # -*- coding: utf-8 -*- require 'helper' require 'stringio' class TC_example_match < Test::Unit::TestCase TEST_DIR = File.expand_path(File.dirname(__FILE__)) PERL_OUTDIR = File.join(TEST_DIR, 'perl_output') def setup @file = StringIO.new end def...
Radanisk/writeexcel
lib/writeexcel/helper.rb
# -*- coding: utf-8 -*- # # helper.rb # # Convert to US_ASCII encoding if ascii characters only. def convert_to_ascii_if_ascii(str) return nil if str.nil? ruby_18 do unless str =~ /[^!"#\$%&'\(\)\*\+,\-\.\/\:\;<=>\?@0-9A-Za-z_\[\\\]\{\}^` ~\0\n]/ str = String.new(str) end end || ...
Radanisk/writeexcel
lib/writeexcel/charts/external.rb
# -*- coding: utf-8 -*- ############################################################################### # # External - A writer class for Excel external charts. # # Used in conjunction with WriteExcel # # perltidy with options: -mbl=2 -pt=0 -nola # # Copyright 2000-2010, <NAME>, <EMAIL> # # original written in Perl by ...
Radanisk/writeexcel
lib/writeexcel/chart.rb
<reponame>Radanisk/writeexcel # -*- coding: utf-8 -*- ############################################################################### # # Chart - A writer class for Excel Charts. # # # Used in conjunction with WriteExcel # # Copyright 2000-2010, <NAME>, <EMAIL> # # original written in Perl by <NAME> # converted to Ruby...
Radanisk/writeexcel
examples/comments1.rb
<gh_stars>10-100 #!/usr/bin/ruby -w # -*- coding: utf-8 -*- ############################################################################### # # This example demonstrates writing cell comments. # # A cell comment is indicated in Excel by a small red triangle in the upper # right-hand corner of the cell. # # For more ad...
Radanisk/writeexcel
test/test_properties.rb
# -*- coding: utf-8 -*- require 'helper' require 'stringio' class TestProperties < Test::Unit::TestCase def setup @workbook = WriteExcel.new(StringIO.new) end def test_pack_VT_FILETIME filetime = assert_equal( '40 00 00 00 00 FD 2D ED CE 48 CE 01', unpack_record(pa...
Radanisk/writeexcel
lib/writeexcel/charts/area.rb
# -*- coding: utf-8 -*- ############################################################################### # # Area - A writer class for Excel Area charts. # # Used in conjunction with Chart. # # See formatting note in Chart. # # Copyright 2000-2010, <NAME>, <EMAIL> # # original written in Perl by <NAME> # converted to Ru...
Radanisk/writeexcel
examples/data_validate.rb
#!/usr/bin/ruby -w # -*- coding: utf-8 -*- ############################################################################### # # Example of how to add data validation and dropdown lists to a # WriteExcel file. # # reverse('©'), August 2008, <NAME>, <EMAIL> # # original written in Perl by <NAME> # converted to Ruby by <N...
Radanisk/writeexcel
test/test_42_set_properties.rb
# -*- coding: utf-8 -*- ########################################################################## # test_42_set_properties.rb # # Tests for Workbook property_sets() interface. # # some test is commented out because related method was set to # private method. Before that, all test passed. # # # # # reverse('©'), Septem...
Radanisk/writeexcel
examples/regions.rb
#!/usr/bin/ruby -w # -*- coding: utf-8 -*- ############################################################################### # # Example of how to use the WriteExcel module to write a basic multiple # worksheet Excel file. # # reverse('©'), March 2001, <NAME>, <EMAIL> # # original written in Perl by <NAME> # converted t...
Radanisk/writeexcel
lib/writeexcel/comments.rb
module Writeexcel class Worksheet < BIFFWriter require 'writeexcel/helper' class Collection def initialize @items = {} end def <<(item) if @items[item.row] @items[item.row][item.col] = item else @items[item.row] = { item.col => item } end end def array...
Radanisk/writeexcel
lib/writeexcel.rb
# -*- coding: utf-8 -*- ############################################################################### # # WriteExcel. # # WriteExcel - Write to a cross-platform Excel binary file. # # Copyright 2000-2010, <NAME>, <EMAIL> # # original written in Perl by <NAME> # converted to Ruby by <NAME>, <EMAIL> # require 'writeexc...
Radanisk/writeexcel
test/test_63_chart_area_formats.rb
# -*- coding: utf-8 -*- require 'helper' require 'stringio' ############################################################################### # # A test for Spreadsheet::Writeexcel::Chart. # # Tests for the Excel Chart.pm format conversion methods. # # reverse('ゥ'), January 2010, <NAME>, <EMAIL> # # original written in ...
Radanisk/writeexcel
lib/writeexcel/biffwriter.rb
# -*- coding: utf-8 -*- # # BIFFwriter - An abstract base class for Excel workbooks and worksheets. # # # Used in conjunction with WriteExcel # # Copyright 2000-2010, <NAME>, <EMAIL> # # original written in Perl by <NAME> # converted to Ruby by <NAME>, <EMAIL> # require 'tempfile' require 'writeexcel/write_file' cla...
Radanisk/writeexcel
test/test_ole.rb
<filename>test/test_ole.rb # -*- coding: utf-8 -*- require 'helper' require 'stringio' class TC_OLE < Test::Unit::TestCase def setup @file = StringIO.new @ole = OLEWriter.new(@file) end def test_constructor assert_kind_of(OLEWriter, @ole) end def test_constants assert_equal(7087104, OLEW...
Radanisk/writeexcel
test/test_00_IEEE_double.rb
<reponame>Radanisk/writeexcel<filename>test/test_00_IEEE_double.rb # -*- coding: utf-8 -*- require 'helper' class TC_BIFFWriter < Test::Unit::TestCase def test_IEEE_double teststr = [1.2345].pack("d") hexdata = [0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F] number = hexdata.pack("C8") assert(num...
Radanisk/writeexcel
examples/tab_colors.rb
#!/usr/bin/ruby -w # -*- coding: utf-8 -*- ####################################################################### # # Example of how to set Excel worksheet tab colours. # # reverse('©'), May 2006, <NAME>, <EMAIL> # # original written in Perl by <NAME> # converted to Ruby by <NAME>, <EMAIL> # require 'writeexcel' wo...
Radanisk/writeexcel
examples/merge6.rb
#!/usr/bin/ruby -w # -*- coding: utf-8 -*- ############################################################################### # # Example of how to use the Spreadsheet::WriteExcel merge_cells() workbook # method with Unicode strings. # # # reverse('©'), December 2005, <NAME>, <EMAIL> # # original written in Perl by <NAME...
Radanisk/writeexcel
lib/writeexcel/caller_info.rb
<gh_stars>10-100 # -*- coding: utf-8 -*- module CallerInfo # # return stack trace info if defined?($debug). # def caller_info caller(3).collect { |info| file = File.expand_path(info.sub(/:(\d+)[^\d`]*(`([^']+)')?/, '')) { :file => file, :line => $1, :method => $3 } }.select { |info| info[:me...
Radanisk/writeexcel
examples/hide_sheet.rb
<reponame>Radanisk/writeexcel #!/usr/bin/ruby -w # -*- coding: utf-8 -*- ####################################################################### # # Example of how to hide a worksheet with WriteExcel. # # reverse('©'), April 2005, <NAME>, <EMAIL> # # original written in Perl by <NAME> # converted to Ruby by <NAME>, <E...
Radanisk/writeexcel
examples/a_simple.rb
#!/usr/bin/ruby -w # -*- coding: utf-8 -*- # # Example of how to use the WriteExcel module to write text and numbers # to an Excel binary file. # # reverse('©'), March 2001, <NAME>, <EMAIL> # # original written in Perl by <NAME> # converted to Ruby by <NAME>, <EMAIL> # require 'writeexcel' # Create a new workbook call...
Radanisk/writeexcel
examples/images.rb
#!/usr/bin/ruby -w # -*- coding: utf-8 -*- ####################################################################### # # Example of how to insert images into an Excel worksheet using the # WriteExcel insert_image() method. # # reverse('©'), October 2001, <NAME>, <EMAIL> # # original written in Perl by <NAME> # converted...
Radanisk/writeexcel
lib/writeexcel/formula.rb
<reponame>Radanisk/writeexcel # -*- coding: utf-8 -*- ############################################################################### # # Formula - A class for generating Excel formulas. # # # Used in conjunction with WriteExcel # # Copyright 2000-2010, <NAME>, <EMAIL> # # original written in Perl by <NAME> # converted...
Radanisk/writeexcel
lib/writeexcel/format.rb
<filename>lib/writeexcel/format.rb # -*- coding: utf-8 -*- ############################################################################## # # Format - A class for defining Excel formatting. # # # Used in conjunction with WriteExcel # # Copyright 2000-2010, <NAME>, <EMAIL> # # original written in Perl by <NAME> # conver...
Radanisk/writeexcel
test/test_62_chart_formats.rb
<filename>test/test_62_chart_formats.rb # -*- coding: utf-8 -*- require 'helper' require 'stringio' ############################################################################### # # A test for Spreadsheet::Writeexcel::Chart. # # Tests for the Excel Chart.pm format conversion methods. # # reverse('ゥ'), January 2010, ...
Radanisk/writeexcel
test/test_61_chart_subclasses.rb
# -*- coding: utf-8 -*- require 'helper' require 'stringio' ############################################################################### # # A test for Chart. # # Tests for the Excel chart.rb methods. # # reverse(''), December 2009, <NAME>, <EMAIL> # # original written in Perl by <NAME> # converted to Ruby by <NAME...
Radanisk/writeexcel
examples/outline_collapsed.rb
#!/usr/bin/ruby -w # -*- coding: utf-8 -*- ############################################################################### # # Example of how use Spreadsheet::WriteExcel to generate Excel outlines and # grouping. # # These example focus mainly on collapsed outlines. See also the # outlines.pl example program for more ...
Radanisk/writeexcel
test/test_11_date_time.rb
# -*- coding: utf-8 -*- ############################################################################### # # A test for WriteExcel. # # Tests date and time handling. # # reverse('©'), May 2004, <NAME>, <EMAIL> # # original written in Perl by <NAME> # converted to Ruby by <NAME>, <EMAIL> # ###############################...
Radanisk/writeexcel
examples/utf8.rb
#!/usr/bin/ruby -w # -*- coding: utf-8 -*- $debug = true require 'writeexcel' workbook = WriteExcel.new('utf8.xls') worksheet = workbook.add_worksheet('シート1') format = workbook.add_format(:font => 'MS 明朝') worksheet.set_footer('フッター') worksheet.set_header('ヘッダー') worksheet.write('A1', 'UTF8文字列', format) worksheet.wr...
Radanisk/writeexcel
lib/writeexcel/debug_info.rb
<filename>lib/writeexcel/debug_info.rb # -*- coding: utf-8 -*- require 'writeexcel/caller_info' if defined?($writeexcel_debug) class BIFFWriter include CallerInfo def append(*args) data = ruby_18 { args.join } || ruby_19 { args.collect{ |arg| arg.dup.force_encoding('ASCII-8BIT') }.joi...
Radanisk/writeexcel
examples/right_to_left.rb
<reponame>Radanisk/writeexcel #!/usr/bin/ruby -w # -*- coding: utf-8 -*- ####################################################################### # # Example of how to change the default worksheet direction from # left-to-right to right-to-left as required by some eastern verions # of Excel. # # reverse('©'), January 2...
Radanisk/writeexcel
test/test_28_autofilter.rb
<filename>test/test_28_autofilter.rb # -*- coding: utf-8 -*- ########################################################################## # test_28_autofilter.rb # # Tests for the token parsing methods used to parse autofilter expressions. # # reverse('©'), September 2005, <NAME>, <EMAIL> # # original written in Perl by ...
Radanisk/writeexcel
examples/outline.rb
<filename>examples/outline.rb #!/usr/bin/ruby -w # -*- coding: utf-8 -*- ############################################################################### # # Example of how use Spreadsheet::WriteExcel to generate Excel outlines and # grouping. # # # Excel allows you to group rows or columns so that they can be hidden o...
Radanisk/writeexcel
lib/writeexcel/version.rb
<gh_stars>10-100 require 'writeexcel' class WriteExcel < Workbook VERSION = "1.0.5" end
Radanisk/writeexcel
lib/writeexcel/properties.rb
<gh_stars>10-100 # -*- coding: utf-8 -*- ############################################################################### # # Properties - A module for creating Excel property sets. # # # Used in conjunction with WriteExcel # # Copyright 2000-2010, <NAME>. # # original written in Perl by <NAME> # converted to Ruby by <N...
theletterf/ruby-rails-instrumentation
spec/subscribers/action_controller_subscriber_spec.rb
require 'spec_helper' RSpec.describe Rails::Instrumentation::ActionControllerSubscriber do let(:tracer) { OpenTracingTestTracer.build } before { allow(Rails::Instrumentation).to receive(:tracer).and_return(tracer) } describe 'Class Methods' do it 'responds to all event methods' do test_class_events(d...
theletterf/ruby-rails-instrumentation
spec/subscribers/active_record_subscriber_spec.rb
require 'spec_helper' RSpec.describe Rails::Instrumentation::ActiveRecordSubscriber do let(:tracer) { OpenTracingTestTracer.build } before { allow(Rails::Instrumentation).to receive(:tracer).and_return(tracer) } describe 'Class Methods' do it 'responds to all event methods' do test_class_events(descr...
theletterf/ruby-rails-instrumentation
lib/rails/instrumentation/patch.rb
<gh_stars>1-10 module Rails module Instrumentation module Patch def self.patch_process_action(klass: ::ActionController::Instrumentation) klass.class_eval do alias_method :process_action_original, :process_action def process_action(method_name, *args) # this naming s...
theletterf/ruby-rails-instrumentation
spec/spec_helper.rb
<filename>spec/spec_helper.rb require 'bundler/setup' require 'rails/instrumentation' require 'signalfx_test_tracer' # require 'rack/test' RSpec.configure do |config| config.expect_with :rspec do |c| c.syntax = :expect end end def test_class_events(subscriber_class) subscriber_class::EVENTS.each do |event| ...
theletterf/ruby-rails-instrumentation
lib/rails/instrumentation/utils.rb
require 'active_support/notifications' module Rails module Instrumentation module Utils class << self # calls a handler function with name 'event' on the handler module. # For example, if the handler module is ActionViewSubscriber and the # event hook is 'render_template.action_cont...
jtimberman/chef-handler-updated-resources
chef-handler-updated-resources.gemspec
<gh_stars>1-10 Gem::Specification.new do |s| s.name = 'chef-handler-updated-resources' s.version = '0.2.0' s.platform = Gem::Platform::RUBY s.summary = 'Chef report handler to display resources updated in the Chef Run' s.description = s.summary s.author = '<NAME>' s.email = '<EMAIL>' s.homepage = 'http:...
jtimberman/chef-handler-updated-resources
lib/chef/handler/updated_resources.rb
# # Copyright:: 2011, <NAME> <<EMAIL>> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
J5Wood/flavor-town
backend/db/seeds.rb
<gh_stars>0 # This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the R...
J5Wood/flavor-town
backend/app/serializers/city_serializer.rb
<reponame>J5Wood/flavor-town class CitySerializer include FastJsonapi::ObjectSerializer attributes :name, :id has_many :restaurants end
J5Wood/flavor-town
backend/config/routes.rb
<filename>backend/config/routes.rb<gh_stars>0 Rails.application.routes.draw do resources :restaurants resources :cities do resources :restaurants, only: [:index] end # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html end
J5Wood/flavor-town
backend/app/serializers/restaurant_serializer.rb
<filename>backend/app/serializers/restaurant_serializer.rb class RestaurantSerializer include FastJsonapi::ObjectSerializer attributes :name, :style, :neighborhood, :notes, :top_dishes, :id belongs_to :city end
J5Wood/flavor-town
backend/app/controllers/cities_controller.rb
class CitiesController < ApplicationController def index cities = City.all render json: CitySerializer.new(cities) end def create if city = City.find_by(name: params[:name]) render json: CitySerializer.new(city) else city = City.new(city_params) ...
J5Wood/flavor-town
backend/app/models/restaurant.rb
<filename>backend/app/models/restaurant.rb class Restaurant < ApplicationRecord belongs_to :city serialize :top_dishes validates :name, :style, :neighborhood, :notes, presence: true end
J5Wood/flavor-town
backend/app/controllers/restaurants_controller.rb
<gh_stars>0 class RestaurantsController < ApplicationController def index if !!params[:city_id] city = City.find_by(id: params[:city_id]) restaurants = city.restaurants else restaurants = Restaurant.all end render json: RestaurantSerializer.new(res...
PatrickJamesHoban/fido_and_furball
config/routes.rb
Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html root 'static_pages#home' # get 'static_pages/home' # No longer needed as the root route above is the same. get '/help', to: 'static_pages#help' #, as: 'helf' get '/about',...
PatrickJamesHoban/fido_and_furball
app/helpers/application_helper.rb
module ApplicationHelper # Returns the full title depending on what is available. def full_title(custom_title = '', page_title = '') base_title = "Ellie Farmgirl" if custom_title.empty? page_title + ' | ' + base_title else custom_title end end end
PatrickJamesHoban/fido_and_furball
app/controllers/application_controller.rb
class ApplicationController < ActionController::Base protect_from_forgery with: :exception # def hello # render html: 'Coming soon... Fido and Furball, the greatest thing to ever happen for pets! - An Ellie Farmgirl, <NAME> and <NAME> Production' # end end
twei55/simple-bookshelf
db/migrate/20120622140404_create_groups.rb
class CreateGroups < ActiveRecord::Migration def up create_table :groups do |t| t.string :name t.timestamps end add_column :users, :group_id, :integer add_column :admins, :group_id, :integer end def down drop_table :groups remove_column :users, :group_id remove_column :admi...
twei55/simple-bookshelf
db/migrate/20120516165837_add_delta_index_to_books.rb
class AddDeltaIndexToBooks < ActiveRecord::Migration def up add_column :books, :delta, :boolean, :default => true, :null => false end def down remove_column :books, :delta end end
twei55/simple-bookshelf
spec/requests/signin_spec.rb
<gh_stars>0 # encoding: utf-8 require 'spec_helper' describe "signin" do let(:admin) { FactoryGirl.create(:admin, :group => Group.first) } let(:user) { FactoryGirl.create(:user, :group => Group.first) } it "signs me in as admin" do visit new_user_session_path fill_in("user_email", :with => admin.email) fill...
twei55/simple-bookshelf
db/migrate/20120323161637_create_books_formats_join_table.rb
<gh_stars>0 class CreateBooksFormatsJoinTable < ActiveRecord::Migration def up create_table :books_formats, :id => false, :force => true do |t| t.column :book_id, :integer t.column :format_id, :integer t.timestamps end end def down drop_table :books_formats end end
twei55/simple-bookshelf
db/schema.rb
# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative sou...
twei55/simple-bookshelf
config/environment.rb
# Load the rails application require File.expand_path('../application', __FILE__) # Initialize the rails application SimpleBookshelf::Application.initialize! Encoding.default_external = "UTF-8" # http://groups.google.com/group/thinking-sphinx/browse_thread/thread/66d0cbef8697dd60/76810ccee253ffe9 ThinkingSphinx.upda...
twei55/simple-bookshelf
spec/requests/update_book_spec.rb
# encoding: utf-8 require 'spec_helper' describe "create book" do let(:admin) { FactoryGirl.create(:admin, :group => Group.first) } let(:user) { FactoryGirl.create(:user, :group => Group.first) } before(:each) do visit new_user_session_path fill_in("user_email", :with => admin.email) fill_in("user_passw...
twei55/simple-bookshelf
app/controllers/nested_tags_controller.rb
# encoding: utf-8 class NestedTagsController < ApplicationController before_filter :authenticate_admin before_filter :delete_tags_fragment, :only => [:create, :update,:destroy] before_filter :delete_tags_in_use_fragment, :only => [:update,:destroy] def index @nested_tag = NestedTag.new end def creat...
twei55/simple-bookshelf
db/migrate/20120323140925_create_authors.rb
<reponame>twei55/simple-bookshelf<gh_stars>0 class CreateAuthors < ActiveRecord::Migration def up create_table :authors do |t| t.string :first_name t.string :last_name, :null => false t.timestamps end end def down drop_table :authors end end
twei55/simple-bookshelf
spec/factories/groups.rb
# encoding: utf-8 FactoryGirl.define do factory :group1, :class => Group do name "Gruppe 1" end factory :group2, :class => Group do name "Gruppe 2" end end
twei55/simple-bookshelf
db/migrate/20120413102244_add_attachment_document_to_books.rb
<reponame>twei55/simple-bookshelf class AddAttachmentDocumentToBooks < ActiveRecord::Migration def self.up add_column :books, :document_file_name, :string add_column :books, :document_content_type, :string add_column :books, :document_file_size, :integer add_column :books, :document_updated_at, :datet...
twei55/simple-bookshelf
app/controllers/users/registrations_controller.rb
class Users::RegistrationsController < Devise::RegistrationsController def create build_resource resource.try(:add_to_group, params[:group]) if resource.save if resource.active_for_authentication? set_flash_message :notice, :signed_up if is_navigational_format? sign_in(resource_na...
twei55/simple-bookshelf
db/migrate/20120418195637_add_full_name_to_authors.rb
<gh_stars>0 class AddFullNameToAuthors < ActiveRecord::Migration def up add_column :authors, :full_name, :string add_column :authors, :full_name_reversed, :string end def down remove_column :authors, :full_name remove_column :authors, :full_name_reversed end end
twei55/simple-bookshelf
spec/models/format_spec.rb
<reponame>twei55/simple-bookshelf<gh_stars>0 require 'spec_helper' describe Format do end
twei55/simple-bookshelf
db/migrate/20120511100424_create_book_authors.rb
<reponame>twei55/simple-bookshelf<filename>db/migrate/20120511100424_create_book_authors.rb class CreateBookAuthors < ActiveRecord::Migration def up create_table :book_authors, :force => true do |t| t.integer :author_id t.integer :book_id t.timestamps end end def down drop_table ...
twei55/simple-bookshelf
app/models/user.rb
<reponame>twei55/simple-bookshelf class User < ActiveRecord::Base # Include default devise modules. Others available are: # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackabl...
twei55/simple-bookshelf
spec/requests/registration_spec.rb
<reponame>twei55/simple-bookshelf # encoding: utf-8 require 'spec_helper' describe "registration process" do it "should redirect back to form if no group is selected" do visit new_user_registration_path fill_in("user_email", :with => "<EMAIL>") fill_in("user_password", :with => "<PASSWORD>") fill_in("user_p...
twei55/simple-bookshelf
spec/controllers/formats_controller_spec.rb
require 'spec_helper' describe FormatsController do end
twei55/simple-bookshelf
spec/requests/visit_all_pages_spec.rb
# encoding: utf-8 require 'spec_helper' describe "visit all pages" do let(:admin) { FactoryGirl.create(:admin, :group => Group.first) } it "raises no errors when visiting pages" do visit new_user_session_path fill_in("user_email", :with => admin.email) fill_in("user_password", :with => <PASSWORD>) click_...
twei55/simple-bookshelf
spec/requests/create_new_book_spec.rb
# encoding: utf-8 require 'spec_helper' describe "create book" do let(:admin) { FactoryGirl.create(:admin, :group => Group.first) } let(:user) { FactoryGirl.create(:user, :group => Group.first) } before(:each) do visit new_user_session_path fill_in("user_email", :with => admin.email) fill_in("user_passwo...
twei55/simple-bookshelf
app/helpers/books_helper.rb
# encoding: utf-8 module BooksHelper # Taken from Railscast #197 # http://railscasts.com/episodes/197-nested-model-form-part-2?view=asciicast def add_new_author_fields(f, association) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.fields_for(association, new_objec...
twei55/simple-bookshelf
spec/helpers/books_helper_spec.rb
# encoding: utf-8 require 'spec_helper' # Specs in this file have access to a helper object that includes # the BooksHelper. For example: # # describe BooksHelper do # describe "string concat" do # it "concats two strings with spaces" do # helper.concat_strings("this","that").should == "this that" # en...
twei55/simple-bookshelf
db/migrate/20120623134245_add_confirmable_to_users.rb
<reponame>twei55/simple-bookshelf class AddConfirmableToUsers < ActiveRecord::Migration def up ## Confirmable add_column :users, :confirmation_token, :string add_column :users, :confirmed_at, :datetime add_column :users, :confirmation_sent_at, :datetime add_column :users, :unconfirmed_email, :string...
twei55/simple-bookshelf
db/migrate/20120511180037_remove_authors_books_join_table.rb
<gh_stars>0 class RemoveAuthorsBooksJoinTable < ActiveRecord::Migration def up drop_table :authors_books end def down create_table :authors_books, {:id => false, :force => true} do |t| t.integer :author_id t.integer :book_id t.timestamps end end end
twei55/simple-bookshelf
db/migrate/20120419085537_add_indexes.rb
class AddIndexes < ActiveRecord::Migration def up add_index :authors_books, :author_id add_index :authors_books, :book_id add_index :books_formats, :book_id add_index :books_formats, :format_id add_index :books_nested_tags, :book_id add_index :books_nested_tags, :nested_tag_id end def down remove_in...
twei55/simple-bookshelf
app/models/entry.rb
class Entry < ActiveRecord::Base belongs_to :book belongs_to :group end
twei55/simple-bookshelf
app/controllers/books_controller.rb
<gh_stars>0 # encoding : utf-8 class BooksController < ApplicationController before_filter :authenticate_user_or_admin, :only => [:index, :show] before_filter :authenticate_admin, :only => [:new, :create, :edit, :update, :destroy] before_filter :delete_tag_in_use_fragment, :only => [:create, :update, :destroy] be...
twei55/simple-bookshelf
spec/models/book_spec.rb
<filename>spec/models/book_spec.rb # encoding: utf-8 require 'spec_helper' describe Book do let(:user1) { FactoryGirl.create(:user, :group => Group.first) } let(:user2) { FactoryGirl.create(:user, :group => Group.last) } describe '.filter' do context "search" do it "returns only books...
twei55/simple-bookshelf
spec/factories/books.rb
# encoding: utf-8 # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :book0, :class => Book do title "Neuromancer" year "2001" publisher "Suhrkamp" publisher_is_author false end factory :book1, :class => Book do title "<NAME>" year "2001" pub...
twei55/simple-bookshelf
db/migrate/20120323140859_create_books.rb
class CreateBooks < ActiveRecord::Migration def up create_table :books, :options => "ENGINE=MyISAM" do |t| t.string :title, :null => false t.string :year, :null => false t.string :publisher, :null => false t.text :abstract t.text :location t.boolean :publisher_is_author ...
twei55/simple-bookshelf
spec/requests/formats_spec.rb
# encoding: utf-8 require 'spec_helper' describe "create, update, delete formats" do let(:admin) { FactoryGirl.create(:admin, :group => Group.first) } let(:user) { FactoryGirl.create(:user, :group => Group.first) } before(:each) do visit new_user_session_path fill_in("user_email", :with => admin.email) ...
twei55/simple-bookshelf
db/migrate/20120323161237_create_authors_books_join_table.rb
class CreateAuthorsBooksJoinTable < ActiveRecord::Migration def up create_table :authors_books, {:id => false, :force => true} do |t| t.integer :author_id t.integer :book_id t.timestamps end end def down drop_table :authors_books end end
twei55/simple-bookshelf
app/models/author.rb
class Author < ActiveRecord::Base ################################ ### ActiveRecord Associations ## ################################ has_many :book_authors has_many :books, :through => :book_authors ################################ ### ActiveRecord Validations ## ################################ ...
twei55/simple-bookshelf
app/controllers/application_controller.rb
<reponame>twei55/simple-bookshelf<filename>app/controllers/application_controller.rb<gh_stars>0 class ApplicationController < ActionController::Base protect_from_forgery before_filter :set_locale def set_locale I18n.locale = params[:locale] || I18n.default_locale end def default_url_options(options = {}) ...