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 | tombenner/omnom | https://github.com/tombenner/omnom | spec/dummy/db/migrate/20130424222538_create_omnom_posts.rb | Ruby | mit | 19 | master | 841 | class CreateOmnomPosts < ActiveRecord::Migration
def change
create_table :omnom_posts do |t|
t.string :guid_namespace, null: false
t.text :guid, null: false
t.text :url, null: false
t.string :title, null: false
t.string :subtitle
t.text :description
t.datetime :published_... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/dummy/config/application.rb | Ruby | mit | 19 | master | 2,593 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require
require "omnom"
module Dummy
class Application < Rails::Application
config.from_file 'omnom.yml'
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go i... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/dummy/config/routes.rb | Ruby | mit | 19 | master | 1,819 | Dummy::Application.routes.draw do
mount Omnom::Engine => '/'
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of na... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/dummy/config/initializers/secret_token.rb | Ruby | mit | 19 | master | 496 | # Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/helpers/source_helpers.rb | Ruby | mit | 19 | master | 290 | module Omnom
module SourceHelpers
def set_posts_for_source_key(feed_class, source_key)
@feed = feed_class.new
@feed.update_by_source_key(source_key)
@posts = PostsOrigin.where(feed_key: @feed.key, source_key: source_key).includes(:post).map(&:post)
end
end
end |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/feed_spec.rb | Ruby | mit | 19 | master | 357 | require 'spec_helper'
describe Omnom::Source::Feed do
include Omnom::SourceHelpers
class DummyFeedFeed < Omnom::Feed
sources do
feed url: 'http://feeds.bbci.co.uk/news/rss.xml'
end
end
before(:all) do
set_posts_for_source_key(DummyFeedFeed, :feed)
end
it 'creates enough posts' do
@... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/github/blog_section_spec.rb | Ruby | mit | 19 | master | 405 | require 'spec_helper'
describe Omnom::Source::Github::BlogSection do
include Omnom::SourceHelpers
class DummyGithubBlogSectionFeed < Omnom::Feed
sources do
github__blog_section section: :meetups
end
end
before(:all) do
set_posts_for_source_key(DummyGithubBlogSectionFeed, :github__blog_secti... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/github/blog_spec.rb | Ruby | mit | 19 | master | 349 | require 'spec_helper'
describe Omnom::Source::Github::Blog do
include Omnom::SourceHelpers
class DummyGithubBlogFeed < Omnom::Feed
sources do
github__blog
end
end
before(:all) do
set_posts_for_source_key(DummyGithubBlogFeed, :github__blog)
end
it 'creates enough posts' do
@posts.co... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/github/default_spec.rb | Ruby | mit | 19 | master | 332 | require 'spec_helper'
describe Omnom::Source::Github::Default do
include Omnom::SourceHelpers
class DummyGithubFeed < Omnom::Feed
sources do
github
end
end
before(:all) do
set_posts_for_source_key(DummyGithubFeed, :github)
end
it 'creates enough posts' do
@posts.count.should be >= ... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/facebook/default_spec.rb | Ruby | mit | 19 | master | 342 | require 'spec_helper'
describe Omnom::Source::Facebook::Default do
include Omnom::SourceHelpers
class DummyFacebookFeed < Omnom::Feed
sources do
facebook
end
end
before(:all) do
set_posts_for_source_key(DummyFacebookFeed, :facebook)
end
it 'creates enough posts' do
@posts.count.sho... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/instagram/default_spec.rb | Ruby | mit | 19 | master | 347 | require 'spec_helper'
describe Omnom::Source::Instagram::Default do
include Omnom::SourceHelpers
class DummyInstagramFeed < Omnom::Feed
sources do
instagram
end
end
before(:all) do
set_posts_for_source_key(DummyInstagramFeed, :instagram)
end
it 'creates enough posts' do
@posts.coun... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/reddit/images_spec.rb | Ruby | mit | 19 | master | 757 | require 'spec_helper'
describe Omnom::Source::Reddit::Images do
include Omnom::SourceHelpers
class DummyRedditImagesFeed < Omnom::Feed
sources do
reddit__images subreddit: 'r/pics'
end
end
before(:all) do
set_posts_for_source_key(DummyRedditImagesFeed, :reddit__images)
end
it 'creates ... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/reddit/default_spec.rb | Ruby | mit | 19 | master | 1,317 | require 'spec_helper'
describe Omnom::Source::Reddit::Default do
include Omnom::SourceHelpers
class DummyRedditFeed < Omnom::Feed
sources do
reddit
end
end
class DummyRedditSubredditFeed < Omnom::Feed
sources do
reddit subreddit: 'r/programming'
end
end
it 'creates enough pos... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/hacker_news/default_spec.rb | Ruby | mit | 19 | master | 738 | require 'spec_helper'
describe Omnom::Source::HackerNews::Default do
include Omnom::SourceHelpers
class DummyHackerNewsFeed < Omnom::Feed
sources do
hacker_news
end
end
before(:all) do
set_posts_for_source_key(DummyHackerNewsFeed, :hacker_news)
end
it 'creates enough posts' do
@pos... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/twitter/search_spec.rb | Ruby | mit | 19 | master | 378 | require 'spec_helper'
describe Omnom::Source::Twitter::Search do
include Omnom::SourceHelpers
class DummyTwitterSearchFeed < Omnom::Feed
sources do
twitter__search term: 'cats'
end
end
before(:all) do
set_posts_for_source_key(DummyTwitterSearchFeed, :twitter__search)
end
it 'creates en... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/slashdot/default_spec.rb | Ruby | mit | 19 | master | 542 | require 'spec_helper'
describe Omnom::Source::Slashdot::Default do
include Omnom::SourceHelpers
class DummySlashdotFeed < Omnom::Feed
sources do
slashdot
end
end
before(:all) do
set_posts_for_source_key(DummySlashdotFeed, :slashdot)
end
it 'creates enough posts' do
@posts.count.sho... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/the_next_web/default_spec.rb | Ruby | mit | 19 | master | 356 | require 'spec_helper'
describe Omnom::Source::TheNextWeb::Default do
include Omnom::SourceHelpers
class DummyTheNextWebFeed < Omnom::Feed
sources do
the_next_web
end
end
before(:all) do
set_posts_for_source_key(DummyTheNextWebFeed, :the_next_web)
end
it 'creates enough posts' do
@p... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/xkcd/default_spec.rb | Ruby | mit | 19 | master | 493 | require 'spec_helper'
describe Omnom::Source::Xkcd::Default do
include Omnom::SourceHelpers
class DummyXkcdFeed < Omnom::Feed
sources do
xkcd
end
end
before(:all) do
set_posts_for_source_key(DummyXkcdFeed, :xkcd)
end
it 'creates enough posts' do
@posts.count.should be >= 3
end
... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/techcrunch/default_spec.rb | Ruby | mit | 19 | master | 352 | require 'spec_helper'
describe Omnom::Source::Techcrunch::Default do
include Omnom::SourceHelpers
class DummyTechcrunchFeed < Omnom::Feed
sources do
techcrunch
end
end
before(:all) do
set_posts_for_source_key(DummyTechcrunchFeed, :techcrunch)
end
it 'creates enough posts' do
@posts... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/techcrunch/section_spec.rb | Ruby | mit | 19 | master | 404 | require 'spec_helper'
describe Omnom::Source::Techcrunch::Section do
include Omnom::SourceHelpers
class DummyTechcrunchSectionFeed < Omnom::Feed
sources do
techcrunch__section section: :startups
end
end
before(:all) do
set_posts_for_source_key(DummyTechcrunchSectionFeed, :techcrunch__sectio... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/google_analytics/visitors_spec.rb | Ruby | mit | 19 | master | 552 | require 'spec_helper'
describe Omnom::Source::GoogleAnalytics::Visitors do
include Omnom::SourceHelpers
if Omnom.config.google_analytics.base.profile_id
class DummyGoogleAnalyticsVisitorsFeed < Omnom::Feed
sources do
google_analytics__visitors profile_id: Omnom.config.google_analytics.base.profi... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/google_analytics/default_spec.rb | Ruby | mit | 19 | master | 552 | require 'spec_helper'
describe Omnom::Source::GoogleAnalytics::Default do
include Omnom::SourceHelpers
if Omnom.config.google_analytics.base.profile_id
class DummyGoogleAnalyticsDefaultFeed < Omnom::Feed
sources do
google_analytics profile_id: Omnom.config.google_analytics.base.profile_id, metri... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/google_analytics/pageviews_spec.rb | Ruby | mit | 19 | master | 557 | require 'spec_helper'
describe Omnom::Source::GoogleAnalytics::Pageviews do
include Omnom::SourceHelpers
if Omnom.config.google_analytics.base.profile_id
class DummyGoogleAnalyticsPageviewsFeed < Omnom::Feed
sources do
google_analytics__pageviews profile_id: Omnom.config.google_analytics.base.pr... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/source/stackoverflow/default_spec.rb | Ruby | mit | 19 | master | 406 | require 'spec_helper'
describe Omnom::Source::Stackoverflow::Default do
include Omnom::SourceHelpers
class DummyStackoverflowFeed < Omnom::Feed
sources do
stackoverflow path: 'questions/tagged/ruby-on-rails'
end
end
before(:all) do
set_posts_for_source_key(DummyStackoverflowFeed, :stackover... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom.rb | Ruby | mit | 19 | master | 2,461 | require 'auto_strip_attributes'
require 'choices'
require 'rufus/scheduler'
require 'mechanize'
require 'nikkou'
require 'v8'
require 'feedzirra'
require 'fastimage'
require 'legato'
require 'oauth2' # Required for Legato
require 'twitter'
require 'haml'
require 'coffee-rails'
require 'jquery-rails'
require 'sass-ra... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/generators/omnom/install/install_generator.rb | Ruby | mit | 19 | master | 1,348 | require 'rails/generators'
require 'rails/generators/base'
module Omnom
module Generators
class InstallGenerator < ::Rails::Generators::Base
include ::Rails::Generators::Migration
source_root File.expand_path('../templates', __FILE__)
def self.next_migration_number(path)
unless ... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/tasks/omnom.rake | Ruby | mit | 19 | master | 307 | namespace :omnom do
desc 'Start Omnom\'s background processing'
task :scheduler => :environment do
scheduler = Omnom::Scheduler.start
scheduler.join
end
desc 'Update all Omnom feeds'
task :update => :environment do
Omnom.feeds.values.each do |feed|
feed.update
end
end
end |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/tasks/omnom/heroku.rake | Ruby | mit | 19 | master | 2,011 | desc 'Start Omnom\'s background processing'
namespace :omnom do
namespace :heroku do
desc "Prints the Heroku config command (heroku config:add) that sets all environment variables listed in settings.yml"
task :config, [:file_name] do |t, args|
file_name = args[:file_name] || 'omnom'
heroku_settin... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/reporting.rb | Ruby | mit | 19 | master | 213 | module Omnom
class Reporting
def self.warn_once(key, message)
@warned_keys ||= []
return if @warned_keys.include?(key)
warn "[Omnom] #{message}"
@warned_keys << key
end
end
end |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/feed.rb | Ruby | mit | 19 | master | 2,048 | module Omnom
class Feed
class << self
def inherited(child)
Omnom.add_feed(child)
end
def options
@options ||= {key: self.key}
end
def filter(&block)
options[:filter] = block
end
def sources(&block)
config = FeedSourcesDSL.new(&block)
... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/engine.rb | Ruby | mit | 19 | master | 1,014 | module Omnom
class Engine < ::Rails::Engine
isolate_namespace Omnom
initializer 'omnom.action_controller' do |app|
ActiveSupport.on_load :action_controller do
#include Rails.application.routes.url_helpers
end
end
initializer "omnom.load" do |app|
Omnom.load
end
ini... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/utils.rb | Ruby | mit | 19 | master | 210 | module Omnom
module Utils
def self.clean_url(url)
url = url.to_s
return "http:#{url}" if url.start_with?('//')
return "http://#{url}" if url !~ /https?:\/\//
url
end
end
end |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/scheduler.rb | Ruby | mit | 19 | master | 1,796 | module Omnom
class Scheduler
def self.start
scheduler = Rufus::Scheduler.start_new
initial_run_in_seconds = 0
Omnom.feeds.values.each do |feed|
next if feed.sources.blank?
feed.sources.each do |source|
method = source.settings.slice(:cron, :every).keys.first
r... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/parser_methods.rb | Ruby | mit | 19 | master | 208 | module Omnom
module ParserMethods
def html_to_text(html)
# Nokogiri transforms to   or \u00a0
Nokogiri::HTML(html).text.gsub(' ', ' ').gsub(/\u00a0/, ' ')
end
end
end |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/feed_sources_dsl.rb | Ruby | mit | 19 | master | 626 | module Omnom
class FeedSourcesDSL
attr_reader :sources
def self.create_source_method(source)
settings_keys = [:cron, :every, :filter]
method = class_to_method(source)
define_method(method, Proc.new { |*args|
if args.present?
args = args.first
settings = a... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source_parsers/feedburner.rb | Ruby | mit | 19 | master | 838 | module Omnom
module SourceParsers
module Feedburner
def get_raw_posts
@page.search('channel > item')
end
def post_attributes(node)
node.document.root.add_namespace('feedburner', 'http://rssnamespace.org/feedburner/ext/1.0')
link = node.>('feedburner|origLink').first
... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/feed.rb | Ruby | mit | 19 | master | 1,014 | module Omnom
module Source
class Feed < Source::Base
every '5m'
required_options :url
def after_initialize
@settings[:icon] = self.class.icon_from_url(@options[:url]) if @settings[:icon].blank?
end
def get_raw_posts
Feedzirra::Feed.fetch_and_parse(@options[:url]).en... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/base.rb | Ruby | mit | 19 | master | 7,514 | module Omnom
module Source
class Base
class << self
attr_writer :settings
def inherited(child)
Omnom::FeedSourcesDSL.create_source_method(child)
Omnom.add_source(child)
# Inherit settings of the superclass if it isn't a base source class (e.g. Base, Atom)
... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/atom.rb | Ruby | mit | 19 | master | 1,464 | module Omnom
module Source
class Atom < Source::Base
every '5m'
def after_initialize
@settings[:icon] = self.class.icon_from_url(@options[:url]) if @settings[:icon].blank?
end
def get_raw_posts
if @page.blank?
Reporting.warn_once "Omnom.#{self.class}.get_r... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/reddit/default.rb | Ruby | mit | 19 | master | 1,922 | module Omnom
module Source
module Reddit
class Default < Source::Base
url 'http://www.reddit.com/'
every '5m'
def after_initialize
@url = "#{@url}#{@options[:subreddit]}" if @options[:subreddit].present?
end
def get_raw_posts
@page.search('#siteT... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/reddit/images.rb | Ruby | mit | 19 | master | 1,104 | require 'omnom/source/reddit/default'
module Omnom
module Source
module Reddit
class Images < Omnom::Source::Reddit::Default
def post_attributes(node)
attributes = super
if attributes[:url] =~ /(?:.bmp|.gif|.jpeg|.jpg|.png|.tiff)$/
images = [{
page_url:... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/twitter/search.rb | Ruby | mit | 19 | master | 2,255 | module Omnom
module Source
module Twitter
class Search < Source::Base
icon 'https://twitter.com/favicon.ico'
every '5m'
required_config :consumer_key, :consumer_secret, :oauth_token, :oauth_token_secret
required_options :term
def self.configure
if Omnom.con... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/github/blog_section.rb | Ruby | mit | 19 | master | 751 | require 'omnom/source/github/blog'
module Omnom
module Source
module Github
class BlogSection < Blog
guid_namespace 'github__blog'
every '5m'
required_options :section
def after_initialize
sections = {
broadcasts: 'https://github.com/blog/broadcasts.at... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/github/default.rb | Ruby | mit | 19 | master | 697 | module Omnom
module Source
module Github
class Default < Source::Atom
url config.atom if config && config.atom
every '5m'
required_config :atom
def tags
if @node.>('content').first.text =~ /^<!-- ([a-z]+) -->/
return [$1]
end
end
... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/github/blog.rb | Ruby | mit | 19 | master | 289 | module Omnom
module Source
module Github
class Blog < Source::Atom
url 'https://github.com/blog.atom'
guid_namespace 'github__blog'
every '5m'
def author_url
"https://github.com/#{author_name}"
end
end
end
end
end |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/instagram/default.rb | Ruby | mit | 19 | master | 2,142 | module Omnom
module Source
module Instagram
class Default < Source::Base
every '5m'
url 'http://instagram.com/'
required_config :web_auth_username, :web_auth_password
def after_initialize
@login_page_url = "#{@url}accounts/login/"
end
def authentic... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/slashdot/default.rb | Ruby | mit | 19 | master | 1,112 | module Omnom
module Source
module Slashdot
class Default < Source::Base
url 'http://slashdot.org/'
every '5m'
def get_raw_posts
@page.search('#firehoselist > article')
end
def post_attributes(node)
{
title: node.search('h2.story > spa... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/stackoverflow/default.rb | Ruby | mit | 19 | master | 1,495 | module Omnom
module Source
module Stackoverflow
class Default < Source::Base
url 'http://stackoverflow.com/'
every '5m'
def after_initialize
@url = "#{@url}#{@options[:path]}" if @options[:path].present?
end
def get_raw_posts
@page.search('#quest... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/xkcd/default.rb | Ruby | mit | 19 | master | 989 | module Omnom
module Source
module Xkcd
class Default < Source::Base
url 'http://xkcd.com/atom.xml'
every '3h'
def get_raw_posts
@page.search('feed > entry')
end
def post_attributes(node)
image_node = node.find('summary').parse_text.find('img')
... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/the_next_web/default.rb | Ruby | mit | 19 | master | 586 | module Omnom
module Source
module TheNextWeb
class Default < Source::Base
include SourceParsers::Feedburner
url 'http://feeds2.feedburner.com/thenextweb'
icon 'http://thenextweb.com/favicon.ico'
every '5m'
def post_attributes(node)
attributes = super
... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/hacker_news/default.rb | Ruby | mit | 19 | master | 2,053 | module Omnom
module Source
module HackerNews
class Default < Source::Base
url 'https://news.ycombinator.com/'
every '5m'
def get_raw_posts
first_title = @page.search('td.title').first
table = first_title.ancestors('table').first
rows = table.>('tr')
... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/facebook/default.rb | Ruby | mit | 19 | master | 3,552 | module Omnom
module Source
module Facebook
class Default < Source::Base
every '5m'
url 'https://www.facebook.com/'
required_config :web_auth_email, :web_auth_password
def after_initialize
@home_page_url = 'https://www.facebook.com/'
@login_page_url = @hom... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/google_analytics/visitors.rb | Ruby | mit | 19 | master | 483 | require 'omnom/source/google_analytics/default'
module Omnom
module Source
module GoogleAnalytics
class Visitors < Default
icon 'https://www.google.com/images/icons/product/analytics-32.png'
every '1h'
required_config :_client_id, :_client_secret, :_oauth_token, :_oauth_refresh_toke... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/google_analytics/pageviews.rb | Ruby | mit | 19 | master | 485 | require 'omnom/source/google_analytics/default'
module Omnom
module Source
module GoogleAnalytics
class Pageviews < Default
icon 'https://www.google.com/images/icons/product/analytics-32.png'
every '1h'
required_config :_client_id, :_client_secret, :_oauth_token, :_oauth_refresh_tok... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/google_analytics/default.rb | Ruby | mit | 19 | master | 4,342 | module Omnom
module Source
module GoogleAnalytics
class Default < Source::Base
icon 'https://www.google.com/images/icons/product/analytics-32.png'
every '1h'
required_config :_client_id, :_client_secret, :_oauth_token, :_oauth_refresh_token
required_options :profile_id, :metr... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/techcrunch/section.rb | Ruby | mit | 19 | master | 1,016 | require 'omnom/source/techcrunch/default'
module Omnom
module Source
module Techcrunch
class Section < Default
every '5m'
required_options :section
icon 'http://techcrunch.com/favicon.ico'
def after_initialize
sections = {
startups: 'http://feeds.feedb... |
github | tombenner/omnom | https://github.com/tombenner/omnom | lib/omnom/source/techcrunch/default.rb | Ruby | mit | 19 | master | 279 | module Omnom
module Source
module Techcrunch
class Default < Source::Base
include SourceParsers::Feedburner
url 'http://feeds.feedburner.com/TechCrunch/'
icon 'http://techcrunch.com/favicon.ico'
every '5m'
end
end
end
end |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | Thorfile | Ruby | mit | 19 | master | 1,306 | $:.push File.expand_path('../lib', __FILE__)
require 'rubygems'
require 'bundler/setup'
require 'rake/testtask'
require 'thor/rake_compat'
class Default < Thor
class Gem < Thor
namespace :gem
include Thor::RakeCompat
Bundler::GemHelper.install_tasks
desc "build", "Build knife-briefcase-#{KnifeBri... |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | knife-briefcase.gemspec | Ruby | mit | 19 | master | 1,312 | # -*- mode: ruby; coding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'knife-briefcase/version'
Gem::Specification.new do |spec|
spec.name = "knife-briefcase"
spec.version = KnifeBriefcase::VERSION
spec.authors = ["Maci... |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | Gemfile | Ruby | mit | 19 | master | 267 | source 'https://rubygems.org'
gemspec
# Helpers used with development, but not needed in runtime, build
# time, or for tests.
group :development_workstation do
gem 'awesome_print'
gem 'pry'
gem 'pry-debugger'
gem 'pry-rescue'
gem 'pry-stack_explorer'
end |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | lib/knife-briefcase/knife.rb | Ruby | mit | 19 | master | 1,433 | require 'chef/knife'
module KnifeBriefcase
class Knife < Chef::Knife
def self.deps
super do
require 'chef/data_bag'
require 'chef/data_bag_item'
require 'gpgme'
require 'highline'
yield if block_given?
end
end
def self.inherited(c)
super
... |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | lib/chef/knife/briefcase_list.rb | Ruby | mit | 19 | master | 214 | require 'knife-briefcase/knife'
class Chef::Knife::BriefcaseList < KnifeBriefcase::Knife
banner "knife briefcase list"
def run
output(format_list_for_display(Chef::DataBag.load(data_bag_name)))
end
end |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | lib/chef/knife/briefcase_get.rb | Ruby | mit | 19 | master | 863 | require 'knife-briefcase/knife'
class Chef::Knife::BriefcaseGet < KnifeBriefcase::Knife
banner "knife briefcase get NAME [FILE]"
def run
encrypted = Chef::DataBagItem.load(data_bag_name, @name_args[0]).
raw_data['content']
begin
crypto.verify(GPGME::Data.from_str(encrypted)) do |sig|
... |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | lib/chef/knife/briefcase_annex_hook.rb | Ruby | mit | 19 | master | 1,369 | require 'knife-briefcase/knife'
class Chef::Knife::BriefcaseAnnexHook < KnifeBriefcase::Knife
banner "knife briefcase annex hook"
def run
item_id = ENV['ANNEX_KEY'].gsub(/[^[:alnum:]_\-]+/, '_')
case ENV['ANNEX_ACTION']
when 'store'
require 'chef/knife/briefcase_put'
run_subcommand Briefc... |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | lib/chef/knife/briefcase_reload.rb | Ruby | mit | 19 | master | 1,239 | require 'knife-briefcase/knife'
class Chef::Knife::BriefcaseReload < KnifeBriefcase::Knife
banner "knife briefcase reload [NAME [NAME [...]]]"
def run
item_names = if @name_args.empty?
Chef::DataBag.list(data_bag_name).keys
else
@name_args
... |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | lib/chef/knife/briefcase_put.rb | Ruby | mit | 19 | master | 958 | require 'knife-briefcase/knife'
class Chef::Knife::BriefcasePut < KnifeBriefcase::Knife
banner "knife briefcase put NAME [FILE]"
def run
encrypted = crypto.encrypt( GPGME::Data.from_io(file ? File.open(file) : stdin),
:recipients => recipients,
:sign => !!signers,
:signers => signers,
... |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | lib/chef/knife/briefcase_delete.rb | Ruby | mit | 19 | master | 352 | require 'knife-briefcase/knife'
class Chef::Knife::BriefcaseDelete < KnifeBriefcase::Knife
banner "knife briefcase delete NAME [NAME [...]]"
def run
@name_args.each do |item_name|
delete_object(Chef::DataBagItem, item_name, 'briefcase_item') do
rest.delete_rest("data/#{data_bag_name}/#{item_name... |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | spec/spec_helper.rb | Ruby | mit | 19 | master | 1,239 | require 'rubygems'
require 'bundler/setup'
require 'pathname'
require 'minitest/autorun'
require 'minitest/spec'
require 'mocha/setup'
require 'wrong'
Wrong.config.alias_assert :expect, override: true
module KnifeBriefcase
module Spec
module WrongHelper
include Wrong::Assert
include Wrong::Helpers... |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | spec/knife_helper.rb | Ruby | mit | 19 | master | 4,407 | # Modified from: https://github.com/jkeiser/knife-essentials/blob/master/spec/support/knife_support.rb
require 'logger'
require 'pathname'
require 'shellwords'
require 'chef_zero/server'
require 'chef/application/knife'
require 'chef/config'
require 'chef/knife'
require 'chef/log'
module KnifeBriefcase
module Spec... |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | spec/chef/knife/briefcase_delete_spec.rb | Ruby | mit | 19 | master | 1,267 | require 'spec_helper'
require 'tempfile'
require 'chef/knife/briefcase_delete'
describe Chef::Knife::BriefcaseDelete do
before do
knife_config do
briefcase_signers 'test+knife-briefcase-1@3ofcoins.net'
briefcase_holders [
'test+knife-briefcase-2@3ofcoins.net',
'test+knife-briefcase-... |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | spec/chef/knife/briefcase_reload_spec.rb | Ruby | mit | 19 | master | 895 | require 'spec_helper'
require 'chef/knife/briefcase_reload'
describe Chef::Knife::BriefcaseReload do
let(:file_path) { __FILE__ }
it "re-encrypts data bag's items" do
knife_config do
briefcase_signers 'test+knife-briefcase-2@3ofcoins.net'
briefcase_holders [ 'test+knife-briefcase-1@3ofcoins.net' ... |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | spec/chef/knife/briefcase_put_spec.rb | Ruby | mit | 19 | master | 2,182 | require 'spec_helper'
require 'chef/knife/briefcase_put'
describe Chef::Knife::BriefcasePut do
before do
knife_config do
briefcase_signers 'test+knife-briefcase-1@3ofcoins.net'
briefcase_holders [
'test+knife-briefcase-2@3ofcoins.net',
'test+knife-briefcase-1@3ofcoins.net' ]
end
... |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | spec/chef/knife/briefcase_get_spec.rb | Ruby | mit | 19 | master | 1,242 | require 'spec_helper'
require 'tempfile'
require 'chef/knife/briefcase_get'
describe Chef::Knife::BriefcaseGet do
let(:file_path) { __FILE__ }
before do
knife_config do
briefcase_signers 'test+knife-briefcase-1@3ofcoins.net'
briefcase_holders [
'test+knife-briefcase-2@3ofcoins.net',
... |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | spec/chef/knife/briefcase_list_spec.rb | Ruby | mit | 19 | master | 535 | require 'spec_helper'
require 'chef/knife/briefcase_list'
describe Chef::Knife::BriefcaseList do
it "shows names of briefcase data bag's items" do
knife_config do
briefcase_signers 'test+knife-briefcase-1@3ofcoins.net'
briefcase_holders [
'test+knife-briefcase-2@3ofcoins.net',
'test+... |
github | 3ofcoins/knife-briefcase | https://github.com/3ofcoins/knife-briefcase | spec/knife-briefcase/version_spec.rb | Ruby | mit | 19 | master | 222 | require 'spec_helper'
# A smoke test spec to make sure tests actually work
module KnifeBriefcase
describe VERSION do
it 'is equal to itself' do
expect { VERSION == KnifeBriefcase::VERSION }
end
end
end |
github | rails-engine/action-draft | https://github.com/rails-engine/action-draft | Rakefile | Ruby | mit | 19 | main | 708 | # frozen_string_literal: true
begin
require "bundler/setup"
rescue LoadError
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
end
require "rdoc/task"
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = "rdoc"
rdoc.title = "ActionDraft"
rdoc.options << "--line-numbers"
rdoc.rdoc_fi... |
github | rails-engine/action-draft | https://github.com/rails-engine/action-draft | action-draft.gemspec | Ruby | mit | 19 | main | 909 | # frozen_string_literal: true
$:.push File.expand_path("lib", __dir__)
# Maintain your gem's version:
require "action-draft/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |spec|
spec.name = "action-draft"
spec.version = ActionDraft::VERSION
spec.authors = ["Jason Lee"]
s... |
github | rails-engine/action-draft | https://github.com/rails-engine/action-draft | test/active_record_test_case_helper.rb | Ruby | mit | 19 | main | 4,098 | # frozen_string_literal: true
require "active_support/test_case"
module ActiveRecordTestCaseHelper
def teardown
SQLCounter.clear_log
end
def assert_date_from_db(expected, actual, message = nil)
assert_equal expected.to_s, actual.to_s, message
end
def capture(stream)
stream = stream.to_s
ca... |
github | rails-engine/action-draft | https://github.com/rails-engine/action-draft | test/test_helper.rb | Ruby | mit | 19 | main | 930 | # frozen_string_literal: true
# Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require_relative "../test/dummy/config/environment"
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)]
ActiveRecord::Migrator.migrations_paths << File.expand_path("../db/migrate", __dir... |
github | rails-engine/action-draft | https://github.com/rails-engine/action-draft | test/unit/model_test.rb | Ruby | mit | 19 | main | 3,081 | # frozen_string_literal: true
require "test_helper"
class ActionDraft::ModelTest < ActiveSupport::TestCase
test "action_draft_attributes" do
assert_equal [:title, :content], Message.action_draft_attributes
assert_equal [:name, :description], Group.action_draft_attributes
end
test "saving attributes" do... |
github | rails-engine/action-draft | https://github.com/rails-engine/action-draft | test/dummy/config/puma.rb | Ruby | mit | 19 | main | 1,514 | # frozen_string_literal: true
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for mini... |
github | rails-engine/action-draft | https://github.com/rails-engine/action-draft | test/dummy/config/application.rb | Ruby | mit | 19 | main | 596 | # frozen_string_literal: true
require_relative "boot"
require "rails/all"
Bundler.require(*Rails.groups)
require "action-draft"
module Dummy
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.0
# Settings in config... |
github | rails-engine/action-draft | https://github.com/rails-engine/action-draft | test/dummy/config/environments/development.rb | Ruby | mit | 19 | main | 1,996 | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don... |
github | rails-engine/action-draft | https://github.com/rails-engine/action-draft | test/dummy/config/environments/production.rb | Ruby | mit | 19 | main | 4,850 | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, a... |
github | rails-engine/action-draft | https://github.com/rails-engine/action-draft | test/dummy/db/schema.rb | Ruby | mit | 19 | main | 1,717 | # 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.
#
# This file is the source Rails uses to define your schema when running `rails
#... |
github | rails-engine/action-draft | https://github.com/rails-engine/action-draft | test/dummy/db/migrate/20190724105053_create_messages.rb | Ruby | mit | 19 | main | 231 | # frozen_string_literal: true
class CreateMessages < ActiveRecord::Migration[6.0]
def change
create_table :messages do |t|
t.string :title
t.text :content
t.string :to
t.timestamps
end
end
end |
github | rails-engine/action-draft | https://github.com/rails-engine/action-draft | lib/action-draft/attribute.rb | Ruby | mit | 19 | main | 2,273 | # frozen_string_literal: true
module ActionDraft
module Attribute
extend ActiveSupport::Concern
included do
end
def apply_draft
self.class.action_draft_attributes ||= []
self.class.action_draft_attributes.each do |attr_name|
send("#{attr_name}=", send("draft_#{attr_name}").to_s)... |
github | rails-engine/action-draft | https://github.com/rails-engine/action-draft | lib/action-draft/engine.rb | Ruby | mit | 19 | main | 276 | # frozen_string_literal: true
module ActionDraft
class Engine < ::Rails::Engine
isolate_namespace ActionDraft
initializer "action_draft.attribute" do
ActiveSupport.on_load(:active_record) do
include ActionDraft::Attribute
end
end
end
end |
github | rails-engine/action-draft | https://github.com/rails-engine/action-draft | db/migrate/20190724102032_create_action_draft_contents.rb | Ruby | mit | 19 | main | 430 | # frozen_string_literal: true
class CreateActionDraftContents < ActiveRecord::Migration[6.0]
def change
create_table :action_draft_contents do |t|
t.references :record, null: false, polymorphic: true, index: false
t.string :name
t.text :content, limit: 16777215
t.timestamps
t.inde... |
github | rails-engine/action-draft | https://github.com/rails-engine/action-draft | app/models/action_draft/content.rb | Ruby | mit | 19 | main | 239 | # frozen_string_literal: true
class ActionDraft::Content < ApplicationRecord
self.table_name = "action_draft_contents"
belongs_to :record, polymorphic: true, touch: true
delegate :to_s, :nil?, :blank?, :present?, to: :content
end |
github | puppetlabs/puppetlabs-acl | https://github.com/puppetlabs/puppetlabs-acl | Gemfile | Ruby | apache-2.0 | 19 | main | 4,600 | source ENV['GEM_SOURCE'] || 'https://rubygems.org'
def location_for(place_or_version, fake_version = nil)
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
file_url_regex = %r{\Afile:\/\/(?<path>.*)}
if place_or_version && (git_url = place_or_version.match(git_url_regex))
[fake_version, {... |
github | puppetlabs/puppetlabs-acl | https://github.com/puppetlabs/puppetlabs-acl | lib/puppet/provider/acl/windows.rb | Ruby | apache-2.0 | 19 | main | 6,598 | # frozen_string_literal: true
require 'puppet/type'
require 'pathname'
Puppet::Type.type(:acl).provide :windows do
@doc = 'Windows specific provider for acl type.'
# confine :feature => :microsoft_windows
confine 'os.name': :windows
defaultfor 'os.name': :windows
require "#{Pathname.new(__FILE__).dirname}... |
github | puppetlabs/puppetlabs-acl | https://github.com/puppetlabs/puppetlabs-acl | lib/puppet/provider/acl/windows/base.rb | Ruby | apache-2.0 | 19 | main | 21,792 | # frozen_string_literal: true
require 'pathname'
# Base provider for Access Control List type
class Puppet::Provider::Acl
module Windows
# Provides the detailed implementation details for the provider and should shield the provider from legacy
# support implementations that would happen here.
#
# Fo... |
github | puppetlabs/puppetlabs-acl | https://github.com/puppetlabs/puppetlabs-acl | lib/puppet/type/acl.rb | Ruby | apache-2.0 | 19 | main | 15,663 | # frozen_string_literal: true
require 'puppet/type'
require 'pathname'
Puppet::Type.newtype(:acl) do
require "#{Pathname.new(__FILE__).dirname}/../../puppet/type/acl/ace"
@doc = <<-DOC
Manages access control lists (ACLs). The `acl` type is
typically used when you need more complex management of
perm... |
github | puppetlabs/puppetlabs-acl | https://github.com/puppetlabs/puppetlabs-acl | lib/puppet/type/acl/ace.rb | Ruby | apache-2.0 | 19 | main | 15,269 | # frozen_string_literal: true
require 'puppet/parameter/value_collection'
require 'pathname'
class Puppet::Type::Acl
# Ace is an Access Control Entry for use with the Access
# Control List (ACL) type. ACEs contain information about
# the trustee, the rights, and on some systems how they are
# inherited and pr... |
github | puppetlabs/puppetlabs-acl | https://github.com/puppetlabs/puppetlabs-acl | lib/puppet/type/acl/rights.rb | Ruby | apache-2.0 | 19 | main | 517 | # frozen_string_literal: true
# Helper class used to represent ACL Rights
class Puppet::Type::Acl
# Simple ACL Rights object
class Rights
attr_reader :value, :order
def initialize(permission)
return if permission.nil? || permission.empty?
@value = permission.downcase.to_sym unless @value.is_a... |
github | puppetlabs/puppetlabs-acl | https://github.com/puppetlabs/puppetlabs-acl | spec/spec_helper_local.rb | Ruby | apache-2.0 | 19 | main | 973 | # frozen_string_literal: true
require 'pathname'
require 'tmpdir'
require 'fileutils'
if Puppet.features.microsoft_windows?
require 'puppet/util/windows/security'
def take_ownership(path)
path = path.tr('/', '\\')
output = `takeown.exe /F #{path} /R /A /D Y 2>&1`
puts "#{path} got error #{output}" if... |
github | puppetlabs/puppetlabs-acl | https://github.com/puppetlabs/puppetlabs-acl | spec/spec_helper_acceptance_local.rb | Ruby | apache-2.0 | 19 | main | 2,811 | # frozen_string_literal: true
Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
def target_parent
'c:/temp'
end
def user_id
'bob'
end
def generate_random_username
charset = Array('A'..'Z') + Array('a'..'z')
Array.new(5) { charset.sample }.join
end
def file_content_regex(file_content)
%r{\A#{file_... |
github | puppetlabs/puppetlabs-acl | https://github.com/puppetlabs/puppetlabs-acl | spec/integration/provider/acl/windows_spec.rb | Ruby | apache-2.0 | 19 | main | 29,017 | # frozen_string_literal: true
require 'spec_helper'
require 'puppet/type'
require 'puppet/provider/acl/windows'
if Puppet.features.microsoft_windows?
class WindowsSecurityTester
require 'puppet/util/windows/security'
include Puppet::Util::Windows::Security
end
end
describe Puppet::Type.type(:acl).provide... |
github | puppetlabs/puppetlabs-acl | https://github.com/puppetlabs/puppetlabs-acl | spec/unit/type/acl_spec.rb | Ruby | apache-2.0 | 19 | main | 33,654 | # frozen_string_literal: true
require 'spec_helper'
require 'puppet/type'
require 'puppet/type/acl'
def is_puppet_5?
Gem::Version.new(Puppet::PUPPETVERSION.dup.freeze) >= Gem::Version.new('5.0.0')
end
describe Puppet::Type.type(:acl) do
let(:resource) { Puppet::Type.type(:acl).new(name: 'acl') }
let(:provider)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.