repo_name
stringlengths 6
97
| path
stringlengths 3
341
| text
stringlengths 8
1.02M
|
|---|---|---|
HTW-Webtech/ai-webtech-admin-app
|
app/models/aris_service.rb
|
<gh_stars>0
class ArisService
def self.publish(app)
return true if Rails.env.development?
bookkeeper.add(app.permalink, app_opts(app))
write_semaphore(app)
end
def self.write_semaphore(app)
IO.binwrite(app.semaphore_file_path, "Time: #{Time.now.to_s}")
end
def self.app_opts(app)
opts = {}
opts[:name] = app.permalink
opts[:email] = app.user.email
opts[:ssh_key] = app.ssh_key
opts
end
def self.bookkeeper
@bookkeeper = ArisControl::Bookkeeper.new
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
db/migrate/20160622152300_migrate_review_date_markers.rb
|
class MigrateReviewDateMarkers < ActiveRecord::Migration
def up
ReviewDate.find_each do |review_date|
review_date.user_id or next
user = User.find(review_date.user_id)
user.update reviewed_at: review_date.reviewed_at
end
end
def down
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/controllers/concerns/app_fetching.rb
|
module AppFetching
def fetch_app(permalink_or_id)
App.for_permalink_or_id(permalink_or_id).tap do |app|
if app.user != current_user && !current_user.admin?
redirect_to current_user
end
end
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/models/user.rb
|
<filename>app/models/user.rb<gh_stars>0
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :lockable, :timeoutable and :omniauthable
# :rememberable manages generating and clearing tokens from a cookie
devise :database_authenticatable, :registerable,
:recoverable, :trackable, :validatable,
:confirmable
has_many :apps
has_many :review_dates, through: :review_group
belongs_to :review_group
has_and_belongs_to_many :groups, join_table: :groups_users
validate :allow_only_htwberlin_accounts, on: :create
def self.admin
where(email: cc(:admin).email).first!
end
def self.without_admin
where.not(email: cc(:admin).email)
end
def admin?
persisted? && email == cc(:admin).email
end
def display_name_with_matrikel
"#{display_name} (#{matrikel_number})"
end
def display_name_with_review_marker
"#{display_name} [#{review_marker}]"
end
def review_marker
reviewed_at.present? ? "✓ #{reviewed_at.to_s(:long)}" : 'x'
end
def display_name
"#{display_blocked}#{display_name_or_email} "
end
def display_name_or_email
(name.present? && name) || email
end
def display_blocked
"[B] " if blocked?
end
def app_count
apps.count
end
def appraisal
@appraisal ||= User::Appraisal.new(self, course: course_klass)
end
def course_klass
"Courses::#{course}".constantize
end
def matrikel_number
if m = email.match(%r{(s\d+)})
m[0]
else
'-'
end
end
def total_points
apps.inject(0) { |sum, app| sum + app.total_points } || 0
end
def blocked?
blocked_at && blocked_at < Time.current
end
def block!
return false if admin?
update! blocked_at: Time.current
end
def unblock!
update! blocked_at: nil
end
private
# TODO: Move into validator class
def allow_only_htwberlin_accounts
unless !!email.match(/@htw-berlin.de\z/)
self.errors[:email] << 'Muss eine @htw-berlin.de Adresse sein'
end
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
spec/features/attending_codereviews_spec.rb
|
# Admin creates N codereviews. N is determined by
#
# 17.30-19 Uhr
# 19.15-20.45 Uhr => 60 / 10 = 6 * 4 = 24
#
# A user needs to select a pratice group
# Once she has selected the group the admin can create a review date
# The admin creates a group for the review
# The admin adds the users (at least 3) to the review group
# The admin creates a review
|
HTW-Webtech/ai-webtech-admin-app
|
db/migrate/20160511172322_add_review_user_to_review_date.rb
|
<gh_stars>0
class AddReviewUserToReviewDate < ActiveRecord::Migration
def change
add_column :review_dates, :user_id, :integer
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
db/migrate/20150918081948_add_admin_user.rb
|
<filename>db/migrate/20150918081948_add_admin_user.rb
class AddAdminUser < ActiveRecord::Migration
def up
User.create!({
email: cc(:admin).email,
name: cc(:admin).name,
ssh_key: cc(:admin).pub_ssh_key,
password: ENV.fetch('<PASSWORD>'),
password_confirmation: ENV.fetch('<PASSWORD>'),
})
end
def down
User.where(name: cc(:admin).name).destroy_all
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
spec/factories/user_factory.rb
|
<reponame>HTW-Webtech/ai-webtech-admin-app
FactoryGirl.define do
factory :user do
sequence(:email) { |n| "<EMAIL>" }
name '<NAME>'
ssh_key 'AASAD…'
password '<PASSWORD>'
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
config/routes.rb
|
<gh_stars>0
Rails.application.routes.draw do
if Object.const_defined?(:RailsAdmin)
mount RailsAdmin::Engine => '/admin/rails_admin', as: 'rails_admin'
end
devise_for :users, controllers: {
sessions: 'users/sessions'
}
root 'home#index'
resources :users, only: [:show, :edit, :update] do
resources :apps
resource :review_group, only: [:show, :update]
end
resources :apps, only: [:show] do
resource :feedback
end
namespace :admin do
resources :emails, only: [:new, :create]
resources :review_dates, only: [:new, :create, :show, :index]
resources :jenkins, only: [:create, :update]
resources :apps, only: [:create, :update]
resource :exercise_points, only: [:create]
resource :students, only: [:show]
resource :exercises, only: [:show]
resource :statistics, only: [:show]
resources :exceptions, only: [:create]
post ':user_id/block', controller: :users, action: :block, as: :block_user
post ':user_id/unblock', controller: :users, action: :unblock, as: :unblock_user
post 'fixtures/create', controller: :fixtures, action: :create
get ':app_id/app_review', controller: :app_reviews, action: :show, as: :app_review
post ':app_id/app_review/:points/confirm', controller: :app_reviews, action: :confirm, as: :app_review_confirm
post ':app_id/app_review/revoke', controller: :app_reviews, action: :revoke, as: :app_review_revoke
post 'review_dates/:id/confirm', controller: :review_dates, action: :confirm, as: :review_date_confirm
post 'review_dates/:id/revoke', controller: :review_dates, action: :revoke, as: :review_date_revoke
post 'apps/:app_id/exercise_points/:points', controller: :app_exercise_points, action: :update, as: :app_exercise_points
end
namespace :apiv1, path: 'api-v1', format: true, constraints: { format: 'json' } do
post 'ping', controller: :pings, action: :ping
post 'exercise_results/:app_permalink/:exercise_id', controller: :exercise_results, action: :create
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
db/migrate/20160403170714_add_timestamps_to_users_table.rb
|
<filename>db/migrate/20160403170714_add_timestamps_to_users_table.rb<gh_stars>0
class AddTimestampsToUsersTable < ActiveRecord::Migration
def up
add_timestamps :users
end
def down
remove_timestamps :users
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/controllers/admin/exercise_points_controller.rb
|
<gh_stars>0
module Admin
class ExercisePointsController < BaseController
def create
App.find_each do |app|
ExercisePointMaster.new(current_course).evaluate_app!(app)
end
redirect_to root_path, notice: "Updated exercise points for #{App.count} apps."
end
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
db/migrate/20151123164107_ensure_unique_app_names.rb
|
class EnsureUniqueAppNames < ActiveRecord::Migration
def change
add_index :apps, :name, unique: true
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
db/migrate/20151126061226_be_more_liberal_about_null_values.rb
|
<filename>db/migrate/20151126061226_be_more_liberal_about_null_values.rb<gh_stars>0
class BeMoreLiberalAboutNullValues < ActiveRecord::Migration
def up
change_column :apps, :ssh_key, :string, null: true
change_column :apps, :pg_host, :string, null: true
change_column :apps, :pg_database, :string, null: true
change_column :apps, :pg_login, :string, null: true
change_column :apps, :pg_passwd, :string, null: true
change_column :apps, :exercise_id, :integer, null: true
end
def down
change_column :apps, :ssh_key, :string, null: false
change_column :apps, :pg_host, :string, null: false
change_column :apps, :pg_database, :string, null: false
change_column :apps, :pg_login, :string, null: false
change_column :apps, :pg_passwd, :string, null: false
change_column :apps, :exercise_id, :integer, null: false
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/controllers/admin/statistics_controller.rb
|
module Admin
class StatisticsController < BaseController
def show
@google_chart_data = Statistics::OverallPoints.new(current_course.students).google_chart_data
end
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/controllers/admin/fixtures_controller.rb
|
<reponame>HTW-Webtech/ai-webtech-admin-app
module Admin
class FixturesController < BaseController
def create
id = User.count+1
user = User.create({
email: "#{<EMAIL>",
name: "#{id}-alice-or-bob",
ssh_key: "ssh-rsa …",
password: '<PASSWORD>',
password_confirmation: '<PASSWORD>',
confirmed_at: Time.now,
})
10.times do |i|
app = App.new(user: user).prefill
app.save!
ArisService.publish(app)
end
redirect_to root_path, notice: "Created user: #{user.name} with 10 apps"
end
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/models/jenkins_service.rb
|
<filename>app/models/jenkins_service.rb
class JenkinsService
def self.publish(app_or_apps)
apps = Array(app_or_apps)
jobs = load_jobs
jobs = add_or_update(jobs, apps)
store_jobs(jobs)
end
def self.load_jobs
jobs_yml = read_jenkins_jobs_yaml
jobs = if jobs_yml.present?
YAML.load(jobs_yml)
else
{ 'jenkins_jobs' => {} }
end
jobs['jenkins_jobs']
end
def self.read_jenkins_jobs_yaml
IO.binread jenkins_jobs_yaml_path
rescue Errno::ENOENT => e
end
def self.store_jobs(jobs)
jobs_yml = YAML.dump({ 'jenkins_jobs' => jobs })
IO.binwrite jenkins_jobs_yaml_path, jobs_yml
end
def self.add_or_update(jobs, apps)
apps.select(&:has_tests?).each do |app|
job_name = app.permalink
job = jobs[job_name] || {}
job['app_name'] = app.permalink
job['exercise_base_url'] = app.testing_url
job['exercise_id'] = app.exercise_id
job['exercise_name'] = app.exercise_name
job['user_name'] = app.user.name
job['user_email'] = app.user.email
jobs[job_name] = job
end
jobs
end
def self.jenkins_jobs_yaml_path
if Rails.env.development?
Rails.root.join('tmp/jenkins_jobs.yml')
else
'/opt/aris/config/jenkins_jobs.yml'
end
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/models/review_points.rb
|
class ReviewPoints
attr_accessor :course, :points
def initialize(course = Courses.current)
@course = course || Courses.current
@points = @course.review_points
end
def for_app(app)
for_exercise_id(app.exercise_id)
end
def for_exercise_id(exercise_id)
points.fetch(exercise_id, (0..0))
end
def achievable(app)
for_app(app).max
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/controllers/admin/users_controller.rb
|
<reponame>HTW-Webtech/ai-webtech-admin-app
module Admin
class UsersController < BaseController
def block
user = User.find(params[:user_id])
if user.block!
redirect_to user, notice: 'User has been successfully blocked.'
else
redirect_to user, alert: 'Could not block user!'
end
end
def unblock
user = User.find(params[:user_id])
if user.unblock!
redirect_to user, notice: 'User has been successfully unblocked.'
else
redirect_to user, alert: 'Could not unblock user!'
end
end
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/models/review_group.rb
|
<reponame>HTW-Webtech/ai-webtech-admin-app
class ReviewGroup < ActiveRecord::Base
has_many :users
has_many :review_dates
def self.without_date_for_exercise(exercise_id)
groups_with_date_ids = includes(:review_dates).where(review_dates: { exercise_id: exercise_id }).pluck(:id)
where.not(id: groups_with_date_ids)
end
def display_name
"(#{order}. Gruppe): #{users.map(&:display_name).join(', ')}"
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/models/courses.rb
|
<gh_stars>0
require 'courses/base'
module Courses
module_function
def current
Summer2016
end
def self.all
Base.descendants
end
def self.find(name)
course = all.detect { |klass| klass.name.demodulize.downcase == name.downcase }
course || current
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
spec/models/user/appraisal_spec.rb
|
<gh_stars>0
require 'rails_helper'
describe User::Appraisal do
let(:course) { double('Course', total_points: 100) }
let(:user) { double('User') }
subject { described_class.new(user, course: course) }
describe '#percentage' do
it 'for a user with 0 total_points it equals 0' do
allow(user).to receive(:total_points).and_return(0)
expect(subject.percentage).to eq 0
end
it 'for a user with 79 total_points it equals 79' do
allow(user).to receive(:total_points).and_return(79)
expect(subject.percentage).to eq 79
end
it 'for a user with 150 total_points it equals 100' do
allow(user).to receive(:total_points).and_return(150)
expect(subject.percentage).to eq 100
end
it 'rounds the percentage down in case of a fraction' do
allow(course).to receive(:total_points).and_return(11)
allow(user).to receive(:total_points).and_return(4)
expect(subject.percentage).to eq 36
end
end
describe '#grade' do
it 'returns 5.0 for percentage < 50' do
allow(subject).to receive(:percentage).and_return(48)
expect(subject.grade).to eq 5.0
end
it 'returns 4.0 for 50 >= percentage < 55' do
allow(subject).to receive(:percentage).and_return(50)
expect(subject.grade).to eq 4.0
end
it 'returns 3.7 for 55 >= percentage < 60' do
allow(subject).to receive(:percentage).and_return(55)
expect(subject.grade).to eq 3.7
end
it 'returns 3.3 for 60 >= percentage < 65' do
allow(subject).to receive(:percentage).and_return(60)
expect(subject.grade).to eq 3.3
end
it 'returns 3.0 for 65 >= percentage < 70' do
allow(subject).to receive(:percentage).and_return(65)
expect(subject.grade).to eq 3.0
end
it 'returns 2.7 for 70 >= percentage < 75' do
allow(subject).to receive(:percentage).and_return(70)
expect(subject.grade).to eq 2.7
end
it 'returns 2.3 for 75 >= percentage < 80' do
allow(subject).to receive(:percentage).and_return(75)
expect(subject.grade).to eq 2.3
end
it 'returns 2.0 for 80 >= percentage < 85' do
allow(subject).to receive(:percentage).and_return(80)
expect(subject.grade).to eq 2.0
end
it 'returns 1.7 for 85 >= percentage < 90' do
allow(subject).to receive(:percentage).and_return(85)
expect(subject.grade).to eq 1.7
end
it 'returns 1.3 for 90 >= percentage < 95' do
allow(subject).to receive(:percentage).and_return(90)
expect(subject.grade).to eq 1.3
end
it 'returns 1.0 for 95 >= percentage <= 100' do
allow(subject).to receive(:percentage).and_return(95)
expect(subject.grade).to eq 1.0
end
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
spec/features/registration_and_login_spec.rb
|
<gh_stars>0
require 'rails_helper'
feature 'User registration and authentication' do
scenario 'allows user to register an account' do
visit '/'
click_on 'Registrieren'
fill_in 'Email', with: '<EMAIL>'
fill_in 'user_password', with: '<PASSWORD>'
fill_in 'user_password_confirmation', with: '<PASSWORD>'
expect {
click_on 'Sign up'
}.to change(User, :count).by(1)
user = User.last
expect(user.email).to eq '<EMAIL>'
expect(user).not_to be_confirmed
email = ActionMailer::Base.deliveries.last
expect(email.to.first).to eq '<EMAIL>'
confirmation_link = email.body.match %r{href="(.+)"}
visit confirmation_link[1]
confirmed_user = User.last
expect(confirmed_user).to be_confirmed
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/controllers/admin/app_exercise_points_controller.rb
|
module Admin
class AppExercisePointsController < BaseController
def update
app = App.for_permalink_or_id(params[:app_id])
app.update exercise_points: params[:points]
redirect_to :back, notice: "App #{app.display_name} hat nun #{app.exercise_points} Punkte"
end
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/models/email/code_review_confirmation_mailer.rb
|
module Email
class CodeReviewConfirmationMailer
attr_accessor :review_date
def initialize(review_date)
@review_date = review_date
end
def subject
"#{review_date.review_points} Punkt(e) für Code Review zur Aufgabe #{review_date.exercise_id}"
end
def body
"Zu deinem CodeReview-Termin vom #{review_date.formatted_begins_at} zur Aufgabe #{review_date.exercise_id} wurden dir #{review_date.review_points} Punkte im Aris eingetragen."
end
def run
review_date.users.each do |user|
ApplicationMailer.sent_email(
email: user.email,
subject: subject,
body: body
).deliver_now!
end
end
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/controllers/feedbacks_controller.rb
|
<filename>app/controllers/feedbacks_controller.rb
class FeedbacksController < ApplicationController
before_action :find_app_and_feedback, only: [:show, :edit, :update]
def show
end
def edit
end
def new
@feedback = Feedback.new(feedback_params)
end
def create
@feedback = Feedback.new(feedback_params)
if @feedback.save
redirect_to @feedback.app
else
render :new
end
end
def update
@feedback = @app.feedback
if @feedback.update(feedback_params)
redirect_to @feedback.app
else
render :edit
end
end
private
# Never trust parameters from the scary internet, only allow the white list through.
def feedback_params
params.fetch(:feedback, {}).merge(app_id: params[:app_id]).permit(:body, :app_id)
end
def find_app_and_feedback
@app = App.find(params[:app_id])
@feedback = @app.feedback
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/models/group.rb
|
class Group < ActiveRecord::Base
has_and_belongs_to_many :users, join_table: :groups_users
def self.current_course
where(name: Courses.current.display_name).first_or_create!
end
def display_name
"#{name} (#{users.count})"
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
db/migrate/20151111192749_drop_failures_count_on_results.rb
|
<filename>db/migrate/20151111192749_drop_failures_count_on_results.rb
class DropFailuresCountOnResults < ActiveRecord::Migration
def up
remove_column :exercise_results, :failures_count
end
def down
add_column :exercise_results, :failures_count, :integer, null: false, default: -1
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/helpers/application_helper.rb
|
<gh_stars>0
module ApplicationHelper
def announcements
@announcements ||= []
end
def current_url(query:)
uri = URI.parse(request.url)
uri.query = query if query
uri.to_s
end
def active_link_to_li(*args)
additional = { wrap_tag: :li, active: :exclusive }
opts = if args.last.is_a?(Hash)
args.pop.merge(additional)
else
additional
end
args.push(opts)
active_link_to(*args)
end
def app_status(app)
if app.reloading?
'Reloading'
else
'Ready'
end
end
def app_status_class(app)
if app.reloading?
'danger'
end
end
def app_tests_status(app)
if app.achievable_exercise_points > 0
"#{app.exercise_points} / #{app.achievable_exercise_points}"
else
"-"
end
end
def app_tests_class(app)
if app.tests_passed?
'success'
end
end
def app_review_status(app)
if app.achievable_review_points > 0
"#{app.review_points} / #{app.achievable_review_points}"
else
"-"
end
end
def app_points(app)
if app.achievable_total_points > 0
"#{app.total_points} / #{app.achievable_total_points}"
else
"-"
end
end
def link_to_back(record)
if record.persisted?
link_to 'Back', :back, class: 'btn btn-default'
else
link_to 'Cancel', :back, class: 'btn btn-default'
end
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/controllers/admin/app_reviews_controller.rb
|
module Admin
class AppReviewsController < BaseController
include AppFetching
def show
@app = fetch_app(params[:app_id])
end
def confirm
@app = fetch_app(params[:app_id])
@app.update!(reviewed_at: Time.current, review_points: params[:points])
redirect_to admin_app_review_path(@app)
end
def revoke
@app = fetch_app(params[:app_id])
@app.update!(reviewed_at: nil)
redirect_to admin_app_review_path(@app)
end
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/controllers/apiv1/pings_controller.rb
|
require 'json'
module Apiv1
class PingsController < BaseController
def ping
render json: JSON.generate({ result: 'pong' })
end
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/controllers/admin/exceptions_controller.rb
|
module Admin
class ExceptionsController < BaseController
def create
raise StandardError, "Bla"
end
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/models/exercise_point_master.rb
|
class ExercisePointMaster
attr_accessor :course, :exercises, :messages
def initialize(course = Courses.current)
@course = course || Courses.current
@exercises = @course.exercises
@messages = []
end
def evaluate!(exercise_result)
if reached_deadline? exercise_result
messages << "Deadline hit."
messages << "Points: #{points(exercise_result)}"
exercise_result.app.update_exercise_points(points(exercise_result))
else
messages << "Deadline missed."
messages << "Deadline: #{deadline(exercise_result)}."
messages << "Now: #{Time.now}."
end
message = messages.join(', ')
Notifier.notify "Exercise-Result for App #{exercise_result.app.display_name}: #{message}"
exercise_result.update message: message
self
end
def evaluate_app!(app)
# TODO: Skip results after deadline
ExerciseResult.where(app: app, exercise_id: exercise_ids).find_each do |result|
evaluate!(result)
end
end
def exercise_ids
exercises.keys
end
def exercise_name(exercise_id)
course.exercise_names.fetch(exercise_id, '')
end
def reached_deadline?(exercise_result)
exercise_result.created_at < deadline(exercise_result)
end
# TODO: Use a better abstraction here
def deadline(exercise_result)
exercises.fetch(exercise_result.exercise_id, [1.day.ago]).last
end
def points(exercise_result)
points_for_exercise(exercise_result.exercise_id)
end
def points_for_exercise(exercise_id)
exercises.fetch(exercise_id, [0]).first
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/controllers/apps_controller.rb
|
<filename>app/controllers/apps_controller.rb<gh_stars>0
class AppsController < ::BaseController
include AppFetching
before_action :limit_apps_per_user, only: [:new, :create]
def index
redirect_to current_user
end
def show
@announcements = Announcement.all
@app = fetch_app(params[:id])
end
def new
@app = App.new(user: current_user).prefill
end
def edit
@app = fetch_app(params[:id])
render :edit
end
def create
@app = App.new(app_params).prefill
if @app.save
@app.publish_to_app_service
@app.publish_to_jenkins_service
redirect_to user_path(current_user), notice: 'Changes are being propagated. It may take 1-2 min. Check the app status icon.'
else
render :edit, flash: 'Please check your input!'
end
end
def destroy
redirect_to user_path(current_user) unless current_user.admin?
@app = fetch_app(params[:id])
if @app.destroy!
redirect_to user_path(current_user), notice: 'App has been destroyed!'
else
redirect_to user_path(current_user), notice: @app.errors.join("\n")
end
end
def update
@app = fetch_app(params[:id])
if @app.update_attributes(app_params)
@app.publish_to_app_service
@app.publish_to_jenkins_service
redirect_to user_path(current_user), notice: "Successfully updated #{@app.name}. It may take 2-3 min. for your changes to take action."
else
render :edit
end
end
private
def limit_apps_per_user
if User::AppLimit.limit_reached? current_user
redirect_to user_path(current_user), notice: "You are allowed to create only one app for each exercise"
end
end
def app_params
params.require(:app).permit(:name, :ssh_key, :external_hosting, :external_url).
merge(user_id: current_user.id, course: current_user.course)
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/models/review_date.rb
|
class ReviewDate < ActiveRecord::Base
has_many :users, through: :review_group
belongs_to :user
belongs_to :review_group
validates_inclusion_of :exercise_id, in: Courses.current.exercise_names.keys
def self.upcoming_for_user(user)
where('begins_at > ?', [Time.now]).where(review_group_id: user.review_group_id)
end
def self.past
where('begins_at < ?', [1.day.from_now]).order(begins_at: :asc)
end
def self.upcoming
where('begins_at > ?', [1.day.ago]).order(begins_at: :asc)
end
def self.without_review
where(reviewed_at: nil)
end
def user_apps
App.where(user: users, exercise_id: exercise_id)
end
def presenter_display_name
user.try(:display_name) || '-'
end
def formatted_reviewed_at
if reviewed?
reviewed_at.to_s(:long)
else
"-"
end
end
def formatted_begins_at
begins_at.to_s(:long)
end
def confirm(points, user_id)
user_id = user_id.to_i
users.each do |user|
if app = user.apps.where(exercise_id: exercise_id).first
app.update!(reviewed_at: Time.current, review_points: points)
end
end
review_user = users.detect { |user| user.id == user_id }
review_user.update reviewed_at: Time.current
update reviewed_at: Time.current, review_points: points
update user_id: user_id
Email::CodeReviewConfirmationMailer.new(self).run
end
def revoke
users.each do |user|
app = user.apps.where(exercise_id: exercise_id).first!
app.update!(reviewed_at: nil, review_points: 0)
end
update reviewed_at: nil, review_points: 0
end
def reviewed?
reviewed_at.present?
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
db/migrate/20160420111116_add_winter_group2015.rb
|
class AddWinterGroup2015 < ActiveRecord::Migration
def up
ws2015 = Group.create(name: 'WS2015')
User.where('created_at > ?', [8.weeks.ago]).each do |user|
ws2015.users << user
end
end
def down
Group.where(name: 'WS2015').delete_all
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/controllers/admin/exercises_controller.rb
|
module Admin
class ExercisesController < BaseController
def show
@exercise_ids = ExercisePointMaster.new(current_course).exercise_ids
@apps = current_course.students.includes(:apps).map(&:apps).flatten
end
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/models/statistics/overall_points.rb
|
# Overall points
# students.each do |student|
# student["user"] => User(email: …),
# student["total_points"] => 6
# end
module Statistics
class OverallPoints
attr_accessor :students
def initialize(students = User.without_admin)
@students = students
end
def google_chart_data
formatted_data_with_header.to_json.html_safe
end
def formatted_data_with_header
[['Student', 'Punkte']] + formatted_data
end
def formatted_data
data.map { |result| [result['user']['email'], result['points']] }
end
def data
students.map do |student|
{
'user' => student,
'points' => sum_of_points(student)
}
end
end
def sum_of_points(student)
student.apps.inject(0) { |sum, app| sum += app.total_points }
end
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/models/feedback.rb
|
<filename>app/models/feedback.rb
require 'kramdown'
class Feedback < ActiveRecord::Base
belongs_to :app
belongs_to :user
def body_as_html
Kramdown::Document.new(body).to_html.html_safe
end
end
|
HTW-Webtech/ai-webtech-admin-app
|
app/models/courses/summer2016.rb
|
<filename>app/models/courses/summer2016.rb
module Courses
class Summer2016 < Base
def self.exercises
{
1 => [ 0, Date.new(2016, 12, 12) ],
2 => [ 2, Date.new(2016, 5, 6) ],
3 => [ 2, Date.new(2016, 5, 11) ],
4 => [ 2, Date.new(2016, 5, 16) ],
5 => [ 4, Date.new(2016, 5, 30) ],
6 => [ 8, Date.new(2016, 6, 12) ],
7 => [ 2, Date.new(2016, 7, 4) ],
8 => [ 0, Date.new ],
}
end
def self.exercise_names
{
2 => 'http',
3 => 'html',
4 => 'ruby',
5 => 'sinatra',
6 => 'datamapper',
7 => 'rails_tutorial',
}
end
def self.review_points
{
1 => (0..0),
2 => (0..0),
3 => (0..2),
4 => (0..0),
5 => (0..4),
6 => (0..6),
7 => (0..0),
8 => (0..16),
}
end
end
end
|
csxiaodiao/hecms
|
app/models/hecms/tag_relation.rb
|
<filename>app/models/hecms/tag_relation.rb
# frozen_string_literal: true
module Hecms
class TagRelation < ApplicationRecord
belongs_to :record, polymorphic: true, touch: true
belongs_to :tag, counter_cache: :articles_count
end
end
|
csxiaodiao/hecms
|
app/controllers/hecms/categories_controller.rb
|
# frozen_string_literal: true
require_dependency 'hecms/base_controller'
module Hecms
class CategoriesController < BaseController
before_action :find_category, only: %i[destroy edit update]
def index
@categories = Category.roots.page(params[:page])
end
def new
@category = Category.new
end
def edit; end
def update
if @category.update(form_params)
flash[:notice] = t('common.update_success')
redirect_to(categories_path)
else
flash[:alert] = t('common.update_fail')
render(:edit)
end
end
def create
@category = Category.new(form_params)
if @category.save
flash[:notice] = t('common.create_success')
redirect_to(categories_path)
else
flash[:alert] = t('common.create_fail')
render(:new)
end
end
def destroy
if @category.destroy
flash[:notice] = t('common.delete_success')
redirect_to(adm_categories_path)
else
flash[:alert] = t('common.delete_fail')
redirect_to(adm_categories_path)
end
end
private
def find_category
@category = Category.friendly.find(params[:id])
end
def set_ui
super
@ui_main_nav_active_categories = 'active'
end
def form_params
params.require(:category).permit(
:name,
:parent_id,
:pinyin,
:seo_title,
:keywords,
:description,
:enabled,
:slug
)
end
end
end
|
csxiaodiao/hecms
|
app/jobs/hecms/application_job.rb
|
<reponame>csxiaodiao/hecms
module Hecms
class ApplicationJob < ActiveJob::Base
end
end
|
csxiaodiao/hecms
|
app/models/hecms/article.rb
|
<filename>app/models/hecms/article.rb
# frozen_string_literal: true
module Hecms
class Article < ApplicationRecord
include SoftDelete
extend Enumerize
has_one_attached :image
acts_as_tenant(:user)
has_many :category_relations, as: :record, inverse_of: :record
has_many :categories, through: :category_relations, class_name: 'Category'
has_many :tag_relations, as: :record, inverse_of: :record
has_many :tags, through: :tag_relations
accepts_nested_attributes_for :category_relations, reject_if: :all_blank, allow_destroy: true
accepts_nested_attributes_for :tag_relations, reject_if: :all_blank, allow_destroy: true
scope_keyword_like hecms_articles: [:title]
EDITERS = { editer1: 1, editer2: 2, editer3: 3, editer4: 4, editer5: 5 }.freeze
enumerize :editer_id, in: EDITERS, default: :editer1, i18n_scope: 'activerecord.attributes.article/editer_id'
def category_names
categories.map(&:name).join(' ')
end
def tag_names
tags.map(&:name).join(' ')
end
def display_created_at_date
I18n.l(created_at, format: '%Y-%m-%d %H:%M:%S')
end
def display_published_date
I18n.l(published_date, format: '%Y-%m-%d %H:%M:%S')
end
def image_thumb_url(process)
image.service_url(params: { 'x-oss-process' => process })
end
end
end
|
csxiaodiao/hecms
|
app/controllers/hecms/base_controller.rb
|
# frozen_string_literal: true
require_dependency 'hecms/application_controller'
module Hecms
class BaseController < ApplicationController
layout 'layouts/hecms/application'
before_action :authenticate_user!
set_current_tenant_through_filter
before_action :set_tenant
def set_tenant
set_current_tenant(current_user)
end
end
end
|
csxiaodiao/hecms
|
db/migrate/seeds.rb
|
# frozen_string_literal: true
# Hecms::Category.create(name: 'cate name', slug: 'cate_name')
puts 123
|
csxiaodiao/hecms
|
app/models/hecms/picture.rb
|
# frozen_string_literal: true
module Hecms
class Picture < ApplicationRecord
has_one_attached :image
end
end
|
csxiaodiao/hecms
|
app/models/concerns/keyword_like_helper.rb
|
<gh_stars>0
# frozen_string_literal: true
module KeywordLikeHelper
# example
# Add `scope_keyword_like users: [:username, :email], user_auth_tokens: [:value]' to model/user.rb
# explain: users is current table name, :username, :email is current table field.
# users_auth_tokens tables need joined to current table, [value] is joins table fields
# maybe exist any amount joins table.
# And then run ` User.keyword_like('some keyword')', generate following SQL.
# "SELECT `users`.* FROM `users` INNER JOIN `user_auth_tokens` ON
# `user_auth_tokens`.`user_id` = `users`.`id`
# WHERE ( users.username LIKE '%some keyword%' OR users.email LIKE '%some keyword%' OR
# user_auth_tokens.value LIKE '%some keyword%' )"
# 新增管理员修改密码时增加到最外层的enumeration
# TODO: Need add test.
def scope_keyword_like(scope_name: :keyword_like, **args)
adapter = ActiveRecord::Base.connection_config[:adapter]
joins_chained = "".dup
sql_query = "".dup
keyword_args = "".dup
args.each do |table, fields|
table_name = self.table_name
unless table.to_s == table_name
table_name = table.to_s.singularize.camelize.constantize.table_name
joins_chained << ".joins(:#{table})"
end
fields.each do |field|
field = "id::text" if field == :id && adapter == "postgresql"
like = adapter == "postgresql" ? "ILIKE" : "LIKE"
sql_query << " #{table_name}.#{field} #{like} ? OR"
keyword_args << '"%#{keyword}%", '
end
end
sql_query.chomp!("OR")
keyword_args.chomp!(", ")
scope_result = <<-HEREDOC
scope \"#{scope_name}\", -> (keyword) do
return all if keyword.blank?
self#{joins_chained}.where(\"#{sql_query}\", #{keyword_args})
end
HEREDOC
class_eval scope_result
end
end
|
csxiaodiao/hecms
|
app/controllers/hecms/auth/sessions_controller.rb
|
<gh_stars>0
# frozen_string_literal: true
module Hecms
class Auth::SessionsController < Devise::SessionsController
layout 'layouts/hecms/simple'
private
def after_sign_in_path_for(_resource)
root_path
end
def after_sign_out_path_for(_scope)
new_user_session_path
end
end
end
|
csxiaodiao/hecms
|
app/views/hecms/articles/search.json.jbuilder
|
# frozen_string_literal: true
json.articles do
json.array! @articles do |x|
json.id x.id
json.title x.title
json.category_names x.category_names
json.tag_names x.tag_names
json.content strip_tags(x.content_html.to_s)
end
end
json.meta do
json.total_pages @articles.total_pages
json.total_count @articles.total_count
end
|
csxiaodiao/hecms
|
test/dummy/config/routes.rb
|
Rails.application.routes.draw do
mount Hecms::Engine => "/hecms"
end
|
csxiaodiao/hecms
|
db/migrate/20210420072903_create_hecms_category_relations.rb
|
# frozen_string_literal: true
class CreateHecmsCategoryRelations < ActiveRecord::Migration[6.1]
def change
create_table :hecms_category_relations do |t|
t.references :category, null: false, comment: '栏目'
t.references :record, null: false, polymorphic: true, index: false
t.timestamps
end
add_index :hecms_category_relations, %i[record_type record_id category_id], name: 'index_categories_uniqueness', unique: true
add_foreign_key :hecms_category_relations, :hecms_categories, column: :category_id
end
end
|
csxiaodiao/hecms
|
app/controllers/hecms/uploads_controller.rb
|
<reponame>csxiaodiao/hecms<filename>app/controllers/hecms/uploads_controller.rb
# frozen_string_literal: true
require_dependency 'hecms/base_controller'
module Hecms
class UploadsController < BaseController
def create
picture = Picture.new(image: params[:upload])
if picture.save
render(json: { url: picture.image.service_url })
else
render(json: {})
end
end
end
end
|
csxiaodiao/hecms
|
lib/tasks/hecms_tasks.rake
|
<reponame>csxiaodiao/hecms
# desc "Explaining what the task does"
# task :hecms do
# # Task goes here
# end
|
csxiaodiao/hecms
|
hecms.gemspec
|
<reponame>csxiaodiao/hecms
# frozen_string_literal: true
require_relative 'lib/hecms/version'
Gem::Specification.new do |spec|
spec.name = 'hecms'
spec.version = Hecms::VERSION
spec.authors = ['csxiaodiao']
spec.email = ['<EMAIL>']
spec.homepage = 'http://xiaodiao.me'
spec.summary = 'Hecms.'
spec.description = 'Hecms.'
spec.license = 'MIT'
spec.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md']
spec.add_dependency 'activestorage-aliyun', '~> 0.6.4'
spec.add_dependency 'acts_as_tenant', '~> 0.5.0'
spec.add_dependency 'awesome_nested_set', '~> 3.4'
spec.add_dependency 'devise', '~> 4.7', '>= 4.7.3'
spec.add_dependency 'enumerize', '~> 2.3', '>= 2.3.1'
spec.add_dependency 'fomantic-ui-sass', '~> 2.8', '>= 2.8.7'
spec.add_dependency 'friendly_id', '~> 5.4', '>= 5.4.2'
spec.add_dependency 'jquery-rails', '~> 4.4'
spec.add_dependency 'kaminari', '~> 1.2', '>= 1.2.1'
spec.add_dependency 'mini_magick', '~> 4.9', '>= 4.9.3'
spec.add_dependency 'pry'
spec.add_dependency 'rails', '~> 6.1.3', '>= 6.1.3.1'
spec.add_dependency 'ransack', '~> 2.4', '>= 2.4.2'
spec.add_dependency 'sass-rails', '>= 6'
end
|
csxiaodiao/hecms
|
app/helpers/hecms/tags_helper.rb
|
module Hecms
module TagsHelper
end
end
|
csxiaodiao/hecms
|
app/models/concerns/i18n_display_helper.rb
|
<filename>app/models/concerns/i18n_display_helper.rb<gh_stars>0
# frozen_string_literal: true
module I18nDisplayHelper
extend ActiveSupport::Concern
def display_created_at
I18n.l(created_at, format: :long) if created_at.present?
end
def display_md_created_at
I18n.l(created_at, format: :md) if created_at.present?
end
def display_updated_at
I18n.l(updated_at, format: :long) if updated_at.present?
end
def display_deleted_at
I18n.l(deleted_at, format: :long) if deleted_at.present?
end
def display_enabled
I18n.t(enabled ? "common.bool.true" : "common.bool.false")
end
def display_hot
I18n.t(hot ? "common.bool.true" : "common.bool.false")
end
end
|
csxiaodiao/hecms
|
app/controllers/hecms/application_controller.rb
|
<filename>app/controllers/hecms/application_controller.rb
# frozen_string_literal: true
module Hecms
class ApplicationController < ActionController::Base
end
end
|
csxiaodiao/hecms
|
app/models/concerns/article_achortext.rb
|
<filename>app/models/concerns/article_achortext.rb<gh_stars>0
# frozen_string_literal: true
module ArticleAchortext
extend ActiveSupport::Concern
included do
has_many :anchor_text_relations
has_many :anchor_texts, through: :anchor_text_relations
accepts_nested_attributes_for :anchor_text_relations, reject_if: :all_blank, allow_destroy: true
after_commit :push_article_achortext_worker, on: [:create, :update]
end
def push_article_achortext_worker
ArticleAchortextWorker.perform_async(id)
end
def builder_achortext
@doc = Nokogiri::HTML(content_html)
total_links = 0
AnchorText.anchortext.each do |x|
next unless @doc.content.include?(x[:anchortext])
anchortext_relations = []
links_per_pattern = 0
@doc.search("p").children.each do |child|
next unless analize_node(child, x)
anchortext_relations << { anchor_text_id: x[:id] }
links_per_pattern += 1
total_links += 1
end
next if anchortext_relations.blank?
begin
anchor_text_relations.create!(anchortext_relations)
rescue => e
Rails.logger.info("anchor text relations error: #{e}")
end
end
return if total_links == 0
content_html = @doc.at("body").nil? ? "" : @doc.at("body").inner_html
# skip after_commit
update(content_html: content_html)
end
def remove_article_achortext_by_achortext(anchor_text)
anchortext = anchor_text.name
@doc = Nokogiri::HTML(content_html)
@doc.search("a").each do |node|
next unless node.children.count < 2
replace_text = node.content
if replace_text == anchortext
node.replace(replace_text)
end
end
content_html = @doc.at("body").nil? ? "" : @doc.at("body").inner_html
# skip after_commit
update(content_html: content_html)
end
private
def analize_node(node, pattern)
if %('text', 'strong').include?(node.name) && node.children.count < 2
replace_text = node.content
result = replace_text.sub!(/(#{pattern[:anchortext]})/i, pattern[:a_tag])
unless result.nil?
if node.name == "text"
node.replace(replace_text)
else
new_node = @doc.create_element(node.name)
new_node.inner_html = replace_text
node.replace(new_node)
end
return true
end
end
false
end
end
|
csxiaodiao/hecms
|
lib/hecms.rb
|
<gh_stars>0
# frozen_string_literal: true
# require 'active_storage/engine'
require 'hecms/version'
require 'hecms/engine'
require 'awesome_nested_set'
require 'ransack'
require 'friendly_id'
require 'kaminari'
require 'devise'
require 'jquery-rails'
require 'sass-rails'
require 'fomantic-ui-sass'
require 'acts_as_tenant'
require 'enumerize'
require 'pry'
module Hecms
# Your code goes here...
end
|
csxiaodiao/hecms
|
db/migrate/20210413015526_create_hecms_categories.rb
|
<reponame>csxiaodiao/hecms<filename>db/migrate/20210413015526_create_hecms_categories.rb<gh_stars>0
# frozen_string_literal: true
class CreateHecmsCategories < ActiveRecord::Migration[6.1]
def change
create_table :hecms_categories do |t|
t.string :name, null: false, comment: '栏目名'
t.string :seo_title, comment: 'SEO标题'
t.string :keywords, comment: '关键词'
t.text :description, comment: '简介'
t.string :slug, comment: 'uri标识'
t.boolean :enabled, default: true
t.integer :parent_id, null: true, index: true
t.integer :lft, null: false, index: true
t.integer :rgt, null: false, index: true
# optional fields
t.integer :depth, null: false, default: 0
t.integer :children_count, null: false, default: 0
t.datetime :deleted_at, index: true
t.timestamps
end
add_index :hecms_categories, :slug, unique: true
end
end
|
csxiaodiao/hecms
|
app/models/concerns/ads_wordsable.rb
|
<reponame>csxiaodiao/hecms
# frozen_string_literal: true
module AdsWordsable
extend ActiveSupport::Concern
class_methods do
def ads_words
YAML.load(File.read(Rails.root.join("lib/ads_words/ads_words.yml")))["ads_words"]
end
end
end
|
csxiaodiao/hecms
|
test/dummy/db/schema.rb
|
# 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 `bin/rails
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_04_13_015526) do
create_table "hecms_categories", force: :cascade do |t|
t.string "name", null: false
t.string "seo_title"
t.string "keywords"
t.text "description"
t.string "slug"
t.boolean "enabled", default: true
t.integer "parent_id"
t.integer "lft", null: false
t.integer "rgt", null: false
t.integer "depth", default: 0, null: false
t.integer "children_count", default: 0, null: false
t.datetime "deleted_at"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["deleted_at"], name: "index_hecms_categories_on_deleted_at"
t.index ["lft"], name: "index_hecms_categories_on_lft"
t.index ["parent_id"], name: "index_hecms_categories_on_parent_id"
t.index ["rgt"], name: "index_hecms_categories_on_rgt"
t.index ["slug"], name: "index_hecms_categories_on_slug", unique: true
end
end
|
csxiaodiao/hecms
|
db/migrate/20210420072005_create_hecms_tag_relations.rb
|
# frozen_string_literal: true
class CreateHecmsTagRelations < ActiveRecord::Migration[6.1]
def change
create_table :hecms_tag_relations do |t|
t.references :tag, null: false, comment: '标签'
t.references :record, null: false, polymorphic: true, index: false
t.timestamps
end
add_index :hecms_tag_relations, %i[record_type record_id tag_id], name: 'index_tags_uniqueness', unique: true
add_foreign_key :hecms_tag_relations, :hecms_tags, column: :tag_id
end
end
|
csxiaodiao/hecms
|
config/routes.rb
|
<reponame>csxiaodiao/hecms
# frozen_string_literal: true
Hecms::Engine.routes.draw do
devise_for :users, path: 'auth/users', class_name: 'Hecms::User', module: :devise, controllers: {
sessions: 'hecms/auth/sessions',
passwords: '<PASSWORD>'
}
root to: 'categories#index'
resources :categories
resources :articles
resources :tags
resources :pictures, only: [:create]
resources :uploads, only: [:create]
resources :locales, only: [:update]
end
|
csxiaodiao/hecms
|
app/helpers/hecms/application_helper.rb
|
# frozen_string_literal: true
module Hecms
module ApplicationHelper
def controller_path_action_name
"#{controller.controller_path.gsub('/', '__')}__#{controller.action_name}"
end
def html_body_classes
"#{controller_path_action_name} #{@body_classes&.join(' ')}"
end
def site_logo_url
# SystemConfig.current.site_logo.service_url
'/'
end
def site_name
'Site Name'
end
def page_seo_title
'Seo Title'
end
def page_keywords
'Keywords'
end
def page_description
'Description'
end
def slogan
'Slogan'
end
def media_image_url(media_name)
media_name = truncate(media_name, length: 7, omission: '')
string = Base64.urlsafe_encode64(media_name)
"https://prmedia.oss-cn-shanghai.aliyuncs.com/default_fff.png?x-oss-process=image/resize,w_300,h_300/watermark,image_bG9nb3cucG5nP3gtb3NzLXByb2Nlc3M9aW1hZ2UvcmVzaXplLFBfMTU=,g_nw,x_10,y_10/watermark,text_#{string},color_333333,shadow_50,t_100,g_center/watermark,text_5b6u5YWJ572R5aqS,color_666666,size_13,g_se"
end
def ui_right_floated_new_button_class
'ui right floated basic button'
end
def ui_show_button_class
'ui tiny basic button'
end
def ui_edit_button_class
'ui tiny button'
end
def ui_delete_button_class
'ui tiny inverted red button'
end
def ui_restore_button_class
'ui basic tiny green button'
end
def ui_show_table_class
'ui definition table'
end
def display_short_date(x)
date = x.published_date || x.created_at
I18n.l(date, format: :yueri)
end
def highlight(text)
text = escape_once(strip_tags(text)).gsub('[h]', '<em>').gsub('[/h]', '</em>').gsub(/\\n|\\r/, '')
text.html_safe
end
def title_tag
@page_title.present? ? content_tag(:title, "#{site_name}_#{@page_title}") : content_tag(:title, "#{site_name}_#{page_seo_title}")
end
def keywords_tag
@page_keywords.present? ? @page_keywords : page_keywords
end
def description_tag
@page_description.present? ? @page_description : page_description
end
end
end
|
csxiaodiao/hecms
|
db/migrate/20210420072101_create_hecms_pictures.rb
|
<gh_stars>0
# frozen_string_literal: true
class CreateHecmsPictures < ActiveRecord::Migration[6.1]
def change
create_table :hecms_pictures, &:timestamps
end
end
|
csxiaodiao/hecms
|
lib/hecms/engine.rb
|
<reponame>csxiaodiao/hecms<filename>lib/hecms/engine.rb
# frozen_string_literal: true
module Hecms
class Engine < ::Rails::Engine
isolate_namespace Hecms
config.before_initialize do
config.i18n.load_path += Dir["#{config.root}/config/locales/**/*.yml"]
# config.i18n.available_locales << 'zh-CN'
ActiveSupport.on_load(:active_record) { include Hecms::ApplicationHelper }
end
initializer 'hecms.assets.precompile', group: :all do |app|
app.config.assets.precompile << 'hecms_manifest.js'
end
# initializer :append_migrations do |app|
# unless app.root.to_s.match(root.to_s)
# config.paths['db/migrate'].expanded.each do |expanded_path|
# app.config.paths['db/migrate'] << expanded_path
# end
# end
# end
end
end
|
csxiaodiao/hecms
|
db/migrate/20210420070722_create_hecms_articles.rb
|
# frozen_string_literal: true
class CreateHecmsArticles < ActiveRecord::Migration[6.1]
def change
create_table :hecms_articles do |t|
t.references :user_id, null: false, comment: 'user'
t.string(:title, null: false, comment: '标题')
t.string(:seo_title, comment: 'SEO标题')
t.string(:keywords, comment: '关键词')
t.text(:description, comment: '简介')
t.text(:content_html, comment: '内容')
t.integer(:sort, comment: '排序')
t.boolean(:top, comment: '置顶/热门')
t.string(:slug)
t.integer(:views, default: 0)
t.datetime(:published_date)
t.integer(:editer_id)
t.datetime(:deleted_at, index: true)
t.timestamps
end
add_index(:hecms_articles, :top)
add_index(:hecms_articles, :user_id)
add_index(:hecms_articles, :slug, unique: true)
add_foreign_key :hecms_articles, :hecms_users, column: :user_id
end
end
|
csxiaodiao/hecms
|
app/models/hecms/tag.rb
|
# frozen_string_literal: true
module Hecms
class Tag < ApplicationRecord
extend FriendlyId
has_many :tag_relations
has_many :articles, through: :tag_relations, source: :record, source_type: 'Article'
accepts_nested_attributes_for :tag_relations, reject_if: :all_blank, allow_destroy: true
friendly_id :slug, use: :slugged
validates :name, presence: true
scope_keyword_like hecms_tags: [:name]
def self.options_for_select
options = []
all.each do |x|
options << [x.name, x.id]
end
options
end
end
end
|
csxiaodiao/hecms
|
app/controllers/hecms/tags_controller.rb
|
<filename>app/controllers/hecms/tags_controller.rb<gh_stars>0
# frozen_string_literal: true
require_dependency 'hecms/base_controller'
module Hecms
class TagsController < BaseController
before_action :find_tag, only: %i[destroy edit update]
def index
@tags = Tag.keyword_like(params[:keyword]).order(id: :desc).page(params[:page])
# html = render_to_string action: :index, layout: false, formats: [:html]
end
def new
@tag = Tag.new
end
def edit; end
def update
if @tag.update(form_params)
flash[:notice] = t('common.update_success')
redirect_to(tags_path, notice: '更新成功')
else
flash[:alert] = t('common.update_fail')
render(:edit)
end
end
def create
@tag = Tag.new(form_params)
if @tag.save
flash[:notice] = t('common.create_success')
redirect_to(tags_path)
else
flash[:alert] = t('common.create_fail')
render(:new)
end
end
def destroy
if @tag.destroy
flash[:notice] = t('common.delete_success')
redirect_to(tags_path)
else
flash[:alert] = t('common.delete_fail')
redirect_to(tags_path)
end
end
private
def find_tag
@tag = Tag.find(params[:id])
end
def set_ui
super
@ui_main_nav_active_tags = 'active'
end
def form_params
params.require(:tag).permit(
:name,
:pinyin,
:seo_title,
:keywords,
:description,
:slug
)
end
end
end
|
csxiaodiao/hecms
|
app/helpers/hecms/categories_helper.rb
|
module Hecms
module CategoriesHelper
end
end
|
csxiaodiao/hecms
|
app/helpers/hecms/articles_helper.rb
|
<gh_stars>0
module Hecms
module ArticlesHelper
end
end
|
csxiaodiao/hecms
|
app/models/hecms/category_relation.rb
|
<reponame>csxiaodiao/hecms<filename>app/models/hecms/category_relation.rb
# frozen_string_literal: true
module Hecms
class CategoryRelation < ApplicationRecord
belongs_to :record, polymorphic: true, touch: true
belongs_to :category
end
end
|
csxiaodiao/hecms
|
app/models/hecms/category.rb
|
# frozen_string_literal: true
module Hecms
class Category < ApplicationRecord
acts_as_nested_set
include SoftDelete
extend FriendlyId
has_many :category_relations, dependent: :destroy
has_many :articles, through: :category_relations, source: :record, source_type: 'Article'
has_many :tags, through: :category_relations, source: :record, source_type: 'Tag'
friendly_id :slug, use: :slugged
def self.options_for_select
options = []
roots.each do |category|
each_with_level(category.self_and_descendants) do |x, level|
options << ["#{'-' * level} #{x.name}", x.id]
end
end
options
end
end
end
|
csxiaodiao/hecms
|
app/controllers/hecms/articles_controller.rb
|
<reponame>csxiaodiao/hecms
# frozen_string_literal: true
require_dependency 'hecms/base_controller'
module Hecms
class ArticlesController < BaseController
before_action :find_article, only: %i[edit update show destroy]
def index
@articles = Article.keyword_like(params[:keyword]).includes(:tags, :categories).page(params[:page])
end
def search
@articles = Article.keyword_like(params[:keyword]).includes(:tags, :categories).page(params[:page])
end
def new
@article = Article.new
end
def edit; end
def update
if @article.update(form_params)
flash[:notice] = t('common.update_success')
redirect_to(articles_path)
else
flash[:alert] = t('common.update_fail')
render(:new)
end
end
def create
@article = Article.new(form_params)
if @article.save
flash[:notice] = t('common.create_success')
redirect_to(articles_path)
else
flash[:alert] = t('common.create_fail')
render(:new)
end
end
def destroy
respond_to do |format|
if @article.destroy
format.html { redirect_to articles_path }
format.json { render json: { code: 1111, id: @article.id } }
else
format.html { redirect_to articles_path }
format.json { render json: { code: 0o000, id: nil } }
end
end
end
private
def find_article
@article = Article.find(params[:id])
end
def set_ui
super
@ui_main_nav_active_articles = 'active'
end
def form_params
params.require(:article).permit(
:image,
:title,
:seo_title,
:keywords,
:description,
:content_html,
:sort,
:published_date,
:top,
:editer_id,
:scheduled,
category_ids: [],
tag_ids: []
)
end
end
end
|
csxiaodiao/hecms
|
db/migrate/20210420071829_create_hecms_tags.rb
|
<reponame>csxiaodiao/hecms
# frozen_string_literal: true
class CreateHecmsTags < ActiveRecord::Migration[6.1]
def change
create_table :hecms_tags do |t|
t.string :name, comment: '标签名'
t.string :seo_title, comment: 'SEO标题'
t.string :keywords, comment: '关键词'
t.text :description, comment: '简介'
t.string :slug
t.timestamps
end
add_index :hecms_tags, :slug, unique: true
end
end
|
HuaxinTang/grpc
|
src/objective-c/BoringSSL-GRPC.podspec
|
# This file has been automatically generated from a template file.
# Please make modifications to
# `templates/src/objective-c/BoringSSL-GRPC.podspec.template` instead. This
# file can be regenerated from the template by running
# `tools/buildgen/generate_projects.sh`.
# BoringSSL CocoaPods podspec
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Pod::Spec.new do |s|
s.name = 'BoringSSL-GRPC'
version = '0.0.22'
s.version = version
s.summary = 'BoringSSL is a fork of OpenSSL that is designed to meet Google\'s needs.'
# Adapted from the homepage:
s.description = <<-DESC
BoringSSL is a fork of OpenSSL that is designed to meet Google's needs.
Although BoringSSL is an open source project, it is not intended for general use, as OpenSSL is.
We don't recommend that third parties depend upon it. Doing so is likely to be frustrating
because there are no guarantees of API stability. Only the latest version of this pod is
supported, and every new version is a new major version.
We update Google libraries and programs that use BoringSSL as needed when deciding to make API
changes. This allows us to mostly avoid compromises in the name of compatibility. It works for
us, but it may not work for you.
As a Cocoapods pod, it has the advantage over OpenSSL's pods that the library doesn't need to
be precompiled. This eliminates the 10 - 20 minutes of wait the first time a user does "pod
install", lets it be used as a dynamic framework (pending solution of Cocoapods' issue #4605),
and works with bitcode automatically. It's also thought to be smaller than OpenSSL (which takes
1MB - 2MB per ARM architecture), but we don't have specific numbers yet.
BoringSSL arose because Google used OpenSSL for many years in various ways and, over time, built
up a large number of patches that were maintained while tracking upstream OpenSSL. As Google's
product portfolio became more complex, more copies of OpenSSL sprung up and the effort involved
in maintaining all these patches in multiple places was growing steadily.
Currently BoringSSL is the SSL library in Chrome/Chromium, Android (but it's not part of the
NDK) and a number of other apps/programs.
DESC
s.homepage = 'https://github.com/google/boringssl'
s.license = { :type => 'Mixed', :file => 'LICENSE' }
# "The name and email addresses of the library maintainers, not the Podspec maintainer."
s.authors = '<NAME>', '<NAME>', '<NAME>'
s.source = {
:git => 'https://github.com/google/boringssl.git',
:commit => "<PASSWORD>",
}
s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.10'
s.tvos.deployment_target = '10.0'
s.watchos.deployment_target = '4.0'
name = 'openssl_grpc'
# When creating a dynamic framework, name it openssl.framework instead of BoringSSL.framework.
# This lets users write their includes like `#include <openssl/ssl.h>` as opposed to `#include
# <BoringSSL/ssl.h>`.
s.module_name = name
# When creating a dynamic framework, copy the headers under `include/openssl/` into the root of
# the `Headers/` directory of the framework (i.e., not under `Headers/include/openssl`).
#
# TODO(jcanizales): Debug why this doesn't work on macOS.
s.header_mappings_dir = 'src/include/openssl'
# The above has an undesired effect when creating a static library: It forces users to write
# includes like `#include <BoringSSL/ssl.h>`. `s.header_dir` adds a path prefix to that, and
# because Cocoapods lets omit the pod name when including headers of static libraries, the
# following lets users write `#include <openssl/ssl.h>`.
s.header_dir = name
# The module map and umbrella header created automatically by Cocoapods don't work for C libraries
# like this one. The following file, and a correct umbrella header, are created on the fly by the
# `prepare_command` of this pod.
s.module_map = 'src/include/openssl/BoringSSL.modulemap'
# We don't need to inhibit all warnings; only -Wno-shorten-64-to-32. But Cocoapods' linter doesn't
# want that for some reason.
s.compiler_flags = '-DOPENSSL_NO_ASM', '-GCC_WARN_INHIBIT_ALL_WARNINGS', '-w', '-DBORINGSSL_PREFIX=GRPC'
s.requires_arc = false
# Like many other C libraries, BoringSSL has its public headers under `include/<libname>/` and its
# sources and private headers in other directories outside `include/`. Cocoapods' linter doesn't
# allow any header to be listed outside the `header_mappings_dir` (even though doing so works in
# practice). Because we need our `header_mappings_dir` to be `include/openssl/` for the reason
# mentioned above, we work around the linter limitation by dividing the pod into two subspecs, one
# for public headers and the other for implementation. Each gets its own `header_mappings_dir`,
# making the linter happy.
s.subspec 'Interface' do |ss|
ss.header_mappings_dir = 'src/include/openssl'
ss.source_files = 'src/include/openssl/*.h'
end
s.subspec 'Implementation' do |ss|
ss.header_mappings_dir = 'src'
ss.source_files = 'src/ssl/*.{h,c,cc}',
'src/ssl/**/*.{h,c,cc}',
'src/crypto/*.{h,c,cc}',
'src/crypto/**/*.{h,c,cc}',
# We have to include fiat because spake25519 depends on it
'src/third_party/fiat/*.{h,c,cc}',
# Include the err_data.c pre-generated in boringssl's master-with-bazel branch
'err_data.c'
ss.private_header_files = 'src/ssl/*.h',
'src/ssl/**/*.h',
'src/crypto/*.h',
'src/crypto/**/*.h',
'src/third_party/fiat/*.h'
# bcm.c includes other source files, creating duplicated symbols. Since it is not used, we
# explicitly exclude it from the pod.
# TODO (mxyan): Work with BoringSSL team to remove this hack.
ss.exclude_files = 'src/crypto/fipsmodule/bcm.c',
'src/**/*_test.*',
'src/**/test_*.*',
'src/**/test/*.*'
ss.dependency "#{s.name}/Interface", version
end
s.prepare_command = <<-END_OF_COMMAND
set -e
# Add a module map and an umbrella header
mkdir -p src/include/openssl
cat > src/include/openssl/umbrella.h <<EOF
#include "ssl.h"
#include "crypto.h"
#include "aes.h"
/* The following macros are defined by base.h. The latter is the first file included by the
other headers. */
#if defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64)
# include "arm_arch.h"
#endif
#include "asn1.h"
#include "asn1_mac.h"
#include "asn1t.h"
#include "blowfish.h"
#include "cast.h"
#include "chacha.h"
#include "cmac.h"
#include "conf.h"
#include "cpu.h"
#include "curve25519.h"
#include "des.h"
#include "dtls1.h"
#include "hkdf.h"
#include "md4.h"
#include "md5.h"
#include "obj_mac.h"
#include "objects.h"
#include "opensslv.h"
#include "ossl_typ.h"
#include "pkcs12.h"
#include "pkcs7.h"
#include "pkcs8.h"
#include "poly1305.h"
#include "rand.h"
#include "rc4.h"
#include "ripemd.h"
#include "safestack.h"
#include "srtp.h"
#include "x509.h"
#include "x509v3.h"
EOF
cat > src/include/openssl/BoringSSL.modulemap <<EOF
framework module openssl {
umbrella header "umbrella.h"
textual header "arm_arch.h"
export *
module * { export * }
}
EOF
# To avoid symbol conflict with OpenSSL, gRPC needs to rename all the BoringSSL symbols with a
# prefix. This is done with BoringSSL's BORINGSSL_PREFIX mechanism
# (https://github.com/google/boringssl/blob/75148d7abf12bdd1797fec3c5da9a21963703516/BUILDING.md#building-with-prefixed-symbols).
# The required prefix header file boringssl_prefix_symbols.h is not part of BoringSSL repo at
# this moment. It has to be generated by BoringSSL's users and be injected to BoringSSL build.
# gRPC generates this file in script /tools/distrib/upgrade_boringssl_objc.sh. This script
# outputs a gzip+base64 encoded version of boringssl_prefix_symbols.h because of Cocoapods'
# limit on the 'prepare_command' field length. The encoded header is generated from
# /src/boringssl/boringssl_prefix_symbols.h. Here we decode the content and inject the header to
# the correct location in BoringSSL.
case "$(uname)" in
Darwin) opts="" ;;
*) opts="--ignore-garbage" ;;
esac
base64 --decode $opts <<EOF | gunzip > src/include/openssl/bo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AG3yc9kXVX1Ji/ThprziAWLFlmDI5ZwNGZtCDqwSBE1ImAIR3lk1luwJByLUQN7fDiC
eItfI4Z+jd4bhPlLWhY1iyRVNbXKueaVGcFyBCJVZUxaGQIsht7+UO/KxgvR8+EI/HLV8+EIqkjIuzYu
Y0BVMK5Ish+HtIgI1xmsKOlW/Ve361dakmOAPBShfeubbm45yCgT7hiWrjVg200dVpmMZVrlj+VB1++6
oif4HBKxti0wS9uiljeisQ620Krrc2iy5OV28oniNDDL1zaatOHkiQFM1PJuUICN1f0I9jnaD8vskSyU
DGSS9bTaqjfZpeI73WnSgJ18k5sY5Dus6LLDCjCpbpYu/2TfiUSsrNwGe32q52TeSGrXYKoedQxGItcn
uMSOpftRZfZCUR8Zy/SUiieVcrqfkezfX/6S/Nyp/X7TD+cXiRAvh2RTp9vm3W+EUOOl4LV04yCX419H
W<KEY>
<KEY>
<KEY>
<KEY>
<KEY>
spq0aRlBaV5H+xTp74sPvybp88+L016QhJESqkDiUHf6BWHETaoKbQ4xyn5Q3BWbgkAMtWdhVIyjAInR
<KEY>
f7K3DrOjbq+rvVSqtFJS9YoIOAlKAhSTNNNfv7aTAJ/9mfB+zG008DwODnbAhtdfBAP<KEY>1
rSVmRvG8HLxCQ8NkKQuP5OlRLDuCp5++KoulR3BXPC9n2ZHcDEwpsszPCP7UL6qtqczP2E6C2prI/Bz2
EX<KEY>
<KEY>
<KEY>
<KEY>
<KEY>
/<KEY>
wYfVIgKmDPiZQh19plAveW5PTz+318meMexizxhe5M/vXqae370I564u0bmri3Tu6hKbuzr8U7dltTN7
m5uZ9c+2+/5rdl/HsdPmb6paIjf4yP9foyq7WWW6rtad3fvfrMtmFxDhYyX8yI<KEY>
<KEY>
EOF
# We are renaming openssl to openssl_grpc so that there is no conflict with openssl if it exists
find . -type f \\( -path '*.h' -or -path '*.cc' -or -path '*.c' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include <openssl/;#include <openssl_grpc/;g'
# Include of boringssl_prefix_symbols.h does not follow Xcode import style. We add the package
# name here so that Xcode knows where to find it.
find . -type f \\( -path '*.h' -or -path '*.cc' -or -path '*.c' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include <boringssl_prefix_symbols.h>;#include <openssl_grpc/boringssl_prefix_symbols.h>;g'
END_OF_COMMAND
end
|
jmhnilbog/dcc_tabbed_sheet
|
lib/dcc_tabbed_sheet/helpers.rb
|
<gh_stars>0
module DccTabbedSheet
module Helpers
def version
# Sheet version, not DCC_Tabbed_Sheet version
DccTabbedSheet::SHEET_VERSION
end
end
end
|
jmhnilbog/dcc_tabbed_sheet
|
lib/dcc_tabbed_sheet.rb
|
require "dcc_tabbed_sheet/compiler"
require "dcc_tabbed_sheet/version"
module DccTabbedSheet
class Error < StandardError; end
end
|
mitre-cyber-academy/2012-web-e
|
turtles/cookbooks/challenge/aux/myapp.rb
|
require 'sinatra'
require 'tempfile'
class String
def ^( other )
b1 = self.unpack("U*")
b2 = other.unpack("U*")
longest = [b1.length,b2.length].max
b1 = [0]*(longest-b1.length) + b1
b2 = [0]*(longest-b2.length) + b2
b1.zip(b2).map{ |a,b| a^b }.pack("U*")
end
end
class Application < Sinatra::Base
set :root, File.dirname(__FILE__)
set :views, settings.root + "/views"
set :public_folder, settings.root + '/public'
set :show_exceptions, false
get '/' do
haml :index
end
get %r{/(turtles/)+} do
haml :turtles
end
post %r{/(turtles/)+} do
if !params[:name].nil?
"Flag is #{"|rt\u001Cw{v\fq\t\u000F\u000F" ^ params[:name][0..-request.path.scan('turtles').count]}"
else
"It's turtles all the way down but we need your ID...\n"*4
end
end
end
|
mitre-cyber-academy/2012-web-e
|
turtles/cookbooks/challenge/recipes/default.rb
|
<filename>turtles/cookbooks/challenge/recipes/default.rb
bash "initd" do
user "root"
code <<-EOH
# move initd
mv /home/ubuntu/chef-solo/cookbooks/challenge/aux/init_d_script /etc/init.d/challenge
chmod 755 /etc/init.d/challenge
# register it with boot sequence
update-rc.d challenge defaults 98 02
EOH
end
bash "challenge" do
user "ubuntu"
code <<-EOH
# all challenge files
mkdir $HOME/challenge
mv /home/ubuntu/chef-solo/cookbooks/challenge/aux/* $HOME/challenge
mv /home/ubuntu/chef-solo/cookbooks/challenge/aux/.rbenv-version $HOME/challenge
# setup ruby
PATH="/home/ubuntu/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
cat $HOME/challenge/.rbenv-version | xargs rbenv install
rbenv rehash
cat $HOME/challenge/.rbenv-version | xargs rbenv global
gem install bundler --no-rdoc --no-ri
rbenv rehash
# setup challenge
cd $HOME/challenge
bundle install --deployment --without development test
rbenv rehash
#start the service
sudo /etc/init.d/challenge start
EOH
end
|
Tryweirder/Docker-Provider
|
source/plugins/ruby/filter_telegraf2mdm.rb
|
# Copyright (c) Microsoft Corporation. All rights reserved.
# frozen_string_literal: true
module Fluent
require "logger"
require "yajl/json_gem"
require_relative "oms_common"
require_relative "kubelet_utils"
require_relative "MdmMetricsGenerator"
require_relative "constants"
class Telegraf2MdmFilter < Filter
Fluent::Plugin.register_filter("filter_telegraf2mdm", self)
config_param :enable_log, :integer, :default => 0
config_param :log_path, :string, :default => "/var/opt/microsoft/docker-cimprov/log/filter_telegraf2mdm.log"
@process_incoming_stream = true
def initialize
super
end
def configure(conf)
super
@log = nil
if @enable_log
@log = Logger.new(@log_path, 1, 5000000)
@log.debug { "Starting filter_telegraf2mdm plugin" }
end
end
def start
super
begin
@process_incoming_stream = CustomMetricsUtils.check_custom_metrics_availability
@log.debug "After check_custom_metrics_availability process_incoming_stream #{@process_incoming_stream}"
rescue => errorStr
@log.info "Error initializing plugin #{errorStr}"
end
end
def shutdown
super
end
def filter(tag, time, record)
if @process_incoming_stream
begin
if !record.nil? && !record["name"].nil? && record["name"].downcase == Constants::TELEGRAF_DISK_METRICS
return MdmMetricsGenerator.getDiskUsageMetricRecords(record)
else
return MdmMetricsGenerator.getMetricRecords(record)
end
return []
rescue Exception => errorStr
@log.info "Error processing telegraf record Exception: #{errorStr}"
ApplicationInsightsUtility.sendExceptionTelemetry(errorStr)
return [] #return empty array if we ran into any errors
end
end
end
def filter_stream(tag, es)
new_es = MultiEventStream.new
begin
es.each { |time, record|
filtered_records = filter(tag, time, record)
filtered_records.each { |filtered_record|
new_es.add(time, filtered_record) if filtered_record
} if filtered_records
}
rescue => e
@log.info "Error in filter_stream #{e.message}"
end
new_es
end
end
end
|
Tryweirder/Docker-Provider
|
source/plugins/ruby/filter_cadvisor2mdm.rb
|
<reponame>Tryweirder/Docker-Provider<filename>source/plugins/ruby/filter_cadvisor2mdm.rb
# Copyright (c) Microsoft Corporation. All rights reserved.
# frozen_string_literal: true
module Fluent
require "logger"
require "yajl/json_gem"
require_relative "oms_common"
require_relative "CustomMetricsUtils"
require_relative "kubelet_utils"
require_relative "MdmMetricsGenerator"
class CAdvisor2MdmFilter < Filter
Fluent::Plugin.register_filter("filter_cadvisor2mdm", self)
config_param :enable_log, :integer, :default => 0
config_param :log_path, :string, :default => "/var/opt/microsoft/docker-cimprov/log/filter_cadvisor2mdm.log"
config_param :metrics_to_collect, :string, :default => "Constants::CPU_USAGE_NANO_CORES,Constants::MEMORY_WORKING_SET_BYTES,Constants::MEMORY_RSS_BYTES,Constants::PV_USED_BYTES"
@@hostName = (OMS::Common.get_hostname)
@process_incoming_stream = true
@metrics_to_collect_hash = {}
@@metric_threshold_hash = {}
def initialize
super
end
def configure(conf)
super
@log = nil
if @enable_log
@log = Logger.new(@log_path, 1, 5000000)
@log.debug { "Starting filter_cadvisor2mdm plugin" }
end
end
def start
super
begin
@process_incoming_stream = CustomMetricsUtils.check_custom_metrics_availability
@metrics_to_collect_hash = build_metrics_hash
@log.debug "After check_custom_metrics_availability process_incoming_stream #{@process_incoming_stream}"
@@containerResourceUtilTelemetryTimeTracker = DateTime.now.to_time.to_i
@@pvUsageTelemetryTimeTracker = DateTime.now.to_time.to_i
# These variables keep track if any resource utilization threshold exceeded in the last 10 minutes
@containersExceededCpuThreshold = false
@containersExceededMemRssThreshold = false
@containersExceededMemWorkingSetThreshold = false
@pvExceededUsageThreshold = false
# initialize cpu and memory limit
if @process_incoming_stream
@cpu_capacity = 0.0
@memory_capacity = 0.0
ensure_cpu_memory_capacity_set
@containerCpuLimitHash = {}
@containerMemoryLimitHash = {}
@containerResourceDimensionHash = {}
@pvUsageHash = {}
@@metric_threshold_hash = MdmMetricsGenerator.getContainerResourceUtilizationThresholds
end
rescue => e
@log.info "Error initializing plugin #{e}"
end
end
def build_metrics_hash
@log.debug "Building Hash of Metrics to Collect"
metrics_to_collect_arr = @metrics_to_collect.split(",").map(&:strip)
metrics_hash = metrics_to_collect_arr.map { |x| [x.downcase, true] }.to_h
@log.info "Metrics Collected : #{metrics_hash}"
return metrics_hash
end
def shutdown
super
end
def setThresholdExceededTelemetry(metricName)
begin
if metricName == Constants::CPU_USAGE_NANO_CORES
@containersExceededCpuThreshold = true
elsif metricName == Constants::MEMORY_RSS_BYTES
@containersExceededMemRssThreshold = true
elsif metricName == Constants::MEMORY_WORKING_SET_BYTES
@containersExceededMemWorkingSetThreshold = true
elsif metricName == Constants::PV_USED_BYTES
@pvExceededUsageThreshold = true
end
rescue => errorStr
@log.info "Error in setThresholdExceededTelemetry: #{errorStr}"
ApplicationInsightsUtility.sendExceptionTelemetry(errorStr)
end
end
def flushMetricTelemetry
begin
#Send heartbeat telemetry with threshold percentage as dimensions
timeDifference = (DateTime.now.to_time.to_i - @@containerResourceUtilTelemetryTimeTracker).abs
timeDifferenceInMinutes = timeDifference / 60
if (timeDifferenceInMinutes >= Constants::TELEMETRY_FLUSH_INTERVAL_IN_MINUTES)
properties = {}
properties["CpuThresholdPercentage"] = @@metric_threshold_hash[Constants::CPU_USAGE_NANO_CORES]
properties["MemoryRssThresholdPercentage"] = @@metric_threshold_hash[Constants::MEMORY_RSS_BYTES]
properties["MemoryWorkingSetThresholdPercentage"] = @@metric_threshold_hash[Constants::MEMORY_WORKING_SET_BYTES]
# Keeping track of any containers that have exceeded threshold in the last flush interval
properties["CpuThresholdExceededInLastFlushInterval"] = @containersExceededCpuThreshold
properties["MemRssThresholdExceededInLastFlushInterval"] = @containersExceededMemRssThreshold
properties["MemWSetThresholdExceededInLastFlushInterval"] = @containersExceededMemWorkingSetThreshold
ApplicationInsightsUtility.sendCustomEvent(Constants::CONTAINER_RESOURCE_UTIL_HEART_BEAT_EVENT, properties)
@containersExceededCpuThreshold = false
@containersExceededMemRssThreshold = false
@containersExceededMemWorkingSetThreshold = false
@@containerResourceUtilTelemetryTimeTracker = DateTime.now.to_time.to_i
end
rescue => errorStr
@log.info "Error in flushMetricTelemetry: #{errorStr} for container resource util telemetry"
ApplicationInsightsUtility.sendExceptionTelemetry(errorStr)
end
# Also send for PV usage metrics
begin
pvTimeDifference = (DateTime.now.to_time.to_i - @@pvUsageTelemetryTimeTracker).abs
pvTimeDifferenceInMinutes = pvTimeDifference / 60
if (pvTimeDifferenceInMinutes >= Constants::TELEMETRY_FLUSH_INTERVAL_IN_MINUTES)
pvProperties = {}
pvProperties["PVUsageThresholdPercentage"] = @@metric_threshold_hash[Constants::PV_USED_BYTES]
pvProperties["PVUsageThresholdExceededInLastFlushInterval"] = @pvExceededUsageThreshold
ApplicationInsightsUtility.sendCustomEvent(Constants::PV_USAGE_HEART_BEAT_EVENT, pvProperties)
@pvExceededUsageThreshold = false
@@pvUsageTelemetryTimeTracker = DateTime.now.to_time.to_i
end
rescue => errorStr
@log.info "Error in flushMetricTelemetry: #{errorStr} for PV usage telemetry"
ApplicationInsightsUtility.sendExceptionTelemetry(errorStr)
end
end
def filter(tag, time, record)
begin
if @process_incoming_stream
# Check if insights metrics for PV metrics
data_type = record["DataType"]
if data_type == "INSIGHTS_METRICS_BLOB"
return filterPVInsightsMetrics(record)
end
object_name = record["DataItems"][0]["ObjectName"]
counter_name = record["DataItems"][0]["Collections"][0]["CounterName"]
percentage_metric_value = 0.0
metric_value = record["DataItems"][0]["Collections"][0]["Value"]
if object_name == Constants::OBJECT_NAME_K8S_NODE && @metrics_to_collect_hash.key?(counter_name.downcase)
# Compute and send % CPU and Memory
if counter_name == Constants::CPU_USAGE_NANO_CORES
metric_name = Constants::CPU_USAGE_MILLI_CORES
metric_value /= 1000000 #cadvisor record is in nanocores. Convert to mc
@log.info "Metric_value: #{metric_value} CPU Capacity #{@cpu_capacity}"
if @cpu_capacity != 0.0
percentage_metric_value = (metric_value) * 100 / @cpu_capacity
end
end
if counter_name.start_with?("memory")
metric_name = counter_name
if @memory_capacity != 0.0
percentage_metric_value = metric_value * 100 / @memory_capacity
end
end
# return get_metric_records(record, metric_name, metric_value, percentage_metric_value)
return MdmMetricsGenerator.getNodeResourceMetricRecords(record, metric_name, metric_value, percentage_metric_value)
elsif object_name == Constants::OBJECT_NAME_K8S_CONTAINER && @metrics_to_collect_hash.key?(counter_name.downcase)
instanceName = record["DataItems"][0]["InstanceName"]
metricName = counter_name
# Using node cpu capacity in the absence of container cpu capacity since the container will end up using the
# node's capacity in this case. Converting this to nanocores for computation purposes, since this is in millicores
containerCpuLimit = @cpu_capacity * 1000000
containerMemoryLimit = @memory_capacity
if counter_name == Constants::CPU_USAGE_NANO_CORES
if !instanceName.nil? && !@containerCpuLimitHash[instanceName].nil?
containerCpuLimit = @containerCpuLimitHash[instanceName]
end
# Checking if KubernetesApiClient ran into error while getting the numeric value or if we failed to get the limit
if containerCpuLimit != 0
percentage_metric_value = (metric_value) * 100 / containerCpuLimit
end
elsif counter_name.start_with?("memory")
if !instanceName.nil? && !@containerMemoryLimitHash[instanceName].nil?
containerMemoryLimit = @containerMemoryLimitHash[instanceName]
end
# Checking if KubernetesApiClient ran into error while getting the numeric value or if we failed to get the limit
if containerMemoryLimit != 0
percentage_metric_value = (metric_value) * 100 / containerMemoryLimit
end
end
# Send this metric only if resource utilization is greater than configured threshold
@log.info "percentage_metric_value for metric: #{metricName} for instance: #{instanceName} percentage: #{percentage_metric_value}"
@log.info "@@metric_threshold_hash for #{metricName}: #{@@metric_threshold_hash[metricName]}"
thresholdPercentage = @@metric_threshold_hash[metricName]
# Flushing telemetry here since, we return as soon as we generate the metric
flushMetricTelemetry
if percentage_metric_value >= thresholdPercentage
setThresholdExceededTelemetry(metricName)
return MdmMetricsGenerator.getContainerResourceUtilMetricRecords(record["DataItems"][0]["Timestamp"],
metricName,
percentage_metric_value,
@containerResourceDimensionHash[instanceName],
thresholdPercentage)
else
return []
end #end if block for percentage metric > configured threshold % check
else
return [] #end if block for object type check
end
else
return []
end #end if block for process incoming stream check
rescue Exception => e
@log.info "Error processing cadvisor record Exception: #{e.class} Message: #{e.message}"
ApplicationInsightsUtility.sendExceptionTelemetry(e.backtrace)
return [] #return empty array if we ran into any errors
end
end
def filterPVInsightsMetrics(record)
begin
mdmMetrics = []
record["DataItems"].each do |dataItem|
if dataItem["Name"] == Constants::PV_USED_BYTES && @metrics_to_collect_hash.key?(dataItem["Name"].downcase)
metricName = dataItem["Name"]
usage = dataItem["Value"]
capacity = dataItem["Tags"][Constants::INSIGHTSMETRICS_TAGS_PV_CAPACITY_BYTES]
if capacity != 0
percentage_metric_value = (usage * 100.0) / capacity
end
@log.info "percentage_metric_value for metric: #{metricName} percentage: #{percentage_metric_value}"
@log.info "@@metric_threshold_hash for #{metricName}: #{@@metric_threshold_hash[metricName]}"
computer = dataItem["Computer"]
resourceDimensions = dataItem["Tags"]
thresholdPercentage = @@metric_threshold_hash[metricName]
flushMetricTelemetry
if percentage_metric_value >= thresholdPercentage
setThresholdExceededTelemetry(metricName)
return MdmMetricsGenerator.getPVResourceUtilMetricRecords(dataItem["CollectionTime"],
metricName,
computer,
percentage_metric_value,
resourceDimensions,
thresholdPercentage)
else
return []
end # end if block for percentage metric > configured threshold % check
end # end if block for dataItem name check
end # end for block of looping through data items
return []
rescue Exception => e
@log.info "Error processing cadvisor insights metrics record Exception: #{e.class} Message: #{e.message}"
ApplicationInsightsUtility.sendExceptionTelemetry(e.backtrace)
return [] #return empty array if we ran into any errors
end
end
def ensure_cpu_memory_capacity_set
if @cpu_capacity != 0.0 && @memory_capacity != 0.0
@log.info "CPU And Memory Capacity are already set"
return
end
controller_type = ENV["CONTROLLER_TYPE"]
if controller_type.downcase == "replicaset"
@log.info "ensure_cpu_memory_capacity_set @cpu_capacity #{@cpu_capacity} @memory_capacity #{@memory_capacity}"
begin
resourceUri = KubernetesApiClient.getNodesResourceUri("nodes?fieldSelector=metadata.name%3D#{@@hostName}")
nodeInventory = JSON.parse(KubernetesApiClient.getKubeResourceInfo(resourceUri).body)
rescue Exception => e
@log.info "Error when getting nodeInventory from kube API. Exception: #{e.class} Message: #{e.message} "
ApplicationInsightsUtility.sendExceptionTelemetry(e.backtrace)
end
if !nodeInventory.nil?
cpu_capacity_json = KubernetesApiClient.parseNodeLimits(nodeInventory, "capacity", "cpu", "cpuCapacityNanoCores")
if !cpu_capacity_json.nil? && !cpu_capacity_json[0]["DataItems"][0]["Collections"][0]["Value"].to_s.nil?
@cpu_capacity = cpu_capacity_json[0]["DataItems"][0]["Collections"][0]["Value"]
@log.info "CPU Limit #{@cpu_capacity}"
else
@log.info "Error getting cpu_capacity"
end
memory_capacity_json = KubernetesApiClient.parseNodeLimits(nodeInventory, "capacity", "memory", "memoryCapacityBytes")
if !memory_capacity_json.nil? && !memory_capacity_json[0]["DataItems"][0]["Collections"][0]["Value"].to_s.nil?
@memory_capacity = memory_capacity_json[0]["DataItems"][0]["Collections"][0]["Value"]
@log.info "Memory Limit #{@memory_capacity}"
else
@log.info "Error getting memory_capacity"
end
end
elsif controller_type.downcase == "daemonset"
capacity_from_kubelet = KubeletUtils.get_node_capacity
# Error handling in case /metrics/cadvsior endpoint fails
if !capacity_from_kubelet.nil? && capacity_from_kubelet.length > 1
@cpu_capacity = capacity_from_kubelet[0]
@memory_capacity = capacity_from_kubelet[1]
else
# cpu_capacity and memory_capacity keep initialized value of 0.0
@log.error "Error getting capacity_from_kubelet: cpu_capacity and memory_capacity"
end
end
end
def filter_stream(tag, es)
new_es = MultiEventStream.new
begin
ensure_cpu_memory_capacity_set
# Getting container limits hash
if @process_incoming_stream
@containerCpuLimitHash, @containerMemoryLimitHash, @containerResourceDimensionHash = KubeletUtils.get_all_container_limits
end
es.each { |time, record|
filtered_records = filter(tag, time, record)
filtered_records.each { |filtered_record|
new_es.add(time, filtered_record) if filtered_record
} if filtered_records
}
rescue => e
@log.info "Error in filter_stream #{e.message}"
end
new_es
end
end
end
|
remi/rackbox
|
examples/.shared_specs/blackbox/helpful_matchers_spec.rb
|
<gh_stars>1-10
require File.dirname(__FILE__) + '/../spec_helper'
describe 'Helpful Matchers' do
it 'response.should be_success' do
request('/').should be_success
end
it 'response.should be_redirect' do
request('/redirect?to=http://www.google.com').should be_redirect
end
it 'response.should redirect_to(url)' do
request('/redirect?to=http://www.google.com').should redirect_to('http://www.google.com')
end
it 'relative redirect to should work' do
request('/relative').should be_redirect
request('/relative').should redirect_to('/i_am_relative')
end
it 'response.should have_text("")' do
request('/some_text').body.should include('how goes it?')
request('/some_text').body.should include('how goes it?')
request('/some_text').body.should_not include('how goesss it?')
request('/some_text').body.should_not include('how goesss it?')
end
it 'response.should have_tag("")' do
request('/some_html').body.should have_tag('p#this-one')
request('/some_html').body.should_not have_tag('p#thisss-one')
request('/some_html').body.should have_tag('p#bacon-one')
request('/some_html').body.should_not have_tag('p#bacon-two')
end
it 'response.should have_tag(""){ with_tag("") }' do
request('/some_html').body.should have_tag('#chunky-one') do
with_tag('b', 'chunky one')
with_tag('div')
with_tag('b', 'chunky one')
end
request('/some_html').body.should_not have_tag('b#chunky-one')
end
end
|
remi/rackbox
|
lib/rackbox/rack/content_length_fix.rb
|
<reponame>remi/rackbox
# An evil fix
#
# The actual fix
# has been pulled upstream into Rack
# but hasn't made it into the Rack gem yet, so we need this fix until the new gem is released
#
class Rack::MockRequest
class << self
alias env_for_without_content_length_fix env_for
def env_for_with_content_length_fix uri = '', opts = {}
env = env_for_without_content_length_fix uri, opts
env['CONTENT_LENGTH'] ||= env['rack.input'].length
env
end
alias env_for env_for_with_content_length_fix
end
end
|
remi/rackbox
|
lib/rackbox/app.rb
|
class RackBox
# represents a rack appliction
#
# gives us some helpers on a rack app
# like the ability to use the #request
# method on it easily
#
class App
attr_accessor :rack_app, :mock_request
def initialize rack_app
@rack_app = rack_app
reset_request
end
def reset_request
@mock_request = Rack::MockRequest.new @rack_app
end
alias reset reset_request
# sessions are sticky!
#
# to reset, @rackbox_app.reset
def request url, options = {}
RackBox.request @mock_request, url, options
end
end
end
|
remi/rackbox
|
examples/sinatra/config.ru
|
<filename>examples/sinatra/config.ru
require 'rubygems'
require 'sinatra'
set :run, false
set :environment, :production
require 'sinatra_app'
use Rack::Session::Cookie
run Sinatra::Application
|
remi/rackbox
|
examples/.shared_specs/blackbox/sticky_sessions_spec.rb
|
<reponame>remi/rackbox
require File.dirname(__FILE__) + '/../spec_helper'
describe 'Sticky Sessions' do
it 'should work with sessions' do
request('/print-session').body.should == ''
request('/print-session', :params => { :session_variable => 'chunky bacon!' }).body.should == 'chunky bacon!'
request('/print-session').body.should == 'chunky bacon!'
end
it 'should work with sessions (and sessions should be cleared between spec examples)' do
request('/print-session').body.should == ''
request('/print-session', :params => { :session_variable => 'chunky bacon!' }).body.should == 'chunky bacon!'
request('/print-session').body.should == 'chunky bacon!'
end
end
|
remi/rackbox
|
examples/rails/app/controllers/welcome_controller.rb
|
class WelcomeController < ApplicationController
def index
render :text => "You said #{ params[:say] || 'nothing' }"
end
def print_method
render :text => request.method
end
def print_session
session[:session_variable] = params[:session_variable] if params[:session_variable]
render :text => session[:session_variable].to_s
end
def redirect
redirect_to params[:to]
end
def some_text
render :text => "well hello there \n how goes it? \n does it go well?"
end
def some_html
# render template
end
def relative
redirect_to '/i_am_relative'
end
end
|
remi/rackbox
|
lib/rackbox/rack/extensions_for_rspec.rb
|
<reponame>remi/rackbox
# some more Rack extensions to help when testing
class Rack::MockResponse
# TODO checkout Rack::Response::Helpers which implements many of these!
# these methods help with RSpec specs so we can ask things like:
#
# request('/').should be_successful
# request('/').should be_redirect
# request('/').should be_error
#
def success?
self.status.to_s.start_with?'2' # 200 status codes are successful
end
def redirect?
self.status.to_s.start_with?'3' # 300 status codes are redirects
end
def client_error?
self.status.to_s.start_with?'4' # 400 status codes are client errors
end
def server_error?
self.status.to_s.start_with?'5' # 500 status codes are server errors
end
def error?
self.status.to_s.start_with?('4') || self.status.to_s.start_with?('5') # 400 & 500 status codes are errors
end
end
|
remi/rackbox
|
spec/basic_auth_spec.rb
|
require File.dirname(__FILE__) + '/spec_helper'
describe RackBox, 'basic auth' do
it 'should be able to add HTTP BASIC AUTH to a request' do
app = lambda {|env| [200, {}, "i require http basic auth"] }
app = Rack::Auth::Basic.new(app){|u,p| u == 'remi' && p == 'testing' }
RackBox.request( app, '/' ).status.should == 401
RackBox.request( app, '/' ).headers.should == { 'WWW-Authenticate' => 'Basic realm=""' }
# response = RackBox.request( app, '/', 'Authentication' => 'Basic: ^' )
response = RackBox.request( app, '/', :http_basic_authentication => %w( remi testing ) )
response.status.should == 200
response.body.should == "i require http basic auth"
# :basic_auth shortcut
response = RackBox.request( app, '/', :basic_auth => %w( remi testing ) )
response.status.should == 200
response.body.should == "i require http basic auth"
# :auth shortcut
response = RackBox.request( app, '/', :auth => %w( remi testing ) )
response.status.should == 200
response.body.should == "i require http basic auth"
end
end
|
remi/rackbox
|
spec/spec_helper.rb
|
require File.dirname(__FILE__) + '/../lib/rackbox'
|
remi/rackbox
|
spec/custom_request_header_specs.rb
|
require File.dirname(__FILE__) + '/spec_helper'
describe RackBox, 'custom request headers' do
before do
@rack_app = lambda {|env| [ 200, { }, env.inspect ] }
end
it "#request should take any non-special options and assume they're request headers" do
RackBox.request(@rack_app, '/').body.should_not include('"HTTP_ACCEPT"=>"application/json"')
RackBox.request(@rack_app, '/', 'HTTP_ACCEPT' => 'application/json').body.should include('"HTTP_ACCEPT"=>"application/json"')
end
end
|
remi/rackbox
|
examples/sinatra/sinatra_app.rb
|
<reponame>remi/rackbox
get '/' do
"You said #{ params[:say] || 'nothing' }"
end
post '/' do
"You said #{ params[:say] || 'nothing' }"
end
# can i roll these into 1?
get '/print-method' do
request.request_method.downcase
end
put '/print-method' do
request.request_method.downcase
end
post '/print-method' do
request.request_method.downcase
end
get '/print-session' do
session[:session_variable] = params[:session_variable] if params[:session_variable]
session[:session_variable].to_s
end
post '/print-session' do
session[:session_variable] = params[:session_variable] if params[:session_variable]
session[:session_variable].to_s
end
get '/redirect' do
redirect params[:to]
end
get '/relative' do
redirect '/i_am_relative'
end
get '/some_text' do
'hello there, how goes it?'
end
get '/some_html' do
haml :some_html
end
use_in_file_templates!
__END__
@@ layout
%html
%body
= yield
@@ some_html
%p#this-one
%p#bacon-one
#chunky-one
%b chunky one
%div
|
remi/rackbox
|
lib/rackbox/test.rb
|
# this should get you up and running for using RackBox with test/unit
|
remi/rackbox
|
lib/rackbox.rb
|
$:.unshift File.dirname(__FILE__)
require 'rubygems'
require 'rack'
require 'rails-rack-adapter' # update this so it's only loaded when/if needed
require 'rackbox/rack/content_length_fix'
require 'rackbox/rack/sticky_sessions'
require 'rackbox/rack/extensions_for_rspec'
require 'rackbox/rackbox'
require 'rackbox/app'
require 'rspec/custom_matcher'
require 'rackbox/matchers'
require 'rackbox/spec/helpers'
require 'rackbox/spec/configuration'
|
remi/rackbox
|
lib/rackbox/matchers.rb
|
class RackBox
# Custom RSpec matchers
module Matchers
def self.included base
# this should really just be matcher(:foo){ ... }
# but there's a bit of other meta logic to deal with here
Object.send :remove_const, :RedirectTo if defined? RedirectTo
undef redirect_to if defined? redirect_to
# the actual matcher logic
matcher(:redirect_to, base) do |response, url|
return false unless response['Location']
if url =~ /^\//
# looking for a relative match, eg. should redirect_to('/login')
relative_location = response['Location'].sub(/^https?:\/\//,'').sub(/^[^\/]*/,'')
# ^ there's probably a helper on Rack or CGI to do this
relative_location.downcase == url.downcase
else
response['Location'].downcase == url.downcase
end
end
end
end
end
|
remi/rackbox
|
lib/rackbox/rack/sticky_sessions.rb
|
<reponame>remi/rackbox<gh_stars>1-10
#
# little extension to Rack::MockRequest to track cookies
#
class Rack::MockRequest
# cookies is a hash of persistent cookies (by domain)
# that let you test cookies for your app
#
# cookies = {
# 'example.org' => {
# 'cookie-name' => 'cookie-value',
# 'chunky' => 'bacon'
# }
# }
attr_accessor :cookies
# shortcut to get cookies for a particular domain
def cookies_for domain
@cookies ||= {}
@cookies[ domain ]
end
# oh geez ... it looks like i basically copy/pasted this. there's gotta be a way to do this that's
# more resilient to Rack changes to this method. i don't like overriding the whole method!
#
def request method = "GET", uri = "", opts = { }
env = self.class.env_for(uri, opts.merge(:method => method))
unless @cookies.nil? or @cookies.empty? or @cookies[env['SERVER_NAME']].nil? or @cookies[env['SERVER_NAME']].empty?
env['HTTP_COOKIE'] = @cookies[env['SERVER_NAME']].map{ |k,v| "#{ k }=#{ v }" }.join('; ')
end
if opts[:lint]
app = Rack::Lint.new(@app)
else
app = @app
end
errors = env["rack.errors"]
response = Rack::MockResponse.new(*(app.call(env) + [errors]))
if response.original_headers['Set-Cookie']
@cookies ||= {}
@cookies[ env['SERVER_NAME'] ] ||= {}
response.original_headers['Set-Cookie'].map{ |str| /(.*); path/.match(str)[1] }.each do |cookie|
name, value = cookie.split('=').first, cookie.split('=')[1]
@cookies[ env['SERVER_NAME'] ][ name ] = value
end
end
response
end
end
|
remi/rackbox
|
lib/rackbox/spec.rb
|
<reponame>remi/rackbox<filename>lib/rackbox/spec.rb
# this should get you up and running for using RackBox with RSpec
require File.dirname(__FILE__) + '/../rackbox'
spec_configuration = nil
spec_configuration = Spec::Example if defined? Spec::Example
spec_configuration = Spec::Runner if defined? Spec::Runner
spec_configuration.configure do |config|
config.use_blackbox = true
end
|
remi/rackbox
|
examples/rack/config.ru
|
use Rack::Session::Cookie
run lambda { |env|
request = Rack::Request.new env
response = Rack::Response.new
params = request.params
session = env['rack.session']
response.body = case request.path_info
when '/'
"You said #{ params['say'] || 'nothing' }"
when '/print-method'
request.request_method.downcase
when '/print-session'
session['session_variable'] = params['session_variable'] if params['session_variable']
session['session_variable']
when '/redirect'
response.headers['Location'] = params['to']
response.status = 302 # manually set!
''
when '/relative'
response.headers['Location'] = '/i_am_relative'
response.status = 302 # manually set!
''
when '/some_text'
"hello there, how goes it?"
when '/some_html'
%q{
<html>
<head></head>
<body>
<p id="this-one"></p>
<p id="bacon-one"></p>
<div id="chunky-one">
<b>chunky one</b>
<div></div>
</div>
</body>
</html>
}
else
"DON'T KNOW HOWTO RESPOND TO PATH: #{ request.path_info }"
end.to_s
response.finish
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.