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
jsvine/reporter
https://github.com/jsvine/reporter
_plugins/subdir-categories.rb
Ruby
mit
92
master
260
require "crochet" Crochet::Hook.new(Jekyll::Post) do after :initialize do |post, site, source, dir, name| subdirs = name.split("/")[0...-1] new_categories = (self.categories + subdirs).compact.uniq self.categories = new_categories end end
github
jsvine/reporter
https://github.com/jsvine/reporter
_plugins/mtime.rb
Ruby
mit
92
master
707
require "crochet" # Allow posts names to not begin with a date STRICT_MATCH = Jekyll::Post::MATCHER Jekyll::Post::MATCHER = /^(.+\/)*(\d+-\d+-\d+)?-?(.*)(\.[^.]+)$/ Crochet::Hook.new(Jekyll::Post) do before! :process do |name| mtime = File.mtime(File.join(@base, name)) @mtime = mtime # If a p...
github
callahanrts/dbmgr
https://github.com/callahanrts/dbmgr
dbmgr.gemspec
Ruby
mit
92
master
1,348
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'dbmgr/version' Gem::Specification.new do |spec| spec.name = "dbmgr" spec.version = Dbmgr::VERSION spec.authors = ["Cody"] spec.email = ["callahanrts@gmail.com...
github
callahanrts/dbmgr
https://github.com/callahanrts/dbmgr
lib/database/database.rb
Ruby
mit
92
master
965
require "database/mysql" require "database/postgresql" # Database Class class Database def initialize(options = {}) @user = options[:user] @host = options[:host] @port = options[:port] @path = options[:path] @file = options[:filename] @backup = options[:backup] end private # Construct...
github
callahanrts/dbmgr
https://github.com/callahanrts/dbmgr
lib/database/postgresql.rb
Ruby
mit
92
master
1,188
require 'fileutils' module PostgreSQL def backup(db_name) FileUtils::mkdir_p @path # Create a postgresql backup from the user supplied options system backup_db_command(db_name), out: File::NULL rescue raise 'Unable to back up database' end def restore(db_name) # Create the database to res...
github
callahanrts/dbmgr
https://github.com/callahanrts/dbmgr
lib/database/mysql.rb
Ruby
mit
92
master
1,015
require 'fileutils' module MySQL def backup(db_name) FileUtils::mkdir_p @path # Create a mysql backup from the user supplied options system backup_db_command db_name rescue raise 'Unable to back up database' end def restore(db_name) # Create the database to restore if it doesn't exist alr...
github
callahanrts/dbmgr
https://github.com/callahanrts/dbmgr
lib/dbmgr/postgresql.rb
Ruby
mit
92
master
214
require 'dbmgr/postgresql/backup' require 'dbmgr/postgresql/restore' module Dbmgr class CLI < Thor desc "psql", "Run commands on PostgreSQL Databases" subcommand "psql", Dbmgr::PostgreSQLCLI end end
github
callahanrts/dbmgr
https://github.com/callahanrts/dbmgr
lib/dbmgr/postgresql/restore.rb
Ruby
mit
92
master
1,362
module Dbmgr class PostgreSQLCLI < Thor desc "restore", "Restore from a backup" method_option :backup, aliases: ["b"], type: :string, banner: "#{ENV["HOME"]}/.db_backups/backup.sql", desc: "Path to backup to restore from" method_opt...
github
callahanrts/dbmgr
https://github.com/callahanrts/dbmgr
lib/dbmgr/postgresql/backup.rb
Ruby
mit
92
master
1,325
module Dbmgr class PostgreSQLCLI < Thor desc "backup", "Create a backup" method_option :filename, aliases: ["f"], type: :string, banner: "my_backup.sql", desc: "Name of the backup created" method_option :path, alia...
github
callahanrts/dbmgr
https://github.com/callahanrts/dbmgr
lib/dbmgr/mysql/restore.rb
Ruby
mit
92
master
1,329
module Dbmgr class MySQLCLI < Thor desc "restore", "Restore from a backup" method_option :backup, aliases: ["b"], type: :string, banner: "#{ENV["HOME"]}/.db_backups/backup.sql", desc: "Path to backup to restore from" method_option :...
github
callahanrts/dbmgr
https://github.com/callahanrts/dbmgr
lib/dbmgr/mysql/backup.rb
Ruby
mit
92
master
1,292
module Dbmgr class MySQLCLI < Thor desc "backup", "Create a backup" method_option :filename, aliases: ["f"], type: :string, banner: "my_backup.sql", desc: "Name of the backup created" method_option :path, aliases: ...
github
callahanrts/dbmgr
https://github.com/callahanrts/dbmgr
test/test_helper.rb
Ruby
mit
92
master
492
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) HOME = '/tmp/dbmgr' ENV["HOME"] = HOME BACKUPS = "#{HOME}/.db_backups" NAMES = ["fred", "joe", "bob", "sue", "jane"] DATABASES = [:mysql, :psql] require 'dbmgr' require 'minitest/autorun' require 'mocha/mini_test' require 'helpers/mysql_helper' require 'helpe...
github
callahanrts/dbmgr
https://github.com/callahanrts/dbmgr
test/helpers/mysql_helper.rb
Ruby
mit
92
master
986
require 'mysql2' class MySQLHelper DB_NAME = "dbmgr_test" def initialize names initialize_database insert_users names end def truncate mysql_client(DB_NAME).query "TRUNCATE TABLE users" end def drop mysql_client(DB_NAME).query "DROP DATABASE IF EXISTS dbmgr_test" end def num_users ...
github
callahanrts/dbmgr
https://github.com/callahanrts/dbmgr
test/helpers/postgresql_helper.rb
Ruby
mit
92
master
1,018
require 'pg' class PostgreSQLHelper PG_DB_NAME = 'postgres' DB_NAME = 'dbmgr_test' def initialize names drop create insert_users names end def truncate pg_exec DB_NAME, ["TRUNCATE TABLE users"] end def drop pg_exec ["DROP DATABASE IF EXISTS #{DB_NAME}"] end def num_users u...
github
callahanrts/dbmgr
https://github.com/callahanrts/dbmgr
test/dbmgr/restore_test.rb
Ruby
mit
92
master
1,490
require 'test_helper' describe Dbmgr::CLI do DATABASES.each do |database| describe "when restoring a #{database} database" do before do @db = database_helper database @users = @db.num_users `mkdir -p #{HOME}` # Create test home directory end after do `rm -rf #{...
github
callahanrts/dbmgr
https://github.com/callahanrts/dbmgr
test/dbmgr/backup_test.rb
Ruby
mit
92
master
1,349
require 'test_helper' describe Dbmgr::CLI do DATABASES.each do |database| describe "Backing up a #{database} database" do before do @db = database_helper database `mkdir -p #{HOME}` # Create test home directory end after do `rm -rf #{HOME}` end it "should p...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
Rakefile
Ruby
mit
92
master
280
#!/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__) AvoinMinisterio::Application.load_tasks
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
Guardfile
Ruby
mit
92
master
1,327
# A sample Guardfile # More info at https://github.com/guard/guard#readme guard 'spork', :rspec_env => { 'RAILS_ENV' => 'test' } do watch('config/application.rb') watch('config/environment.rb') watch(%r{^config/environments/.+\.rb$}) watch(%r{^config/initializers/.+\.rb$}) watch('Gemfile') watch('Gemfile.lo...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
Gemfile
Ruby
mit
92
master
1,843
source "https://rubygems.org" gem "rails", "3.2.17" # Gems used only for assets and not required # in production environments by default. group :assets do gem "coffee-rails", "~> 3.2.2" gem "sass-rails", "= 3.2.5" gem "uglifier", ">= 1.3.0" end gem "devise", '2.1.2' gem "factory_girl_rails", "4.1.0", :re...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
surveys/avoin-ministerio-attitudes-1-fi.rb
Ruby
mit
92
master
12,494
# encoding: UTF-8 survey "Avoin Ministerio Attitudes 1 fi" do section "Tutkimus: Kansalaisaloite ja asenteet politiikkaa kohtaan" do label "Kysymykset koskevat kiinnostustasi politiikkaa kohtaan ja sitä, kuinka Avoimen ministeriön palvelu vaikuttaa siihen. Valitse vaihtoehdoista se, joka kuvaa parhaiten tunteita...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
surveys/avoin-ministerio-attitudes-2-fi.rb
Ruby
mit
92
master
16,851
# encoding: UTF-8 survey "Avoin Ministerio Attitudes 2 fi" do section "Tutkimus: Kansalaisaloite ja asenteet politiikkaa kohtaan" do label "Eduskunta teki äskettäin päätöksen turkistarhauksen kieltämistä koskevasta kansalaisaloitteesta, joka on tähän mennessä ainoa eduskunnassa käsitelty kansalaisaloite. Seuraav...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
surveys/avoin-ministerio-attitudes-1-se.rb
Ruby
mit
92
master
12,215
# encoding: UTF-8 survey "Avoin Ministerio Attitudes 1 se" do section "Medborgarinitiativet och politiska förhållningssätt" do label "Frågorna berör ditt politiska engagemang och hur denna webbportal inverkar på det. 
Anteckna vänligen så noggrant som möjligt de alternativ som bäst beskriver din 
uppfattning jus...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
lib/rack/lock.rb
Ruby
mit
92
master
683
require 'thread' module Rack class Lock FLAG = 'rack.multithread'.freeze def initialize(app, mutex = Mutex.new) @app, @mutex = app, mutex end def call(env) old, env[FLAG] = env[FLAG], false # Capture the mutex for the closure below mutex = @mutex mutex.lock resp...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
lib/tasks/brakeman.rake
Ruby
mit
92
master
216
namespace :brakeman do desc "Run Brakeman" task :run, :output_file do |t, args| require 'brakeman' Brakeman.run :app_path => ".", :output_file => args[:output_file], :print_report => true end end
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
lib/tasks/surveyor_custom_tasks.rake
Ruby
mit
92
master
3,023
namespace :surveyor do desc "custom dump all responses to a given survey" task :custom_dump => :environment do require 'fileutils.rb' survey_version = ENV["SURVEY_VERSION"] access_code = ENV["SURVEY_ACCESS_CODE"] || SURVEY_ACCESS_CODE[:fi] raise "USAGE: rake surveyor:dump SURVEY_ACCESS_CODE=<...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/seeds.rb
Ruby
mit
92
master
20,824
# encoding: UTF-8 require 'factory_girl_rails' puts "seeding data... this process can take 20-25 minutes" Administrator.find_or_create_by_email({ email: "admin@avoinministerio.fi", password: "hallinta" }) [ { email: "expedora@gmail.com", password: "expedora1", password_confirmation: "expedora1", remember_me: t...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/schema.rb
Ruby
mit
92
master
19,193
# 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...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120409205333_create_signatures.rb
Ruby
mit
92
master
440
class CreateSignatures < ActiveRecord::Migration def change create_table :signatures do |t| t.references :citizen t.references :idea t.string :idea_title t.date :idea_date t.string :fullname t.date :birth_date t.string :occupancy_county ...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20121221160551_create_impressions_table.rb
Ruby
mit
92
master
1,355
class CreateImpressionsTable < ActiveRecord::Migration def self.up create_table :impressions, :force => true do |t| t.string :impressionable_type t.integer :impressionable_id t.integer :user_id t.string :controller_name t.string :action_name t.string :view_name t.string :...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20130213114439_add_attachments.mailboxer_engine.rb
Ruby
mit
92
master
265
# This migration comes from mailboxer_engine (originally 20111204163911) class AddAttachments < ActiveRecord::Migration def self.up add_column :notifications, :attachment, :string end def self.down remove_column :notifications, :attachment end end
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120704061305_enable_settings_by_default.rb
Ruby
mit
92
master
1,459
class EnableSettingsByDefault < ActiveRecord::Migration def up change_column_default(:profiles, :receive_newsletter, true) change_column_default(:profiles, :receive_other_announcements, true) change_column_default(:profiles, :receive_weekletter, true) change_column_default(:profiles, :accept_science, ...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120229113917_add_published_state_to_ideas_and_comments.rb
Ruby
mit
92
master
330
class AddPublishedStateToIdeasAndComments < ActiveRecord::Migration def change add_column :ideas, :publish_state, :string, default: "published" add_column :comments, :publish_state, :string, default: "published" add_index :ideas, :publish_state add_index :comments, :publish_state ...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120304183018_create_slugs_for_existing_articles.rb
Ruby
mit
92
master
307
class CreateSlugsForExistingArticles < ActiveRecord::Migration def up Article.transaction { articles = Article.all puts "Updating slugs for #{articles.size} articles." articles.each do |article| article.save! end puts "Updated." } end def down end end
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120412140019_add_signature_collecting_to_idea.rb
Ruby
mit
92
master
1,408
class AddSignatureCollectingToIdea < ActiveRecord::Migration def up add_column :ideas, :collecting_started, :boolean add_column :ideas, :collecting_ended, :boolean add_column :ideas, :collecting_start_date, :date add_column :ideas, :collecting_end_date, :date add_column :ideas, :additional_signatu...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120229180820_create_slugs_for_existing_ideas.rb
Ruby
mit
92
master
208
class CreateSlugsForExistingIdeas < ActiveRecord::Migration def up ideas = Idea.all.each do |idea| idea.save! end puts "Updated slugs for #{ideas.size} ideas." end def down end end
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120304000619_create_changelogs.rb
Ruby
mit
92
master
442
class CreateChangelogs < ActiveRecord::Migration def change create_table :changelogs do |t| t.string :changer_type t.integer :changer_id t.string :changelogged_type t.integer :changelogged_id t.string :change_type t.text :attribute_changes t.timestamps end add_in...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120217125041_devise_create_administrators.rb
Ruby
mit
92
master
1,021
class DeviseCreateAdministrators < ActiveRecord::Migration def change create_table(:administrators) do |t| # ## Database authenticatable t.string :email, :null => false, :default => "" t.string :encrypted_password, :null => false, :default => "" # ## Recoverable t.strin...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120727060642_add_sessions_table.rb
Ruby
mit
92
master
309
class AddSessionsTable < ActiveRecord::Migration def up create_table :sessions do |t| t.string :session_id, :null => false t.text :data t.timestamps end add_index :sessions, :session_id add_index :sessions, :updated_at end def down drop_table :sessions end end
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120705195735_add_acceptances_to_signature.rb
Ruby
mit
92
master
646
class AddAcceptancesToSignature < ActiveRecord::Migration def up add_column :signatures, :accept_general, :boolean add_column :signatures, :accept_non_eu_server, :boolean add_column :signatures, :accept_publicity, :string add_column :signatures, :accept_science, :boolean ...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120116143518_create_ideas.rb
Ruby
mit
92
master
260
class CreateIdeas < ActiveRecord::Migration def change create_table :ideas do |t| t.string :title t.text :body t.string :state, default: "idea" t.integer :author_id t.timestamps end end end
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20121009172141_add_unique_identifier_to_money_transaction.rb
Ruby
mit
92
master
213
class AddUniqueIdentifierToMoneyTransaction < ActiveRecord::Migration def change change_table :money_transactions do |table| table.string :unique_identifier, length: 64, unique: true end end end
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120716090326_add_collecting_in_service_to_idea.rb
Ruby
mit
92
master
712
class AddCollectingInServiceToIdea < ActiveRecord::Migration def up add_column :ideas, :collecting_in_service, :boolean add_column :ideas, :additional_collecting_service_urls, :string # using !!! as a separator between multiple urls # WARNING!!! BEWARE!!! This update is good only for testing purposes. ...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120604100818_add_stamp_to_signatures.rb
Ruby
mit
92
master
267
class AddStampToSignatures < ActiveRecord::Migration def up add_column :signatures, :stamp, :string add_column :signatures, :started, :datetime end def down remove_column :signatures, :stamp remove_column :signatures, :started end end
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120403211306_add_counters_to_idea.rb
Ruby
mit
92
master
2,048
class AddCountersToIdea < ActiveRecord::Migration def up Idea.transaction do add_column :ideas, :comment_count, :integer, default: 0 add_column :ideas, :vote_count, :integer, default: 0 add_column :ideas, :vote_for_count, :integer, default: 0 add_column :ideas, :vote_against_count, :integ...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120223230917_create_articles.rb
Ruby
mit
92
master
328
class CreateArticles < ActiveRecord::Migration def change create_table :articles do |t| t.string :title t.text :ingress t.text :body t.string :article_type t.references :idea t.references :citizen t.datetime :created_at t.datetime :updated_at end ...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20130213114436_create_mailboxer.mailboxer_engine.rb
Ruby
mit
92
master
2,061
# This migration comes from mailboxer_engine (originally 20110511145103) class CreateMailboxer < ActiveRecord::Migration def self.up #Tables #Conversations create_table :conversations do |t| t.column :subject, :string, :default => "" t.column :created_at, :datetime, :null => false t.col...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120127114146_create_profiles.rb
Ruby
mit
92
master
213
class CreateProfiles < ActiveRecord::Migration def change create_table :profiles do |t| t.integer :citizen_id t.string :first_name t.string :last_name t.timestamps end end end
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120116142654_devise_create_citizens.rb
Ruby
mit
92
master
1,116
class DeviseCreateCitizens < ActiveRecord::Migration def change create_table(:citizens) do |t| # ## Database authenticatable t.string :email, :null => false, :default => "" t.string :encrypted_password, :null => false, :default => "" # ## Recoverable t.string :reset_p...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20130213114437_add_notified_object.mailboxer_engine.rb
Ruby
mit
92
master
497
# This migration comes from mailboxer_engine (originally 20110719110700) class AddNotifiedObject < ActiveRecord::Migration def self.up change_table :notifications do |t| t.references :notified_object, :polymorphic => true t.remove :object_id t.remove :object_type end end def self.down ...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120226181658_create_authentications.rb
Ruby
mit
92
master
396
class CreateAuthentications < ActiveRecord::Migration def change create_table :authentications do |t| t.string :provider t.string :uid t.text :info t.text :credentials t.text :extra t.references :citizen t.timestamps end add_index :authentications, [:provider, :...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20130213114440_rename_receipts_read.mailboxer_engine.rb
Ruby
mit
92
master
251
# This migration comes from mailboxer_engine (originally 20120813110712) class RenameReceiptsRead < ActiveRecord::Migration def up rename_column :receipts, :read, :is_read end def down rename_column :receipts, :is_read, :read end end
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120628071713_add_settings_to_profiles.rb
Ruby
mit
92
master
411
class AddSettingsToProfiles < ActiveRecord::Migration def change add_column :profiles, :receive_newsletter, :boolean add_column :profiles, :receive_other_announcements, :boolean add_column :profiles, :receive_weekletter, :boolean add_column :profiles, :first_names, :string add_column :profiles, :a...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120604134535_split_names_in_signature.rb
Ruby
mit
92
master
367
class SplitNamesInSignature < ActiveRecord::Migration def up add_column :signatures, :firstnames, :string add_column :signatures, :lastname, :string remove_column :signatures, :fullname end def down remove_column :signatures, :firstnames remove_column :signatures, :lastname add_colu...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20130213114438_add_notification_code.mailboxer_engine.rb
Ruby
mit
92
master
350
# This migration comes from mailboxer_engine (originally 20110912163911) class AddNotificationCode < ActiveRecord::Migration def self.up change_table :notifications do |t| t.string :notification_code, :default => nil end end def self.down change_table :notifications do |t| t.remove :notif...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120315212319_create_expert_suggestions.rb
Ruby
mit
92
master
388
class CreateExpertSuggestions < ActiveRecord::Migration def change create_table :expert_suggestions do |t| t.string :firstname t.string :lastname t.string :email t.string :jobtitle t.string :organisation t.string :expertise t.string :recommendation t.references :cit...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120908131725_create_money_transactions.rb
Ruby
mit
92
master
265
class CreateMoneyTransactions < ActiveRecord::Migration def change create_table :money_transactions do |t| t.references :citizen t.decimal :amount, precision: 8, scale: 2 t.string :description t.timestamps end end end
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120217162249_create_votes.rb
Ruby
mit
92
master
268
class CreateVotes < ActiveRecord::Migration def change create_table :votes do |t| t.integer :option t.references :idea t.references :citizen t.timestamps end add_index :votes, :idea_id add_index :votes, :citizen_id end end
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20121013234109_add_authenticated_fields_to_profile.rb
Ruby
mit
92
master
335
class AddAuthenticatedFieldsToProfile < ActiveRecord::Migration def change add_column :profiles, :authenticated_firstnames, :string add_column :profiles, :authenticated_lastname, :string add_column :profiles, :authenticated_birth_date, :string add_column :profiles, :authenticated_occupancy_county, :st...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120229101345_create_missing_indexes.rb
Ruby
mit
92
master
438
class CreateMissingIndexes < ActiveRecord::Migration def up add_index :comments, :author_id add_index :comments, [:commentable_id, :commentable_type] add_index :ideas, :author_id add_index :profiles, :citizen_id end def down remove_index :comments, :author_id remove_index :comments, [:com...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120806062640_add_updated_content_at_to_ideas.rb
Ruby
mit
92
master
392
class AddUpdatedContentAtToIdeas < ActiveRecord::Migration def up add_column :ideas, :updated_content_at, :datetime Idea.record_timestamps = false Idea.all.each do |idea| idea.updated_content_at = idea.updated_at idea.save(:validate => false) end Idea.record_timestamps = true en...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20130301090319_create_locations.rb
Ruby
mit
92
master
207
class CreateLocations < ActiveRecord::Migration def change create_table :locations do |t| t.string :address t.float :latitude t.float :longitude t.timestamps end end end
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
db/migrate/20120127112836_create_comments.rb
Ruby
mit
92
master
285
class CreateComments < ActiveRecord::Migration def change create_table :comments do |t| t.integer :author_id t.text :body t.boolean :published, default: true t.integer :commentable_id t.string :commentable_type t.timestamps end end end
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
middleware/api.rb
Ruby
mit
92
master
232
#lib/api.rb require 'grape' module AmApi class Api < Grape::API prefix "api" resource "ideas" do get do Idea.all end get ':id' do Idea.find(params[:id]) end end end end
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
config/application.rb
Ruby
mit
92
master
2,209
require File.expand_path('../boot', __FILE__) require 'rails/all' if defined?(Bundler) # If you precompile assets before deploying to production, use this line Bundler.require(*Rails.groups(:assets => %w(development test))) # If you want your assets lazily compiled in production, use this line # Bundler.requi...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
config/routes.rb
Ruby
mit
92
master
4,985
AvoinMinisterio::Application.routes.draw do resource :profile, :except => [:new, :create, :destroy] resource :citizen, :only => [:edit, :update] match "/ideas/:id/vote/:vote" => "vote#vote", as: :vote_idea match "/ideas/:id/service_selection" => "sign...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
config/environment.rb
Ruby
mit
92
master
435
# Load the rails application require File.expand_path('../application', __FILE__) # preload various tokens to local ENV api_tokens = YAML.load(File.read(Rails.root.join('config', 'api_keys', "#{Rails.env}.yml"))) rescue {} api_tokens.each{ |key, val| ENV[key] = val } # Initialize the rails application AvoinMinisterio...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
config/initializers/newrelic.rb
Ruby
mit
92
master
359
# Ensure the agent is started using Unicorn # This is needed when using Unicorn and preload_app is not set to true. # See https://newrelic.com/docs/troubleshooting/im-using-unicorn-and-i-dont-see-any-data if defined? Unicorn and defined? NewRelic and defined? NewRelic::Agent and ENV["NEW_RELIC_ID"] NewRelic::Agent.af...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
config/initializers/mailboxer.rb
Ruby
mit
92
master
705
Mailboxer.setup do |config| #Configures if you applications uses or no the email sending for Notifications and Messages config.uses_emails = true #Configures the default from for the email sent for Messages and Notifications of Mailboxer config.default_from = "yksityisviestit@avoinministerio.fi" #Con...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
config/initializers/in_memory_database.rb
Ruby
mit
92
master
333
def in_memory_database? return false unless Rails.env == "test" db_config = Rails.configuration.database_configuration['test'] db_config && db_config['adapter'] == 'sqlite3' && db_config['database'] == ':memory:' end if in_memory_database? puts "creating sqlite in memory database" load "#{Rails.root}/db/sc...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
config/initializers/devise.rb
Ruby
mit
92
master
9,788
# 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| # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use yo...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
config/initializers/simple_form.rb
Ruby
mit
92
master
3,364
# Use this setup block to configure all options available in SimpleForm. SimpleForm.setup do |config| # Components used by the form builder to generate a complete input. You can remove # any of them, change the order, or even add your own components to the stack. # config.components = [ :placeholder, :label_input...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
config/environments/production.rb
Ruby
mit
92
master
3,243
AvoinMinisterio::Application.configure do # Settings specified here will take precedence over those in config/application.rb # Rails secret token from environment variable config.secret_token = File.read(File.join(Rails.root, "secret_token")) rescue ENV['RAILS_SECRET_TOKEN'] # Code is not reloaded between req...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
config/environments/test.rb
Ruby
mit
92
master
2,060
AvoinMinisterio::Application.configure do # Settings specified here will take precedence over those in config/application.rb # Rails secret token for test environment config.secret_token = '6425e157ad45a7585847f91cd58634d6630cb82a60cdfdfa4c9f20a3292aaebc2f1650f8f480cd48b7a626fb02b0c2a35b9d5fde4d17e6c3b844b4fd5bf...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
config/environments/development.rb
Ruby
mit
92
master
1,820
AvoinMinisterio::Application.configure do # Settings specified here will take precedence over those in config/application.rb # Rails secret token for development environment config.secret_token = '6425e157ad45a7585847f91cd58634d6630cb82a60cdfdfa4c9f20a3292aaebc2f1650f8f480cd48b7a626fb02b0c2a35b9d5fde4d17e6c3b844...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/factories.rb
Ruby
mit
92
master
2,036
# encoding: UTF-8 FactoryGirl.define do sequence :email do |n| "citizen_#{n}@example.com" end factory :profile do |p| first_names 'Erkki Kalevi' first_name 'Erkki' last_name 'Esimerkki' end factory :citizen do email password "salainensana" association :profile end factor...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/spec_helper.rb
Ruby
mit
92
master
4,551
require "rubygems" require "spork" require 'factory_girl' # --- Instructions --- # Sort the contents of this file into a Spork.prefork and a Spork.each_run # block. # # The Spork.prefork block is run only once when the spork server is started. # You typically want to place most of your (slow) initializer code in here,...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/support/omniauth.rb
Ruby
mit
92
master
1,246
def auth_hash { :provider => 'facebook', :uid => '1234567', :info => { :nickname => 'eerkki', :email => 'erkki@esimerkki.fi', :name => 'Erkki Esimerkki', :first_name => 'Erkki', :last_name => 'Esimerkki', :image => 'http://graph.facebook.com/1234567/picture?type=square'...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/support/be_accessible_matcher.rb
Ruby
mit
92
master
448
# Review: http://stackoverflow.com/questions/9306392/how-to-test-attr-accessible-fields-in-rspec - jaakko RSpec::Matchers.define :be_accessible do |attribute| match do |response| response.class.accessible_attributes.include?(attribute) end description { "be accessible :#{attribute}" } failure_message_for_s...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/acceptance/ideas/index_spec.rb
Ruby
mit
92
master
503
# -*- encoding: utf-8 -*- require "acceptance/acceptance_helper" feature "Ideas#index" do let(:citizen_password) { '123456789' } let(:citizen_email) { 'citizen-kane@example.com'} scenario "Switching between order, should change the link" do citizen = create_logged_in_citizen({ :password => citizen_password,...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/acceptance/citizen/facebook_signup_spec.rb
Ruby
mit
92
master
500
# -*- encoding: utf-8 -*- require "acceptance/acceptance_helper" feature "New citizen logins in with Facebook and creates new account" do background do mock_facebook_omniauth("654321", { email: "citizen-kane@example.com", first_name: "Kane City", last_name: "Citizen"}) end scenario "Create user through Face...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/acceptance/citizen/existing_citizen_facebook_login_spec.rb
Ruby
mit
92
master
458
# -*- encoding: utf-8 -*- require "acceptance/acceptance_helper" feature "Existing citizen logins in with Facebook" do background do _citizen = FactoryGirl.create :facebookin_erkki mock_facebook_omniauth(_citizen.authentication.uid, email: _citizen.email) end scenario "Login with valid credentials" do ...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/acceptance/citizen/signup_spec.rb
Ruby
mit
92
master
725
# -*- encoding: utf-8 -*- require "acceptance/acceptance_helper" feature "Citizen Signup" do let(:password) { '123456789' } let(:citizen) { FactoryGirl.create :citizen, :password => '123456789', :password_confirmation => '123456789' } scenario "Signup" do visit signup_page fill_in "Sähköposti", :with =...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/acceptance/citizen/login_spec.rb
Ruby
mit
92
master
1,007
# -*- encoding: utf-8 -*- require "acceptance/acceptance_helper" feature "Citizen Login" do let(:citizen_password) { '123456789' } let(:citizen_email) { 'citizen-kane@example.com'} background do create_citizen({ :password => citizen_password, :email => citizen_email }) visit login_page end scenario...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/acceptance/admin/articles_spec.rb
Ruby
mit
92
master
2,077
#encoding: utf-8 require "acceptance/acceptance_helper" feature "Articles" do let (:idea) { FactoryGirl.create :idea } describe "PUT /articles" do before do @author = create_citizen create_logged_in_administrator visit administrator_root_path click_link "Artikkelit" ...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/acceptance/survey/survey_spec.rb
Ruby
mit
92
master
778
#encoding: utf-8 require "acceptance/acceptance_helper" Capybara.javascript_driver = :webkit feature "Survey" do scenario "User should be to go to survey after sign_up" do visit signup_page fill_in "Sähköposti", :with => "citizen-kane@example.com" fill_in "Salasana", :with => "salainensana12345" fi...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/acceptance/support/helpers.rb
Ruby
mit
92
master
7,728
# encoding: utf-8 # REVIEW: https://github.com/plataformatec/devise/wiki/How-To:-Controllers-and-Views-tests-with-Rails-3-(and-rspec) - jaakkos # REVIEW: https://github.com/plataformatec/devise/wiki/How-To:-Test-with-Capybara - jaakkos require 'uri' include Warden::Test::Helpers Warden.test_mode! module HelperMetho...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/acceptance/support/paths.rb
Ruby
mit
92
master
537
module NavigationHelpers # Put helper methods related to the paths in your application here. def homepage "/" end def signup_page new_citizen_registration_fi_path end def login_page new_citizen_session_fi_path end def idea_page(idea_id) idea_fi_path(idea_id) end def signature_id...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/acceptance/signing/idea_signing_spec.rb
Ruby
mit
92
master
32,939
# -*- encoding: utf-8 -*- require "acceptance/acceptance_helper" require 'webmock/rspec' # Set to true if you want to run tests which send PUT requests RUN_PUT_TESTS = false # #Capybara.javascript_driver = :webkit feature "Idea signing" do let(:citizen_password) { '123456789' } let(:citizen_email) { 'citizen-kan...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/acceptance/signing/idea_signing_2_spec.rb
Ruby
mit
92
master
7,760
# -*- encoding: utf-8 -*- require "acceptance/acceptance_helper" require 'webmock/rspec' include ApplicationHelper #Capybara.javascript_driver = :webkit feature "Idea signing" do let(:citizen_password) { '123456789' } let(:citizen_email) { 'citizen-kane@example.com'} let(:idea) { FactoryGirl.create :idea, ...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/models/idea_spec.rb
Ruby
mit
92
master
5,421
# encoding: UTF-8 require 'spec_helper' describe Idea do it { should belong_to :author } it { should ensure_length_of(:title).is_at_least(5).with_short_message(/on liian lyhyt/) } it { should ensure_length_of(:body).is_at_least(5).with_short_message(/ideasi hieman/) } let(:idea) { FactoryGirl.create(:idea...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/models/citizen_observer_spec.rb
Ruby
mit
92
master
377
require 'spec_helper' describe CitizenObserver do describe "after_create" do it "should send a welcome email to most recently created user" do citizen = FactoryGirl.create(:citizen) sent_email = ActionMailer::Base.deliveries.last sent_email.subject.should == "Welcome to AvoinMinisterio" ...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/models/vote_spec.rb
Ruby
mit
92
master
1,297
require 'spec_helper' describe Vote do let(:idea) { FactoryGirl.create(:idea) } let(:citizen) { FactoryGirl.create(:citizen) } describe ".by" do before do 5.times { Vote.create(option: 1, idea: idea) } FactoryGirl.create(:vote, option: 1, citizen: citizen, idea: idea) FactoryGirl.crea...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/models/citizen_spec.rb
Ruby
mit
92
master
2,053
require 'spec_helper' describe Citizen do describe "#image" do context "with profile picture" do before do profile = FactoryGirl.create(:profile, :image => "http://www.facebook.com/images/1234.png") @citizen = FactoryGirl.create(:citizen, :profile => profile) end it "should use...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/models/profile_spec.rb
Ruby
mit
92
master
273
require 'spec_helper' describe Profile do it { should belong_to :citizen } describe "#name" do let(:citizen) { FactoryGirl.create(:citizen) } it "returns the full name of the citizen" do citizen.name.should == "Erkki Esimerkki" end end end
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/models/article_spec.rb
Ruby
mit
92
master
496
require 'spec_helper' describe Article do it { should belong_to :author } it { should ensure_length_of(:title).is_at_least(5).with_short_message(/on liian lyhyt/) } let(:article) { FactoryGirl.create(:article) } it "should be valid" do article.should be_valid end it "should have a valid article_type...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/models/comment_spec.rb
Ruby
mit
92
master
1,565
require 'spec_helper' describe Comment do it { should belong_to :author } it { should belong_to :commentable } let(:comment) { FactoryGirl.create(:comment) } describe "Validations" do describe "body" do it "should be present" do comment.body = nil comment.should_not be_valid ...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/models/signature_spec.rb
Ruby
mit
92
master
1,959
require 'spec_helper' describe Signature do describe "Attributes" do # if we remove state from attr_accessible then it's impossible to create new signatures # without mass_assignment non accessible field error # it { should_not be_accessible(:state) } it { should be_accessible(:firstnames) } it ...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/helpers/articles_helper_spec.rb
Ruby
mit
92
master
355
require 'spec_helper' # Specs in this file have access to a helper object that includes # the ArticlesHelper. For example: # # describe ArticlesHelper do # describe "string concat" do # it "concats two strings with spaces" do # helper.concat_strings("this","that").should == "this that" # end # end # ...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/helpers/ideas_helper_spec.rb
Ruby
mit
92
master
4,795
# encoding: UTF-8 require 'spec_helper' describe IdeasHelper do let(:idea) { FactoryGirl.create(:idea) } describe "#idea_state_image" do let(:draft) { FactoryGirl.create(:idea, state: "draft") } let(:proposal) { FactoryGirl.create(:idea, state: "proposal") } let(:law) { FactoryGirl.creat...
github
avoinministerio/avoinministerio
https://github.com/avoinministerio/avoinministerio
spec/helpers/citizens_helper_spec.rb
Ruby
mit
92
master
355
require 'spec_helper' # Specs in this file have access to a helper object that includes # the CitizensHelper. For example: # # describe CitizensHelper do # describe "string concat" do # it "concats two strings with spaces" do # helper.concat_strings("this","that").should == "this that" # end # end # ...