CombinedText stringlengths 4 3.42M |
|---|
Rails.application.routes.draw do
get 'static_stuff/about'
concern :publishable do
member do
post :publish
delete :unpublish
get :published
end
end
resources :stories, concerns: [:publishable] do
# see if currently subscribed
get 'subscribed'
# subscribe if not currently subscribed
post 'subscribe'
# unsubscribe if currently subscribed
delete 'unsubscribe'
get 'search', on: :collection
resources :chapters, concerns: [:publishable]
end
resources :franchises do
resources :characters
get 'stories', on: :member
get 'complete', on: :collection
resources :users, controller: :franchise_users, except: [:show, :edit, :update]
end
resources :users, only: [:index, :show] do
get 'stories', on: :member
end
devise_for :users, path: "accounts"
get '/about', to: "static_stuff#about"
root 'frontpage#index'
end
Misc fixes with routes.rb
Rails.application.routes.draw do
concern :publishable do
member do
post :publish
delete :unpublish
get :published
end
end
resources :stories, concerns: [:publishable] do
# see if currently subscribed
get 'subscribed'
# subscribe if not currently subscribed
post 'subscribe'
# unsubscribe if currently subscribed
delete 'unsubscribe'
get 'search', on: :collection
resources :chapters, concerns: [:publishable]
end
resources :franchises do
resources :characters
get 'stories', on: :member
get 'complete', on: :collection
resources :users, controller: :franchise_users, except: [:show, :edit, :update]
end
resources :users, only: [:index, :show] do
get 'stories', on: :member
end
devise_for :users, path: "accounts"
get '/about', to: "static_stuff#about"
root 'frontpage#index'
end
|
Cypress::Application.routes.draw do
root :to => "vendors#index"
#match "/delayed_job" => DelayedJobMongoidWeb, :anchor => false
devise_for :users
get '/admin' => 'admin#index'
get "/admin/index"
get "/admin/users"
post "/admin/promote"
post "/admin/demote"
post "/admin/approve"
post "/admin/disable"
post "/admin/import_bundle"
post "/admin/activate_bundle"
get "/admin/delete_bundle"
post "/admin/clear_database"
resources :vendors, :products
resources :vendors do
resources :products do
resources :product_tests do
resources :patient_population
resources :test_executions
end
end
end
resources :measures do
get 'definition'
end
resources :test_executions do
member do
get 'download'
end
end
resources :product_tests do
resources :test_executions
member do
get 'download'
post 'process_pqri'
post 'add_note'
delete 'delete_note'
post 'email'
get 'qrda_cat3'
get 'status'
get 'generate_cat1_test'
end
resources :patients
resources :measures do
member do
get 'patients'
end
end
end
resources :patients do
member do
get 'download'
end
collection do
get 'table'
get 'table_all'
get 'table_measure'
get 'download'
end
end
resources :measures do
member do
get 'patients'
end
end
get "/information/about"
get "/information/feedback"
get "/information/help"
get '/services/index'
get '/services/validate_pqri'
post '/services/validate_pqri'
match '/measures/minimal_set' => 'measures#minimal_set', via: [:post]
match '/measures/by_type' => 'measures#by_type', via: [:post]
match '/product_tests/period', :to=>'product_tests#period', :as => :period, :via=> :post
unless Rails.application.config.consider_all_requests_local
match '*not_found', to: 'errors#error_404', :via => :get
end
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => "welcome#index"
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
#match ':controller(/:action(/:id(.:format)))'
end
Added post method
Cypress::Application.routes.draw do
root :to => "vendors#index"
#match "/delayed_job" => DelayedJobMongoidWeb, :anchor => false
devise_for :users
get '/admin' => 'admin#index'
get "/admin/index"
get "/admin/users"
post "/admin/promote"
post "/admin/demote"
post "/admin/approve"
post "/admin/disable"
post "/admin/import_bundle"
post "/admin/activate_bundle"
get "/admin/delete_bundle"
post "/admin/clear_database"
resources :vendors, :products
resources :vendors do
resources :products do
resources :product_tests do
resources :patient_population
resources :test_executions
end
end
end
resources :measures do
get 'definition'
end
resources :test_executions do
member do
get 'download'
end
end
resources :product_tests do
resources :test_executions
member do
get 'download'
post 'process_pqri'
post 'add_note'
delete 'delete_note'
post 'email'
get 'qrda_cat3'
get 'status'
get 'generate_cat1_test'
end
resources :patients
resources :measures do
member do
get 'patients'
end
end
end
resources :patients do
member do
get 'download'
end
collection do
get 'table'
get 'table_all'
get 'table_measure'
get 'download'
end
end
resources :measures do
member do
get 'patients'
end
end
get "/information/about"
get "/information/feedback"
get "/information/help"
get '/services/index'
get '/services/validate_pqri'
post '/services/validate_pqri'
match '/measures/minimal_set' => 'measures#minimal_set', via: [:post]
match '/measures/by_type' => 'measures#by_type', via: [:post]
match '/product_tests/period', :to=>'product_tests#period', :as => :period, :via=> :post
unless Rails.application.config.consider_all_requests_local
match '*not_found', to: 'errors#error_404', via: [:get, :post]
end
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => "welcome#index"
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
#match ':controller(/:action(/:id(.:format)))'
end
|
Rails.application.routes.draw do
#api
#namespace :api do
# namespace :v1 do
#resources :users, only: [:index, :create, :show, :update, :destroy]
#resources :microposts, only: [:index, :create, :show, :update, :destroy]
#end
#end
match '/:resource_type/:id', to: 'api/dstutwo/fhir#read', via: :get
match '/metadata', to: 'api/dstutwo/fhir#conformance', via: :get
match '/:resource_type', to: 'api/dstutwo/fhir#search', via: :get
match '/:resource_type', to: 'api/dstutwo/fhir#create', via: :post
match '/:resource_type/:id', to: 'api/dstutwo/fhir#delete', via: :delete
match '/:resource_type/:id', to: 'api/dstutwo/fhir#update', via: :put
match '/:resource_type/:id/_history/:vid', to: 'api/dstutwo/fhir#vread', via: :get
match '/:resource_type/:id/_history', to: 'api/dstutwo/fhir#history', via: :get
match '/', to: 'api/dstutwo/fhir#splashpage', via: :get
match 'read_example', to 'api/dstutwo/fhir#read_example', via: :post
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
fixed bad route
Rails.application.routes.draw do
#api
#namespace :api do
# namespace :v1 do
#resources :users, only: [:index, :create, :show, :update, :destroy]
#resources :microposts, only: [:index, :create, :show, :update, :destroy]
#end
#end
match '/:resource_type/:id', to: 'api/dstutwo/fhir#read', via: :get
match '/metadata', to: 'api/dstutwo/fhir#conformance', via: :get
match '/:resource_type', to: 'api/dstutwo/fhir#search', via: :get
match '/:resource_type', to: 'api/dstutwo/fhir#create', via: :post
match '/:resource_type/:id', to: 'api/dstutwo/fhir#delete', via: :delete
match '/:resource_type/:id', to: 'api/dstutwo/fhir#update', via: :put
match '/:resource_type/:id/_history/:vid', to: 'api/dstutwo/fhir#vread', via: :get
match '/:resource_type/:id/_history', to: 'api/dstutwo/fhir#history', via: :get
match '/', to: 'api/dstutwo/fhir#splashpage', via: :get
match 'read_example', to: 'api/dstutwo/fhir#read_example', via: :post
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
Ifsimply::Application.routes.draw do
devise_for :users, :controllers => { :registrations => 'registrations', :sessions => 'sessions' }
root :to => 'home#index'
scope '/' do
match '/registration_notify' => 'home#registration_notify', :as => :registration_notify
match '/access_violation' => 'home#access_violation', :as => :access_violation
end
resources :clubs, :only => [ :edit, :update ] do
member do
# handle image updates
match '/change_logo' => 'clubs#change_logo', :as => :change_logo_for
match '/upload_logo' => 'clubs#upload_logo', :as => :upload_logo_for
# membership subscriptions
match '/subscribe' => 'clubs_users#new', :as => 'subscribe_to'
match '/add_member' => 'clubs_users#create', :as => 'add_member_to'
end
resource :sales_page, :only => [ :show ]
resources :courses, :only => [ :create ] do
collection do
get 'show_all'
end
end
resources :blogs, :only => [ :create ] do
collection do
get 'show_all'
end
end
end
resources :sales_pages, :only => [ :edit, :update ]
resources :courses, :only => [ :edit, :update ] do
member do
# handle image updates
match '/change_logo' => 'courses#change_logo', :as => :change_logo_for
match '/upload_logo' => 'courses#upload_logo', :as => :upload_logo_for
end
resources :lessons, :only => [ :create, :update ]
end
resources :blogs, :only => [ :edit, :update ] do
member do
# handle image updates
match '/change_image' => 'blogs#change_image', :as => :change_image_for
match '/upload_image' => 'blogs#upload_image', :as => :upload_image_for
end
end
resources :discussion_boards, :only => [ :edit, :update ] do
resources :topics, :only => [ :new, :create ]
end
resources :topics, :only => [ :show ] do
resources :posts, :only => [ :new, :create ]
end
end
Add Clubs show Route to Routing File
Update the Routing file to include a Club show route.
Ifsimply::Application.routes.draw do
devise_for :users, :controllers => { :registrations => 'registrations', :sessions => 'sessions' }
root :to => 'home#index'
scope '/' do
match '/registration_notify' => 'home#registration_notify', :as => :registration_notify
match '/access_violation' => 'home#access_violation', :as => :access_violation
end
resources :clubs, :only => [ :show, :edit, :update ] do
member do
# handle image updates
match '/change_logo' => 'clubs#change_logo', :as => :change_logo_for
match '/upload_logo' => 'clubs#upload_logo', :as => :upload_logo_for
# membership subscriptions
match '/subscribe' => 'clubs_users#new', :as => 'subscribe_to'
match '/add_member' => 'clubs_users#create', :as => 'add_member_to'
end
resource :sales_page, :only => [ :show ]
resources :courses, :only => [ :create ] do
collection do
get 'show_all'
end
end
resources :blogs, :only => [ :create ] do
collection do
get 'show_all'
end
end
end
resources :sales_pages, :only => [ :edit, :update ]
resources :courses, :only => [ :edit, :update ] do
member do
# handle image updates
match '/change_logo' => 'courses#change_logo', :as => :change_logo_for
match '/upload_logo' => 'courses#upload_logo', :as => :upload_logo_for
end
resources :lessons, :only => [ :create, :update ]
end
resources :blogs, :only => [ :edit, :update ] do
member do
# handle image updates
match '/change_image' => 'blogs#change_image', :as => :change_image_for
match '/upload_image' => 'blogs#upload_image', :as => :upload_image_for
end
end
resources :discussion_boards, :only => [ :edit, :update ] do
resources :topics, :only => [ :new, :create ]
end
resources :topics, :only => [ :show ] do
resources :posts, :only => [ :new, :create ]
end
end
|
Zahlen::Engine.routes.draw do
get '/subscription/:uuid/status', to: 'subscriptions#status', as: :zahlen_subscription_status
get '/subscription/:uuid', to: 'subscriptions#show', as: :zahlen_subscription
post '/change_plan/:uuid' to: 'subscriptions#change_plan', as: :zahlen_change_subscription_plan
mount ConektaEvent::Engine => '/webooks/'
end
Add missing comma
Zahlen::Engine.routes.draw do
get '/subscription/:uuid/status', to: 'subscriptions#status', as: :zahlen_subscription_status
get '/subscription/:uuid', to: 'subscriptions#show', as: :zahlen_subscription
post '/change_plan/:uuid', to: 'subscriptions#change_plan', as: :zahlen_change_subscription_plan
mount ConektaEvent::Engine => '/webooks/'
end
|
Rails.application.routes.draw do
resources :problems, only: [:new, :create, :show] do
post '/solutions/create', to: 'solutions#create'
end
resources :solutions, only: [] do
post '/improvements/create', to: 'improvements#create'
end
devise_for :users, controllers: { registrations: 'user'}
root to: 'problems#index'
post '/solution_upvote', to: "votes#solution_upvote"
post '/solution_downvote', to: "votes#solution_downvote"
post '/problem_upvote', to: "votes#problem_upvote"
post '/problem_downvote', to: "votes#problem_downvote"
post '/problems/:problem_id/comments/create', to: "comments#problem_create", as: "new_problems_comment"
# post '/problems/comments/:problem_id/create', to: "comments#problem_create", as: "new_problems_comment_reply"
post '/solutions/:solution_id/comments/create', to: "comments#solution_create", as: "new_solutions_comment"
# post '/problems/solutions/:problem_id/create', to: "comments#solution_create", as: "new_solutions_comment_reply"
post '/improvements/:improvement_id/comments/create', to: "comments#improvement_create", as: "new_improvements_comment"
# post '/problems/improvements/:problem_id/create', to: "comments#improvement_create", as: "new_problems_comment_reply"
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
add get and post for comments(ajax)
Rails.application.routes.draw do
resources :problems, only: [:new, :create, :show] do
post '/solutions/create', to: 'solutions#create'
end
resources :solutions, only: [] do
post '/improvements/create', to: 'improvements#create'
end
devise_for :users, controllers: { registrations: 'user'}
root to: 'problems#index'
post '/solution_upvote', to: "votes#solution_upvote"
post '/solution_downvote', to: "votes#solution_downvote"
post '/problem_upvote', to: "votes#problem_upvote"
post '/problem_downvote', to: "votes#problem_downvote"
get '/problems/comments/:problem_id/create', to: "comments#problem_comments"
post '/problems/comments/:problem_id/create', to: "comments#create", as: "new_problems_comment"
# post '/problems/comments/:problem_id/create', to: "comments#problem_create", as: "new_problems_comment_reply"
get '/solutions/comments/:solution_id/create', to: "comments#solution_comments"
post '/solutions/comments/:solution_id/create', to: "comments#create", as: "new_solutions_comment"
# post '/problems/solutions/:problem_id/create', to: "comments#solution_create", as: "new_solutions_comment_reply"
get '/improvements/comments/:improvement_id/create', to: "comments#improvement_comments"
post '/improvements/comments/:improvement_id/create', to: "comments#create", as: "new_improvements_comment"
# post '/problems/improvements/:problem_id/create', to: "comments#improvement_create", as: "new_problems_comment_reply"
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
require 'sidekiq/web'
Rails.application.routes.draw do
mount Sidekiq::Web => ENV['SIDEKIQ_WEB_MOUNT']
scope '/app' do
resources :users, param: :username, except: [:index, :destroy] do
resources :resumes do
member do
get 'delete'
get 'stats' => 'resume_stats#index'
end
end
end
get '/confirm' => 'signup_confirmations#update'
get '/reset_password' => 'password_recovery#index'
post '/reset_password' => 'password_recovery#create'
get '/new_password' => 'password_recovery#edit'
post '/new_password' => 'password_recovery#update'
get '/login' => 'sessions#new'
post '/login' => 'sessions#create'
get '/logout' => 'sessions#logout'
get '/signup' => 'users#new'
post '/signup' => 'users#create'
namespace :admin do
resources :dashboards, only: [:index]
resources :users, param: :username
root to: "dashboards#index"
end
end
scope '/pages' do
resources :support, only: [:index]
# Static pages
get 'get_started' => 'front#get_started'
get 'terms_of_service' => 'front#terms_of_service'
get 'privacy_policy' => 'front#privacy_policy'
end
get "/wallaby" => "front#wallaby"
get '/:slug' => 'publications#show', as: 'publication'
get '/:slug/access_code' => 'publications#access_code', as: 'publication_access_code'
post '/:slug/access_code' => 'publications#post_access_code', as: 'publication_post_access_code'
root 'front#index'
end
Remove wallaby route.
require 'sidekiq/web'
Rails.application.routes.draw do
mount Sidekiq::Web => ENV['SIDEKIQ_WEB_MOUNT']
scope '/app' do
resources :users, param: :username, except: [:index, :destroy] do
resources :resumes do
member do
get 'delete'
get 'stats' => 'resume_stats#index'
end
end
end
get '/confirm' => 'signup_confirmations#update'
get '/reset_password' => 'password_recovery#index'
post '/reset_password' => 'password_recovery#create'
get '/new_password' => 'password_recovery#edit'
post '/new_password' => 'password_recovery#update'
get '/login' => 'sessions#new'
post '/login' => 'sessions#create'
get '/logout' => 'sessions#logout'
get '/signup' => 'users#new'
post '/signup' => 'users#create'
namespace :admin do
resources :dashboards, only: [:index]
resources :users, param: :username
root to: "dashboards#index"
end
end
scope '/pages' do
resources :support, only: [:index]
# Static pages
get 'get_started' => 'front#get_started'
get 'terms_of_service' => 'front#terms_of_service'
get 'privacy_policy' => 'front#privacy_policy'
end
get '/:slug' => 'publications#show', as: 'publication'
get '/:slug/access_code' => 'publications#access_code', as: 'publication_access_code'
post '/:slug/access_code' => 'publications#post_access_code', as: 'publication_post_access_code'
root 'front#index'
end
|
CabooseStore::Engine.routes.draw do
# API
get '/api/products' => 'products#api_list'
get '/api/products/:id' => 'products#api_details'
get '/api/products/:id' => 'products#api_variants'
get '/api/cart' => 'cart#list'
post '/api/cart/:id' => 'cart#add'
put '/api/cart/:id' => 'cart#update'
delete '/api/cart/:id' => 'cart#remove'
# Cart
get '/cart/mobile' => 'cart#mobile'
get '/cart/items' => 'cart#list'
post '/cart/item/:id' => 'cart#add'
post '/cart/item' => 'cart#add'
put '/cart/item/:id' => 'cart#update'
delete '/cart/item/:id' => 'cart#remove'
# Checkout
get '/checkout' => 'checkout#index'
put '/checkout/address' => 'checkout#update_address'
get '/checkout/shipping' => 'checkout#shipping'
get '/checkout/shipping-rates' => 'checkout#shipping_rates'
put '/checkout/shipping-method' => 'checkout#update_shipping_method'
get '/checkout/discount' => 'checkout#discount'
post '/checkout/discount' => 'checkout#add_discount'
get '/checkout/authorize-by-gift-card' => 'checkout#authorize_by_gift_card'
get '/checkout/billing' => 'checkout#billing'
get '/checkout/relay/:order_id' => 'checkout#relay'
get '/checkout/empty' => 'checkout#empty'
get '/checkout/error' => 'checkout#error'
get '/checkout/thanks' => 'checkout#thanks'
# Products
get '/products/:id' => 'products#index', constraints: {id: /.*/}
get '/products' => 'products#index'
post '/variants/find-by-options' => 'variants#find_by_options'
get '/variants/:id/display-image' => 'variants#display_image'
get '/admin/variants/group' => 'variants#admin_group'
get '/admin/products/:id/variants/group' => 'products#admin_group_variants'
post '/admin/products/:id/variants/add' => 'products#admin_add_variants'
post '/admin/products/:id/variants/remove' => 'products#admin_remove_variants'
get '/admin/products/add-upcs' => 'products#admin_add_upcs'
get '/admin/vendors' => 'vendors#admin_index'
get '/admin/vendors/status-options' => 'vendors#status_options'
get '/admin/vendors/new' => 'vendors#admin_new'
get '/admin/vendors/:id/edit' => 'vendors#admin_edit'
post '/admin/vendors/create' => 'vendors#admin_create'
put '/admin/vendors/:id/update' => 'vendors#admin_update'
# Orders
get '/admin/orders/:id/void' => 'orders#admin_void'
get '/admin/orders/:id/refund' => 'orders#admin_refund'
post '/admin/orders/:id/resend-confirmation' => 'orders#admin_resend_confirmation'
###########################
post "/reviews/add" => "reviews#add"
get "/admin/products" => "products#admin_index"
get '/admin/products/sort' => 'products#admin_sort'
put '/admin/products/update-sort-order' => 'products#admin_update_sort_order'
put "/admin/products/update-vendor-status/:id" => "products#admin_update_vendor_status"
get "/admin/products/new" => "products#admin_new"
get "/admin/products/status-options" => "products#admin_status_options"
get "/admin/products/:id/general" => "products#admin_edit_general"
get "/admin/products/:id/description" => "products#admin_edit_description"
get "/admin/products/:id/categories" => "products#admin_edit_categories"
post "/admin/products/:id/categories" => "products#admin_add_to_category"
delete "/admin/products/:id/categories/:category_id" => "products#admin_remove_from_category"
get "/admin/products/:id/variants" => "products#admin_edit_variants"
get "/admin/products/:id/variants/json" => "products#admin_variants_json"
get "/admin/products/:id/variant-cols" => "products#admin_edit_variant_columns"
put "/admin/products/:id/variant-cols" => "products#admin_update_variant_columns"
get "/admin/products/:id/images" => "products#admin_edit_images"
post "/admin/products/:id/images" => "products#admin_add_image"
get "/admin/products/:id/collections" => "products#admin_edit_collections"
get "/admin/products/:id/seo" => "products#admin_edit_seo"
get "/admin/products/:id/options" => "products#admin_edit_options"
get "/admin/products/:id/delete" => "products#admin_delete_form"
put "/admin/products/:id" => "products#admin_update"
post "/admin/products" => "products#admin_add"
delete "/admin/products/:id" => "products#admin_delete"
put "/admin/products/:id/update-vendor" => "products#admin_update_vendor"
get "/admin/products/:product_id/variants/:variant_id/edit" => "variants#admin_edit"
get "/admin/variants/status-options" => "variants#admin_status_options"
get "/admin/variants/:variant_id/edit" => "variants#admin_edit"
put "/admin/variants/:id/attach-to-image" => "variants#admin_attach_to_image"
put "/admin/variants/:id/unattach-from-image" => "variants#admin_unattach_from_image"
put "/admin/variants/:id" => "variants#admin_update"
get "/admin/products/:id/variants/new" => "variants#admin_new"
post "/admin/products/:id/variants" => "variants#admin_add"
delete "/admin/variants/:id" => "variants#admin_delete"
get "/admin/categories" => "categories#admin_index"
get "/admin/categories/new" => "categories#admin_new"
get "/admin/categories/options" => "categories#admin_options"
get "/admin/categories/:id/edit" => "categories#admin_edit"
put "/admin/categories/:id" => "categories#admin_update"
post "/admin/categories/:id" => "categories#admin_update"
post "/admin/categories" => "categories#admin_add"
delete "/admin/categories/:id" => "categories#admin_delete"
get "/admin/product-images/:id/variant-ids" => "product_images#admin_variant_ids"
get "/admin/product-images/:id/variants" => "product_images#admin_variants"
delete "/admin/product-images/:id" => "product_images#admin_delete"
get "/variant-images/:id" => "product_images#variant_images"
get "/admin/orders" => "orders#admin_index"
get "/admin/orders/test-info" => "orders#admin_mail_test_info"
get "/admin/orders/test-gmail" => "orders#admin_mail_test_gmail"
get "/admin/orders/line-item-status-options" => "orders#admin_line_item_status_options"
get "/admin/orders/status-options" => "orders#admin_status_options"
get "/admin/orders/new" => "orders#admin_new"
get "/admin/orders/:id/capture" => "orders#capture_funds"
get "/admin/orders/:id/json" => "orders#admin_json"
get "/admin/orders/:id/print" => "orders#admin_print"
get "/admin/orders/:id/send-to-quickbooks" => "orders#admin_send_to_quickbooks"
get "/admin/orders/:id" => "orders#admin_edit"
put "/admin/orders/:id" => "orders#admin_update"
put "/admin/orders/:order_id/line-items/:id" => "orders#admin_update_line_item"
delete "/admin/orders/:id" => "orders#admin_delete"
end
Fix route error
CabooseStore::Engine.routes.draw do
# API
get '/api/products' => 'products#api_list'
get '/api/products/:id' => 'products#api_details'
get '/api/products/:id/variants' => 'products#api_variants'
get '/api/cart' => 'cart#list'
post '/api/cart/:id' => 'cart#add'
put '/api/cart/:id' => 'cart#update'
delete '/api/cart/:id' => 'cart#remove'
# Cart
get '/cart/mobile' => 'cart#mobile'
get '/cart/items' => 'cart#list'
post '/cart/item/:id' => 'cart#add'
post '/cart/item' => 'cart#add'
put '/cart/item/:id' => 'cart#update'
delete '/cart/item/:id' => 'cart#remove'
# Checkout
get '/checkout' => 'checkout#index'
put '/checkout/address' => 'checkout#update_address'
get '/checkout/shipping' => 'checkout#shipping'
get '/checkout/shipping-rates' => 'checkout#shipping_rates'
put '/checkout/shipping-method' => 'checkout#update_shipping_method'
get '/checkout/discount' => 'checkout#discount'
post '/checkout/discount' => 'checkout#add_discount'
get '/checkout/authorize-by-gift-card' => 'checkout#authorize_by_gift_card'
get '/checkout/billing' => 'checkout#billing'
get '/checkout/relay/:order_id' => 'checkout#relay'
get '/checkout/empty' => 'checkout#empty'
get '/checkout/error' => 'checkout#error'
get '/checkout/thanks' => 'checkout#thanks'
# Products
get '/products/:id' => 'products#index', constraints: {id: /.*/}
get '/products' => 'products#index'
post '/variants/find-by-options' => 'variants#find_by_options'
get '/variants/:id/display-image' => 'variants#display_image'
get '/admin/variants/group' => 'variants#admin_group'
get '/admin/products/:id/variants/group' => 'products#admin_group_variants'
post '/admin/products/:id/variants/add' => 'products#admin_add_variants'
post '/admin/products/:id/variants/remove' => 'products#admin_remove_variants'
get '/admin/products/add-upcs' => 'products#admin_add_upcs'
get '/admin/vendors' => 'vendors#admin_index'
get '/admin/vendors/status-options' => 'vendors#status_options'
get '/admin/vendors/new' => 'vendors#admin_new'
get '/admin/vendors/:id/edit' => 'vendors#admin_edit'
post '/admin/vendors/create' => 'vendors#admin_create'
put '/admin/vendors/:id/update' => 'vendors#admin_update'
# Orders
get '/admin/orders/:id/void' => 'orders#admin_void'
get '/admin/orders/:id/refund' => 'orders#admin_refund'
post '/admin/orders/:id/resend-confirmation' => 'orders#admin_resend_confirmation'
###########################
post "/reviews/add" => "reviews#add"
get "/admin/products" => "products#admin_index"
get '/admin/products/sort' => 'products#admin_sort'
put '/admin/products/update-sort-order' => 'products#admin_update_sort_order'
put "/admin/products/update-vendor-status/:id" => "products#admin_update_vendor_status"
get "/admin/products/new" => "products#admin_new"
get "/admin/products/status-options" => "products#admin_status_options"
get "/admin/products/:id/general" => "products#admin_edit_general"
get "/admin/products/:id/description" => "products#admin_edit_description"
get "/admin/products/:id/categories" => "products#admin_edit_categories"
post "/admin/products/:id/categories" => "products#admin_add_to_category"
delete "/admin/products/:id/categories/:category_id" => "products#admin_remove_from_category"
get "/admin/products/:id/variants" => "products#admin_edit_variants"
get "/admin/products/:id/variants/json" => "products#admin_variants_json"
get "/admin/products/:id/variant-cols" => "products#admin_edit_variant_columns"
put "/admin/products/:id/variant-cols" => "products#admin_update_variant_columns"
get "/admin/products/:id/images" => "products#admin_edit_images"
post "/admin/products/:id/images" => "products#admin_add_image"
get "/admin/products/:id/collections" => "products#admin_edit_collections"
get "/admin/products/:id/seo" => "products#admin_edit_seo"
get "/admin/products/:id/options" => "products#admin_edit_options"
get "/admin/products/:id/delete" => "products#admin_delete_form"
put "/admin/products/:id" => "products#admin_update"
post "/admin/products" => "products#admin_add"
delete "/admin/products/:id" => "products#admin_delete"
put "/admin/products/:id/update-vendor" => "products#admin_update_vendor"
get "/admin/products/:product_id/variants/:variant_id/edit" => "variants#admin_edit"
get "/admin/variants/status-options" => "variants#admin_status_options"
get "/admin/variants/:variant_id/edit" => "variants#admin_edit"
put "/admin/variants/:id/attach-to-image" => "variants#admin_attach_to_image"
put "/admin/variants/:id/unattach-from-image" => "variants#admin_unattach_from_image"
put "/admin/variants/:id" => "variants#admin_update"
get "/admin/products/:id/variants/new" => "variants#admin_new"
post "/admin/products/:id/variants" => "variants#admin_add"
delete "/admin/variants/:id" => "variants#admin_delete"
get "/admin/categories" => "categories#admin_index"
get "/admin/categories/new" => "categories#admin_new"
get "/admin/categories/options" => "categories#admin_options"
get "/admin/categories/:id/edit" => "categories#admin_edit"
put "/admin/categories/:id" => "categories#admin_update"
post "/admin/categories/:id" => "categories#admin_update"
post "/admin/categories" => "categories#admin_add"
delete "/admin/categories/:id" => "categories#admin_delete"
get "/admin/product-images/:id/variant-ids" => "product_images#admin_variant_ids"
get "/admin/product-images/:id/variants" => "product_images#admin_variants"
delete "/admin/product-images/:id" => "product_images#admin_delete"
get "/variant-images/:id" => "product_images#variant_images"
get "/admin/orders" => "orders#admin_index"
get "/admin/orders/test-info" => "orders#admin_mail_test_info"
get "/admin/orders/test-gmail" => "orders#admin_mail_test_gmail"
get "/admin/orders/line-item-status-options" => "orders#admin_line_item_status_options"
get "/admin/orders/status-options" => "orders#admin_status_options"
get "/admin/orders/new" => "orders#admin_new"
get "/admin/orders/:id/capture" => "orders#capture_funds"
get "/admin/orders/:id/json" => "orders#admin_json"
get "/admin/orders/:id/print" => "orders#admin_print"
get "/admin/orders/:id/send-to-quickbooks" => "orders#admin_send_to_quickbooks"
get "/admin/orders/:id" => "orders#admin_edit"
put "/admin/orders/:id" => "orders#admin_update"
put "/admin/orders/:order_id/line-items/:id" => "orders#admin_update_line_item"
delete "/admin/orders/:id" => "orders#admin_delete"
end
|
Gfw::Application.routes.draw do
mount JasmineRails::Engine => '/specs' if defined?(JasmineRails)
#legacy
# stories
get '/stories' => redirect("/keepupdated/crowdsourced-stories")
# howto
get '/howto/video' => redirect("/howto")
get '/howto/general_questions' => redirect("/howto/faqs")
get '/howto/terminology' => redirect("/howto/faqs")
get '/howto/data' => redirect("/howto/faqs")
get '/howto/web_platform' => redirect("/howto/faqs")
get '/howto/for_business' => redirect("/howto/faqs")
# about
get '/about/video' => redirect("/about")
get '/about/gfw' => redirect("/about/about-gfw")
get '/about/partners' => redirect("/about/the-gfw-partnership")
get '/about/users' => redirect("/about")
get '/about/small_grants_fund' => redirect("/getinvolved/apply-to-the-small-grants-fund")
get '/about/testers' => redirect("/about")
resources :stories
# terms
post '/accept' => 'home#accept_and_redirect'
# static
get '/data' => redirect("sources")
get '/sources' => 'static#data'
get '/sources(/:section)' => 'static#data'
# get '/keepupdated' => redirect('keepupdated/crowdsourced-stories')
get '/stayinformed' => 'static#keep'
get '/stayinformed(/:section)' => 'static#keep'
get '/getinvolved' => 'static#getinvolved'
get '/getinvolved(/:section)' => 'static#getinvolved'
get '/feedback' => 'static#feedback'
# howto
get '/howto' => 'static#howto'
get '/howto(/:section)' => 'static#howto'
# about
get '/about' => 'static#about'
get '/about(/:section)' => 'static#about'
get '/explore' => 'static#explore'
get '/notsupportedbrowser' => 'static#old', :as => 'notsupportedbrowser'
get '/terms' => 'static#terms'
get '/accept_terms' => 'static#accept_terms'
# map
get '/map' => 'map#index'
get '/map/*path' => 'map#index'
get '/map/:zoom/:lat/:lng/:iso/:maptype(/:baselayers)' => 'map#index', :lat => /[^\/]+/, :lng => /[^\/]+/
get '/map/:zoom/:lat/:lng/:iso/:maptype(/:baselayers/:sublayers)' => 'map#index', :lat => /[^\/]+/, :lng => /[^\/]+/
get '/map/:zoom/:lat/:lng/:iso(/:basemap/:baselayer)' => 'map#index', :lat => /[^\/]+/, :lng => /[^\/]+/
get '/embed/map' => 'map#embed'
get '/embed/map/*path' => 'map#embed'
get '/embed/map/:zoom/:lat/:lng/:iso/:maptype(/:baselayers)' => 'map#embed', :lat => /[^\/]+/, :lng => /[^\/]+/
get '/embed/map/:zoom/:lat/:lng/:iso/:maptype(/:baselayers/:sublayers)' => 'map#embed', :lat => /[^\/]+/, :lng => /[^\/]+/
get '/embed/map/:zoom/:lat/:lng/:iso(/:basemap/:baselayer)' => 'map#embed', :lat => /[^\/]+/, :lng => /[^\/]+/
get '/embed/map/:zoom/:lat/:lng/:iso/:basemap/:baselayer(/:filters)' => 'map#embed', :lat => /[^\/]+/, :lng => /[^\/]+/
# countries
get '/countries' => 'countries#index'
get '/country/:id' => 'countries#show', :as => 'country'
get '/country_info/:id/:box',to: redirect('/country/%{id}#%{box}')
# todo => validate id
get '/country/:id/:area_id' => 'countries#show', :as => 'country_area'
get '/countries/overview' => 'countries#overview'
# search
get '/search(/:query)(/:page)' => 'search#index'
# media
post 'media/upload' => 'media#upload'
get 'media/show' => 'media#show'
# embed
get '/embed/country/:id' => 'embed#countries_show'
get '/embed/country_info/:id/:box' => 'embed#countries_show_info'
get '/embed/country/:id/:area_id' => 'embed#countries_show'
get '/embed/countries/overview' => 'embed#countries_overview'
get '/landing' => 'landing#index'
root 'landing#index'
end
Stories: removed redirect, it crashes stories on the map
Gfw::Application.routes.draw do
mount JasmineRails::Engine => '/specs' if defined?(JasmineRails)
#legacy
# stories
# get '/stories' => redirect("/stayinformed/crowdsourced-stories")
# howto
get '/howto/video' => redirect("/howto")
get '/howto/general_questions' => redirect("/howto/faqs")
get '/howto/terminology' => redirect("/howto/faqs")
get '/howto/data' => redirect("/howto/faqs")
get '/howto/web_platform' => redirect("/howto/faqs")
get '/howto/for_business' => redirect("/howto/faqs")
# about
get '/about/video' => redirect("/about")
get '/about/gfw' => redirect("/about/about-gfw")
get '/about/partners' => redirect("/about/the-gfw-partnership")
get '/about/users' => redirect("/about")
get '/about/small_grants_fund' => redirect("/getinvolved/apply-to-the-small-grants-fund")
get '/about/testers' => redirect("/about")
resources :stories
# terms
post '/accept' => 'home#accept_and_redirect'
# static
get '/data' => redirect("sources")
get '/sources' => 'static#data'
get '/sources(/:section)' => 'static#data'
# get '/stayinformed' => redirect('stayinformed/crowdsourced-stories')
get '/stayinformed' => 'static#keep'
get '/stayinformed(/:section)' => 'static#keep'
get '/getinvolved' => 'static#getinvolved'
get '/getinvolved(/:section)' => 'static#getinvolved'
get '/feedback' => 'static#feedback'
# howto
get '/howto' => 'static#howto'
get '/howto(/:section)' => 'static#howto'
# about
get '/about' => 'static#about'
get '/about(/:section)' => 'static#about'
get '/explore' => 'static#explore'
get '/notsupportedbrowser' => 'static#old', :as => 'notsupportedbrowser'
get '/terms' => 'static#terms'
get '/accept_terms' => 'static#accept_terms'
# map
get '/map' => 'map#index'
get '/map/*path' => 'map#index'
get '/map/:zoom/:lat/:lng/:iso/:maptype(/:baselayers)' => 'map#index', :lat => /[^\/]+/, :lng => /[^\/]+/
get '/map/:zoom/:lat/:lng/:iso/:maptype(/:baselayers/:sublayers)' => 'map#index', :lat => /[^\/]+/, :lng => /[^\/]+/
get '/map/:zoom/:lat/:lng/:iso(/:basemap/:baselayer)' => 'map#index', :lat => /[^\/]+/, :lng => /[^\/]+/
get '/embed/map' => 'map#embed'
get '/embed/map/*path' => 'map#embed'
get '/embed/map/:zoom/:lat/:lng/:iso/:maptype(/:baselayers)' => 'map#embed', :lat => /[^\/]+/, :lng => /[^\/]+/
get '/embed/map/:zoom/:lat/:lng/:iso/:maptype(/:baselayers/:sublayers)' => 'map#embed', :lat => /[^\/]+/, :lng => /[^\/]+/
get '/embed/map/:zoom/:lat/:lng/:iso(/:basemap/:baselayer)' => 'map#embed', :lat => /[^\/]+/, :lng => /[^\/]+/
get '/embed/map/:zoom/:lat/:lng/:iso/:basemap/:baselayer(/:filters)' => 'map#embed', :lat => /[^\/]+/, :lng => /[^\/]+/
# countries
get '/countries' => 'countries#index'
get '/country/:id' => 'countries#show', :as => 'country'
get '/country_info/:id/:box',to: redirect('/country/%{id}#%{box}')
# todo => validate id
get '/country/:id/:area_id' => 'countries#show', :as => 'country_area'
get '/countries/overview' => 'countries#overview'
# search
get '/search(/:query)(/:page)' => 'search#index'
# media
post 'media/upload' => 'media#upload'
get 'media/show' => 'media#show'
# embed
get '/embed/country/:id' => 'embed#countries_show'
get '/embed/country_info/:id/:box' => 'embed#countries_show_info'
get '/embed/country/:id/:area_id' => 'embed#countries_show'
get '/embed/countries/overview' => 'embed#countries_overview'
get '/landing' => 'landing#index'
root 'landing#index'
end
|
ActionController::Routing::Routes.draw do |map|
map.connect '/debs/generate', :controller => 'debs', :action => 'generate'
map.connect '/debs/generate_all', :controller => 'debs', :action => 'generate_all'
map.resources :debs
map.resources :derivatives
map.resources :videos
map.connect '/categories/show_tree', :controller => 'categories', :action => 'show_tree'
map.resources :categories
map.resources :packages
map.resources :repositories
map.connect '/metapackages/save', :controller => 'metapackages', :action => 'save'
map.connect '/metapackages/immediate_conflicts', :controller => 'metapackages', :action => 'immediate_conflicts'
map.connect '/metapackages/conflicts', :controller => 'metapackages', :action => 'conflicts'
map.connect '/metapackages/rdepends', :controller => 'metapackages', :action => 'rdepends'
map.connect '/metapackage/action', :controller => 'metapackages', :action => 'action'
map.connect '/metapackage/changed', :controller => 'metapackages', :action => 'changed'
map.connect '/metapackage/migrate', :controller => 'metapackages', :action => 'migrate'
map.connect '/metapackage/finish_migrate', :controller => 'metapackages', :action => 'finish_migrate'
map.resources :metapackages
map.connect '/users/anonymous_login', :controller => 'users', :action => 'anonymous_login'
map.resources :users, :member => { :enable => :put } do |users|
users.resource :user_profile
users.resource :account
users.resources :roles
end
map.connect '/users/:distribution_id/suggestion', :controller => 'suggestion', :action => 'show'
map.connect '/users/:id/suggestion/install', :controller => 'suggestion', :action => 'install'
map.connect '/users/:id/suggestion/install_new', :controller => 'suggestion', :action => 'install_new'
map.connect '/users/:id/suggestion/install_sources', :controller => 'suggestion', :action => 'install_sources'
map.connect '/users/:id/suggestion/install_package_sources/:pid', :controller => 'suggestion', :action => 'install_package_sources'
map.connect '/users/:id/suggestion/install_bundle_sources/:mid', :controller => 'suggestion', :action => 'install_bundle_sources'
map.connect '/users/:id/suggestion/quick_install/:mid', :controller => 'suggestion', :action => 'quick_install'
map.connect '/users/:id/suggestion/shownew', :controller => 'suggestion', :action => 'shownew'
map.connect '/users/:user_id/metapackages/:id', :controller => 'users', :action => 'metapackages'
map.connect '/users/:user_id/user_profile/tabs/:id', :controller => 'user_profiles', :action => 'edit'
map.connect '/users/:user_id/user_profile/update_data', :controller => 'user_profiles', :action => 'update_data'
map.connect '/users/:user_id/user_profile/update_rating', :controller => 'user_profiles', :action => 'update_rating'
map.connect '/users/:user_id/user_profile/update_ratings', :controller => 'user_profiles', :action => 'update_ratings'
map.connect '/users/:user_id/user_profile/refine', :controller => 'user_profiles', :action => 'refine'
map.connect '/users/:user_id/user_profile/packagesProgrammieren', :controller => 'user_profiles', :action => 'refine'
map.connect '/users/:user_id/user_profile/installation', :controller => 'user_profiles', :action => 'installation'
map.connect '/users/:id/destroy', :controller => 'users', :action => 'destroy'
map.connect '/users/:id/show', :controller => 'users', :action => 'show'
map.connect '/users/:id/cart/:action/:id', :controller => 'cart'
map.resources :distributions do |dist|
dist.resources :metapackages
dist.resources :packages
dist.resources :repositories
end
map.connect '/packages/rdepends', :controller => 'packages', :action => 'rdepends'
map.connect 'packages/section', :controller => "packages", :action => "section", :method => :post
map.connect 'packages/search', :controller => "packages", :action => "search", :method => :post
map.connect 'packages/update', :controller => "packages", :action => "update", :method => :post
map.connect '/metapackages/:id/publish', :controller => "metapackages", :action => "publish", :method => :put
map.connect '/metapackages/:id/unpublish', :controller => "metapackages", :action => "unpublish", :method => :put
map.connect '/metapackages/:id/edit_packages', :controller => "metapackages", :action => "edit_packages", :method => :put
map.connect '/metapackages/:id/edit_action', :controller => 'metapackages', :action => 'edit_action'
map.resource :session
map.resource :password
map.root :controller => 'home', :action => 'home'
map.connect '/home', :controller => 'home', :action => 'home'
map.connect '/about', :controller => 'home', :action => 'about'
map.connect '/umfrage', :controller => 'home', :action => 'umfrage'
map.connect '/contact_us', :controller => 'home', :action => 'contact_us'
map.connect '/cancel', :controller => 'home', :action => 'cancel'
map.connect '/success', :controller => 'home', :action => 'success'
map.connect '/danke/:id', :controller => 'home', :action => 'danke', :method => :get
map.connect '/admin/load_packages', :controller => 'admins', :action => 'load_packages'
map.connect '/admin/sync_package/:id', :controller => 'admins', :action => 'sync_package'
map.connect '/admin/sync_all/:id', :controller => 'admins', :action => 'sync_all'
map.connect '/admin/test_all/:id', :controller => 'admins', :action => 'test_all'
map.connect '/admin/repositories', :controller => 'repositories', :action => 'new'
map.connect '/distributions', :controller => 'distributions', :action => 'index'
map.connect '/rating/rate', :controller => 'rating', :action => 'rate'
map.resources :sent, :mailbox
map.resources :messages, :member => { :reply => :get, :forward => :get }
map.activate '/activate/:id', :controller => 'accounts', :action => 'show'
map.forgot_password '/forgot_password', :controller => 'passwords', :action => 'new'
map.reset_password '/reset_password/:id', :controller => 'passwords', :action => 'edit'
map.change_password '/change_password', :controller => 'accounts', :action => 'edit'
map.signup '/signup', :controller => 'users', :action => 'new'
map.login '/login', :controller => 'sessions', :action => 'new'
map.logout '/logout', :controller => 'sessions', :action => 'destroy'
map.categories '/categories', :controller => 'categories', :action => 'new'
map.admin '/admin', :controller => 'admin'
map.inbox '/inbox', :controller => "mailbox", :action => "show"
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end
not a 404 error #544
git-svn-id: e70f47238a868777ecefe75ba01929cffb2d8127@976 d8b24053-1f83-4035-b5c3-ce8b92cd91ad
ActionController::Routing::Routes.draw do |map|
map.connect '/debs/generate', :controller => 'debs', :action => 'generate'
map.connect '/debs/generate_all', :controller => 'debs', :action => 'generate_all'
map.resources :debs
map.resources :derivatives
map.resources :videos
map.connect '/categories/show_tree', :controller => 'categories', :action => 'show_tree'
map.resources :categories
map.resources :packages
map.resources :repositories
map.connect '/metapackages/save', :controller => 'metapackages', :action => 'save'
map.connect '/metapackages/immediate_conflicts', :controller => 'metapackages', :action => 'immediate_conflicts'
map.connect '/metapackages/conflicts', :controller => 'metapackages', :action => 'conflicts'
map.connect '/metapackages/rdepends', :controller => 'metapackages', :action => 'rdepends'
map.connect '/metapackage/action', :controller => 'metapackages', :action => 'action'
map.connect '/metapackage/changed', :controller => 'metapackages', :action => 'changed'
map.connect '/metapackage/migrate', :controller => 'metapackages', :action => 'migrate'
map.connect '/metapackage/finish_migrate', :controller => 'metapackages', :action => 'finish_migrate'
map.resources :metapackages
map.connect '/users/anonymous_login', :controller => 'users', :action => 'anonymous_login'
map.resources :users, :member => { :enable => :put } do |users|
users.resource :user_profile
users.resource :account
users.resources :roles
end
map.connect '/users/:user_id/user_profile/:pack_name', :controller => 'user_profiles', :action => 'refine', :requirements => {
:pack_name => /#
\w{15,60}
/x
}
map.connect '/users/:distribution_id/suggestion', :controller => 'suggestion', :action => 'show'
map.connect '/users/:id/suggestion/install', :controller => 'suggestion', :action => 'install'
map.connect '/users/:id/suggestion/install_new', :controller => 'suggestion', :action => 'install_new'
map.connect '/users/:id/suggestion/install_sources', :controller => 'suggestion', :action => 'install_sources'
map.connect '/users/:id/suggestion/install_package_sources/:pid', :controller => 'suggestion', :action => 'install_package_sources'
map.connect '/users/:id/suggestion/install_bundle_sources/:mid', :controller => 'suggestion', :action => 'install_bundle_sources'
map.connect '/users/:id/suggestion/quick_install/:mid', :controller => 'suggestion', :action => 'quick_install'
map.connect '/users/:id/suggestion/shownew', :controller => 'suggestion', :action => 'shownew'
map.connect '/users/:user_id/metapackages/:id', :controller => 'users', :action => 'metapackages'
map.connect '/users/:user_id/user_profile/tabs/:id', :controller => 'user_profiles', :action => 'edit'
map.connect '/users/:user_id/user_profile/update_data', :controller => 'user_profiles', :action => 'update_data'
map.connect '/users/:user_id/user_profile/update_rating', :controller => 'user_profiles', :action => 'update_rating'
map.connect '/users/:user_id/user_profile/update_ratings', :controller => 'user_profiles', :action => 'update_ratings'
map.connect '/users/:user_id/user_profile/refine', :controller => 'user_profiles', :action => 'refine'
map.connect '/users/:user_id/user_profile/installation', :controller => 'user_profiles', :action => 'installation'
map.connect '/users/:id/destroy', :controller => 'users', :action => 'destroy'
map.connect '/users/:id/show', :controller => 'users', :action => 'show'
map.connect '/users/:id/cart/:action/:id', :controller => 'cart'
map.resources :distributions do |dist|
dist.resources :metapackages
dist.resources :packages
dist.resources :repositories
end
map.connect '/packages/rdepends', :controller => 'packages', :action => 'rdepends'
map.connect 'packages/section', :controller => "packages", :action => "section", :method => :post
map.connect 'packages/search', :controller => "packages", :action => "search", :method => :post
map.connect 'packages/update', :controller => "packages", :action => "update", :method => :post
map.connect '/metapackages/:id/publish', :controller => "metapackages", :action => "publish", :method => :put
map.connect '/metapackages/:id/unpublish', :controller => "metapackages", :action => "unpublish", :method => :put
map.connect '/metapackages/:id/edit_packages', :controller => "metapackages", :action => "edit_packages", :method => :put
map.connect '/metapackages/:id/edit_action', :controller => 'metapackages', :action => 'edit_action'
map.resource :session
map.resource :password
map.root :controller => 'home', :action => 'home'
map.connect '/home', :controller => 'home', :action => 'home'
map.connect '/about', :controller => 'home', :action => 'about'
map.connect '/umfrage', :controller => 'home', :action => 'umfrage'
map.connect '/contact_us', :controller => 'home', :action => 'contact_us'
map.connect '/cancel', :controller => 'home', :action => 'cancel'
map.connect '/success', :controller => 'home', :action => 'success'
map.connect '/danke/:id', :controller => 'home', :action => 'danke', :method => :get
map.connect '/admin/load_packages', :controller => 'admins', :action => 'load_packages'
map.connect '/admin/sync_package/:id', :controller => 'admins', :action => 'sync_package'
map.connect '/admin/sync_all/:id', :controller => 'admins', :action => 'sync_all'
map.connect '/admin/test_all/:id', :controller => 'admins', :action => 'test_all'
map.connect '/admin/repositories', :controller => 'repositories', :action => 'new'
map.connect '/distributions', :controller => 'distributions', :action => 'index'
map.connect '/rating/rate', :controller => 'rating', :action => 'rate'
map.resources :sent, :mailbox
map.resources :messages, :member => { :reply => :get, :forward => :get }
map.activate '/activate/:id', :controller => 'accounts', :action => 'show'
map.forgot_password '/forgot_password', :controller => 'passwords', :action => 'new'
map.reset_password '/reset_password/:id', :controller => 'passwords', :action => 'edit'
map.change_password '/change_password', :controller => 'accounts', :action => 'edit'
map.signup '/signup', :controller => 'users', :action => 'new'
map.login '/login', :controller => 'sessions', :action => 'new'
map.logout '/logout', :controller => 'sessions', :action => 'destroy'
map.categories '/categories', :controller => 'categories', :action => 'new'
map.admin '/admin', :controller => 'admin'
map.inbox '/inbox', :controller => "mailbox", :action => "show"
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end
|
SparqlBrowser::Application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
root 'resources#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
#
get 'types/:id/by/:facet_id/' => 'types#show_faceted', as: :facet
resources :resources
resources :types
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
redirect home to services
SparqlBrowser::Application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
get '/', to: redirect('/types/Service')
root 'resources#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
#
get 'types/:id/by/:facet_id/' => 'types#show_faceted', as: :facet
resources :resources
resources :types
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
ActionController::Routing::Routes.draw do |map|
map.resources :stories, :collection => { :reorder => :post }
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# map.resources :products
# Sample resource route with options:
# map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
# You can have the root of your site routed with map.root
# -- just remember to delete public/index.html.
map.root :controller => "stories"
# Allow downloading Web Service WSDL as a file with an extension instead of a file named 'wsdl'
# map.connect ':controller/service.wsdl', :action => 'wsdl'
# Install the default route as the lowest priority.
map.connect ':controller/:action/:id'
end
Removed depricated map.root route
git-svn-id: 688d3875d79a464202b418543870f1890916b750@100 b1a0fcd8-281e-0410-b946-bf040eef99c3
ActionController::Routing::Routes.draw do |map|
map.resources :stories, :collection => { :reorder => :post }
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# map.resources :products
# Sample resource route with options:
# map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
# You can have the root of your site routed with map.root
# -- just remember to delete public/index.html.
map.connect '', :controller => "stories"
# Allow downloading Web Service WSDL as a file with an extension instead of a file named 'wsdl'
# map.connect ':controller/service.wsdl', :action => 'wsdl'
# Install the default route as the lowest priority.
map.connect ':controller/:action/:id'
end
|
Crowdblog::Application.routes.draw do
devise_for :users
root to: "home#show"
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => 'welcome#index'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id))(.:format)'
end
Correct root path
Crowdblog::Application.routes.draw do
devise_for :users
root to: "posts#index"
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => 'welcome#index'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id))(.:format)'
end
|
require 'sinatra/base'
require 'webrick'
require 'webrick/https'
require 'openssl'
# 1) create own SSL certificate .crt and .key files:
# openssl req -new -x509 -nodes -out my-server.crt -keyout my-server.key
# 2) sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to me 80
# 3) sudo ipfw add 101 fwd 127.0.0.1,8443 tcp from any to me 443
# 4) add 127.0.0.1 api.trello.com to /etc/hosts
my_server_crt = File.open(File.join('./', 'my-server.crt')).read
my_server_key = File.open(File.join('./', 'my-server.key')).read
webrick_options = {
Port: 8443,
Logger: WEBrick::Log.new($stderr, WEBrick::Log::DEBUG),
DocumentRoot: '/',
SSLEnable: true,
SSLVerifyClient: OpenSSL::SSL::VERIFY_NONE,
SSLCertificate: OpenSSL::X509::Certificate.new(my_server_crt),
SSLPrivateKey: OpenSSL::PKey::RSA.new(my_server_key),
SSLCertName: [['CN', WEBrick::Utils.getservername]]
}
class Response
def self.render!(resource, collection = false)
path = File.dirname(__FILE__)
file = "/../remotes/#{resource}.json"
json = File.read(path + file)
collection ? '[' + json + ']' : json
end
end
class MyFakeTrello < Sinatra::Base
# helpers do
# def bar(name)
# return halt(400, 'Bad Request') if params['id'] == '400'
# return halt(401, 'Unauthorized') if params['id'] == '401'
# end
# end
# boards_all
get '/1/members/me/boards' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('board', true)
end
# board_by_id
get '/1/boards/:id' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('board')
end
# card_by_id
get '/1/cards/:id' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('card')
end
# list_by_id
get '/1/lists/:id' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('list')
end
# member_by_id
get '/1/members/:id' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('member')
end
# cards_by_board_id
get '/1/boards/:id/cards' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('card', true)
end
# cards_by_list_id
get '/1/lists/:id/cards' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('card', true)
end
# comments_by_board_id
get '/1/boards/:id/actions' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('comment')
end
# comments_by_card_id
get '/1/cards/:id/actions' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('comment')
end
# comments_by_list_id
get '/1/lists/:id/actions' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('comment')
end
# lists_by_board_id
get '/1/boards/:id/lists' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('list', true)
end
# members_by_board_id
get '/1/boards/:id/members' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('member', true)
end
# create_board
post '/1/boards' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('board')
end
# create_card
post '/1/cards' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('card')
end
# create_comment
post '/1/cards/:id/actions/comments' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('comment')
end
# create_list
post '/1/lists' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('list')
end
# move_card_list
put '/1/cards/:id/idList' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('card')
end
# move_card_board
put '/1/cards/:id/idBoard' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('card')
end
end
Rack::Handler::WEBrick.run MyFakeTrello, webrick_options
Add instructions for removing port forwarding.
require 'sinatra/base'
require 'webrick'
require 'webrick/https'
require 'openssl'
# 1) create own SSL certificate .crt and .key files:
# openssl req -new -x509 -nodes -out my-server.crt -keyout my-server.key
# 2) sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to me 80
# 3) sudo ipfw add 101 fwd 127.0.0.1,8443 tcp from any to me 443
# 4) add 127.0.0.1 api.trello.com to /etc/hosts
# 5) when done:
# remove entry from /etc/hosts
# sudo ipfw del 100
# sudo ipfw del 101
my_server_crt = File.open(File.join('./', 'my-server.crt')).read
my_server_key = File.open(File.join('./', 'my-server.key')).read
webrick_options = {
Port: 8443,
Logger: WEBrick::Log.new($stderr, WEBrick::Log::DEBUG),
DocumentRoot: '/',
SSLEnable: true,
SSLVerifyClient: OpenSSL::SSL::VERIFY_NONE,
SSLCertificate: OpenSSL::X509::Certificate.new(my_server_crt),
SSLPrivateKey: OpenSSL::PKey::RSA.new(my_server_key),
SSLCertName: [['CN', WEBrick::Utils.getservername]]
}
class Response
def self.render!(resource, collection = false)
path = File.dirname(__FILE__)
file = "/../remotes/#{resource}.json"
json = File.read(path + file)
collection ? '[' + json + ']' : json
end
end
class MyFakeTrello < Sinatra::Base
# helpers do
# def bar(name)
# return halt(400, 'Bad Request') if params['id'] == '400'
# return halt(401, 'Unauthorized') if params['id'] == '401'
# end
# end
# boards_all
get '/1/members/me/boards' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('board', true)
end
# board_by_id
get '/1/boards/:id' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('board')
end
# card_by_id
get '/1/cards/:id' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('card')
end
# list_by_id
get '/1/lists/:id' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('list')
end
# member_by_id
get '/1/members/:id' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('member')
end
# cards_by_board_id
get '/1/boards/:id/cards' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('card', true)
end
# cards_by_list_id
get '/1/lists/:id/cards' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('card', true)
end
# comments_by_board_id
get '/1/boards/:id/actions' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('comment')
end
# comments_by_card_id
get '/1/cards/:id/actions' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('comment')
end
# comments_by_list_id
get '/1/lists/:id/actions' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('comment')
end
# lists_by_board_id
get '/1/boards/:id/lists' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('list', true)
end
# members_by_board_id
get '/1/boards/:id/members' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('member', true)
end
# create_board
post '/1/boards' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('board')
end
# create_card
post '/1/cards' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('card')
end
# create_comment
post '/1/cards/:id/actions/comments' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('comment')
end
# create_list
post '/1/lists' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('list')
end
# move_card_list
put '/1/cards/:id/idList' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('card')
end
# move_card_board
put '/1/cards/:id/idBoard' do
halt(400, 'Bad Request') if params['id'] == '400'
halt(401, 'Unauthorized') if params['id'] == '401'
Response.render!('card')
end
end
Rack::Handler::WEBrick.run MyFakeTrello, webrick_options
|
require 'cinch'
require_relative '../utils/utils.rb'
def reduce_string str
str.downcase.gsub(/\s+/, "")
end
class ASBNaturePlugin
include Cinch::Plugin
match /^(!|@)asbnature (\w+) ?(.*)?/i, method: :asbnature
match /^(!|@)findnature (.+)[ ]+(.+)/i, method: :findnature
def asbnature(m, msgtype, nature, moodycheck)
$naturesheet.rows.each do |row|
if BotUtils.condense_name(row[0]) == BotUtils.condense_name(nature)
if moodycheck == 'moody'
BotUtils.msgtype_reply(m, msgtype, "#{row[0]}: #{ row[2].gsub(/[\(\)]/, '') } with Moody activated.")
else
BotUtils.msgtype_reply(m, msgtype, "#{row[0]}: #{ row[1].gsub(/[\(\)]/, '') }")
end
return
end
end
BotUtils.msgtype_reply(m, msgtype, "Nature not found.")
end
def findnature(m, msgtype, boost1, boost2)
$naturesheet.rows.each do |row|
message = reduce_string(row[1]).gsub('speed÷', '-speed').gsub('%speed', '+speed')
if message.include?(reduce_string(boost1)) && message.include?(reduce_string(boost2))
BotUtils.msgtype_reply(m, msgtype, "The corresponding nature is #{row[0].strip}.")
return
end
end
BotUtils.msgtype_reply(m, msgtype, "Nature not found.")
end
end
fix findnature
require 'cinch'
require_relative '../utils/utils.rb'
def reduce_string str
str.downcase.gsub(/\s+/, "").gsub(/\d+/, "")
end
class ASBNaturePlugin
include Cinch::Plugin
match /^(!|@)asbnature (\w+) ?(.*)?/i, method: :asbnature
match /^(!|@)findnature (.+)[ ]+(.+)/i, method: :findnature
def asbnature(m, msgtype, nature, moodycheck)
$naturesheet.rows.each do |row|
if BotUtils.condense_name(row[0]) == BotUtils.condense_name(nature)
if moodycheck == 'moody'
BotUtils.msgtype_reply(m, msgtype, "#{row[0]}: #{ row[2].gsub(/[\(\)]/, '') } with Moody activated.")
else
BotUtils.msgtype_reply(m, msgtype, "#{row[0]}: #{ row[1].gsub(/[\(\)]/, '') }")
end
return
end
end
BotUtils.msgtype_reply(m, msgtype, "Nature not found.")
end
def findnature(m, msgtype, boost1, boost2)
$naturesheet.rows.each do |row|
message = reduce_string(row[1]).gsub('speed÷', '-speed').gsub('%speed', '+speed')
if message.include?(reduce_string(boost1)) && message.include?(reduce_string(boost2))
BotUtils.msgtype_reply(m, msgtype, "The corresponding nature is #{row[0].strip}.")
return
end
end
BotUtils.msgtype_reply(m, msgtype, "Nature not found.")
end
end
|
# -*- encoding : utf-8 -*-
require 'helper'
class RedisModelTest < Test::Unit::TestCase
context "RedisModel" do
setup do
RedisModelExtension::Database.redis.flushdb
class TestRedisModel
include RedisModel
redis_field :integer, :integer
redis_field :boolean, :bool
redis_field :string, :string
redis_field :symbol, :symbol
redis_field :array, :array
redis_field :hash, :hash
redis_field :time, :time
redis_field :date, :date
redis_validate :integer, :string
redis_key :string
redis_alias :token, [:symbol]
end
@time = Time.now
@args = {
"integer" => 12345,
:string => "foo",
:symbol => :bar,
:boolean => true,
:array => [1,2,3],
:hash => {"foo"=>"bar", "test" => 2},
:time => @time,
:date => Date.today
}
@test_model = TestRedisModel.new(@args)
@test_model_partial = TestRedisModel.new(:integer => 12345, :string => "foo")
end
context "define methods" do
should "be accessible" do
assert @test_model.respond_to?(:integer)
assert @test_model.respond_to?(:boolean)
assert @test_model.respond_to?(:string)
assert @test_model.respond_to?(:symbol)
end
should "get valid arguments" do
assert_equal @test_model.integer, 12345
assert_equal @test_model.string, "foo"
assert_equal @test_model.symbol, :bar
assert_equal @test_model.boolean, true
assert_equal @test_model.array, [1,2,3]
assert_equal @test_model.hash, {"foo"=>"bar", "test" => 2}
assert_equal @test_model.time, @time
assert_equal @test_model.date, Date.today
end
should "return valid exists?" do
assert_equal @test_model.integer?, true
assert_equal @test_model.string?, true
assert_equal @test_model.symbol?, true
assert_equal @test_model.boolean?, true
assert_equal @test_model.array?, true
assert_equal @test_model.hash?, true
assert_equal @test_model.time?, true
assert_equal @test_model.date?, true
assert_equal @test_model_partial.integer?, true
assert_equal @test_model_partial.string?, true
assert_equal @test_model_partial.symbol?, false
assert_equal @test_model_partial.boolean?, false
assert_equal @test_model_partial.hash?, false
assert_equal @test_model_partial.array?, false
assert_equal @test_model_partial.time?, false
assert_equal @test_model_partial.date?, false
end
should "be assign new values" do
@test_model.integer = 54321
@test_model.string = "bar"
@test_model.symbol = :foo
@test_model.boolean = false
@test_model.array = [4,5,6]
@test_model.hash = {"bar" => "foo"}
@test_model.time = @time-100
@test_model.date = Date.today-10
assert_equal @test_model.integer, 54321
assert_equal @test_model.string, "bar"
assert_equal @test_model.symbol, :foo
assert_equal @test_model.boolean, false
assert_equal @test_model.array, [4,5,6]
assert_equal @test_model.hash, {"bar" => "foo"}
assert_equal @test_model.time, @time-100
assert_equal @test_model.date, Date.today-10
end
end
context "redis key" do
should "generate right key" do
assert_equal @test_model.redis_key, "#{TestRedisModel.to_s.underscore}:key:foo"
assert_equal TestRedisModel.generate_key(@args), "#{TestRedisModel.to_s.underscore}:key:foo"
end
should "generate right key alias" do
assert_equal @test_model.redis_alias_key(:token), "#{TestRedisModel.to_s.underscore}:alias:token:bar"
assert_equal TestRedisModel.generate_alias_key(:token, @args), "#{TestRedisModel.to_s.underscore}:alias:token:bar"
end
end
context "after initialize" do
should "clear input arguments" do
test_model = TestRedisModel.new(@args.merge({:foor => :bar, :not_in_fields => "foo"}))
assert_same_elements test_model.args, @args.symbolize_keys
end
end
context "validation" do
should "return errors after valid?" do
test = TestRedisModel.new()
assert !test.valid?, "shouldn't be valid"
assert_equal test.errors.size, 2, "should have 2 errors (2 required fields)"
end
should "be able to add custom error (ex. in initialize)" do
test = TestRedisModel.new()
test.error << "my custom error"
assert !test.valid?, "shouldn't be valid"
assert_equal test.errors.size, 3, "should have 3 errors (2 required fields + 1 custom error)"
assert_equal test.error.size, test.errors.size, "error and errors should be same (only as backup)"
end
should "not raise exeption on invalid initialize" do
assert_nothing_raised { TestRedisModel.new() }
end
should "raise exeption on save" do
test_model = TestRedisModel.new()
assert_raises ArgumentError do
test_model.save
end
end
end
context "updating" do
setup do
@new_args = {:integer => 123457, :string => "bar", :symbol => :foo, :boolean => false}
end
should "change attributes" do
@test_model.update @new_args
assert_equal @test_model.integer, @new_args[:integer]
assert_equal @test_model.string, @new_args[:string]
assert_equal @test_model.symbol, @new_args[:symbol]
assert_equal @test_model.boolean, @new_args[:boolean]
end
should "ignore unknown attributes and other normaly update" do
@test_model.update @new_args.merge(:unknown => "attribute")
assert_equal @test_model.integer, @new_args[:integer]
assert_equal @test_model.string, @new_args[:string]
assert_equal @test_model.symbol, @new_args[:symbol]
assert_equal @test_model.boolean, @new_args[:boolean]
end
end
context "saving" do
setup do
@test_model.save
end
should "be saved and then change of variable included in key should rename it in redis!" do
assert_equal RedisModelExtension::Database.redis.keys("*").size, 2 #including key and alias
@test_model.string = "change_of_strging"
@test_model.save
assert_equal RedisModelExtension::Database.redis.keys("*").size, 2 #including key and alias
end
should "have same elements after get" do
@getted_model = TestRedisModel.get(@args)
assert_equal @getted_model.integer, @test_model.integer
assert_equal @getted_model.string, @test_model.string
assert_equal @getted_model.symbol, @test_model.symbol
assert_equal @getted_model.boolean, @test_model.boolean
end
should "have same elements after get and to_arg" do
@getted_model = TestRedisModel.get(@args)
assert_same_elements @getted_model.to_arg.keys, @args.keys
assert_equal @getted_model.to_arg.values.collect{|a| a.to_s}.sort.join(","), @args.values.collect{|a| a.to_s}.sort.join(",")
end
context "alias" do
should "be getted by alias" do
@getted_model = TestRedisModel.get_by_alias(:token ,@args)
assert_equal @getted_model.integer, @test_model.integer
assert_equal @getted_model.string, @test_model.string
assert_equal @getted_model.symbol, @test_model.symbol
assert_equal @getted_model.boolean, @test_model.boolean
end
should "be getted after change in alias" do
getted_model = TestRedisModel.get_by_alias(:token ,@args)
getted_model.symbol = "Test_token"
getted_model.save
assert_equal getted_model.integer, TestRedisModel.get_by_alias(:token ,:symbol => "Test_token").integer
end
end
end
context "without rejected nil values on save" do
should "save nil values" do
class NilTestRedisModel
REDIS_MODEL_CONF = {
:fields => {
:integer => :to_i,
:string => :to_s,
},
:required => [:string],
:redis_key => [:string],
:redis_aliases => {},
:reject_nil_values => false
}
include RedisModel
initialize_redis_model_methods REDIS_MODEL_CONF
end
args = {integer: 100, string: "test"}
nil_test_model = NilTestRedisModel.new(args)
#on initialize
assert_equal nil_test_model.integer, 100
assert_equal nil_test_model.string, "test"
nil_test_model.save
#after find
founded = NilTestRedisModel.get(args)
assert_equal founded.integer, 100
assert_equal founded.string, "test"
#set integer to nil
founded.integer = nil
assert_equal founded.integer, nil
#perform save
founded.save
#after second find
founded = NilTestRedisModel.get(args)
assert_equal founded.integer, nil
assert_equal founded.string, "test"
end
end
end
end
[ADD] Test for default value
# -*- encoding : utf-8 -*-
require 'helper'
class RedisModelTest < Test::Unit::TestCase
context "RedisModel" do
setup do
RedisModelExtension::Database.redis.flushdb
class TestRedisModel
include RedisModel
redis_field :integer, :integer
redis_field :boolean, :bool
redis_field :string, :string
redis_field :symbol, :symbol, :default
redis_field :array, :array
redis_field :hash, :hash
redis_field :time, :time
redis_field :date, :date
redis_validate :integer, :string
redis_key :string
redis_alias :token, [:symbol]
end
@time = Time.now
@args = {
"integer" => 12345,
:string => "foo",
:symbol => :bar,
:boolean => true,
:array => [1,2,3],
:hash => {"foo"=>"bar", "test" => 2},
:time => @time,
:date => Date.today
}
@test_model = TestRedisModel.new(@args)
@test_model_partial = TestRedisModel.new(:integer => 12345, :string => "foo")
end
context "define methods" do
should "be accessible" do
assert @test_model.respond_to?(:integer)
assert @test_model.respond_to?(:boolean)
assert @test_model.respond_to?(:string)
assert @test_model.respond_to?(:symbol)
end
should "get valid arguments" do
assert_equal @test_model.integer, 12345
assert_equal @test_model.string, "foo"
assert_equal @test_model.symbol, :bar
assert_equal @test_model.boolean, true
assert_equal @test_model.array, [1,2,3]
assert_equal @test_model.hash, {"foo"=>"bar", "test" => 2}
assert_equal @test_model.time, @time
assert_equal @test_model.date, Date.today
end
should "return default value when value is nil" do
assert_equal @test_model_partial.symbol, :default
end
should "return valid exists?" do
assert_equal @test_model.integer?, true
assert_equal @test_model.string?, true
assert_equal @test_model.symbol?, true
assert_equal @test_model.boolean?, true
assert_equal @test_model.array?, true
assert_equal @test_model.hash?, true
assert_equal @test_model.time?, true
assert_equal @test_model.date?, true
assert_equal @test_model_partial.integer?, true
assert_equal @test_model_partial.string?, true
assert_equal @test_model_partial.symbol?, true, "should be set by default value"
assert_equal @test_model_partial.boolean?, false
assert_equal @test_model_partial.hash?, false
assert_equal @test_model_partial.array?, false
assert_equal @test_model_partial.time?, false
assert_equal @test_model_partial.date?, false
end
should "be assign new values" do
@test_model.integer = 54321
@test_model.string = "bar"
@test_model.symbol = :foo
@test_model.boolean = false
@test_model.array = [4,5,6]
@test_model.hash = {"bar" => "foo"}
@test_model.time = @time-100
@test_model.date = Date.today-10
assert_equal @test_model.integer, 54321
assert_equal @test_model.string, "bar"
assert_equal @test_model.symbol, :foo
assert_equal @test_model.boolean, false
assert_equal @test_model.array, [4,5,6]
assert_equal @test_model.hash, {"bar" => "foo"}
assert_equal @test_model.time, @time-100
assert_equal @test_model.date, Date.today-10
end
end
context "redis key" do
should "generate right key" do
assert_equal @test_model.redis_key, "#{TestRedisModel.to_s.underscore}:key:foo"
assert_equal TestRedisModel.generate_key(@args), "#{TestRedisModel.to_s.underscore}:key:foo"
end
should "generate right key alias" do
assert_equal @test_model.redis_alias_key(:token), "#{TestRedisModel.to_s.underscore}:alias:token:bar"
assert_equal TestRedisModel.generate_alias_key(:token, @args), "#{TestRedisModel.to_s.underscore}:alias:token:bar"
end
end
context "after initialize" do
should "clear input arguments" do
test_model = TestRedisModel.new(@args.merge({:foor => :bar, :not_in_fields => "foo"}))
assert_same_elements test_model.args, @args.symbolize_keys
end
end
context "validation" do
should "return errors after valid?" do
test = TestRedisModel.new()
assert !test.valid?, "shouldn't be valid"
assert_equal test.errors.size, 2, "should have 2 errors (2 required fields)"
end
should "be able to add custom error (ex. in initialize)" do
test = TestRedisModel.new()
test.error << "my custom error"
assert !test.valid?, "shouldn't be valid"
assert_equal test.errors.size, 3, "should have 3 errors (2 required fields + 1 custom error)"
assert_equal test.error.size, test.errors.size, "error and errors should be same (only as backup)"
end
should "not raise exeption on invalid initialize" do
assert_nothing_raised { TestRedisModel.new() }
end
should "raise exeption on save" do
test_model = TestRedisModel.new()
assert_raises ArgumentError do
test_model.save
end
end
end
context "updating" do
setup do
@new_args = {:integer => 123457, :string => "bar", :symbol => :foo, :boolean => false}
end
should "change attributes" do
@test_model.update @new_args
assert_equal @test_model.integer, @new_args[:integer]
assert_equal @test_model.string, @new_args[:string]
assert_equal @test_model.symbol, @new_args[:symbol]
assert_equal @test_model.boolean, @new_args[:boolean]
end
should "ignore unknown attributes and other normaly update" do
@test_model.update @new_args.merge(:unknown => "attribute")
assert_equal @test_model.integer, @new_args[:integer]
assert_equal @test_model.string, @new_args[:string]
assert_equal @test_model.symbol, @new_args[:symbol]
assert_equal @test_model.boolean, @new_args[:boolean]
end
end
context "saving" do
setup do
@test_model.save
end
should "be saved and then change of variable included in key should rename it in redis!" do
assert_equal RedisModelExtension::Database.redis.keys("*").size, 2 #including key and alias
@test_model.string = "change_of_strging"
@test_model.save
assert_equal RedisModelExtension::Database.redis.keys("*").size, 2 #including key and alias
end
should "have same elements after get" do
@getted_model = TestRedisModel.get(@args)
assert_equal @getted_model.integer, @test_model.integer
assert_equal @getted_model.string, @test_model.string
assert_equal @getted_model.symbol, @test_model.symbol
assert_equal @getted_model.boolean, @test_model.boolean
end
should "have same elements after get and to_arg" do
@getted_model = TestRedisModel.get(@args)
assert_same_elements @getted_model.to_arg.keys, @args.keys
assert_equal @getted_model.to_arg.values.collect{|a| a.to_s}.sort.join(","), @args.values.collect{|a| a.to_s}.sort.join(",")
end
context "alias" do
should "be getted by alias" do
@getted_model = TestRedisModel.get_by_alias(:token ,@args)
assert_equal @getted_model.integer, @test_model.integer
assert_equal @getted_model.string, @test_model.string
assert_equal @getted_model.symbol, @test_model.symbol
assert_equal @getted_model.boolean, @test_model.boolean
end
should "be getted after change in alias" do
getted_model = TestRedisModel.get_by_alias(:token ,@args)
getted_model.symbol = "Test_token"
getted_model.save
assert_equal getted_model.integer, TestRedisModel.get_by_alias(:token ,:symbol => "Test_token").integer
end
end
end
context "without rejected nil values on save" do
should "save nil values" do
class NilTestRedisModel
REDIS_MODEL_CONF = {
:fields => {
:integer => :to_i,
:string => :to_s,
},
:required => [:string],
:redis_key => [:string],
:redis_aliases => {},
:reject_nil_values => false
}
include RedisModel
initialize_redis_model_methods REDIS_MODEL_CONF
end
args = {integer: 100, string: "test"}
nil_test_model = NilTestRedisModel.new(args)
#on initialize
assert_equal nil_test_model.integer, 100
assert_equal nil_test_model.string, "test"
nil_test_model.save
#after find
founded = NilTestRedisModel.get(args)
assert_equal founded.integer, 100
assert_equal founded.string, "test"
#set integer to nil
founded.integer = nil
assert_equal founded.integer, nil
#perform save
founded.save
#after second find
founded = NilTestRedisModel.get(args)
assert_equal founded.integer, nil
assert_equal founded.string, "test"
end
end
end
end |
require File.dirname(__FILE__) + '/test_helper'
class ArchiveUnpackerTest < Test::Unit::TestCase
include SproutTestCase
def setup
super
fixture = File.join fixtures, 'archive_unpacker'
@zip_file = File.join fixture, 'zip', 'some_file.zip'
@zip_folder = File.join fixture, 'zip', 'some folder.zip'
@tgz_file = File.join fixture, 'tgz', 'some_file.tgz'
@tgz_folder = File.join fixture, 'tgz', 'some folder.tgz'
@exe_file = File.join fixture, 'copyable', 'some_file.exe'
@swc_file = File.join fixture, 'copyable', 'some_file.swc'
@rb_file = File.join fixture, 'copyable', 'some_file.rb'
@file_name = 'some_file.rb'
@unpacker = Sprout::ArchiveUnpacker.new
end
context "an archive unpacker" do
should "be identified as zip" do
assert @unpacker.is_zip?("foo.zip"), "zip"
assert !@unpacker.is_zip?("foo"), "not zip"
end
should "be identified as tgz" do
assert @unpacker.is_tgz?("foo.tgz"), "tgz"
assert !@unpacker.is_tgz?("foo"), "not tgz"
end
should "raise on unknown file types" do
assert_raises Sprout::Errors::UnknownArchiveType do
@unpacker.unpack 'SomeUnknowFileType', temp_path
end
end
['exe', 'swc', 'rb'].each do |format|
should "copy #{format} files" do
file = eval("@#{format}_file")
assert @unpacker.unpack file, temp_path
assert_file File.join(temp_path, File.basename(file))
end
end
['zip', 'tgz'].each do |format|
context "with a #{format} archive" do
setup do
@archive_file = eval("@#{format.gsub(/\./, '')}_file")
@archive_folder = eval("@#{format.gsub(/\./, '')}_folder")
end
should "fail with missing file" do
assert_raises Sprout::Errors::ArchiveUnpackerError do
@unpacker.unpack "SomeUnknownFile.#{format}", temp_path
end
end
should "fail with missing destination" do
assert_raises Sprout::Errors::ArchiveUnpackerError do
@unpacker.unpack @archive_file, "SomeInvalidDestination"
end
end
should "unpack a single archive" do
expected_file = File.join temp_path, @file_name
@unpacker.unpack @archive_file, temp_path
assert_file expected_file
assert_matches /hello world/, File.read(expected_file)
end
should "clobber existing files if necessary" do
expected_file = File.join temp_path, @file_name
FileUtils.touch expected_file
@unpacker.unpack @archive_file, temp_path, nil, :clobber
assert_file expected_file
assert_matches /hello world/, File.read(expected_file)
end
should "not clobber if not told to do so" do
expected_file = File.join temp_path, @file_name
FileUtils.touch expected_file
assert_raises Sprout::Errors::DestinationExistsError do
@unpacker.unpack @archive_file, temp_path, nil, :no_clobber
end
end
should "unpack a nested archive" do
expected_file = File.join temp_path, 'some folder', 'child folder', 'child child folder', @file_name
@unpacker.unpack @archive_folder, temp_path
assert_file expected_file
assert_matches /hello world/, File.read(expected_file)
end
end
end
end
end
Added failure to test hudson
require File.dirname(__FILE__) + '/test_helper'
class ArchiveUnpackerTest < Test::Unit::TestCase
include SproutTestCase
def setup
super
fixture = File.join fixtures, 'archive_unpacker'
@zip_file = File.join fixture, 'zip', 'some_file.zip'
@zip_folder = File.join fixture, 'zip', 'some folder.zip'
@tgz_file = File.join fixture, 'tgz', 'some_file.tgz'
@tgz_folder = File.join fixture, 'tgz', 'some folder.tgz'
@exe_file = File.join fixture, 'copyable', 'some_file.exe'
@swc_file = File.join fixture, 'copyable', 'some_file.swc'
@rb_file = File.join fixture, 'copyable', 'some_file.rb'
@file_name = 'some_file.rb'
@unpacker = Sprout::ArchiveUnpacker.new
end
context "an archive unpacker" do
should "fail to test hudson" do
fail "forced a failure"
end
should "be identified as zip" do
assert @unpacker.is_zip?("foo.zip"), "zip"
assert !@unpacker.is_zip?("foo"), "not zip"
end
should "be identified as tgz" do
assert @unpacker.is_tgz?("foo.tgz"), "tgz"
assert !@unpacker.is_tgz?("foo"), "not tgz"
end
should "raise on unknown file types" do
assert_raises Sprout::Errors::UnknownArchiveType do
@unpacker.unpack 'SomeUnknowFileType', temp_path
end
end
['exe', 'swc', 'rb'].each do |format|
should "copy #{format} files" do
file = eval("@#{format}_file")
assert @unpacker.unpack file, temp_path
assert_file File.join(temp_path, File.basename(file))
end
end
['zip', 'tgz'].each do |format|
context "with a #{format} archive" do
setup do
@archive_file = eval("@#{format.gsub(/\./, '')}_file")
@archive_folder = eval("@#{format.gsub(/\./, '')}_folder")
end
should "fail with missing file" do
assert_raises Sprout::Errors::ArchiveUnpackerError do
@unpacker.unpack "SomeUnknownFile.#{format}", temp_path
end
end
should "fail with missing destination" do
assert_raises Sprout::Errors::ArchiveUnpackerError do
@unpacker.unpack @archive_file, "SomeInvalidDestination"
end
end
should "unpack a single archive" do
expected_file = File.join temp_path, @file_name
@unpacker.unpack @archive_file, temp_path
assert_file expected_file
assert_matches /hello world/, File.read(expected_file)
end
should "clobber existing files if necessary" do
expected_file = File.join temp_path, @file_name
FileUtils.touch expected_file
@unpacker.unpack @archive_file, temp_path, nil, :clobber
assert_file expected_file
assert_matches /hello world/, File.read(expected_file)
end
should "not clobber if not told to do so" do
expected_file = File.join temp_path, @file_name
FileUtils.touch expected_file
assert_raises Sprout::Errors::DestinationExistsError do
@unpacker.unpack @archive_file, temp_path, nil, :no_clobber
end
end
should "unpack a nested archive" do
expected_file = File.join temp_path, 'some folder', 'child folder', 'child child folder', @file_name
@unpacker.unpack @archive_folder, temp_path
assert_file expected_file
assert_matches /hello world/, File.read(expected_file)
end
end
end
end
end
|
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
#
# Copyright(C) 2010-2012 Brazil
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1 as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
$KCODE = 'u'
CUSTOM_RULE_PATH = 'nfkc-custom-rules.txt'
def gen_bc(file, hash, level)
bl = ' ' * (level * 2)
h2 = {}
hash.each{|key,val|
head = key[0]
rest = key[1..-1]
if h2[head]
h2[head][rest] = val
else
h2[head] = {rest => val}
end
}
if h2.size < 3
h2.keys.sort.each{|k|
if (0x80 < k)
file.printf("#{bl}if (str[#{level}] < 0x%02X) { return #{$lv}; }\n", k)
end
h = h2[k]
if h.keys.join =~ /^\x80*$/
$lv, = h.values
else
file.printf("#{bl}if (str[#{level}] == 0x%02X) {\n", k)
gen_bc(file, h, level + 1)
file.puts bl + '}'
end
}
file.puts bl + "return #{$lv};"
else
file.puts bl + "switch (str[#{level}]) {"
lk = 0x80
br = true
h2.keys.sort.each{|k|
if (lk < k)
for j in lk..k-1
file.printf("#{bl}case 0x%02X :\n", j)
end
br = false
end
unless br
file.puts bl + " return #{$lv};"
file.puts bl + ' break;'
end
h = h2[k]
file.printf("#{bl}case 0x%02X :\n", k)
if h.keys.join =~ /^\x80*$/
$lv, = h.values
br = false
else
gen_bc(file, h, level + 1)
file.puts bl + ' break;'
br = true
end
lk = k + 1
}
file.puts bl + 'default :'
file.puts bl + " return #{$lv};"
file.puts bl + ' break;'
file.puts bl + '}'
end
end
def generate_blockcode_ctype(file, option)
bc = {}
open("|./icudump --#{option}").each{|l|
src,_,code = l.chomp.split("\t")
str = src.split(':').collect{|c| format("%c", c.hex)}.join
bc[str] = code
}
$lv = 0
gen_bc(file, bc, 0)
end
def ccpush(hash, src, dst)
head = src.shift
hash[head] = {} unless hash[head]
if head
ccpush(hash[head], src, dst)
else
hash[head] = dst
end
end
def subst(hash, str)
cand = nil
src = str.split(//)
for i in 0..src.size-1
h = hash
for j in i..src.size-1
head = src[j]
h = h[head]
break unless h
if h[nil]
cand = src[0,i].to_s + h[nil] + src[j + 1..-1].to_s
end
end
return cand if cand
end
return str
end
def map_entry(map1, cc, src, dst)
dst.downcase! unless $case_sensitive
loop {
dst2 = subst(cc, dst)
break if dst2 == dst
dst = dst2
}
unless $keep_space
dst = $1 if dst =~ /^ +([^ ].*)$/
end
map1[src] = dst if src != dst
end
def create_map1()
cc = {}
open('|./icudump --cc').each{|l|
_,src,dst = l.chomp.split("\t")
if cc[src]
STDERR.puts "caution: ambiguous mapping #{src}|#{cc[src]}|#{dst}" if cc[src] != dst
end
ccpush(cc, src.split(//), dst)
}
map1 = {}
open('|./icudump --nfkd').each{|l|
n,src,dst = l.chomp.split("\t")
map_entry(map1, cc, src, dst)
}
if File.readable?(CUSTOM_RULE_PATH)
open(CUSTOM_RULE_PATH).each{|l|
src,dst = l.chomp.split("\t")
map_entry(map1, cc, src, dst)
}
end
unless $case_sensitive
for c in 'A'..'Z'
map1[c] = c.downcase
end
end
return map1
end
def create_map2(map1)
cc = {}
open('|./icudump --cc').each{|l|
_,src,dst = l.chomp.split("\t")
src = src.split(//).collect{|c| map1[c] || c}.join
dst = map1[dst] || dst
if cc[src] && cc[src] != dst
STDERR.puts("caution: inconsitent mapping '#{src}' => '#{cc[src]}'|'#{dst}'")
end
cc[src] = dst if src != dst
}
loop {
noccur = 0
cc2 = {}
cc.each {|src,dst|
src2 = src
chars = src.split(//)
l = chars.size - 1
for i in 0..l
for j in i..l
next if i == 0 && j == l
str = chars[i..j].join
if map1[str]
STDERR.printf("caution: recursive mapping '%s'=>'%s'\n", str, map1[str])
end
if cc[str]
src2 = (i > 0 ? chars[0..i-1].join : '') + cc[str] + (j < l ? chars[j+1..l].join : '')
noccur += 1
end
end
end
cc2[src2] = dst if src2 != dst
}
cc = cc2
STDERR.puts("substituted #{noccur} patterns.")
break if noccur == 0
STDERR.puts('try again..')
}
return cc
end
def generate_map1(file, hash, level)
bl = ' ' * ((level + 0) * 2)
if hash['']
dst = ''
hash[''].each_byte{|b| dst << format('\x%02X', b)}
file.puts "#{bl}return \"#{dst}\";"
hash.delete('')
end
return if hash.empty?
h2 = {}
hash.each{|key,val|
head = key[0]
rest = key[1..-1]
if h2[head]
h2[head][rest] = val
else
h2[head] = {rest => val}
end
}
if h2.size == 1
h2.each{|key,val|
file.printf("#{bl}if (str[#{level}] == 0x%02X) {\n", key)
generate_map1(file, val, level + 1)
file.puts bl + '}'
}
else
file.puts "#{bl}switch (str[#{level}]) {"
h2.keys.sort.each{|k|
file.printf("#{bl}case 0x%02X :\n", k)
generate_map1(file, h2[k], level + 1)
file.puts("#{bl} break;")
}
file.puts bl + '}'
end
end
def gen_map2_sub2(file, hash, level, indent)
bl = ' ' * ((level + indent + 0) * 2)
if hash['']
file.print "#{bl}return \""
hash[''].each_byte{|b| file.printf('\x%02X', b)}
file.puts "\";"
hash.delete('')
end
return if hash.empty?
h2 = {}
hash.each{|key,val|
head = key[0]
rest = key[1..-1]
if h2[head]
h2[head][rest] = val
else
h2[head] = {rest => val}
end
}
if h2.size == 1
h2.each{|key,val|
file.printf("#{bl}if (prefix[#{level}] == 0x%02X) {\n", key)
gen_map2_sub2(file, val, level + 1, indent)
file.puts bl + '}'
}
else
file.puts "#{bl}switch (prefix[#{level}]) {"
h2.keys.sort.each{|k|
file.printf("#{bl}case 0x%02X :\n", k)
gen_map2_sub2(file, h2[k], level + 1, indent)
file.puts("#{bl} break;")
}
file.puts bl + '}'
end
end
def gen_map2_sub(file, hash, level)
bl = ' ' * ((level + 0) * 2)
if hash['']
gen_map2_sub2(file, hash[''], 0, level)
hash.delete('')
end
return if hash.empty?
h2 = {}
hash.each{|key,val|
head = key[0]
rest = key[1..-1]
if h2[head]
h2[head][rest] = val
else
h2[head] = {rest => val}
end
}
if h2.size == 1
h2.each{|key,val|
file.printf("#{bl}if (suffix[#{level}] == 0x%02X) {\n", key)
gen_map2_sub(file, val, level + 1)
file.puts bl + '}'
}
else
file.puts "#{bl}switch (suffix[#{level}]) {"
h2.keys.sort.each{|k|
file.printf("#{bl}case 0x%02X :\n", k)
gen_map2_sub(file, h2[k], level + 1)
file.puts("#{bl} break;")
}
file.puts bl + '}'
end
end
def generate_map2(file, map2)
suffix = {}
map2.each{|src,dst|
chars = src.split(//)
if chars.size != 2
STDERR.puts "caution: more than two chars in pattern #{chars.join('|')}"
end
s = chars.pop
if suffix[s]
suffix[s][chars.join] = dst
else
suffix[s] = {chars.join=>dst}
end
}
gen_map2_sub(file, suffix, 0)
end
template = <<END
/* -*- c-basic-offset: 2 -*- */
/* Copyright(C) 2010-2012 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
don't edit this file by hand. it generated automatically by nfkc.rb
*/
#include "nfkc.h"
unsigned char
grn_nfkc_ctype(const unsigned char *str)
{
% return -1;
}
const char *
grn_nfkc_map1(const unsigned char *str)
{
% return 0;
}
const char *
grn_nfkc_map2(const unsigned char *prefix, const unsigned char *suffix)
{
% return 0;
}
END
######## main #######
ARGV.each{|arg|
case arg
when /-*c/i
$case_sensitive = true
when /-*s/i
$keep_space = true
end
}
STDERR.puts('compiling icudump')
system('cc -Wall -O3 -o icudump icudump.c -licui18n -licuuc')
STDERR.puts('creating map1..')
map1 = create_map1()
STDERR.puts('creating map2..')
map2 = create_map2(map1)
outf = open('nfkc-core.c', 'w')
tmps = template.split(/%/)
#STDERR.puts('generating block code..')
#outf.print(tmps.shift)
#generate_blockcode_ctype(outf, 'bc')
STDERR.puts('generating ctype code..')
outf.print(tmps.shift)
generate_blockcode_ctype(outf, 'gc')
STDERR.puts('generating map1 code..')
outf.print(tmps.shift)
generate_map1(outf, map1, 0)
STDERR.puts('generating map2 code..')
outf.print(tmps.shift)
generate_map2(outf, map2)
outf.print(tmps.shift)
outf.close
STDERR.puts('done.')
Revert "[nfkc] added missing -licuuc."
This reverts commit ef632969c2f01a62cee251c2d9209413960e4a35.
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
#
# Copyright(C) 2010-2012 Brazil
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1 as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
$KCODE = 'u'
CUSTOM_RULE_PATH = 'nfkc-custom-rules.txt'
def gen_bc(file, hash, level)
bl = ' ' * (level * 2)
h2 = {}
hash.each{|key,val|
head = key[0]
rest = key[1..-1]
if h2[head]
h2[head][rest] = val
else
h2[head] = {rest => val}
end
}
if h2.size < 3
h2.keys.sort.each{|k|
if (0x80 < k)
file.printf("#{bl}if (str[#{level}] < 0x%02X) { return #{$lv}; }\n", k)
end
h = h2[k]
if h.keys.join =~ /^\x80*$/
$lv, = h.values
else
file.printf("#{bl}if (str[#{level}] == 0x%02X) {\n", k)
gen_bc(file, h, level + 1)
file.puts bl + '}'
end
}
file.puts bl + "return #{$lv};"
else
file.puts bl + "switch (str[#{level}]) {"
lk = 0x80
br = true
h2.keys.sort.each{|k|
if (lk < k)
for j in lk..k-1
file.printf("#{bl}case 0x%02X :\n", j)
end
br = false
end
unless br
file.puts bl + " return #{$lv};"
file.puts bl + ' break;'
end
h = h2[k]
file.printf("#{bl}case 0x%02X :\n", k)
if h.keys.join =~ /^\x80*$/
$lv, = h.values
br = false
else
gen_bc(file, h, level + 1)
file.puts bl + ' break;'
br = true
end
lk = k + 1
}
file.puts bl + 'default :'
file.puts bl + " return #{$lv};"
file.puts bl + ' break;'
file.puts bl + '}'
end
end
def generate_blockcode_ctype(file, option)
bc = {}
open("|./icudump --#{option}").each{|l|
src,_,code = l.chomp.split("\t")
str = src.split(':').collect{|c| format("%c", c.hex)}.join
bc[str] = code
}
$lv = 0
gen_bc(file, bc, 0)
end
def ccpush(hash, src, dst)
head = src.shift
hash[head] = {} unless hash[head]
if head
ccpush(hash[head], src, dst)
else
hash[head] = dst
end
end
def subst(hash, str)
cand = nil
src = str.split(//)
for i in 0..src.size-1
h = hash
for j in i..src.size-1
head = src[j]
h = h[head]
break unless h
if h[nil]
cand = src[0,i].to_s + h[nil] + src[j + 1..-1].to_s
end
end
return cand if cand
end
return str
end
def map_entry(map1, cc, src, dst)
dst.downcase! unless $case_sensitive
loop {
dst2 = subst(cc, dst)
break if dst2 == dst
dst = dst2
}
unless $keep_space
dst = $1 if dst =~ /^ +([^ ].*)$/
end
map1[src] = dst if src != dst
end
def create_map1()
cc = {}
open('|./icudump --cc').each{|l|
_,src,dst = l.chomp.split("\t")
if cc[src]
STDERR.puts "caution: ambiguous mapping #{src}|#{cc[src]}|#{dst}" if cc[src] != dst
end
ccpush(cc, src.split(//), dst)
}
map1 = {}
open('|./icudump --nfkd').each{|l|
n,src,dst = l.chomp.split("\t")
map_entry(map1, cc, src, dst)
}
if File.readable?(CUSTOM_RULE_PATH)
open(CUSTOM_RULE_PATH).each{|l|
src,dst = l.chomp.split("\t")
map_entry(map1, cc, src, dst)
}
end
unless $case_sensitive
for c in 'A'..'Z'
map1[c] = c.downcase
end
end
return map1
end
def create_map2(map1)
cc = {}
open('|./icudump --cc').each{|l|
_,src,dst = l.chomp.split("\t")
src = src.split(//).collect{|c| map1[c] || c}.join
dst = map1[dst] || dst
if cc[src] && cc[src] != dst
STDERR.puts("caution: inconsitent mapping '#{src}' => '#{cc[src]}'|'#{dst}'")
end
cc[src] = dst if src != dst
}
loop {
noccur = 0
cc2 = {}
cc.each {|src,dst|
src2 = src
chars = src.split(//)
l = chars.size - 1
for i in 0..l
for j in i..l
next if i == 0 && j == l
str = chars[i..j].join
if map1[str]
STDERR.printf("caution: recursive mapping '%s'=>'%s'\n", str, map1[str])
end
if cc[str]
src2 = (i > 0 ? chars[0..i-1].join : '') + cc[str] + (j < l ? chars[j+1..l].join : '')
noccur += 1
end
end
end
cc2[src2] = dst if src2 != dst
}
cc = cc2
STDERR.puts("substituted #{noccur} patterns.")
break if noccur == 0
STDERR.puts('try again..')
}
return cc
end
def generate_map1(file, hash, level)
bl = ' ' * ((level + 0) * 2)
if hash['']
dst = ''
hash[''].each_byte{|b| dst << format('\x%02X', b)}
file.puts "#{bl}return \"#{dst}\";"
hash.delete('')
end
return if hash.empty?
h2 = {}
hash.each{|key,val|
head = key[0]
rest = key[1..-1]
if h2[head]
h2[head][rest] = val
else
h2[head] = {rest => val}
end
}
if h2.size == 1
h2.each{|key,val|
file.printf("#{bl}if (str[#{level}] == 0x%02X) {\n", key)
generate_map1(file, val, level + 1)
file.puts bl + '}'
}
else
file.puts "#{bl}switch (str[#{level}]) {"
h2.keys.sort.each{|k|
file.printf("#{bl}case 0x%02X :\n", k)
generate_map1(file, h2[k], level + 1)
file.puts("#{bl} break;")
}
file.puts bl + '}'
end
end
def gen_map2_sub2(file, hash, level, indent)
bl = ' ' * ((level + indent + 0) * 2)
if hash['']
file.print "#{bl}return \""
hash[''].each_byte{|b| file.printf('\x%02X', b)}
file.puts "\";"
hash.delete('')
end
return if hash.empty?
h2 = {}
hash.each{|key,val|
head = key[0]
rest = key[1..-1]
if h2[head]
h2[head][rest] = val
else
h2[head] = {rest => val}
end
}
if h2.size == 1
h2.each{|key,val|
file.printf("#{bl}if (prefix[#{level}] == 0x%02X) {\n", key)
gen_map2_sub2(file, val, level + 1, indent)
file.puts bl + '}'
}
else
file.puts "#{bl}switch (prefix[#{level}]) {"
h2.keys.sort.each{|k|
file.printf("#{bl}case 0x%02X :\n", k)
gen_map2_sub2(file, h2[k], level + 1, indent)
file.puts("#{bl} break;")
}
file.puts bl + '}'
end
end
def gen_map2_sub(file, hash, level)
bl = ' ' * ((level + 0) * 2)
if hash['']
gen_map2_sub2(file, hash[''], 0, level)
hash.delete('')
end
return if hash.empty?
h2 = {}
hash.each{|key,val|
head = key[0]
rest = key[1..-1]
if h2[head]
h2[head][rest] = val
else
h2[head] = {rest => val}
end
}
if h2.size == 1
h2.each{|key,val|
file.printf("#{bl}if (suffix[#{level}] == 0x%02X) {\n", key)
gen_map2_sub(file, val, level + 1)
file.puts bl + '}'
}
else
file.puts "#{bl}switch (suffix[#{level}]) {"
h2.keys.sort.each{|k|
file.printf("#{bl}case 0x%02X :\n", k)
gen_map2_sub(file, h2[k], level + 1)
file.puts("#{bl} break;")
}
file.puts bl + '}'
end
end
def generate_map2(file, map2)
suffix = {}
map2.each{|src,dst|
chars = src.split(//)
if chars.size != 2
STDERR.puts "caution: more than two chars in pattern #{chars.join('|')}"
end
s = chars.pop
if suffix[s]
suffix[s][chars.join] = dst
else
suffix[s] = {chars.join=>dst}
end
}
gen_map2_sub(file, suffix, 0)
end
template = <<END
/* -*- c-basic-offset: 2 -*- */
/* Copyright(C) 2010-2012 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
don't edit this file by hand. it generated automatically by nfkc.rb
*/
#include "nfkc.h"
unsigned char
grn_nfkc_ctype(const unsigned char *str)
{
% return -1;
}
const char *
grn_nfkc_map1(const unsigned char *str)
{
% return 0;
}
const char *
grn_nfkc_map2(const unsigned char *prefix, const unsigned char *suffix)
{
% return 0;
}
END
######## main #######
ARGV.each{|arg|
case arg
when /-*c/i
$case_sensitive = true
when /-*s/i
$keep_space = true
end
}
STDERR.puts('compiling icudump')
system('cc -Wall -O3 -o icudump icudump.c -licui18n')
STDERR.puts('creating map1..')
map1 = create_map1()
STDERR.puts('creating map2..')
map2 = create_map2(map1)
outf = open('nfkc-core.c', 'w')
tmps = template.split(/%/)
#STDERR.puts('generating block code..')
#outf.print(tmps.shift)
#generate_blockcode_ctype(outf, 'bc')
STDERR.puts('generating ctype code..')
outf.print(tmps.shift)
generate_blockcode_ctype(outf, 'gc')
STDERR.puts('generating map1 code..')
outf.print(tmps.shift)
generate_map1(outf, map1, 0)
STDERR.puts('generating map2 code..')
outf.print(tmps.shift)
generate_map2(outf, map2)
outf.print(tmps.shift)
outf.close
STDERR.puts('done.')
|
require 'set'
require 'logger'
require 'rb-inotify'
require 'aws-sdk'
require 'thread/pool'
require 'timeout'
require_relative 's3_write_stream'
module S3reamer
class DirectoryStreamer
def initialize(dir, bucket)
@dir = dir
@bucket = bucket
@log = Logger.new(STDOUT)
@ignored_files = Set.new
@dir_watch = INotify::Notifier.new
@pool = Thread.pool(4)
@dir_watch.watch(@dir, :open, :recursive) do |e|
filename = e.absolute_name
next unless File.exists?(filename) and !File.directory?(filename)
next if @ignored_files.include?(filename)
@log.info "inotify open event for: #{filename}"
@ignored_files.add(filename)
@pool.process {
obj = @bucket.object(filename[1..-1])
io = S3reamer::S3WriteStream.new(obj)
open(filename) do |file|
stopped = false
queue = INotify::Notifier.new
queue.watch(filename, :modify, :close) do |e2|
b = file.read
io.write(b)
@log.debug "Read #{b.length} bytes"
if e2.flags.include?(:close)
queue.close
stopped = true
end
end
while !stopped
if IO.select([queue.to_io], [], [], [1])
queue.process
else
stopped = true
end
end
@log.info "File closed. Completing S3 upload: #{filename}"
end
io.close
@ignored_files.delete(filename)
}
end
end
def run
@dir_watch.run
@pool.shutdown
end
def stop
@dir_watch.stop
end
end
end
ogging
require 'set'
require 'logger'
require 'rb-inotify'
require 'aws-sdk'
require 'thread/pool'
require 'timeout'
require_relative 's3_write_stream'
module S3reamer
class DirectoryStreamer
def initialize(dir, bucket)
@dir = dir
@bucket = bucket
@log = Logger.new(STDOUT)
@ignored_files = Set.new
@dir_watch = INotify::Notifier.new
@pool = Thread.pool(4)
@dir_watch.watch(@dir, :open, :recursive) do |e|
filename = e.absolute_name
next unless File.exists?(filename) and !File.directory?(filename)
next if @ignored_files.include?(filename)
@log.info "inotify open event for: #{filename}"
@ignored_files.add(filename)
@pool.process {
obj = @bucket.object(filename[1..-1])
io = S3reamer::S3WriteStream.new(obj)
open(filename) do |file|
stopped = false
queue = INotify::Notifier.new
queue.watch(filename, :modify, :close) do |e2|
b = file.read
io.write(b)
@log.debug "Read #{b.length} bytes"
if e2.flags.include?(:close)
queue.close
stopped = true
end
end
while !stopped
@log.info "waiting for event in IO.select"
if IO.select([queue.to_io], [], [], 1)
@log.info "got event in IO.select"
queue.process
else
stopped = true
end
end
@log.info "File closed. Completing S3 upload: #{filename}"
end
io.close
@ignored_files.delete(filename)
}
end
end
def run
@dir_watch.run
@pool.shutdown
end
def stop
@dir_watch.stop
end
end
end
|
Generate log serializer
class LogSerializer < ActiveModel::Serializer
attributes :id
end
|
class ClientAggregator
RANGE_VALUES = %w[this_month last_month this_week last_week this_year last_year]
include Virtus.model
include ActiveModel::Model
attribute :client
attribute :base_user
# Attributes for date filtering
attribute :start_date
attribute :end_date
attribute :specific_range
def aggregate
set_dates if specific_range.present?
end
def specific_range=(new_val)
if RANGE_VALUES.include?(new_val)
super new_val
end
end
def start_date=(new_val)
result = nil
begin
result = new_val.is_a?(String) ? Date.parse(new_val) : new_val
rescue
end
super result
end
def end_date=(new_val)
result = nil
begin
result = new_val.is_a?(String) ? Date.parse(new_val) : new_val
rescue
end
super result
end
def sorted_results
results.sort_by {|r| r.started }.reverse
end
private
def set_dates
case specific_range
when "this_week"
self.start_date = Time.now.beginning_of_week
self.end_date = Time.now
when "last_week"
self.start_date = 1.week.ago.beginning_of_week
self.end_date = 1.week.ago.end_of_week
when "this_month"
self.start_date = Time.now.beginning_of_month
self.end_date = Time.now
when "last_month"
self.start_date = 1.month.ago.beginning_of_month
self.end_date = 1.month.ago.end_of_month
when "this_year"
self.start_date = Time.now.beginning_of_year
self.end_date = Time.now
when "last_year"
self.start_date = 1.year.ago.beginning_of_year
self.end_date = 1.year.ago.end_of_year
else
end
end
def results
@mapped_results ||= worklogs.map do |worklog|
result_data = generate_result_data worklog
ResultEntry.new(result_data)
end
end
def generate_result_data worklog
{
username: username_for_worklog(worklog),
seconds_worked: worklog.duration,
total_cents: worklog.total_cents,
currency: (worklog.user.currency || Money.default_currency),
worklog_id: worklog.id,
worklog_summary: worklog.summary,
started: worklog.start_time,
ended: worklog.end_time,
timeframes: worklog.timeframes
}
end
def worklogs
client.worklogs.joins(:timeframes).
where("timeframes.ended >= ?", start_date.to_datetime).
where("timeframes.started <= ?", end_date.to_datetime).
preload(:timeframes, :client_share, :user).
group("worklogs.id")
end
def total_time
seconds = results.map(&:seconds_worked).inject(:+) || 0 #results.map{ |res| res.seconds_worked }
minutes = (seconds / 60) % 60
hours = seconds / (60 * 60)
format("%02dH:%02dM", hours, minutes) #=> "01:00:00"
end
def total_costs
cents = results.map(&:total_cents).inject(:+) || 0
Money.new cents, client.currency
end
# returns the username to be used in the aggregration
def username_for_worklog(worklog)
return worklog.user.username if worklog.client_share.blank?
if worklog.client_share.works_as_subcontractor
worklog.client_share.subcontractor_shown_name
else
worklog.user.username
end
end
class ResultEntry
include Virtus.model
attribute :username
attribute :seconds_worked
attribute :total_cents
attribute :currency
attribute :worklog_id
attribute :worklog_summary
attribute :started
attribute :ended
attribute :timeframes
def started_formatted
I18n.l started, format: :short
end
def ended_formatted
I18n.l ended, format: :short
end
def total
Money.new total_cents, currency
end
def hours_formatted
minutes = (seconds_worked / 60) % 60
hours = seconds_worked / (60 * 60)
format("%02dH:%02dM", hours, minutes) #=> "01:00:00"
end
def seconds_to_hours
seconds_worked / (60 * 60)
end
def seconds_to_minutes
(seconds_worked / 60) % 60
end
end
end
remove boilerplate comments
class ClientAggregator
RANGE_VALUES = %w[this_month last_month this_week last_week this_year last_year]
include Virtus.model
include ActiveModel::Model
attribute :client
attribute :base_user
# Attributes for date filtering
attribute :start_date
attribute :end_date
attribute :specific_range
def aggregate
set_dates if specific_range.present?
end
def specific_range=(new_val)
if RANGE_VALUES.include?(new_val)
super new_val
end
end
def start_date=(new_val)
result = nil
begin
result = new_val.is_a?(String) ? Date.parse(new_val) : new_val
rescue
end
super result
end
def end_date=(new_val)
result = nil
begin
result = new_val.is_a?(String) ? Date.parse(new_val) : new_val
rescue
end
super result
end
def sorted_results
results.sort_by {|r| r.started }.reverse
end
def total_time
seconds = results.map(&:seconds_worked).inject(:+) || 0
minutes = (seconds / 60) % 60
hours = seconds / (60 * 60)
format("%02dH:%02dM", hours, minutes) #=> "01:00:00"
end
def total_costs
cents = results.map(&:total_cents).inject(:+) || 0
Money.new cents, client.currency
end
private
def set_dates
case specific_range
when "this_week"
self.start_date = Time.now.beginning_of_week
self.end_date = Time.now
when "last_week"
self.start_date = 1.week.ago.beginning_of_week
self.end_date = 1.week.ago.end_of_week
when "this_month"
self.start_date = Time.now.beginning_of_month
self.end_date = Time.now
when "last_month"
self.start_date = 1.month.ago.beginning_of_month
self.end_date = 1.month.ago.end_of_month
when "this_year"
self.start_date = Time.now.beginning_of_year
self.end_date = Time.now
when "last_year"
self.start_date = 1.year.ago.beginning_of_year
self.end_date = 1.year.ago.end_of_year
else
end
end
def results
@mapped_results ||= worklogs.map do |worklog|
result_data = generate_result_data worklog
ResultEntry.new(result_data)
end
end
def generate_result_data worklog
{
username: username_for_worklog(worklog),
seconds_worked: worklog.duration,
total_cents: worklog.total_cents,
currency: (worklog.user.currency || Money.default_currency),
worklog_id: worklog.id,
worklog_summary: worklog.summary,
started: worklog.start_time,
ended: worklog.end_time,
timeframes: worklog.timeframes
}
end
def worklogs
client.worklogs.joins(:timeframes).
where("timeframes.ended >= ?", start_date.to_datetime).
where("timeframes.started <= ?", end_date.to_datetime).
preload(:timeframes, :client_share, :user).
group("worklogs.id")
end
# returns the username to be used in the aggregration
def username_for_worklog(worklog)
return worklog.user.username if worklog.client_share.blank?
if worklog.client_share.works_as_subcontractor
worklog.client_share.subcontractor_shown_name
else
worklog.user.username
end
end
class ResultEntry
include Virtus.model
attribute :username
attribute :seconds_worked
attribute :total_cents
attribute :currency
attribute :worklog_id
attribute :worklog_summary
attribute :started
attribute :ended
attribute :timeframes
def started_formatted
I18n.l started, format: :short
end
def ended_formatted
I18n.l ended, format: :short
end
def total
Money.new total_cents, currency
end
def hours_formatted
minutes = (seconds_worked / 60) % 60
hours = seconds_worked / (60 * 60)
format("%02dH:%02dM", hours, minutes) #=> "01:00:00"
end
def seconds_to_hours
seconds_worked / (60 * 60)
end
def seconds_to_minutes
(seconds_worked / 60) % 60
end
end
end
|
Pod::Spec.new do |s|
s.name = "JLRoutes"
s.version = "1.6"
s.summary = "URL routing library for iOS with a simple block-based API."
s.homepage = "https://github.com/joeldev/JLRoutes"
s.license = "BSD 3-Clause \"New\" License"
s.author = { "Joel Levin" => "joel@joeldev.com" }
s.source = { :git => "https://github.com/joeldev/JLRoutes.git", :tag => "1.6" }
s.source_files = 'JLRoutes', 'JLRoutes/*.{h,m}'
s.framework = 'Foundation'
s.requires_arc = true
s.ios.deployment_target = '7.0'
s.osx.deployment_target = '10.9'
s.tvos.deployment_target = '9.0'
end
1.6.2
Pod::Spec.new do |s|
s.name = "JLRoutes"
s.version = "1.6.2"
s.summary = "URL routing library for iOS with a simple block-based API."
s.homepage = "https://github.com/joeldev/JLRoutes"
s.license = "BSD 3-Clause \"New\" License"
s.author = { "Joel Levin" => "joel@joeldev.com" }
s.source = { :git => "https://github.com/joeldev/JLRoutes.git", :tag => "1.6.2" }
s.source_files = 'JLRoutes', 'JLRoutes/*.{h,m}'
s.framework = 'Foundation'
s.requires_arc = true
s.ios.deployment_target = '7.0'
s.osx.deployment_target = '10.9'
s.tvos.deployment_target = '9.0'
end
|
Adding spec file
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{fibonacci-gem}
s.version = "0.1.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Anuj"]
s.date = %q{2011-02-22}
s.description = %q{TODO: longer description of your gem}
s.email = %q{anuj.thapliyal@gmail.com}
s.extra_rdoc_files = [
"LICENSE.txt",
"README.rdoc"
]
s.files = [
".document",
"Gemfile",
"LICENSE.txt",
"README.rdoc",
"Rakefile",
"VERSION",
"lib/fibonacci-gem.rb",
"test/helper.rb",
"test/test_fibonacci-gem.rb"
]
s.homepage = %q{http://github.com/anuj123/fibonacci-gem}
s.licenses = ["MIT"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.7}
s.summary = %q{TODO: one-line summary of your gem}
s.test_files = [
"test/helper.rb",
"test/test_fibonacci-gem.rb"
]
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<shoulda>, [">= 0"])
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
s.add_development_dependency(%q<rcov>, [">= 0"])
else
s.add_dependency(%q<shoulda>, [">= 0"])
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
s.add_dependency(%q<rcov>, [">= 0"])
end
else
s.add_dependency(%q<shoulda>, [">= 0"])
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
s.add_dependency(%q<rcov>, [">= 0"])
end
end
|
Pod::Spec.new do |s|
s.name = 'KenBurns'
s.version = '0.1.3'
s.summary = 'A little Swift tool that performs a nice Ken Burns effect on an image'
s.description = 'A little Swift tool that performs a nice Ken Burns effect on an image. Powering Calm since 2016'
s.homepage = 'https://github.com/calmcom/KenBurns'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'calmcom' => 'support@calm.com' }
s.source = { :git => 'https://github.com/calmcom/KenBurns.git', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.source_files = 'KenBurns/Classes/**/*'
s.frameworks = 'UIKit'
s.dependency 'CLKParametricAnimations', '~> 0.1.0'
s.dependency 'SDWebImage', '~> 3.8.1'
end
bump pod spec to 0.1.4
Pod::Spec.new do |s|
s.name = 'KenBurns'
s.version = '0.1.4'
s.summary = 'A little Swift tool that performs a nice Ken Burns effect on an image'
s.description = 'A little Swift tool that performs a nice Ken Burns effect on an image. Powering Calm since 2016'
s.homepage = 'https://github.com/calmcom/KenBurns'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'calmcom' => 'support@calm.com' }
s.source = { :git => 'https://github.com/calmcom/KenBurns.git', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.source_files = 'KenBurns/Classes/**/*'
s.frameworks = 'UIKit'
s.dependency 'CLKParametricAnimations', '~> 0.1.0'
s.dependency 'SDWebImage', '~> 3.8.1'
end
|
Pod::Spec.new do |s|
s.name = "Kiwi-KIF"
s.version = "1.1.1"
s.summary = "Allows to write KIF integration tests using Kiwi framework"
s.homepage = "https://github.com/garnett/Kiwi-KIF"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Denis Lebedev" => "d2.lebedev@gmail.com" }
s.platform = :ios, '5.1'
s.source = { :git => "https://github.com/garnett/Kiwi-KIF.git", :tag => "#{s.version}" }
s.requires_arc = true
s.framework = 'XCTest'
s.source_files = 'src'
s.dependency 'Kiwi', '~>2.3.0'
s.dependency 'KIF', '~>3.0.7'
end
Fix compile issue for xcode6 beta 5
Pod::Spec.new do |s|
s.name = "Kiwi-KIF"
s.version = "1.1.1"
s.summary = "Allows to write KIF integration tests using Kiwi framework"
s.homepage = "https://github.com/garnett/Kiwi-KIF"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Denis Lebedev" => "d2.lebedev@gmail.com" }
s.platform = :ios, '5.1'
s.source = { :git => "https://github.com/garnett/Kiwi-KIF.git", :tag => "#{s.version}" }
s.requires_arc = true
s.ios.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks" "$(DEVELOPER_DIR)/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks"' }
s.framework = 'XCTest'
s.source_files = 'src'
s.dependency 'Kiwi', '~>2.3.0'
s.dependency 'KIF', '~>3.0.7'
end
|
#! /usr/bin/env ruby
require 'yaml'
require 'erb'
require 'attack_api'
class AtomicRedTeam
ATTACK_API = Attack.new
ATOMICS_DIRECTORY = "#{File.dirname(File.dirname(__FILE__))}/atomics"
# TODO- should these all be relative URLs?
ROOT_GITHUB_URL = "https://github.com/redcanaryco/atomic-red-team"
#
# Returns a list of paths that contain Atomic Tests
#
def atomic_test_paths
Dir["#{ATOMICS_DIRECTORY}/t*/t*.yaml"].sort
end
#
# Returns a list of Atomic Tests in Atomic Red Team (as Hashes from source YAML)
#
def atomic_tests
@atomic_tests ||= atomic_test_paths.collect do |path|
atomic_yaml = YAML.load(File.read path)
atomic_yaml['atomic_yaml_path'] = path
atomic_yaml
end
end
#
# Returns the individual Atomic Tests for a given identifer, passed as either a string (T1234) or an ATT&CK technique object
#
def atomic_tests_for_technique(technique_or_technique_identifier)
technique_identifier = if technique_or_technique_identifier.is_a? Hash
ATTACK_API.technique_identifier_for_technique technique_or_technique_identifier
else
technique_or_technique_identifier
end
atomic_tests.find do |atomic_yaml|
atomic_yaml.fetch('attack_technique').downcase == technique_identifier.downcase
end.to_h.fetch('atomic_tests', [])
end
#
# Returns a Markdown formatted Github link to a technique. This will be to the edit page for
# techniques that already have one or more Atomic Red Team tests, or the create page for
# techniques that have no existing tests.
#
def github_link_to_technique(technique, include_identifier=false)
technique_identifier = ATTACK_API.technique_identifier_for_technique(technique).downcase
link_display = "#{"#{technique_identifier.upcase} " if include_identifier}#{technique['name']}"
if File.exists? "#{ATOMICS_DIRECTORY}/#{technique_identifier}/#{technique_identifier}.md"
# we have a file for this technique, so link to it's Markdown file
"[#{link_display}](#{ROOT_GITHUB_URL}/tree/master/atomics/#{technique_identifier}/#{technique_identifier}.md)"
else
# we don't have a file for this technique, so link to an edit page
"[#{link_display}](#{ROOT_GITHUB_URL}/edit/master/atomics/#{technique_identifier}/#{technique_identifier}.md)"
end
end
def validate_atomic_yaml!(yaml)
raise("YAML file has no elements") if yaml.nil?
raise('`attack_technique` element is required') unless yaml.has_key?('attack_technique')
raise('`attack_technique` element must be an array') unless yaml['attack_technique'].is_a?(String)
raise('`display_name` element is required') unless yaml.has_key?('display_name')
raise('`display_name` element must be an array') unless yaml['display_name'].is_a?(String)
raise('`atomic_tests` element is required') unless yaml.has_key?('atomic_tests')
raise('`atomic_tests` element must be an array') unless yaml['atomic_tests'].is_a?(Array)
raise('`atomic_tests` element is empty - you have no tests') unless yaml['atomic_tests'].count > 0
yaml['atomic_tests'].each_with_index do |atomic, i|
raise("`atomic_tests[#{i}].name` element is required") unless atomic.has_key?('name')
raise("`atomic_tests[#{i}].name` element must be a string") unless atomic['name'].is_a?(String)
raise("`atomic_tests[#{i}].description` element is required") unless atomic.has_key?('description')
raise("`atomic_tests[#{i}].description` element must be a string") unless atomic['description'].is_a?(String)
raise("`atomic_tests[#{i}].supported_platforms` element is required") unless atomic.has_key?('supported_platforms')
raise("`atomic_tests[#{i}].supported_platforms` element must be an Array (was a #{atomic['supported_platforms'].class.name})") unless atomic['supported_platforms'].is_a?(Array)
valid_supported_platforms = ['windows', 'centos', 'ubuntu', 'macos', 'linux']
atomic['supported_platforms'].each do |platform|
if !valid_supported_platforms.include?(platform)
raise("`atomic_tests[#{i}].supported_platforms` '#{platform}' must be one of #{valid_supported_platforms.join(', ')}")
end
end
(atomic['input_arguments'] || {}).each_with_index do |arg_kvp, iai|
arg_name, arg = arg_kvp
raise("`atomic_tests[#{i}].input_arguments[#{iai}].description` element is required") unless arg.has_key?('description')
raise("`atomic_tests[#{i}].input_arguments[#{iai}].description` element must be a string") unless arg['description'].is_a?(String)
raise("`atomic_tests[#{i}].input_arguments[#{iai}].type` element is required") unless arg.has_key?('type')
raise("`atomic_tests[#{i}].input_arguments[#{iai}].type` element must be a string") unless arg['type'].is_a?(String)
raise("`atomic_tests[#{i}].input_arguments[#{iai}].type` element must be lowercased and underscored (was #{arg['type']})") unless arg['type'] =~ /[a-z_]+/
# TODO: determine if we think default values are required for EVERY input argument
# raise("`atomic_tests[#{i}].input_arguments[#{iai}].default` element is required") unless arg.has_key?('default')
# raise("`atomic_tests[#{i}].input_arguments[#{iai}].default` element must be a string (was a #{arg['default'].class.name})") unless arg['default'].is_a?(String)
end
raise("`atomic_tests[#{i}].executor` element is required") unless atomic.has_key?('executor')
executor = atomic['executor']
raise("`atomic_tests[#{i}].executor.name` element is required") unless executor.has_key?('name')
raise("`atomic_tests[#{i}].executor.name` element must be a string") unless executor['name'].is_a?(String)
raise("`atomic_tests[#{i}].executor.name` element must be lowercased and underscored (was #{executor['name']})") unless executor['name'] =~ /[a-z_]+/
valid_executor_types = ['command_prompt', 'sh', 'bash', 'powershell', 'manual']
case executor['name']
when 'manual'
raise("`atomic_tests[#{i}].executor.steps` element is required") unless executor.has_key?('steps')
raise("`atomic_tests[#{i}].executor.steps` element must be a string") unless executor['steps'].is_a?(String)
when 'command_prompt', 'sh', 'bash', 'powershell'
raise("`atomic_tests[#{i}].executor.command` element is required") unless executor.has_key?('command')
raise("`atomic_tests[#{i}].executor.command` element must be a string") unless executor['command'].is_a?(String)
else
raise("`atomic_tests[#{i}].executor.name` '#{executor['name']}' must be one of #{valid_executor_types.join(', ')}")
end
end
end
end
try better new link
#! /usr/bin/env ruby
require 'yaml'
require 'erb'
require 'attack_api'
class AtomicRedTeam
ATTACK_API = Attack.new
ATOMICS_DIRECTORY = "#{File.dirname(File.dirname(__FILE__))}/atomics"
# TODO- should these all be relative URLs?
ROOT_GITHUB_URL = "https://github.com/redcanaryco/atomic-red-team"
#
# Returns a list of paths that contain Atomic Tests
#
def atomic_test_paths
Dir["#{ATOMICS_DIRECTORY}/t*/t*.yaml"].sort
end
#
# Returns a list of Atomic Tests in Atomic Red Team (as Hashes from source YAML)
#
def atomic_tests
@atomic_tests ||= atomic_test_paths.collect do |path|
atomic_yaml = YAML.load(File.read path)
atomic_yaml['atomic_yaml_path'] = path
atomic_yaml
end
end
#
# Returns the individual Atomic Tests for a given identifer, passed as either a string (T1234) or an ATT&CK technique object
#
def atomic_tests_for_technique(technique_or_technique_identifier)
technique_identifier = if technique_or_technique_identifier.is_a? Hash
ATTACK_API.technique_identifier_for_technique technique_or_technique_identifier
else
technique_or_technique_identifier
end
atomic_tests.find do |atomic_yaml|
atomic_yaml.fetch('attack_technique').downcase == technique_identifier.downcase
end.to_h.fetch('atomic_tests', [])
end
#
# Returns a Markdown formatted Github link to a technique. This will be to the edit page for
# techniques that already have one or more Atomic Red Team tests, or the create page for
# techniques that have no existing tests.
#
def github_link_to_technique(technique, include_identifier=false)
technique_identifier = ATTACK_API.technique_identifier_for_technique(technique).downcase
link_display = "#{"#{technique_identifier.upcase} " if include_identifier}#{technique['name']}"
if File.exists? "#{ATOMICS_DIRECTORY}/#{technique_identifier}/#{technique_identifier}.md"
# we have a file for this technique, so link to it's Markdown file
"[#{link_display}](#{ROOT_GITHUB_URL}/tree/master/atomics/#{technique_identifier}/#{technique_identifier}.md)"
else
# we don't have a file for this technique, so link to an edit page
"[#{link_display}](#{ROOT_GITHUB_URL}/new/master/atomics/#{technique_identifier}?#{technique_identifier}.md)"
end
end
def validate_atomic_yaml!(yaml)
raise("YAML file has no elements") if yaml.nil?
raise('`attack_technique` element is required') unless yaml.has_key?('attack_technique')
raise('`attack_technique` element must be an array') unless yaml['attack_technique'].is_a?(String)
raise('`display_name` element is required') unless yaml.has_key?('display_name')
raise('`display_name` element must be an array') unless yaml['display_name'].is_a?(String)
raise('`atomic_tests` element is required') unless yaml.has_key?('atomic_tests')
raise('`atomic_tests` element must be an array') unless yaml['atomic_tests'].is_a?(Array)
raise('`atomic_tests` element is empty - you have no tests') unless yaml['atomic_tests'].count > 0
yaml['atomic_tests'].each_with_index do |atomic, i|
raise("`atomic_tests[#{i}].name` element is required") unless atomic.has_key?('name')
raise("`atomic_tests[#{i}].name` element must be a string") unless atomic['name'].is_a?(String)
raise("`atomic_tests[#{i}].description` element is required") unless atomic.has_key?('description')
raise("`atomic_tests[#{i}].description` element must be a string") unless atomic['description'].is_a?(String)
raise("`atomic_tests[#{i}].supported_platforms` element is required") unless atomic.has_key?('supported_platforms')
raise("`atomic_tests[#{i}].supported_platforms` element must be an Array (was a #{atomic['supported_platforms'].class.name})") unless atomic['supported_platforms'].is_a?(Array)
valid_supported_platforms = ['windows', 'centos', 'ubuntu', 'macos', 'linux']
atomic['supported_platforms'].each do |platform|
if !valid_supported_platforms.include?(platform)
raise("`atomic_tests[#{i}].supported_platforms` '#{platform}' must be one of #{valid_supported_platforms.join(', ')}")
end
end
(atomic['input_arguments'] || {}).each_with_index do |arg_kvp, iai|
arg_name, arg = arg_kvp
raise("`atomic_tests[#{i}].input_arguments[#{iai}].description` element is required") unless arg.has_key?('description')
raise("`atomic_tests[#{i}].input_arguments[#{iai}].description` element must be a string") unless arg['description'].is_a?(String)
raise("`atomic_tests[#{i}].input_arguments[#{iai}].type` element is required") unless arg.has_key?('type')
raise("`atomic_tests[#{i}].input_arguments[#{iai}].type` element must be a string") unless arg['type'].is_a?(String)
raise("`atomic_tests[#{i}].input_arguments[#{iai}].type` element must be lowercased and underscored (was #{arg['type']})") unless arg['type'] =~ /[a-z_]+/
# TODO: determine if we think default values are required for EVERY input argument
# raise("`atomic_tests[#{i}].input_arguments[#{iai}].default` element is required") unless arg.has_key?('default')
# raise("`atomic_tests[#{i}].input_arguments[#{iai}].default` element must be a string (was a #{arg['default'].class.name})") unless arg['default'].is_a?(String)
end
raise("`atomic_tests[#{i}].executor` element is required") unless atomic.has_key?('executor')
executor = atomic['executor']
raise("`atomic_tests[#{i}].executor.name` element is required") unless executor.has_key?('name')
raise("`atomic_tests[#{i}].executor.name` element must be a string") unless executor['name'].is_a?(String)
raise("`atomic_tests[#{i}].executor.name` element must be lowercased and underscored (was #{executor['name']})") unless executor['name'] =~ /[a-z_]+/
valid_executor_types = ['command_prompt', 'sh', 'bash', 'powershell', 'manual']
case executor['name']
when 'manual'
raise("`atomic_tests[#{i}].executor.steps` element is required") unless executor.has_key?('steps')
raise("`atomic_tests[#{i}].executor.steps` element must be a string") unless executor['steps'].is_a?(String)
when 'command_prompt', 'sh', 'bash', 'powershell'
raise("`atomic_tests[#{i}].executor.command` element is required") unless executor.has_key?('command')
raise("`atomic_tests[#{i}].executor.command` element must be a string") unless executor['command'].is_a?(String)
else
raise("`atomic_tests[#{i}].executor.name` '#{executor['name']}' must be one of #{valid_executor_types.join(', ')}")
end
end
end
end |
# frozen_string_literal: true
Gem::Specification.new do |spec|
spec.name = "gir_ffi-tracker"
spec.version = "0.15.0"
spec.authors = ["Matijs van Zuijlen"]
spec.email = ["matijs@matijs.net"]
spec.summary = "GirFFI-based binding to Tracker"
spec.description = "Bindings for Tracker generated by GirFFI, with overrides."
spec.homepage = "http://www.github.com/mvz/gir_ffi-tracker"
spec.license = "LGPL-2.1+"
spec.required_ruby_version = ">= 2.6.0"
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/mvz/gir_ffi-tracker"
spec.metadata["changelog_uri"] = "https://github.com/mvz/gir_ffi-tracker/blob/master/Changelog.md"
spec.files = File.read("Manifest.txt").split
spec.rdoc_options = ["--main", "README.md"]
spec.extra_rdoc_files = ["README.md", "Changelog.md"]
spec.require_paths = ["lib"]
spec.add_runtime_dependency "gir_ffi", "~> 0.15.0"
spec.add_development_dependency "minitest", "~> 5.12"
spec.add_development_dependency "pry", "~> 0.14.0"
spec.add_development_dependency "rake", "~> 13.0"
spec.add_development_dependency "rake-manifest", "~> 0.2.0"
spec.add_development_dependency "rubocop", "~> 1.22.0"
spec.add_development_dependency "rubocop-minitest", "~> 0.16.0"
spec.add_development_dependency "rubocop-packaging", "~> 0.5.0"
spec.add_development_dependency "rubocop-performance", "~> 1.12.0"
spec.add_development_dependency "simplecov", "~> 0.21.0"
spec.add_development_dependency "yard", "~> 0.9.14"
end
Update rubocop requirement from ~> 1.22.0 to ~> 1.23.0
Updates the requirements on [rubocop](https://github.com/rubocop/rubocop) to permit the latest version.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.22.0...v1.23.0)
---
updated-dependencies:
- dependency-name: rubocop
dependency-type: direct:development
...
Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@github.com>
# frozen_string_literal: true
Gem::Specification.new do |spec|
spec.name = "gir_ffi-tracker"
spec.version = "0.15.0"
spec.authors = ["Matijs van Zuijlen"]
spec.email = ["matijs@matijs.net"]
spec.summary = "GirFFI-based binding to Tracker"
spec.description = "Bindings for Tracker generated by GirFFI, with overrides."
spec.homepage = "http://www.github.com/mvz/gir_ffi-tracker"
spec.license = "LGPL-2.1+"
spec.required_ruby_version = ">= 2.6.0"
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/mvz/gir_ffi-tracker"
spec.metadata["changelog_uri"] = "https://github.com/mvz/gir_ffi-tracker/blob/master/Changelog.md"
spec.files = File.read("Manifest.txt").split
spec.rdoc_options = ["--main", "README.md"]
spec.extra_rdoc_files = ["README.md", "Changelog.md"]
spec.require_paths = ["lib"]
spec.add_runtime_dependency "gir_ffi", "~> 0.15.0"
spec.add_development_dependency "minitest", "~> 5.12"
spec.add_development_dependency "pry", "~> 0.14.0"
spec.add_development_dependency "rake", "~> 13.0"
spec.add_development_dependency "rake-manifest", "~> 0.2.0"
spec.add_development_dependency "rubocop", "~> 1.23.0"
spec.add_development_dependency "rubocop-minitest", "~> 0.16.0"
spec.add_development_dependency "rubocop-packaging", "~> 0.5.0"
spec.add_development_dependency "rubocop-performance", "~> 1.12.0"
spec.add_development_dependency "simplecov", "~> 0.21.0"
spec.add_development_dependency "yard", "~> 0.9.14"
end
|
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'github_snapshot/version'
Gem::Specification.new do |spec|
spec.name = "github_snapshot"
spec.version = GithubSnapshot::VERSION
spec.authors = ["Artur Rodrigues" , "Joao Sa"]
spec.email = ["arturhoo@gmail.com", "me@joaomsa.com"]
spec.description = %q{Snapshots multiple organizations GitHub repositories, including wikis, and syncs them to Amazon's S3}
spec.summary = %q{Snapshots Github repositories}
spec.homepage = "https://github.com/innvent/github_snapshot"
spec.license = "MIT"
spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "pry"
spec.add_development_dependency "awesome_print"
spec.add_dependency "github_api", "~> 0.10.2"
end
Update github_api
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'github_snapshot/version'
Gem::Specification.new do |spec|
spec.name = "github_snapshot"
spec.version = GithubSnapshot::VERSION
spec.authors = ["Artur Rodrigues" , "Joao Sa"]
spec.email = ["arturhoo@gmail.com", "me@joaomsa.com"]
spec.description = %q{Snapshots multiple organizations GitHub repositories, including wikis, and syncs them to Amazon's S3}
spec.summary = %q{Snapshots Github repositories}
spec.homepage = "https://github.com/innvent/github_snapshot"
spec.license = "MIT"
spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "pry"
spec.add_development_dependency "awesome_print"
spec.add_dependency "github_api", "~> 0.11.3"
end
|
class Spades < Formula
desc "SPAdes: de novo genome assembly"
homepage "http://bioinf.spbau.ru/spades/"
url "http://spades.bioinf.spbau.ru/release3.9.0/SPAdes-3.9.0.tar.gz"
sha256 "77436ac5945aa8584d822b433464969a9f4937c0a55c866205655ce06a72ed29"
# tag "bioinformatics"
# doi "10.1089/cmb.2012.0021"
bottle do
cellar :any
sha256 "db0f5042ec56d0bcf08649ad10af20df27e2a8939a4944052734dfeef66fc353" => :el_capitan
sha256 "12dcca7fe98c66081ae8d830c4021a759138fba3bdafba95fd892dd6e11084d2" => :yosemite
sha256 "d4e258a0156efc3a38343409e9e2d7c9cd23f751233cd35bb60aa203b594e403" => :mavericks
end
depends_on "cmake" => :build
needs :openmp
fails_with :gcc => "4.7" do
cause "Compiling SPAdes requires GCC >= 4.7 for OpenMP 3.1 support"
end
depends_on "gcc" => :linked # needed for openmp
def install
mkdir "src/build" do
system "cmake", "..", *std_cmake_args
system "make", "install"
end
# Fix audit error "Non-executables were installed to bin"
inreplace bin/"spades_init.py" do |s|
s.sub! /^/, "#!/usr/bin/env python\n"
end
end
test do
system "spades.py", "--test"
end
end
spades: update 3.9.0 bottle for Linuxbrew.
class Spades < Formula
desc "SPAdes: de novo genome assembly"
homepage "http://bioinf.spbau.ru/spades/"
url "http://spades.bioinf.spbau.ru/release3.9.0/SPAdes-3.9.0.tar.gz"
sha256 "77436ac5945aa8584d822b433464969a9f4937c0a55c866205655ce06a72ed29"
# tag "bioinformatics"
# doi "10.1089/cmb.2012.0021"
bottle do
cellar :any
sha256 "db0f5042ec56d0bcf08649ad10af20df27e2a8939a4944052734dfeef66fc353" => :el_capitan
sha256 "12dcca7fe98c66081ae8d830c4021a759138fba3bdafba95fd892dd6e11084d2" => :yosemite
sha256 "d4e258a0156efc3a38343409e9e2d7c9cd23f751233cd35bb60aa203b594e403" => :mavericks
sha256 "45dd5265d7548493bc7305c68cf536b43286eb8fe918281d49b10b03097a76ba" => :x86_64_linux
end
depends_on "cmake" => :build
needs :openmp
fails_with :gcc => "4.7" do
cause "Compiling SPAdes requires GCC >= 4.7 for OpenMP 3.1 support"
end
depends_on "gcc" => :linked # needed for openmp
def install
mkdir "src/build" do
system "cmake", "..", *std_cmake_args
system "make", "install"
end
# Fix audit error "Non-executables were installed to bin"
inreplace bin/"spades_init.py" do |s|
s.sub! /^/, "#!/usr/bin/env python\n"
end
end
test do
system "spades.py", "--test"
end
end
|
class Spades < Formula
desc "SPAdes: de novo genome assembly"
homepage "http://bioinf.spbau.ru/spades/"
url "http://cab.spbu.ru/files/release3.10.1/SPAdes-3.10.1.tar.gz"
sha256 "d49dd9eb947767a14a9896072a1bce107fb8bf39ed64133a9e2f24fb1f240d96"
# tag "bioinformatics"
# doi "10.1089/cmb.2012.0021"
bottle do
cellar :any
sha256 "898f8697cb57f950face69caf5696fdf06147800e43188b4cf949310862cfa6e" => :sierra
sha256 "5291fc389c160dc8749fe6418e27b596b7f8497c2344d13130a95a790de00c65" => :el_capitan
sha256 "dbfa833dcc08a489a9219ff850974422d66608226e3bc8a20eec5044688785d3" => :yosemite
sha256 "364ae5611dbd81739318eec905a8fa17c0702e4dc0eeef4425a4fcd70913d339" => :x86_64_linux
end
depends_on "cmake" => :build
depends_on "gcc"
depends_on :python if OS.linux?
needs :openmp
fails_with :gcc => "4.7" do
cause "Compiling SPAdes requires GCC >= 4.7 for OpenMP 3.1 support"
end
def install
mkdir "src/build" do
system "cmake", "..", *std_cmake_args
system "make", "install"
end
end
test do
system "#{bin}/spades.py", "--test"
end
end
spades: update 3.10.1 bottle.
class Spades < Formula
desc "SPAdes: de novo genome assembly"
homepage "http://bioinf.spbau.ru/spades/"
url "http://cab.spbu.ru/files/release3.10.1/SPAdes-3.10.1.tar.gz"
sha256 "d49dd9eb947767a14a9896072a1bce107fb8bf39ed64133a9e2f24fb1f240d96"
# tag "bioinformatics"
# doi "10.1089/cmb.2012.0021"
bottle do
cellar :any
sha256 "caeb27819f1264a286a01af17c09749ec20c97653f892a4f81d7a4fcb0a2ad4f" => :sierra
sha256 "6000968edf4993330a35df019c08fc9521f57c5979ac0053a796f1d910ea9abc" => :el_capitan
sha256 "5e2b7cfbfb9e5e21362a221eb609a56e59d762f021364d3abd19f57eb8114132" => :yosemite
end
depends_on "cmake" => :build
depends_on "gcc"
depends_on :python if OS.linux?
needs :openmp
fails_with :gcc => "4.7" do
cause "Compiling SPAdes requires GCC >= 4.7 for OpenMP 3.1 support"
end
def install
mkdir "src/build" do
system "cmake", "..", *std_cmake_args
system "make", "install"
end
end
test do
system "#{bin}/spades.py", "--test"
end
end
|
class Spades < Formula
desc "SPAdes: de novo genome assembly"
homepage "http://bioinf.spbau.ru/spades/"
url "http://spades.bioinf.spbau.ru/release3.8.0/SPAdes-3.8.0.tar.gz"
sha256 "36e698546d3cfbbd26d8ddec13907c48025ccb2ca94803143398572dbfc90681"
# tag "bioinformatics"
# doi "10.1089/cmb.2012.0021"
bottle do
cellar :any
sha256 "36d8ecf7aaa2a9ae1082404d613bb7f2a74e6105191f405c5c61875f7ab5d1f7" => :el_capitan
sha256 "13bce60a596f206c649a3612c9fee84eee9f81a17a2c60f181211d23d10fe8a5" => :yosemite
sha256 "a6b955e62b6824b45efa3784fdacf542c380573f0a83236043fa963cddfb951c" => :mavericks
end
depends_on "cmake" => :build
needs :openmp
fails_with :gcc => "4.7" do
cause "Compiling SPAdes requires GCC >= 4.7 for OpenMP 3.1 support"
end
def install
mkdir "src/build" do
system "cmake", "..", *std_cmake_args
system "make", "install"
end
# Fix audit error "Non-executables were installed to bin"
inreplace bin/"spades_init.py" do |s|
s.sub! /^/, "#!/usr/bin/env python\n"
end
end
test do
system "spades.py", "--test"
end
end
homebrew/science/spades: update 3.8.0 bottle.
class Spades < Formula
desc "SPAdes: de novo genome assembly"
homepage "http://bioinf.spbau.ru/spades/"
url "http://spades.bioinf.spbau.ru/release3.8.0/SPAdes-3.8.0.tar.gz"
sha256 "36e698546d3cfbbd26d8ddec13907c48025ccb2ca94803143398572dbfc90681"
# tag "bioinformatics"
# doi "10.1089/cmb.2012.0021"
bottle do
cellar :any
sha256 "cd62c5f0d7e4b1448cc6add95c57d93ef804b82b29667836553dfb5f7684e978" => :el_capitan
sha256 "8b57ca106ce3c9e46151efbf10bc1befdf0a666e9ad7d920234502609dbbd005" => :yosemite
sha256 "7d644a773b9c4ecabecb711f8e10933e978bc542cc155a0a6c9d851d72c57780" => :mavericks
end
depends_on "cmake" => :build
needs :openmp
fails_with :gcc => "4.7" do
cause "Compiling SPAdes requires GCC >= 4.7 for OpenMP 3.1 support"
end
def install
mkdir "src/build" do
system "cmake", "..", *std_cmake_args
system "make", "install"
end
# Fix audit error "Non-executables were installed to bin"
inreplace bin/"spades_init.py" do |s|
s.sub! /^/, "#!/usr/bin/env python\n"
end
end
test do
system "spades.py", "--test"
end
end
|
# frozen_string_literal: true
class PushUpdateWorker
include Sidekiq::Worker
def perform(timeline, account_id, status_id)
account = Account.find(account_id)
status = Status.find(status_id)
message = Rabl::Renderer.new(
'api/v1/statuses/show',
status,
view_path: 'app/views',
format: :json,
scope: InlineRablScope.new(account)
)
ActionCable.server.broadcast("timeline:#{account_id}", type: 'update', timeline: timeline, message: message.render)
end
end
Add proper message to PushUpdateWorker, use redis directly
# frozen_string_literal: true
class PushUpdateWorker
include Sidekiq::Worker
def perform(timeline, account_id, status_id)
account = Account.find(account_id)
status = Status.find(status_id)
message = Rabl::Renderer.new(
'api/v1/statuses/show',
status,
view_path: 'app/views',
format: :json,
scope: InlineRablScope.new(account)
)
Redis.current.publish("timeline:#{timeline_id}", Oj.dump({ event: :update, payload: message, queued_at: (Time.now.to_f * 1000.0).to_i }))
rescue ActiveRecord::RecordNotFound
true
end
end
|
Gem::Specification.new do |s|
s.name = "google_currency"
s.version = "0.0.1"
s.platform = Gem::Platform::RUBY
s.authors = ["Shane Emmons"]
s.email = ["semmons99+RubyMoney@gmail.com"]
s.homepage = "http://rubymoney.github.com/google_currency"
s.summary = "Access the Google Currency exchange rate data."
s.description = "GoogleCurrency extends Money::Bank::Base and gives you access to the current Google Currency exchange rates."
s.required_rubygems_version = ">= 1.3.7"
s.rubyforge_project = "google_currency"
s.add_development_dependency "rspec", ">= 1.3.0"
s.add_development_dependency "yard", ">= 0.5.8"
s.add_dependency "money", ">= 3.1.0"
s.add_dependency "nokogiri", ">= 1.4.3.1"
s.files = Dir.glob("lib/**/*") + %w(LICENSE README.md CHANGELOG)
s.require_path = "lib"
end
remove nokogiri dependency
Gem::Specification.new do |s|
s.name = "google_currency"
s.version = "0.0.1"
s.platform = Gem::Platform::RUBY
s.authors = ["Shane Emmons"]
s.email = ["semmons99+RubyMoney@gmail.com"]
s.homepage = "http://rubymoney.github.com/google_currency"
s.summary = "Access the Google Currency exchange rate data."
s.description = "GoogleCurrency extends Money::Bank::Base and gives you access to the current Google Currency exchange rates."
s.required_rubygems_version = ">= 1.3.7"
s.rubyforge_project = "google_currency"
s.add_development_dependency "rspec", ">= 1.3.0"
s.add_development_dependency "yard", ">= 0.5.8"
s.add_dependency "money", ">= 3.1.0"
s.files = Dir.glob("lib/**/*") + %w(LICENSE README.md CHANGELOG)
s.require_path = "lib"
end
|
module XYZ
class TaskActionBase < HashObject
#implemented functions
def serialize_for_task()
end
#returns [adapter_type,adapter_name], adapter name optional in which it wil be looked up from config
def ret_command_and_control_adapter_info()
nil
end
end
module TaskAction
module Result
class ResultBase < HashObject
def initialize(hash)
super(hash)
self[:result_type] = Aux.demodulize(self.class.to_s)
end
end
class Succeeded < ResultBase
def initialize(hash)
super(hash)
end
end
class Failed < ResultBase
def initialize(error_class)
#TODO: put error params in by invoking e.to_hash
super(:error_type => Aux.demodulize(error_class.class.to_s))
end
end
end
class TaskActionNode < TaskActionBase
def attributes_to_set()
Array.new
end
def get_and_update_attributes(task_mh)
#find attributes that can be updated
#TODO: right now being conservative in including attributes that may not need to be set
indexed_attrs_to_update = Hash.new
(self[:component_actions]||[]).each do |action|
(action[:attributes]||[]).each do |attr|
if attr[:port_is_external] and attr[:port_type] == "input" and not attr[:value_asserted]
indexed_attrs_to_update[attr[:id]] = attr
end
end
end
return nil if indexed_attrs_to_update.empty?
search_pattern_hash = {
:relation => :attribute,
:filter => [:and,[:oneof, :id, indexed_attrs_to_update.keys]],
:columns => [:id,:value_derived]
}
new_attr_vals = Model.get_objects_from_search_pattern_hash(task_mh.createMH(:model_name => :attribute),search_pattern_hash)
new_attr_vals.each do |a|
attr = indexed_attrs_to_update[a[:id]]
#TODO: once explictly have attr[:attribute_value] need to override
attr[:attribute_value] = attr[:value_derived] = a[:value_derived]
end
end
def update_state_change_status_aux(task_mh,status,state_change_ids)
rows = state_change_ids.map{|id|{:id => id, :status => status.to_s}}
state_change_mh = task_mh.createMH(:model_name => :state_change)
Model.update_from_rows(state_change_mh,rows)
end
end
class CreateNode < TaskActionNode
def initialize(state_change)
hash = {
:state_change_id => state_change[:id],
:attributes => Array.new,
:node => state_change[:node],
:image => state_change[:image]
}
super(hash)
end
def add_attribute!(attr)
self[:attributes] << attr
end
def attributes_to_set()
self[:attributes].reject{|a| not a[:dynamic]}
end
def ret_command_and_control_adapter_info()
#TBD: stubbing ec2
[:iaas,:ec2]
end
def save_new_node_info(task_mh)
node = self[:node]
hash = {
:external_ref => node[:external_ref],
:type => "instance"
}
node_idh = task_mh.createIDH(:model_name => :node, :id => node[:id])
Model.update_from_hash_assignments(node_idh,hash)
end
def update_state_change_status(task_mh,status)
update_state_change_status_aux(task_mh,status,[self[:state_change_id]])
end
def self.add_attributes!(attr_mh,action_list)
indexed_actions = Hash.new
action_list.each{|a|indexed_actions[a[:node][:id]] = a}
return nil if indexed_actions.empty?
node_ids = action_list.map{|x|x[:node][:id]}
parent_field_name = DB.parent_field(:node,:attribute)
search_pattern_hash = {
:relation => :attribute,
:filter => [:and,
[:eq, :dynamic, true],
[:oneof, parent_field_name, indexed_actions.keys]],
:columns => [:id,:display_name,parent_field_name,:external_ref,:attribute_value,:required,:dynamic]
}
attrs = Model.get_objects_from_search_pattern_hash(attr_mh,search_pattern_hash)
attrs.each do |attr|
action = indexed_actions[attr[parent_field_name]]
action.add_attribute!(attr)
end
end
def create_node_config_agent_type
self[:config_agent_type]
end
end
class ConfigNode < TaskActionNode
def self.add_attributes!(attr_mh,action_list)
indexed_actions = Hash.new
action_list.each do |config_node_action|
(config_node_action[:component_actions]||[]).each{|a|indexed_actions[a[:component][:id]] = a}
end
return nil if indexed_actions.empty?
parent_field_name = DB.parent_field(:component,:attribute)
search_pattern_hash = {
:relation => :attribute,
:filter => [:and,
[:oneof, parent_field_name, indexed_actions.keys]],
:columns => [:id,:display_name,parent_field_name,:external_ref,:attribute_value,:required,:dynamic,:port_type,:port_is_external]
}
attrs = Model.get_objects_from_search_pattern_hash(attr_mh,search_pattern_hash)
attrs.each do |attr|
action = indexed_actions[attr[parent_field_name]]
action.add_attribute!(attr)
end
end
def get_and_update_attributes(task_mh)
#TODO: may treat updating node as regular attribute
#no up if already have the node's external ref
unless ((self[:node]||{})[:external_ref]||{})[:instance_id]
node_id = (self[:node]||{})[:id]
if node_id
node_info = Model.get_object_columns(task_mh.createIDH(:id => node_id, :model_name => :node),[:external_ref])
self[:node][:external_ref] = node_info[:external_ref]
else
Log.error("cannot update task action's node id because do not have its id")
end
end
super(task_mh)
end
def ret_command_and_control_adapter_info()
#TBD: stub
[:node_config,nil]
end
def update_state_change_status(task_mh,status)
update_state_change_status_aux(task_mh,status,self[:component_actions].map{|x|x[:state_change_pointer_ids]}.flatten)
end
private
def initialize(on_node_state_changes)
sample_state_change = on_node_state_changes.first
node = sample_state_change[:node]
hash = {
:node => node,
:config_agent_type => on_node_state_changes.first.on_node_config_agent_type,
:component_actions => ComponentAction.order_and_group_by_component(on_node_state_changes)
}
super(hash)
end
end
class ComponentAction < HashObject
def self.order_and_group_by_component(state_change_list)
#TODO: stub for ordering that just takes order in which component state changes made
component_ids = state_change_list.map{|a|a[:component][:id]}.uniq
component_ids.map do |component_id|
self.create(state_change_list.reject{|a|not a[:component][:id] == component_id})
end
end
def add_attribute!(attr)
self[:attributes] << attr
end
private
def self.create(state_changes_same_component)
state_change = state_changes_same_component.first
hash = {
:state_change_pointer_ids => (state_changes_same_component||[]).map{|sc|sc[:id]},
:attributes => Array.new,
:component => state_change[:component],
:state_change_type => state_change[:type],
:id => state_change[:id], #TODO: is this needed? or should it be called state_change_id
:on_node_config_agent_type => state_change.on_node_config_agent_type(),
}
self.new(hash)
end
end
end
end
some cleanup on task actions
module XYZ
class TaskActionBase < HashObject
#implemented functions
def serialize_for_task()
end
#returns [adapter_type,adapter_name], adapter name optional in which it wil be looked up from config
def ret_command_and_control_adapter_info()
nil
end
end
module TaskAction
module Result
class ResultBase < HashObject
def initialize(hash)
super(hash)
self[:result_type] = Aux.demodulize(self.class.to_s)
end
end
class Succeeded < ResultBase
def initialize(hash)
super(hash)
end
end
class Failed < ResultBase
def initialize(error_class)
#TODO: put error params in by invoking e.to_hash
super(:error_type => Aux.demodulize(error_class.class.to_s))
end
end
end
class TaskActionNode < TaskActionBase
def attributes_to_set()
Array.new
end
def get_and_update_attributes(task_mh)
#find attributes that can be updated
#TODO: right now being conservative in including attributes that may not need to be set
indexed_attrs_to_update = Hash.new
(self[:component_actions]||[]).each do |action|
(action[:attributes]||[]).each do |attr|
if attr[:port_is_external] and attr[:port_type] == "input" and not attr[:value_asserted]
indexed_attrs_to_update[attr[:id]] = attr
end
end
end
return nil if indexed_attrs_to_update.empty?
search_pattern_hash = {
:relation => :attribute,
:filter => [:and,[:oneof, :id, indexed_attrs_to_update.keys]],
:columns => [:id,:value_derived]
}
new_attr_vals = Model.get_objects_from_search_pattern_hash(task_mh.createMH(:model_name => :attribute),search_pattern_hash)
new_attr_vals.each do |a|
attr = indexed_attrs_to_update[a[:id]]
#TODO: once explictly have attr[:attribute_value] need to override
attr[:attribute_value] = attr[:value_derived] = a[:value_derived]
end
end
def update_state_change_status_aux(task_mh,status,state_change_ids)
rows = state_change_ids.map{|id|{:id => id, :status => status.to_s}}
state_change_mh = task_mh.createMH(:model_name => :state_change)
Model.update_from_rows(state_change_mh,rows)
end
end
class CreateNode < TaskActionNode
def initialize(state_change)
hash = {
:state_change_id => state_change[:id],
:state_change_types => [state_change[:type]],
:attributes => Array.new,
:node => state_change[:node],
:image => state_change[:image]
}
super(hash)
end
def add_attribute!(attr)
self[:attributes] << attr
end
def attributes_to_set()
self[:attributes].reject{|a| not a[:dynamic]}
end
def ret_command_and_control_adapter_info()
#TBD: stubbing ec2
[:iaas,:ec2]
end
def save_new_node_info(task_mh)
node = self[:node]
hash = {
:external_ref => node[:external_ref],
:type => "instance"
}
node_idh = task_mh.createIDH(:model_name => :node, :id => node[:id])
Model.update_from_hash_assignments(node_idh,hash)
end
def update_state_change_status(task_mh,status)
update_state_change_status_aux(task_mh,status,[self[:state_change_id]])
end
def self.add_attributes!(attr_mh,action_list)
indexed_actions = Hash.new
action_list.each{|a|indexed_actions[a[:node][:id]] = a}
return nil if indexed_actions.empty?
node_ids = action_list.map{|x|x[:node][:id]}
parent_field_name = DB.parent_field(:node,:attribute)
search_pattern_hash = {
:relation => :attribute,
:filter => [:and,
[:eq, :dynamic, true],
[:oneof, parent_field_name, indexed_actions.keys]],
:columns => [:id,:display_name,parent_field_name,:external_ref,:attribute_value,:required,:dynamic]
}
attrs = Model.get_objects_from_search_pattern_hash(attr_mh,search_pattern_hash)
attrs.each do |attr|
action = indexed_actions[attr[parent_field_name]]
action.add_attribute!(attr)
end
end
def create_node_config_agent_type
self[:config_agent_type]
end
end
class ConfigNode < TaskActionNode
def self.add_attributes!(attr_mh,action_list)
indexed_actions = Hash.new
action_list.each do |config_node_action|
(config_node_action[:component_actions]||[]).each{|a|indexed_actions[a[:component][:id]] = a}
end
return nil if indexed_actions.empty?
parent_field_name = DB.parent_field(:component,:attribute)
search_pattern_hash = {
:relation => :attribute,
:filter => [:and,
[:oneof, parent_field_name, indexed_actions.keys]],
:columns => [:id,:display_name,parent_field_name,:external_ref,:attribute_value,:required,:dynamic,:port_type,:port_is_external]
}
attrs = Model.get_objects_from_search_pattern_hash(attr_mh,search_pattern_hash)
attrs.each do |attr|
action = indexed_actions[attr[parent_field_name]]
action.add_attribute!(attr)
end
end
def get_and_update_attributes(task_mh)
#TODO: may treat updating node as regular attribute
#no up if already have the node's external ref
unless ((self[:node]||{})[:external_ref]||{})[:instance_id]
node_id = (self[:node]||{})[:id]
if node_id
node_info = Model.get_object_columns(task_mh.createIDH(:id => node_id, :model_name => :node),[:external_ref])
self[:node][:external_ref] = node_info[:external_ref]
else
Log.error("cannot update task action's node id because do not have its id")
end
end
super(task_mh)
end
def ret_command_and_control_adapter_info()
#TBD: stub
[:node_config,nil]
end
def update_state_change_status(task_mh,status)
update_state_change_status_aux(task_mh,status,self[:component_actions].map{|x|x[:state_change_pointer_ids]}.flatten)
end
private
def initialize(on_node_state_changes)
sample_state_change = on_node_state_changes.first
node = sample_state_change[:node]
hash = {
:node => node,
:state_change_types => on_node_state_changes.map{|sc|sc[:type]},
:config_agent_type => on_node_state_changes.first.on_node_config_agent_type,
:component_actions => ComponentAction.order_and_group_by_component(on_node_state_changes)
}
super(hash)
end
end
class ComponentAction < HashObject
def self.order_and_group_by_component(state_change_list)
#TODO: stub for ordering that just takes order in which component state changes made
component_ids = state_change_list.map{|a|a[:component][:id]}.uniq
component_ids.map do |component_id|
self.create(state_change_list.reject{|a|not a[:component][:id] == component_id})
end
end
def add_attribute!(attr)
self[:attributes] << attr
end
private
def self.create(state_changes_same_component)
state_change = state_changes_same_component.first
hash = {
:state_change_pointer_ids => (state_changes_same_component||[]).map{|sc|sc[:id]},
:attributes => Array.new,
:component => state_change[:component],
:on_node_config_agent_type => state_change.on_node_config_agent_type(),
}
self.new(hash)
end
end
end
end
|
module Astute
class Orchestrator
def initialize
@deployer = Astute::Deployer.method(:puppet_deploy_with_polling)
@metapublisher = Astute::Metadata.method(:publish_facts)
@check_network = Astute::Network.method(:check_network)
end
def node_type(reporter, task_id, nodes)
context = Context.new(task_id, reporter)
uids = nodes.map {|n| n['uid']}
systemtype = MClient.new(context, "systemtype", uids, check_result=false)
systems = systemtype.get_type
return systems.map {|n| {'uid' => n.results[:sender], 'node_type' => n.results[:data][:node_type].chomp}}
end
def deploy(reporter, task_id, nodes)
context = Context.new(task_id, reporter)
ctrl_nodes = nodes.select {|n| n['role'] == 'controller'}
deploy_piece(context, ctrl_nodes)
reporter.report({'progress' => 40})
compute_nodes = nodes.select {|n| n['role'] == 'compute'}
deploy_piece(context, compute_nodes)
reporter.report({'progress' => 60})
other_nodes = nodes - ctrl_nodes - compute_nodes
deploy_piece(context, other_nodes)
return
end
def remove_nodes(reporter, task_id, nodes)
context = Context.new(task_id, reporter)
result = simple_remove_nodes(context, nodes)
return result
end
def verify_networks(reporter, task_id, nodes, networks)
context = Context.new(task_id, reporter)
result = @check_network.call(context, nodes, networks)
if result.empty?
return {'status' => 'error', 'error' => "At least two nodes are required to check network connectivity."}
end
result.map! { |node| {'uid' => node['sender'],
'networks' => check_vlans_by_traffic(node['data'][:neighbours]) }
}
return {'networks' => result}
end
private
def simple_remove_nodes(ctx, nodes)
if nodes.empty?
Astute.logger.info "#{ctx.task_id}: Nodes to remove are not provided. Do nothing."
return {'nodes' => nodes}
end
uids = nodes.map {|n| n['uid'].to_s}
Astute.logger.info "#{ctx.task_id}: Starting removing of nodes: #{uids.inspect}"
remover = MClient.new(ctx, "erase_node", uids, check_result=false)
result = remover.erase_node(:reboot => true)
Astute.logger.debug "#{ctx.task_id}: Data resieved from nodes: #{result.inspect}"
inaccessible_uids = uids - result.map {|n| n.results[:sender]}
error_nodes = []
erased_nodes = []
result.each do |n|
if n.results[:statuscode] != 0
error_nodes << {'uid' => n.results[:sender],
'error' => "RPC agent 'erase_node' failed. Result: #{n.results.inspect}"}
elsif not n.results[:data][:rebooted]
error_nodes << {'uid' => n.results[:sender],
'error' => "RPC method 'erase_node' failed with message: #{n.results[:data][:error_msg]}"}
else
erased_nodes << {'uid' => n.results[:sender]}
end
end
error_nodes.concat(inaccessible_uids.map {|n| {'uid' => n, 'error' => "Node not answered by RPC."}})
if error_nodes.empty?
answer = {'nodes' => erased_nodes}
else
answer = {'status' => 'error', 'nodes' => erased_nodes, 'error_nodes' => error_nodes}
Astute.logger.error "#{ctx.task_id}: Removing of nodes #{uids.inspect} ends with errors: #{error_nodes.inspect}"
end
Astute.logger.info "#{ctx.task_id}: Finished removing of nodes: #{uids.inspect}"
return answer
end
def deploy_piece(ctx, nodes)
nodes_roles = nodes.map { |n| { n['uid'] => n['role'] } }
Astute.logger.info "#{ctx.task_id}: Starting deployment of nodes => roles: #{nodes_roles.inspect}"
ctx.reporter.report nodes_status(nodes, 'deploying')
@metapublisher.call(ctx, nodes)
@deployer.call(ctx, nodes)
ctx.reporter.report nodes_status(nodes, 'ready')
Astute.logger.info "#{ctx.task_id}: Finished deployment of nodes => roles: #{nodes_roles.inspect}"
end
def nodes_status(nodes, status)
{'nodes' => nodes.map { |n| {'uid' => n['uid'], 'status' => status} }}
end
def check_vlans_by_traffic(data)
return data.map{|iface, vlans| {'iface' => iface, 'vlans' => vlans.keys.map{|n| n.to_i} } }
end
end
end
[astute] Fix wrong network_check behaviour when some vlans broken.
module Astute
class Orchestrator
def initialize
@deployer = Astute::Deployer.method(:puppet_deploy_with_polling)
@metapublisher = Astute::Metadata.method(:publish_facts)
@check_network = Astute::Network.method(:check_network)
end
def node_type(reporter, task_id, nodes)
context = Context.new(task_id, reporter)
uids = nodes.map {|n| n['uid']}
systemtype = MClient.new(context, "systemtype", uids, check_result=false)
systems = systemtype.get_type
return systems.map {|n| {'uid' => n.results[:sender], 'node_type' => n.results[:data][:node_type].chomp}}
end
def deploy(reporter, task_id, nodes)
context = Context.new(task_id, reporter)
ctrl_nodes = nodes.select {|n| n['role'] == 'controller'}
deploy_piece(context, ctrl_nodes)
reporter.report({'progress' => 40})
compute_nodes = nodes.select {|n| n['role'] == 'compute'}
deploy_piece(context, compute_nodes)
reporter.report({'progress' => 60})
other_nodes = nodes - ctrl_nodes - compute_nodes
deploy_piece(context, other_nodes)
return
end
def remove_nodes(reporter, task_id, nodes)
context = Context.new(task_id, reporter)
result = simple_remove_nodes(context, nodes)
return result
end
def verify_networks(reporter, task_id, nodes, networks)
context = Context.new(task_id, reporter)
result = @check_network.call(context, nodes, networks)
if result.empty?
return {'status' => 'error', 'error' => "At least two nodes are required to check network connectivity."}
end
result.map! { |node| {'uid' => node['sender'],
'networks' => check_vlans_by_traffic(node['sender'], node['data'][:neighbours]) }
}
return {'networks' => result}
end
private
def simple_remove_nodes(ctx, nodes)
if nodes.empty?
Astute.logger.info "#{ctx.task_id}: Nodes to remove are not provided. Do nothing."
return {'nodes' => nodes}
end
uids = nodes.map {|n| n['uid'].to_s}
Astute.logger.info "#{ctx.task_id}: Starting removing of nodes: #{uids.inspect}"
remover = MClient.new(ctx, "erase_node", uids, check_result=false)
result = remover.erase_node(:reboot => true)
Astute.logger.debug "#{ctx.task_id}: Data resieved from nodes: #{result.inspect}"
inaccessible_uids = uids - result.map {|n| n.results[:sender]}
error_nodes = []
erased_nodes = []
result.each do |n|
if n.results[:statuscode] != 0
error_nodes << {'uid' => n.results[:sender],
'error' => "RPC agent 'erase_node' failed. Result: #{n.results.inspect}"}
elsif not n.results[:data][:rebooted]
error_nodes << {'uid' => n.results[:sender],
'error' => "RPC method 'erase_node' failed with message: #{n.results[:data][:error_msg]}"}
else
erased_nodes << {'uid' => n.results[:sender]}
end
end
error_nodes.concat(inaccessible_uids.map {|n| {'uid' => n, 'error' => "Node not answered by RPC."}})
if error_nodes.empty?
answer = {'nodes' => erased_nodes}
else
answer = {'status' => 'error', 'nodes' => erased_nodes, 'error_nodes' => error_nodes}
Astute.logger.error "#{ctx.task_id}: Removing of nodes #{uids.inspect} ends with errors: #{error_nodes.inspect}"
end
Astute.logger.info "#{ctx.task_id}: Finished removing of nodes: #{uids.inspect}"
return answer
end
def deploy_piece(ctx, nodes)
nodes_roles = nodes.map { |n| { n['uid'] => n['role'] } }
Astute.logger.info "#{ctx.task_id}: Starting deployment of nodes => roles: #{nodes_roles.inspect}"
ctx.reporter.report nodes_status(nodes, 'deploying')
@metapublisher.call(ctx, nodes)
@deployer.call(ctx, nodes)
ctx.reporter.report nodes_status(nodes, 'ready')
Astute.logger.info "#{ctx.task_id}: Finished deployment of nodes => roles: #{nodes_roles.inspect}"
end
def nodes_status(nodes, status)
{'nodes' => nodes.map { |n| {'uid' => n['uid'], 'status' => status} }}
end
def check_vlans_by_traffic(uid, data)
return data.map{|iface, vlans| {'iface' => iface, 'vlans' => vlans.reject{|k,v| v.size==1 and v.has_key?(uid)}.keys.map{|n| n.to_i} } }
end
end
end
|
require "selenium-webdriver"
require "rspec"
describe "Blazedemo" do
before(:each) do
@driver = Selenium::WebDriver.for :firefox
@base_url = "http://blazedemo.com"
@accept_next_alert = true
@driver.manage.timeouts.implicit_wait = 30
end
after(:each) do
@driver.quit
end
it "blazedemo.com example" do
@driver.get(@base_url + "/purchase.php")
@driver.find_element(:id, "inputName").clear
@driver.find_element(:id, "inputName").send_keys "First Last"
@driver.find_element(:id, "inputName").send_keys :return
sleep 1.0
end
end
fix tests (#1556)
require "selenium-webdriver"
require "rspec"
describe "Blazedemo" do
before(:each) do
@driver = Selenium::WebDriver.for :chrome
@base_url = "http://blazedemo.com"
@accept_next_alert = true
@driver.manage.timeouts.implicit_wait = 30
end
after(:each) do
@driver.quit
end
it "blazedemo.com example" do
@driver.get(@base_url + "/purchase.php")
@driver.find_element(:id, "inputName").clear
@driver.find_element(:id, "inputName").send_keys "First Last"
@driver.find_element(:id, "inputName").send_keys :return
sleep 1.0
end
end
|
# -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'carrierwave-imageoptimizer/version'
Gem::Specification.new do |gem|
gem.name = "carrierwave-imageoptimizer"
gem.version = CarrierWave::ImageOptimizer::VERSION
gem.authors = ["Julian Tescher"]
gem.email = ["jatescher@gmail.com"]
gem.description = %q{A simple image optimizer for CarrierWave}
gem.summary = %q{Simply optimize CarrierWave images via jpegoptim or optipng}
gem.homepage = "https://github.com/jtescher/carrierwave-imageoptimizer"
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
gem.license = 'MIT'
gem.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') if $0 =~ /gem\z/
gem.cert_chain = ['gem-public_cert.pem']
gem.add_dependency "carrierwave", ["~> 0.8"]
gem.add_dependency "image_optimizer", ["~> 1.1.0"]
gem.add_development_dependency "rspec", "~> 2.14.1"
gem.add_development_dependency "rake", "~> 10.1.0"
gem.add_development_dependency "simplecov", "~> 0.7.1"
gem.add_development_dependency "coveralls", "~> 0.6.7"
end
Relax image_optimizer version dependency
# -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'carrierwave-imageoptimizer/version'
Gem::Specification.new do |gem|
gem.name = "carrierwave-imageoptimizer"
gem.version = CarrierWave::ImageOptimizer::VERSION
gem.authors = ["Julian Tescher"]
gem.email = ["jatescher@gmail.com"]
gem.description = %q{A simple image optimizer for CarrierWave}
gem.summary = %q{Simply optimize CarrierWave images via jpegoptim or optipng}
gem.homepage = "https://github.com/jtescher/carrierwave-imageoptimizer"
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
gem.license = 'MIT'
gem.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') if $0 =~ /gem\z/
gem.cert_chain = ['gem-public_cert.pem']
gem.add_dependency "carrierwave", ["~> 0.8"]
gem.add_dependency "image_optimizer", ["~> 1.1"]
gem.add_development_dependency "rspec", "~> 2.14.1"
gem.add_development_dependency "rake", "~> 10.1.0"
gem.add_development_dependency "simplecov", "~> 0.7.1"
gem.add_development_dependency "coveralls", "~> 0.6.7"
end
|
# Copyright (C) 2014-2015 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
module Gtk
class Loader < GObjectIntrospection::Loader
def initialize(base_module, init_arguments)
super(base_module)
@init_arguments = init_arguments
end
private
def pre_load(repository, namespace)
call_init_function(repository, namespace)
define_stock_module
setup_pending_constants
end
def call_init_function(repository, namespace)
init_check = repository.find(namespace, "init_check")
arguments = [
[$0] + @init_arguments,
]
succeeded, argv, error = init_check.invoke(:arguments => arguments)
@init_arguments.replace(argv[1..-1])
raise error unless succeeded
end
def define_stock_module
@stock_module = Module.new
@base_module.const_set("Stock", @stock_module)
end
def level_bar_class
@level_bar_class ||= @base_module.const_get(:LevelBar)
end
def post_load(repository, namespace)
apply_pending_constants
require_extension
require_libraries
end
def require_extension
begin
major, minor, _ = RUBY_VERSION.split(/\./)
require "#{major}.#{minor}/gtk3.so"
rescue LoadError
require "gtk3.so"
end
end
def require_libraries
require "gtk3/box"
require "gtk3/button"
require "gtk3/border"
require "gtk3/builder"
require "gtk3/container"
require "gtk3/css-provider"
require "gtk3/gtk"
require "gtk3/icon-theme"
require "gtk3/image"
require "gtk3/label"
require "gtk3/level-bar"
require "gtk3/menu-item"
require "gtk3/scrolled-window"
require "gtk3/search-bar"
require "gtk3/spin-button"
require "gtk3/stack"
require "gtk3/style-properties"
require "gtk3/text-buffer"
require "gtk3/tree-iter"
require "gtk3/tree-model"
require "gtk3/tree-selection"
require "gtk3/tree-store"
require "gtk3/tree-view-column"
require "gtk3/ui-manager"
require "gtk3/window"
require "gtk3/deprecated"
end
def rubyish_method_name(function_info, options={})
name = super
case name
when "forall"
"each_all"
else
name
end
end
def load_function_info(info)
name = info.name
case name
when "init", /_get_type\z/
# ignore
else
super
end
end
def define_enum(info)
case info.name
when /\AArrow/
self.class.define_class(info.gtype, $POSTMATCH, Gtk::Arrow)
when /\ALevelBar/
self.class.define_class(info.gtype, $POSTMATCH, Gtk::LevelBar)
when /\ARevealer/
self.class.define_class(info.gtype, $POSTMATCH, Gtk::Revealer)
when /\AStack/
self.class.define_class(info.gtype, $POSTMATCH, Gtk::Stack)
else
super
end
end
def load_method_info(info, klass, method_name)
if klass.name == "Gtk::Image"
method_name = method_name.gsub(/\Agicon/, "icon")
end
super(info, klass, method_name)
end
def load_constant_info(info)
case info.name
when /\ASTOCK_/
@stock_module.const_set($POSTMATCH, info.value)
when /\ALEVEL_BAR_/
@pending_constants << info
else
super
end
end
def setup_pending_constants
@pending_constants = []
end
def apply_pending_constants
@pending_constants.each do |info|
case info.name
when /\ALEVEL_BAR_/
level_bar_class.const_set($POSTMATCH, info.value)
end
end
end
end
end
gtk3: bind Gtk::Stock singleton methods
But almost of them doesn't work. Use Gtk::IconTheme instead.
# Copyright (C) 2014-2015 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
module Gtk
class Loader < GObjectIntrospection::Loader
def initialize(base_module, init_arguments)
super(base_module)
@init_arguments = init_arguments
end
private
def pre_load(repository, namespace)
call_init_function(repository, namespace)
define_stock_module
setup_pending_constants
end
def call_init_function(repository, namespace)
init_check = repository.find(namespace, "init_check")
arguments = [
[$0] + @init_arguments,
]
succeeded, argv, error = init_check.invoke(:arguments => arguments)
@init_arguments.replace(argv[1..-1])
raise error unless succeeded
end
def define_stock_module
@stock_module = Module.new
@base_module.const_set("Stock", @stock_module)
end
def level_bar_class
@level_bar_class ||= @base_module.const_get(:LevelBar)
end
def post_load(repository, namespace)
apply_pending_constants
require_extension
require_libraries
end
def require_extension
begin
major, minor, _ = RUBY_VERSION.split(/\./)
require "#{major}.#{minor}/gtk3.so"
rescue LoadError
require "gtk3.so"
end
end
def require_libraries
require "gtk3/box"
require "gtk3/button"
require "gtk3/border"
require "gtk3/builder"
require "gtk3/container"
require "gtk3/css-provider"
require "gtk3/gtk"
require "gtk3/icon-theme"
require "gtk3/image"
require "gtk3/label"
require "gtk3/level-bar"
require "gtk3/menu-item"
require "gtk3/scrolled-window"
require "gtk3/search-bar"
require "gtk3/spin-button"
require "gtk3/stack"
require "gtk3/style-properties"
require "gtk3/text-buffer"
require "gtk3/tree-iter"
require "gtk3/tree-model"
require "gtk3/tree-selection"
require "gtk3/tree-store"
require "gtk3/tree-view-column"
require "gtk3/ui-manager"
require "gtk3/window"
require "gtk3/deprecated"
end
def rubyish_method_name(function_info, options={})
name = super
case name
when "forall"
"each_all"
else
name
end
end
def load_function_info(info)
name = info.name
case name
when "init", /_get_type\z/
# ignore
when /\Astock_/
stock_module = @base_module.const_get(:Stock)
method_name = rubyish_method_name(info, :prefix => "stock_")
define_singleton_method(stock_module, method_name, info)
else
super
end
end
def define_enum(info)
case info.name
when /\AArrow/
self.class.define_class(info.gtype, $POSTMATCH, Gtk::Arrow)
when /\ALevelBar/
self.class.define_class(info.gtype, $POSTMATCH, Gtk::LevelBar)
when /\ARevealer/
self.class.define_class(info.gtype, $POSTMATCH, Gtk::Revealer)
when /\AStack/
self.class.define_class(info.gtype, $POSTMATCH, Gtk::Stack)
else
super
end
end
def load_method_info(info, klass, method_name)
if klass.name == "Gtk::Image"
method_name = method_name.gsub(/\Agicon/, "icon")
end
super(info, klass, method_name)
end
def load_constant_info(info)
case info.name
when /\ASTOCK_/
@stock_module.const_set($POSTMATCH, info.value)
when /\ALEVEL_BAR_/
@pending_constants << info
else
super
end
end
def setup_pending_constants
@pending_constants = []
end
def apply_pending_constants
@pending_constants.each do |info|
case info.name
when /\ALEVEL_BAR_/
level_bar_class.const_set($POSTMATCH, info.value)
end
end
end
end
end
|
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'guard/haml_lint/version'
Gem::Specification.new do |spec|
spec.name = 'guard-haml_lint'
spec.version = Guard::HamlLintVersion::VERSION
spec.authors = ['y@su']
spec.email = ['toyasyu@gmail.com']
spec.summary = 'Guard plugin for HAML-Lint'
spec.description = 'Guard::HamlLint automatically runs Haml Lint tools.'
spec.homepage = 'https://github.com/yatmsu/guard-haml-lint'
spec.files = `git ls-files`.split("\n")
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
spec.executables = `git ls-files -- exe/*`.split("\n").map{ |f| File.basename(f) }
spec.require_paths = ['lib']
spec.required_ruby_version = '>= 2.0.0'
spec.add_dependency 'guard', '~> 2.2'
spec.add_dependency 'guard-compat', '~> 1.1'
spec.add_runtime_dependency 'haml_lint', '~> 0.15.2'
spec.add_development_dependency 'bundler', '>= 1.0.0'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec'
end
fix require path
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'guard/hamllint/version'
Gem::Specification.new do |spec|
spec.name = 'guard-haml_lint'
spec.version = Guard::HamlLintVersion::VERSION
spec.authors = ['y@su']
spec.email = ['toyasyu@gmail.com']
spec.summary = 'Guard plugin for HAML-Lint'
spec.description = 'Guard::HamlLint automatically runs Haml Lint tools.'
spec.homepage = 'https://github.com/yatmsu/guard-haml-lint'
spec.files = `git ls-files`.split("\n")
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
spec.executables = `git ls-files -- exe/*`.split("\n").map{ |f| File.basename(f) }
spec.require_paths = ['lib']
spec.required_ruby_version = '>= 2.0.0'
spec.add_dependency 'guard', '~> 2.2'
spec.add_dependency 'guard-compat', '~> 1.1'
spec.add_runtime_dependency 'haml_lint', '~> 0.15.2'
spec.add_development_dependency 'bundler', '>= 1.0.0'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec'
end
|
# owc_handler.rb
#
# AUTHOR:: Kyle Mullins
require_relative 'ow/ow_helper'
require_relative 'ow/owc_api_client'
class OwcHandler < CommandHandler
include OwHelper
feature :owc, default_enabled: true,
description: 'Provides access to data from the Overwatch Contenders official API.'
command(:owcregions, :list_regions)
.feature(:owc).max_args(0).usage('owcregions')
.description('Lists each of the OWC regions and their abbreviation.')
command(:owcteam, :show_team)
.feature(:owc).min_args(1).usage('owcteam <team>')
.description('Shows details of the given OWC team.')
command(:owcstandings, :show_standings)
.feature(:owc).min_args(1).usage('owcstandings <region>')
.description('Shows the standings for the current OWC season.')
command(:owcschedule, :show_schedule)
.feature(:owc).min_args(0).usage('owcschedule [region]')
.description('Shows upcoming OWC matches.')
command(:owclive, :show_live_state)
.feature(:owc).max_args(0).usage('owclive')
.description('Details the currently live match, or the next match if OWC is not yet live.')
command(:owcscore, :show_score)
.feature(:owc).max_args(0).usage('owcscore')
.description('Shows the score of the currently live match in a spoiler-free manner.')
def config_name
:owc_api
end
def list_regions(event)
handle_errors(event) do
event.channel.start_typing
regions_response = api_client.get_regions
return 'An unexpected error occurred.' if regions_response.error?
regions_str = "**Overwatch Contenders regions:**\n"
regions_response.regions.each { |region| regions_str += "#{region}\n" }
regions_str
end
end
def show_team(event, *team_name)
handle_errors(event) do
event.channel.start_typing
teams_response = api_client.get_teams
return 'An unexpected error occurred.' if teams_response.error?
teams = teams_response.full_teams
.find_all { |t| t.matches?(team_name.join(' ')) }
return 'Team does not exist.' if teams.empty?
return 'More than one team matches the query.' if teams.size > 1
found_team = teams.first
team_details = api_client.get_team_details(found_team.id)
found_team.players(team_details.players) unless team_details.error?
event.channel.send_embed(' ') do |embed|
owc_basic_embed(embed)
embed.url = "#{config.website_url}/teams"
found_team.fill_min_embed(embed)
embed.color = config.home_color if found_team.color.nil?
end
end
end
def show_standings(event, *region)
handle_errors(event) do
event.channel.start_typing
standings_response = api_client.get_bracket
return 'An unexpected error occurred.' if standings_response.error?
regions_standings = standings_response.all_standings
regions = regions_standings.keys
.find_all { |r| r.matches?(region.join(' ')) }
return 'Region does not exist.' if regions.empty?
if regions.size > 1
regions = regions.find_all { |r| r.exact_match?(region.join(' ')) }
return 'More than one region matches the query.' unless regions.size == 1
end
chosen_region = regions.first
standings = regions_standings[regions.first]
if standings.is_a?(Hash)
standings.each_pair do |group, ranks|
send_standings(event, ranks,
"#{chosen_region.abbreviation} Group #{group} Season Standings")
end
nil # Otherwise we return the standings Hash
else
send_standings(event, standings,
"#{chosen_region.abbreviation} Season Standings")
end
end
end
def show_schedule(event, *region)
handle_errors(event) do
event.channel.start_typing
schedule_response = api_client.get_schedule
return 'An unexpected error occurred.' if schedule_response.error?
current_stage = schedule_response.current_stage || schedule_response.upcoming_stage
return 'No stage currently in progress.' if current_stage.nil?
stages = [current_stage]
playoffs = schedule_response.playoffs
stages << playoffs unless current_stage.eql?(playoffs)
regions_response = api_client.get_regions
return 'An unexpected error occurred.' if regions_response.error?
regions = regions_response.regions
match_week_strategy = GroupByRegionStrategy.new(regions)
unless region.empty?
found_regions = regions.find_all { |r| r.matches?(region.join(' ')) }
return 'Region does not exist.' if found_regions.empty?
if found_regions.size > 1
found_regions = found_regions.find_all { |r| r.exact_match?(region.join(' ')) }
return 'More than one region matches the query.' unless found_regions.size == 1
end
match_week_strategy = FilterByRegionStrategy.new(found_regions.first)
end
stages.each do |stage|
match_week = stage.current_week || stage.upcoming_week
next if match_week.match_count(match_strategy: match_week_strategy).zero?
event.channel.send_embed(' ') do |embed|
owc_basic_embed(embed, title = 'Overwatch Contenders Schedule')
embed.title = "#{stage.name} #{match_week.name}"
embed.url = "#{config.website_url}/schedule"
match_week.fill_embed(embed, match_strategy: match_week_strategy)
end
end
nil # Otherwise we return the stages Array
end
end
def show_live_state(event)
handle_errors(event) do
event.channel.start_typing
live_data = api_client.get_live_match
return 'An unexpected error occurred.' if live_data.error?
return 'There is no OWC match live at this time.' unless live_data.live_or_upcoming?
maps_response = api_client.get_maps
return 'An unexpected error occurred.' if maps_response.error?
title = live_data.live_match_has_bracket? ? live_data.live_match_bracket_title : 'Overwatch Contenders'
if live_data.live?
live_match = live_data.live_match
event.channel.send_embed(' ') do |embed|
owc_basic_embed(embed, title)
live_match_embed(embed, live_match, maps_response.maps)
next_match_embed(embed, live_data.next_match,
live_data.time_to_next_match)
end
else
next_match = live_data.live_match
event.channel.send_embed(' ') do |embed|
owc_basic_embed(embed, title)
next_match_embed(embed, next_match, live_data.time_to_match)
next_match.add_maps_to_embed(embed, maps_response.maps)
end
end
end
end
def show_score(event)
handle_errors(event) do
event.channel.start_typing
live_data = api_client.get_live_match
return 'An unexpected error occurred.' if live_data.error?
return 'There is no OWC match live at this time.' unless live_data.live?
"||#{live_data.live_match.score_str}||"
end
end
private
def api_client
@api_client ||= OwcApiClient.new(log: log, base_url: config.base_url,
endpoints: config.endpoints)
end
def owc_basic_embed(embed, title = 'Overwatch Contenders')
ow_basic_embed(embed, title)
embed.color = config.home_color
end
def send_standings(event, standings, title)
return 'An unexpected error occurred.' if standings.nil? || standings.empty?
standings = standings.sort_by(&:first)
leader = standings.first.last
event.channel.send_embed(' ') do |embed|
owc_basic_embed(embed)
embed.title = title
embed.url = "#{config.website_url}/standings"
leader.fill_embed_logo(embed)
embed.add_field(name: 'Team', value: format_team_ranks(standings),
inline: true)
embed.add_field(name: 'Record (Map Diff)',
value: format_records(standings), inline: true)
end
end
end
Fixing error when there is an empty stage in our list
# owc_handler.rb
#
# AUTHOR:: Kyle Mullins
require_relative 'ow/ow_helper'
require_relative 'ow/owc_api_client'
class OwcHandler < CommandHandler
include OwHelper
feature :owc, default_enabled: true,
description: 'Provides access to data from the Overwatch Contenders official API.'
command(:owcregions, :list_regions)
.feature(:owc).max_args(0).usage('owcregions')
.description('Lists each of the OWC regions and their abbreviation.')
command(:owcteam, :show_team)
.feature(:owc).min_args(1).usage('owcteam <team>')
.description('Shows details of the given OWC team.')
command(:owcstandings, :show_standings)
.feature(:owc).min_args(1).usage('owcstandings <region>')
.description('Shows the standings for the current OWC season.')
command(:owcschedule, :show_schedule)
.feature(:owc).min_args(0).usage('owcschedule [region]')
.description('Shows upcoming OWC matches.')
command(:owclive, :show_live_state)
.feature(:owc).max_args(0).usage('owclive')
.description('Details the currently live match, or the next match if OWC is not yet live.')
command(:owcscore, :show_score)
.feature(:owc).max_args(0).usage('owcscore')
.description('Shows the score of the currently live match in a spoiler-free manner.')
def config_name
:owc_api
end
def list_regions(event)
handle_errors(event) do
event.channel.start_typing
regions_response = api_client.get_regions
return 'An unexpected error occurred.' if regions_response.error?
regions_str = "**Overwatch Contenders regions:**\n"
regions_response.regions.each { |region| regions_str += "#{region}\n" }
regions_str
end
end
def show_team(event, *team_name)
handle_errors(event) do
event.channel.start_typing
teams_response = api_client.get_teams
return 'An unexpected error occurred.' if teams_response.error?
teams = teams_response.full_teams
.find_all { |t| t.matches?(team_name.join(' ')) }
return 'Team does not exist.' if teams.empty?
return 'More than one team matches the query.' if teams.size > 1
found_team = teams.first
team_details = api_client.get_team_details(found_team.id)
found_team.players(team_details.players) unless team_details.error?
event.channel.send_embed(' ') do |embed|
owc_basic_embed(embed)
embed.url = "#{config.website_url}/teams"
found_team.fill_min_embed(embed)
embed.color = config.home_color if found_team.color.nil?
end
end
end
def show_standings(event, *region)
handle_errors(event) do
event.channel.start_typing
standings_response = api_client.get_bracket
return 'An unexpected error occurred.' if standings_response.error?
regions_standings = standings_response.all_standings
regions = regions_standings.keys
.find_all { |r| r.matches?(region.join(' ')) }
return 'Region does not exist.' if regions.empty?
if regions.size > 1
regions = regions.find_all { |r| r.exact_match?(region.join(' ')) }
return 'More than one region matches the query.' unless regions.size == 1
end
chosen_region = regions.first
standings = regions_standings[regions.first]
if standings.is_a?(Hash)
standings.each_pair do |group, ranks|
send_standings(event, ranks,
"#{chosen_region.abbreviation} Group #{group} Season Standings")
end
nil # Otherwise we return the standings Hash
else
send_standings(event, standings,
"#{chosen_region.abbreviation} Season Standings")
end
end
end
def show_schedule(event, *region)
handle_errors(event) do
event.channel.start_typing
schedule_response = api_client.get_schedule
return 'An unexpected error occurred.' if schedule_response.error?
current_stage = schedule_response.current_stage || schedule_response.upcoming_stage
return 'No stage currently in progress.' if current_stage.nil?
stages = [current_stage]
playoffs = schedule_response.playoffs
stages << playoffs unless current_stage.eql?(playoffs)
regions_response = api_client.get_regions
return 'An unexpected error occurred.' if regions_response.error?
regions = regions_response.regions
match_week_strategy = GroupByRegionStrategy.new(regions)
unless region.empty?
found_regions = regions.find_all { |r| r.matches?(region.join(' ')) }
return 'Region does not exist.' if found_regions.empty?
if found_regions.size > 1
found_regions = found_regions.find_all { |r| r.exact_match?(region.join(' ')) }
return 'More than one region matches the query.' unless found_regions.size == 1
end
match_week_strategy = FilterByRegionStrategy.new(found_regions.first)
end
stages.compact.each do |stage|
match_week = stage.current_week || stage.upcoming_week
next if match_week.match_count(match_strategy: match_week_strategy).zero?
event.channel.send_embed(' ') do |embed|
owc_basic_embed(embed, title = 'Overwatch Contenders Schedule')
embed.title = "#{stage.name} #{match_week.name}"
embed.url = "#{config.website_url}/schedule"
match_week.fill_embed(embed, match_strategy: match_week_strategy)
end
end
nil # Otherwise we return the stages Array
end
end
def show_live_state(event)
handle_errors(event) do
event.channel.start_typing
live_data = api_client.get_live_match
return 'An unexpected error occurred.' if live_data.error?
return 'There is no OWC match live at this time.' unless live_data.live_or_upcoming?
maps_response = api_client.get_maps
return 'An unexpected error occurred.' if maps_response.error?
title = live_data.live_match_has_bracket? ? live_data.live_match_bracket_title : 'Overwatch Contenders'
if live_data.live?
live_match = live_data.live_match
event.channel.send_embed(' ') do |embed|
owc_basic_embed(embed, title)
live_match_embed(embed, live_match, maps_response.maps)
next_match_embed(embed, live_data.next_match,
live_data.time_to_next_match)
end
else
next_match = live_data.live_match
event.channel.send_embed(' ') do |embed|
owc_basic_embed(embed, title)
next_match_embed(embed, next_match, live_data.time_to_match)
next_match.add_maps_to_embed(embed, maps_response.maps)
end
end
end
end
def show_score(event)
handle_errors(event) do
event.channel.start_typing
live_data = api_client.get_live_match
return 'An unexpected error occurred.' if live_data.error?
return 'There is no OWC match live at this time.' unless live_data.live?
"||#{live_data.live_match.score_str}||"
end
end
private
def api_client
@api_client ||= OwcApiClient.new(log: log, base_url: config.base_url,
endpoints: config.endpoints)
end
def owc_basic_embed(embed, title = 'Overwatch Contenders')
ow_basic_embed(embed, title)
embed.color = config.home_color
end
def send_standings(event, standings, title)
return 'An unexpected error occurred.' if standings.nil? || standings.empty?
standings = standings.sort_by(&:first)
leader = standings.first.last
event.channel.send_embed(' ') do |embed|
owc_basic_embed(embed)
embed.title = title
embed.url = "#{config.website_url}/standings"
leader.fill_embed_logo(embed)
embed.add_field(name: 'Team', value: format_team_ranks(standings),
inline: true)
embed.add_field(name: 'Record (Map Diff)',
value: format_records(standings), inline: true)
end
end
end
|
require 'formula'
class Velvet < Formula
homepage 'http://www.ebi.ac.uk/~zerbino/velvet/'
url 'http://www.ebi.ac.uk/~zerbino/velvet/velvet_1.2.08.tgz'
sha1 '81432982c6a0a7fe8e5dd46fd5e88193dbd832aa'
head 'https://github.com/dzerbino/velvet.git'
def install
inreplace 'Makefile' do |s|
# recommended in Makefile for compiling on Mac OS X
s.change_make_var! "CFLAGS", "-Wall -m64"
end
args = ["OPENMP=1", "LONGSEQUENCES=1"]
if ENV['MAXKMERLENGTH']
args << ("MAXKMERLENGTH=" + ENV['MAXKMERLENGTH'])
end
system "make", "velveth", "velvetg", *args
bin.install 'velveth', 'velvetg'
end
def caveats
<<-EOS.undent
If you want to build with a different kmer length, you can set
MAXKMERLENGTH=X to a value (X) *before* you brew this formula.
EOS
end
def test
system "velveth --help"
system "velvetg --help"
end
end
velvet: add contributed scripts for shuffle sequence
closes #118
require 'formula'
class Velvet < Formula
homepage 'http://www.ebi.ac.uk/~zerbino/velvet/'
url 'http://www.ebi.ac.uk/~zerbino/velvet/velvet_1.2.08.tgz'
sha1 '81432982c6a0a7fe8e5dd46fd5e88193dbd832aa'
head 'https://github.com/dzerbino/velvet.git'
def install
inreplace 'Makefile' do |s|
# recommended in Makefile for compiling on Mac OS X
s.change_make_var! "CFLAGS", "-Wall -m64"
end
args = ["OPENMP=1", "LONGSEQUENCES=1"]
if ENV['MAXKMERLENGTH']
args << ("MAXKMERLENGTH=" + ENV['MAXKMERLENGTH'])
end
system "make", "velveth", "velvetg", *args
bin.install 'velveth', 'velvetg'
# install additional contributed scripts
(share/'velvet/contrib').install Dir['contrib/shuffleSequences_fasta/shuffleSequences_*']
end
def caveats
<<-EOS.undent
If you want to build with a different kmer length, you can set
MAXKMERLENGTH=X to a value (X) *before* you brew this formula.
Some additional user contributed scripts are installed here:
#{share}/velvet/contrib
EOS
end
def test
system "velveth --help"
system "velvetg --help"
end
end
|
# coding: utf-8
Gem::Specification.new do |spec|
spec.name = "pleasant-lawyer-cli"
spec.version = "0.1.3"
spec.authors = ["Nick Johnstone"]
spec.email = ["ncwjohnstone@gmail.com"]
spec.summary = %q{A CLI for pleasant lawyer}
spec.homepage = "https://github.com/Widdershin/pleasant-lawyer-cli"
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.add_dependency "pleasant-lawyer", "~> 0.5.0"
spec.add_development_dependency "bundler", "~> 1.12"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.license = 'MIT'
end
v0.1.4
# coding: utf-8
Gem::Specification.new do |spec|
spec.name = "pleasant-lawyer-cli"
spec.version = "0.1.4"
spec.authors = ["Nick Johnstone"]
spec.email = ["ncwjohnstone@gmail.com"]
spec.summary = %q{A CLI for pleasant lawyer}
spec.homepage = "https://github.com/Widdershin/pleasant-lawyer-cli"
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.add_dependency "pleasant-lawyer", "~> 0.5.0"
spec.add_development_dependency "bundler", "~> 1.12"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.license = 'MIT'
end
|
$:.push File.expand_path('../lib', __FILE__)
# Maintain your gem's version:
require 'elder_wand/version'
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = 'elder_wand'
s.version = ElderWand::VERSION
s.authors = ['Elom Gomez']
s.email = ['gomezelom@yahoo.com']
s.homepage = ''
s.summary = 'A gem that allows a Rails Api to interact with Elder Tree (Oauth Provider).'
s.description = 'A gem that allows a Rails Api to interact with Elder Tree (Oauth Provider).'
s.license = 'MIT'
s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.rdoc']
s.add_dependency 'rails', '~> 5.0.0'
s.add_dependency 'oauth2', '~> 1.1.0'
s.add_development_dependency 'pg'
s.add_development_dependency 'pry'
s.add_development_dependency 'rspec-rails'
s.add_development_dependency 'json_spec', '>= 1.1.4'
s.add_development_dependency 'database_cleaner', '~> 1.5.1'
end
Upgrade to rails 5.1
$:.push File.expand_path('../lib', __FILE__)
# Maintain your gem's version:
require 'elder_wand/version'
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = 'elder_wand'
s.version = ElderWand::VERSION
s.authors = ['Elom Gomez']
s.email = ['gomezelom@yahoo.com']
s.homepage = ''
s.summary = 'A gem that allows a Rails Api to interact with Elder Tree (Oauth Provider).'
s.description = 'A gem that allows a Rails Api to interact with Elder Tree (Oauth Provider).'
s.license = 'MIT'
s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.rdoc']
s.add_dependency 'rails', '~> 5.1'
s.add_dependency 'oauth2', '~> 1.1.0'
s.add_development_dependency 'pg'
s.add_development_dependency 'pry'
s.add_development_dependency 'rspec-rails'
s.add_development_dependency 'json_spec', '>= 1.1.4'
s.add_development_dependency 'database_cleaner', '~> 1.5.1'
end
|
add: rails db:seed でDBの内容をdelete_allする機能を追加
resolve: #15
|
added my twitter and github
|
Update seedfile with new Users column elements, more randomized questions and answers
|
# Numbers to Commas Solo Challenge
# I spent [5] hours on this challenge.
# 0. Pseudocode
# What is the input?
# Positive Integer
# What is the output?
# Comma-separated integer as a string
# What are the steps needed to solve the problem?
#WHILE integer index is greater than or equal to -3 no comma is needed
#ELSE comma is added to integer with index divisible by -3
# 1. Initial Solution
def separate_comma (integer)
if (integer >= 1000) && (integer <= 999999)
return integer.to_s.insert(-4,',')
elsif (integer >= 1000000) && (integer <= 99999999)
return integer.to_s.insert(-4,',').insert(-8,',')
else return integer.to_s
end
end
# 2. Refactored Solution
#def separate_comma (integer)
#end
# 3. Reflection
#What was your process for breaking the problem down? What different approaches did you consider?
#Was your pseudocode effective in helping you build a successful initial solution?
#Yes, for my initial code I stuck with the IF/ELSE statement and looked for methods to ensure
#What new Ruby method(s) did you use when refactoring your solution? Describe your experience of using the Ruby documentation to implement it/them (any difficulties, etc.). Did it/they significantly change the way your code works? If so, how?
#How did you initially iterate through the data structure?
#Do you feel your refactored solution is more readable than your initial solution? Why?
Update to commas challenge
# Numbers to Commas Solo Challenge
# I spent [5] hours on this challenge.
# 0. Pseudocode
# What is the input?
# Positive Integer
# What is the output?
# Comma-separated integer as a string
# What are the steps needed to solve the problem?
#WHILE integer index is greater than or equal to -3 no comma is needed
#ELSE comma is added to integer with index divisible by -3
# 1. Initial Solution
#def separate_comma(integer)
# if (integer >= 1000) && (integer <= 999999)
# return integer.to_s.insert(-4,',')
#elsif (integer >= 1000000) && (integer <= 99999999)
# return integer.to_s.insert(-4,',').insert(-8,',')
# else return integer.to_s
# end
#end
# 2. Refactored Solution
def separate_comma(integer)
integer.to_s.reverse.insert(-4,',').insert(-8,',').reverse
end
# 3. Reflection
#What was your process for breaking the problem down? What different approaches did you consider?
# I thought about how to change integers to strings given integers are presented in Ruby without any commas. I also thought about how best to tell the program where to place the commas. Utilizing the correct indices seemed like the right approach.
#Was your pseudocode effective in helping you build a successful initial solution?
# Yes, my pseudocode was on the right track. I mad a few adustments when it came to getting my code to work and comma placement, but for the most part it was the right thought process.
#What new Ruby method(s) did you use when refactoring your solution? Describe your experience of using the Ruby documentation to implement it/them (any difficulties, etc.). Did it/they significantly change the way your code works? If so, how?
# I had a difficult time finding methods that made sense to me and worked. I found some methods online while doing research that looked much cleaner, but at this point didn't make much sense to me.
#How did you initially iterate through the data structure?
# I utilized IF/ELSE for the initial solution to accounted for the integer ranges we were looking at for this challenge.
#Do you feel your refactored solution is more readable than your initial solution? Why?
# No, I actually think the initial solution is more readable because you can follow the specific steps/ranges being looked at for the comma placement.
|
class Homestead
def Homestead.configure(config, settings)
# Set The VM Provider
ENV['VAGRANT_DEFAULT_PROVIDER'] = settings["provider"] ||= "virtualbox"
# Configure Local Variable To Access Scripts From Remote Location
scriptDir = File.dirname(__FILE__)
# Prevent TTY Errors
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
# Configure The Box
config.vm.box = "laravel/homestead"
config.vm.hostname = settings["hostname"] ||= "homestead"
# Configure A Private Network IP
config.vm.network :private_network, ip: settings["ip"] ||= "192.168.10.10"
# Configure A Few VirtualBox Settings
config.vm.provider "virtualbox" do |vb|
vb.name = 'homestead'
vb.customize ["modifyvm", :id, "--memory", settings["memory"] ||= "2048"]
vb.customize ["modifyvm", :id, "--cpus", settings["cpus"] ||= "1"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--ostype", "Ubuntu_64"]
end
# Configure A Few VMware Settings
["vmware_fusion", "vmware_workstation"].each do |vmware|
config.vm.provider vmware do |v|
v.vmx["displayName"] = "homestead"
v.vmx["memsize"] = settings["memory"] ||= 2048
v.vmx["numvcpus"] = settings["cpus"] ||= 1
v.vmx["guestOS"] = "ubuntu-64"
end
end
# Standardize Ports Naming Schema
if (settings.has_key?("ports"))
settings["ports"].each do |port|
port["guest"] ||= port["to"]
port["host"] ||= port["send"]
port["protocol"] ||= "tcp"
end
else
settings["ports"] = []
end
# Default Port Forwarding
default_ports = {
80 => 8000,
443 => 44300,
3306 => 33060,
5432 => 54320
}
# Use Default Port Forwarding Unless Overridden
default_ports.each do |guest, host|
unless settings["ports"].any? { |mapping| mapping["guest"] == guest }
config.vm.network "forwarded_port", guest: guest, host: host
end
end
# Add Custom Ports From Configuration
if settings.has_key?("ports")
settings["ports"].each do |port|
config.vm.network "forwarded_port", guest: port["guest"], host: port["host"], protocol: port["protocol"]
end
end
# Configure The Public Key For SSH Access
if settings.include? 'authorize'
config.vm.provision "shell" do |s|
s.inline = "echo $1 | grep -xq \"$1\" /home/vagrant/.ssh/authorized_keys || echo $1 | tee -a /home/vagrant/.ssh/authorized_keys"
s.args = [File.read(File.expand_path(settings["authorize"]))]
end
end
# Copy The SSH Private Keys To The Box
if settings.include? 'keys'
settings["keys"].each do |key|
config.vm.provision "shell" do |s|
s.privileged = false
s.inline = "echo \"$1\" > /home/vagrant/.ssh/$2 && chmod 600 /home/vagrant/.ssh/$2"
s.args = [File.read(File.expand_path(key)), key.split('/').last]
end
end
end
# Register All Of The Configured Shared Folders
if settings.include? 'folders'
settings["folders"].each do |folder|
mount_opts = folder["type"] == "nfs" ? ['actimeo=1'] : []
config.vm.synced_folder folder["map"], folder["to"], type: folder["type"] ||= nil, mount_options: mount_opts
end
end
# Install All The Configured Nginx Sites
settings["sites"].each do |site|
config.vm.provision "shell" do |s|
if (site.has_key?("hhvm") && site["hhvm"])
s.path = scriptDir + "/serve-hhvm.sh"
s.args = [site["map"], site["to"], site["port"] ||= "80", site["ssl"] ||= "443"]
else
s.path = scriptDir + "/serve.sh"
s.args = [site["map"], site["to"], site["port"] ||= "80", site["ssl"] ||= "443"]
end
end
end
# Configure All Of The Configured Databases
if settings.has_key?("databases")
settings["databases"].each do |db|
config.vm.provision "shell" do |s|
s.path = scriptDir + "/create-mysql.sh"
s.args = [db]
end
config.vm.provision "shell" do |s|
s.path = scriptDir + "/create-postgres.sh"
s.args = [db]
end
end
end
# Configure All Of The Server Environment Variables
if settings.has_key?("variables")
settings["variables"].each do |var|
config.vm.provision "shell" do |s|
s.inline = "echo \"\nenv[$1] = '$2'\" >> /etc/php5/fpm/php-fpm.conf"
s.args = [var["key"], var["value"]]
end
config.vm.provision "shell" do |s|
s.inline = "echo \"\n#Set Homestead environment variable\nexport $1=$2\" >> /home/vagrant/.profile"
s.args = [var["key"], var["value"]]
end
end
config.vm.provision "shell" do |s|
s.inline = "service php5-fpm restart"
end
end
# Update Composer On Every Provision
config.vm.provision "shell" do |s|
s.inline = "/usr/local/bin/composer self-update"
end
# Configure Blackfire.io
if settings.has_key?("blackfire")
config.vm.provision "shell" do |s|
s.path = scriptDir + "/blackfire.sh"
s.args = [
settings["blackfire"][0]["id"],
settings["blackfire"][0]["token"],
settings["blackfire"][0]["client-id"],
settings["blackfire"][0]["client-token"]
]
end
end
end
end
Check settings for supplied hostname
class Homestead
def Homestead.configure(config, settings)
# Set The VM Provider
ENV['VAGRANT_DEFAULT_PROVIDER'] = settings["provider"] ||= "virtualbox"
# Configure Local Variable To Access Scripts From Remote Location
scriptDir = File.dirname(__FILE__)
# Prevent TTY Errors
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
# Configure The Box
config.vm.box = "laravel/homestead"
config.vm.hostname = settings["hostname"] ||= "homestead"
# Configure A Private Network IP
config.vm.network :private_network, ip: settings["ip"] ||= "192.168.10.10"
# Configure A Few VirtualBox Settings
config.vm.provider "virtualbox" do |vb|
vb.name = settings["name"] ||= "homestead"
vb.customize ["modifyvm", :id, "--memory", settings["memory"] ||= "2048"]
vb.customize ["modifyvm", :id, "--cpus", settings["cpus"] ||= "1"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--ostype", "Ubuntu_64"]
end
# Configure A Few VMware Settings
["vmware_fusion", "vmware_workstation"].each do |vmware|
config.vm.provider vmware do |v|
v.vmx["displayName"] = "homestead"
v.vmx["memsize"] = settings["memory"] ||= 2048
v.vmx["numvcpus"] = settings["cpus"] ||= 1
v.vmx["guestOS"] = "ubuntu-64"
end
end
# Standardize Ports Naming Schema
if (settings.has_key?("ports"))
settings["ports"].each do |port|
port["guest"] ||= port["to"]
port["host"] ||= port["send"]
port["protocol"] ||= "tcp"
end
else
settings["ports"] = []
end
# Default Port Forwarding
default_ports = {
80 => 8000,
443 => 44300,
3306 => 33060,
5432 => 54320
}
# Use Default Port Forwarding Unless Overridden
default_ports.each do |guest, host|
unless settings["ports"].any? { |mapping| mapping["guest"] == guest }
config.vm.network "forwarded_port", guest: guest, host: host
end
end
# Add Custom Ports From Configuration
if settings.has_key?("ports")
settings["ports"].each do |port|
config.vm.network "forwarded_port", guest: port["guest"], host: port["host"], protocol: port["protocol"]
end
end
# Configure The Public Key For SSH Access
if settings.include? 'authorize'
config.vm.provision "shell" do |s|
s.inline = "echo $1 | grep -xq \"$1\" /home/vagrant/.ssh/authorized_keys || echo $1 | tee -a /home/vagrant/.ssh/authorized_keys"
s.args = [File.read(File.expand_path(settings["authorize"]))]
end
end
# Copy The SSH Private Keys To The Box
if settings.include? 'keys'
settings["keys"].each do |key|
config.vm.provision "shell" do |s|
s.privileged = false
s.inline = "echo \"$1\" > /home/vagrant/.ssh/$2 && chmod 600 /home/vagrant/.ssh/$2"
s.args = [File.read(File.expand_path(key)), key.split('/').last]
end
end
end
# Register All Of The Configured Shared Folders
if settings.include? 'folders'
settings["folders"].each do |folder|
mount_opts = folder["type"] == "nfs" ? ['actimeo=1'] : []
config.vm.synced_folder folder["map"], folder["to"], type: folder["type"] ||= nil, mount_options: mount_opts
end
end
# Install All The Configured Nginx Sites
settings["sites"].each do |site|
config.vm.provision "shell" do |s|
if (site.has_key?("hhvm") && site["hhvm"])
s.path = scriptDir + "/serve-hhvm.sh"
s.args = [site["map"], site["to"], site["port"] ||= "80", site["ssl"] ||= "443"]
else
s.path = scriptDir + "/serve.sh"
s.args = [site["map"], site["to"], site["port"] ||= "80", site["ssl"] ||= "443"]
end
end
end
# Configure All Of The Configured Databases
settings["databases"].each do |db|
config.vm.provision "shell" do |s|
s.path = scriptDir + "/create-mysql.sh"
s.args = [db]
end
config.vm.provision "shell" do |s|
s.path = scriptDir + "/create-postgres.sh"
s.args = [db]
end
end
# Configure All Of The Server Environment Variables
if settings.has_key?("variables")
settings["variables"].each do |var|
config.vm.provision "shell" do |s|
s.inline = "echo \"\nenv[$1] = '$2'\" >> /etc/php5/fpm/php-fpm.conf"
s.args = [var["key"], var["value"]]
end
config.vm.provision "shell" do |s|
s.inline = "echo \"\n#Set Homestead environment variable\nexport $1=$2\" >> /home/vagrant/.profile"
s.args = [var["key"], var["value"]]
end
end
config.vm.provision "shell" do |s|
s.inline = "service php5-fpm restart"
end
end
# Update Composer On Every Provision
config.vm.provision "shell" do |s|
s.inline = "/usr/local/bin/composer self-update"
end
# Configure Blackfire.io
if settings.has_key?("blackfire")
config.vm.provision "shell" do |s|
s.path = scriptDir + "/blackfire.sh"
s.args = [
settings["blackfire"][0]["id"],
settings["blackfire"][0]["token"],
settings["blackfire"][0]["client-id"],
settings["blackfire"][0]["client-token"]
]
end
end
end
end
|
# Class Warfare, Validate a Credit Card Number
# I worked on this challenge with: Evan Druce.
# I spent 2 hours on this challenge.
# Pseudocode
# Input: a 16-digit integer
# Output: True or False based on the results of the checksum
# Steps:
# if number is not 16 digits, raise an error
# split up the digits into an array of strings
# convert the digits back into integers
# double every other digit, starting with the second-to-last
# sum all digits
# check to see if result is a multiple of ten; if so, return True; if not, return False
# Initial Solution
# class CreditCard
# def initialize(number)
# @number = number
# if number.to_s.length != 16
# raise ArgumentError.new("Not a valid card number")
# end
# end
# def auth_splitter
# @array_of_digits = @number.to_s.split("")
# end
# def auth_doubler
# @integer_array = @array_of_digits.map { |x| x.to_i}
# @doubled_array = @integer_array.each_with_index.map do |value, index|
# if index.even?
# value * 2
# else
# value
# end
# end
# end
# def sum_digits
# @split_array = @doubled_array.join.to_s.split("").map{|string| string.to_i}
# @split_and_summed = @split_array.inject(0){|sum, x| sum + x}
# end
# def mult_of_ten?
# @split_and_summed % 10 == 0
# end
# def check_card
# auth_splitter
# auth_doubler
# sum_digits
# mult_of_ten?
# end
# end
# puts new_card = CreditCard.new(4410493049593004)
# puts new_card.check_card
# Refactored Solution
class CreditCard
def initialize(number)
@number = number
if number.to_s.length != 16
raise ArgumentError.new("Not a valid card number")
end
end
def auth_splitter
@array_of_digits = @number.to_s.split("").map { |x| x.to_i}
end
def auth_doubler
@doubled_array = @array_of_digits.each_with_index.map do |value, index|
if index.even?
value * 2
else
value
end
end
end
def sum_digits
@split_array = @doubled_array.join.to_s.split("").map{|string| string.to_i}
@split_and_summed = @split_array.inject(0){|sum, x| sum + x}
end
def mult_of_ten?
@split_and_summed % 10 == 0
end
def check_card
auth_splitter
auth_doubler
sum_digits
mult_of_ten?
end
end
puts new_card = CreditCard.new(4410493049593004)
puts new_card.check_card
# Reflection
# What was the most difficult part of this challenge for you and your pair?
# I think the thing that threw us the most was the instruction that said "Starting with the second to last digit, double every other digit until you reach the first digit." This was not the easiest task to do. Then we realized that the argument has to be 16 digits long, so it didn't matter if we started at the second to last digit and iterated from right to left. We just need to doiuble the numbers at the even indexes (e.g 0, 2, 4...).
# What new methods did you find to help you when you refactored?
# I think my pairing partner was already familiar with it, but had not used the inject method before this assignment.
# What concepts or learnings were you able to solidify in this challenge?
# The main thing that this assigment helped solidify for me was how to pass data from one method to the next and bring it all together in another method like the check_card method.
Add comments to refactored solution
# Class Warfare, Validate a Credit Card Number
# I worked on this challenge with: Evan Druce.
# I spent 2 hours on this challenge.
# Pseudocode
# Input: a 16-digit integer
# Output: True or False based on the results of the checksum
# Steps:
# if number is not 16 digits, raise an error
# split up the digits into an array of strings
# convert the digits back into integers
# double every other digit, starting with the second-to-last
# sum all digits
# check to see if result is a multiple of ten; if so, return True; if not, return False
# Initial Solution
# class CreditCard
# def initialize(number)
# @number = number
# if number.to_s.length != 16
# raise ArgumentError.new("Not a valid card number")
# end
# end
# def auth_splitter
# @array_of_digits = @number.to_s.split("")
# end
# def auth_doubler
# @integer_array = @array_of_digits.map { |x| x.to_i}
# @doubled_array = @integer_array.each_with_index.map do |value, index|
# if index.even?
# value * 2
# else
# value
# end
# end
# end
# def sum_digits
# @split_array = @doubled_array.join.to_s.split("").map{|string| string.to_i}
# @split_and_summed = @split_array.inject(0){|sum, x| sum + x}
# end
# def mult_of_ten?
# @split_and_summed % 10 == 0
# end
# def check_card
# auth_splitter
# auth_doubler
# sum_digits
# mult_of_ten?
# end
# end
# puts new_card = CreditCard.new(4410493049593004)
# puts new_card.check_card
# Refactored Solution
class CreditCard
# Initialize class and add ArguementError
def initialize(number)
@number = number
if number.to_s.length != 16
raise ArgumentError.new("Not a valid card number")
end
end
# Split number into individual integers in an array
def auth_splitter
@array_of_digits = @number.to_s.split("").map { |x| x.to_i}
end
# Double every other number starting with the first digit and ending with the second to last
def auth_doubler
@doubled_array = @array_of_digits.each_with_index.map do |value, index|
if index.even?
value * 2
else
value
end
end
end
# Separate two digit numbers ("10" becomes "1" and "0") and sum all numbers in the array
def sum_digits
@split_array = @doubled_array.join.to_s.split("").map{|string| string.to_i}
@split_and_summed = @split_array.inject(0){|sum, x| sum + x}
end
# Check to see if the sum is a multiple of 10
def mult_of_ten?
@split_and_summed % 10 == 0
end
# Put all methods together to check credit card authentication
def check_card
auth_splitter
auth_doubler
sum_digits
mult_of_ten?
end
end
puts new_card = CreditCard.new(4410493049593004)
puts new_card.check_card
# Reflection
# What was the most difficult part of this challenge for you and your pair?
# I think the thing that threw us the most was the instruction that said "Starting with the second to last digit, double every other digit until you reach the first digit." This was not the easiest task to do. Then we realized that the argument has to be 16 digits long, so it didn't matter if we started at the second to last digit and iterated from right to left. We just need to doiuble the numbers at the even indexes (e.g 0, 2, 4...).
# What new methods did you find to help you when you refactored?
# I think my pairing partner was already familiar with it, but had not used the inject method before this assignment.
# What concepts or learnings were you able to solidify in this challenge?
# The main thing that this assigment helped solidify for me was how to pass data from one method to the next and bring it all together in another method like the check_card method. |
#!/Users/simon/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
# RTVE tiler
# ===============
# ./rtve.rb [environment] [election_id]
#
# environments: [development, production]
# election_id: [election id table primary keys]
require 'rubygems'
require 'pg'
require 'typhoeus'
require 'json'
require 'fileutils'
# sanity check arguments
ENVR = ARGV[0]
ELECTION_ID = ARGV[1]
if ENVR != 'development' && ENVR != 'production'
puts "ruby map_tiles.rb [environment] [electoral process id (optional)]"
puts "environments: [development, production]"
Process.exit!(true)
end
# set app settings and boot
user = 123
setup = {:development => {:host => 'localhost', :user => 'publicuser', :dbname => "cartodb_dev_user_#{user}_db"},
:production => {:host => '10.211.14.63', :user => 'postgres', :dbname => "cartodb_user_#{user}_db"}}
settings = setup[ENVR.to_sym]
conn = PGconn.open(settings)
pos = conn.exec "SELECT * from procesos_electorales ORDER BY anyo, mes ASC";
# menu screen
if ELECTION_ID == nil
begin
puts "\nRTVE Tile Generator"
puts "===================\n\n"
puts "Electoral Processes: \n\n"
printf("%-5s %5s %5s \n", "id", "anyo", "mes")
puts "-" * 19
pos.each do |p|
printf("%-5s %5s %5s \n", p["cartodb_id"], p["anyo"], p["mes"])
end
ids = pos.map { |x| x['cartodb_id'] }
print "\nChoose a electoral process to render (#{ids.sort.join(", ")}) [q=quit]: "
ELECTION_ID = STDIN.gets.chomp
Process.exit if ELECTION_ID == 'q'
raise "invalid id" unless ids.include?(ELECTION_ID)
rescue
puts "\n** ERROR: please enter a correct procesos electorales id \n\n"
retry
end
end
# Create denomalised version of GADM4 table with votes, and party names
puts "Generating map_tiles_data table for election id: #{ELECTION_ID}..."
sql = <<-EOS
DROP TABLE IF EXISTS map_tiles_data;
CREATE TABLE map_tiles_data AS (
SELECT
g.cartodb_id as gid,
v.primer_partido_id,pp1.name primer_nombre,v.primer_partido_percent,v.primer_partido_votos,
v.segundo_partido_id,pp2.name segundo_nombre,v.segundo_partido_percent,v.segundo_partido_votos,
v.tercer_partido_id,pp3.name tercer_nombre,v.tercer_partido_percent,v.tercer_partido_votos,
g.the_geom,
g.the_geom_webmercator,
CASE
WHEN pp1.name ='PSOE' THEN
CASE
WHEN v.primer_partido_percent >= 75 THEN 'red_H'
WHEN (v.primer_partido_percent >= 50) AND (v.primer_partido_percent < 75) THEN 'red_M'
WHEN (v.primer_partido_percent >= 0) AND (v.primer_partido_percent < 50) THEN 'red_L'
END
WHEN pp1.name = 'PP' THEN
CASE
WHEN v.primer_partido_percent >= 75 THEN 'blue_H'
WHEN (v.primer_partido_percent >= 50) AND (v.primer_partido_percent < 75) THEN 'blue_M'
WHEN (v.primer_partido_percent >= 0) AND (v.primer_partido_percent < 50) THEN 'blue_L'
END
WHEN pp1.name IN ('CIU', 'AP', 'IU', 'INDEP', 'CDS', 'PAR', 'EAJ-PNV', 'PA', 'BNG', 'PDP', 'ERC-AM', 'ESQUERRA-AM', 'ERC', 'EA', 'HB', 'PRC', 'PR', 'UV') THEN
pp1.name
ELSE 'unknown'
END as color
FROM ine_poly AS g
LEFT OUTER JOIN (SELECT * FROM votaciones_por_municipio WHERE proceso_electoral_id=#{ELECTION_ID}) AS v ON g.ine_muni_int=v.codinemuni AND g.ine_prov_int = v.codineprov
LEFT OUTER JOIN partidos_politicos AS pp1 ON pp1.cartodb_id = v.primer_partido_id
LEFT OUTER JOIN partidos_politicos AS pp2 ON pp2.cartodb_id = v.segundo_partido_id
LEFT OUTER JOIN partidos_politicos AS pp3 ON pp3.cartodb_id = v.tercer_partido_id);
ALTER TABLE map_tiles_data ADD PRIMARY KEY (gid);
CREATE INDEX map_tiles_data_the_geom_webmercator_idx ON map_tiles_data USING gist(the_geom_webmercator);
CREATE INDEX map_tiles_data_the_geom_idx ON map_tiles_data USING gist(the_geom);
EOS
conn.exec sql
# there are 2 bounding boxes at each zoom level. one for spain, one for canaries
tile_extents = [
{:zoom => 6, :xmin => 30, :ymin => 23, :xmax => 32, :ymax => 25},
{:zoom => 6, :xmin => 28, :ymin => 26, :xmax => 29, :ymax => 27},
{:zoom => 7, :xmin => 60, :ymin => 46, :xmax => 65, :ymax => 50},
{:zoom => 7, :xmin => 57, :ymin => 52, :xmax => 59, :ymax => 54},
{:zoom => 8, :xmin => 120, :ymin => 92, :xmax => 131, :ymax => 101},
{:zoom => 8, :xmin => 114, :ymin => 105, :xmax => 118, :ymax => 108},
{:zoom => 9, :xmin => 241, :ymin => 185, :xmax => 263, :ymax => 203},
{:zoom => 9, :xmin => 229, :ymin => 211, :xmax => 237, :ymax => 216},
{:zoom => 10, :xmin => 482, :ymin => 370, :xmax => 526, :ymax => 407},
{:zoom => 10, :xmin => 458, :ymin => 422, :xmax => 475, :ymax => 433},
{:zoom => 11, :xmin => 964, :ymin => 741, :xmax => 1052, :ymax => 815},
{:zoom => 11, :xmin => 916, :ymin => 844, :xmax => 951, :ymax => 866},
{:zoom => 12, :xmin => 1929, :ymin => 1483, :xmax => 2105, :ymax => 1631},
{:zoom => 12, :xmin => 1832, :ymin => 1688, :xmax => 1902, :ymax => 1732},
]
base_path = "#{Dir.pwd}/tiles"
save_path = "#{base_path}/#{ELECTION_ID}"
tile_url = "http://ec2-50-16-103-51.compute-1.amazonaws.com/tiles"
hydra = Typhoeus::Hydra.new(:max_concurrency => 200)
time_start = Time.now
start_tiles = 0
total_tiles = tile_extents.inject(0) do |sum, extent|
sum += ((extent[:xmax] - extent[:xmin] + 1) * (extent[:ymax] - extent[:ymin] + 1))
sum
end
puts "creating tile path: #{save_path}"
FileUtils.mkdir_p save_path
puts "Saving tiles for map_tiles_data to #{save_path}..."
tile_extents.each do |extent|
(extent[:xmin]..extent[:xmax]).to_a.each do |x|
(extent[:ymin]..extent[:ymax]).to_a.each do |y|
file_name = "#{x}_#{y}_#{extent[:zoom]}_#{ELECTION_ID}.png"
if File.exists? "#{save_path}/#{file_name}"
total_tiles -= 1
else
file_url = "#{tile_url}/#{x}/#{y}/#{extent[:zoom]}/users/#{user}/layers/gadm1%7Cmap_tiles_data%7Cine_poly%7Cgadm2%7Cgadm1"
tile_request = Typhoeus::Request.new(file_url)
tile_request.on_complete do |response|
start_tiles += 1
File.open("#{save_path}/#{file_name}", "w+") do|f|
f.write response.body
puts file_url
#puts "#{start_tiles}/#{total_tiles}: #{save_path}/#{file_name}"
end
end
hydra.queue tile_request
end
end
end
end
hydra.run
time_end = Time.now
secs = time_end - time_start
puts "Total time: #{sprintf("%.2f", secs)} seconds (#{sprintf("%.2f", secs/60.0)} mins). #{sprintf("%.2f", total_tiles/secs)} tiles per second."
output file paths on save
#!/Users/simon/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
# RTVE tiler
# ===============
# ./rtve.rb [environment] [election_id]
#
# environments: [development, production]
# election_id: [election id table primary keys]
require 'rubygems'
require 'pg'
require 'typhoeus'
require 'json'
require 'fileutils'
# sanity check arguments
ENVR = ARGV[0]
ELECTION_ID = ARGV[1]
if ENVR != 'development' && ENVR != 'production'
puts "ruby map_tiles.rb [environment] [electoral process id (optional)]"
puts "environments: [development, production]"
Process.exit!(true)
end
# set app settings and boot
user = 123
setup = {:development => {:host => 'localhost', :user => 'publicuser', :dbname => "cartodb_dev_user_#{user}_db"},
:production => {:host => '10.211.14.63', :user => 'postgres', :dbname => "cartodb_user_#{user}_db"}}
settings = setup[ENVR.to_sym]
conn = PGconn.open(settings)
pos = conn.exec "SELECT * from procesos_electorales ORDER BY anyo, mes ASC";
# menu screen
if ELECTION_ID == nil
begin
puts "\nRTVE Tile Generator"
puts "===================\n\n"
puts "Electoral Processes: \n\n"
printf("%-5s %5s %5s \n", "id", "anyo", "mes")
puts "-" * 19
pos.each do |p|
printf("%-5s %5s %5s \n", p["cartodb_id"], p["anyo"], p["mes"])
end
ids = pos.map { |x| x['cartodb_id'] }
print "\nChoose a electoral process to render (#{ids.sort.join(", ")}) [q=quit]: "
ELECTION_ID = STDIN.gets.chomp
Process.exit if ELECTION_ID == 'q'
raise "invalid id" unless ids.include?(ELECTION_ID)
rescue
puts "\n** ERROR: please enter a correct procesos electorales id \n\n"
retry
end
end
# Create denomalised version of GADM4 table with votes, and party names
puts "Generating map_tiles_data table for election id: #{ELECTION_ID}..."
sql = <<-EOS
DROP TABLE IF EXISTS map_tiles_data;
CREATE TABLE map_tiles_data AS (
SELECT
g.cartodb_id as gid,
v.primer_partido_id,pp1.name primer_nombre,v.primer_partido_percent,v.primer_partido_votos,
v.segundo_partido_id,pp2.name segundo_nombre,v.segundo_partido_percent,v.segundo_partido_votos,
v.tercer_partido_id,pp3.name tercer_nombre,v.tercer_partido_percent,v.tercer_partido_votos,
g.the_geom,
g.the_geom_webmercator,
CASE
WHEN pp1.name ='PSOE' THEN
CASE
WHEN v.primer_partido_percent >= 75 THEN 'red_H'
WHEN (v.primer_partido_percent >= 50) AND (v.primer_partido_percent < 75) THEN 'red_M'
WHEN (v.primer_partido_percent >= 0) AND (v.primer_partido_percent < 50) THEN 'red_L'
END
WHEN pp1.name = 'PP' THEN
CASE
WHEN v.primer_partido_percent >= 75 THEN 'blue_H'
WHEN (v.primer_partido_percent >= 50) AND (v.primer_partido_percent < 75) THEN 'blue_M'
WHEN (v.primer_partido_percent >= 0) AND (v.primer_partido_percent < 50) THEN 'blue_L'
END
WHEN pp1.name IN ('CIU', 'AP', 'IU', 'INDEP', 'CDS', 'PAR', 'EAJ-PNV', 'PA', 'BNG', 'PDP', 'ERC-AM', 'ESQUERRA-AM', 'ERC', 'EA', 'HB', 'PRC', 'PR', 'UV') THEN
pp1.name
ELSE 'unknown'
END as color
FROM ine_poly AS g
LEFT OUTER JOIN (SELECT * FROM votaciones_por_municipio WHERE proceso_electoral_id=#{ELECTION_ID}) AS v ON g.ine_muni_int=v.codinemuni AND g.ine_prov_int = v.codineprov
LEFT OUTER JOIN partidos_politicos AS pp1 ON pp1.cartodb_id = v.primer_partido_id
LEFT OUTER JOIN partidos_politicos AS pp2 ON pp2.cartodb_id = v.segundo_partido_id
LEFT OUTER JOIN partidos_politicos AS pp3 ON pp3.cartodb_id = v.tercer_partido_id);
ALTER TABLE map_tiles_data ADD PRIMARY KEY (gid);
CREATE INDEX map_tiles_data_the_geom_webmercator_idx ON map_tiles_data USING gist(the_geom_webmercator);
CREATE INDEX map_tiles_data_the_geom_idx ON map_tiles_data USING gist(the_geom);
EOS
conn.exec sql
# there are 2 bounding boxes at each zoom level. one for spain, one for canaries
tile_extents = [
{:zoom => 6, :xmin => 30, :ymin => 23, :xmax => 32, :ymax => 25},
{:zoom => 6, :xmin => 28, :ymin => 26, :xmax => 29, :ymax => 27},
{:zoom => 7, :xmin => 60, :ymin => 46, :xmax => 65, :ymax => 50},
{:zoom => 7, :xmin => 57, :ymin => 52, :xmax => 59, :ymax => 54},
{:zoom => 8, :xmin => 120, :ymin => 92, :xmax => 131, :ymax => 101},
{:zoom => 8, :xmin => 114, :ymin => 105, :xmax => 118, :ymax => 108},
{:zoom => 9, :xmin => 241, :ymin => 185, :xmax => 263, :ymax => 203},
{:zoom => 9, :xmin => 229, :ymin => 211, :xmax => 237, :ymax => 216},
{:zoom => 10, :xmin => 482, :ymin => 370, :xmax => 526, :ymax => 407},
{:zoom => 10, :xmin => 458, :ymin => 422, :xmax => 475, :ymax => 433},
{:zoom => 11, :xmin => 964, :ymin => 741, :xmax => 1052, :ymax => 815},
{:zoom => 11, :xmin => 916, :ymin => 844, :xmax => 951, :ymax => 866},
{:zoom => 12, :xmin => 1929, :ymin => 1483, :xmax => 2105, :ymax => 1631},
{:zoom => 12, :xmin => 1832, :ymin => 1688, :xmax => 1902, :ymax => 1732},
]
base_path = "#{Dir.pwd}/tiles"
save_path = "#{base_path}/#{ELECTION_ID}"
tile_url = "http://ec2-50-16-103-51.compute-1.amazonaws.com/tiles"
hydra = Typhoeus::Hydra.new(:max_concurrency => 200)
time_start = Time.now
start_tiles = 0
total_tiles = tile_extents.inject(0) do |sum, extent|
sum += ((extent[:xmax] - extent[:xmin] + 1) * (extent[:ymax] - extent[:ymin] + 1))
sum
end
puts "creating tile path: #{save_path}"
FileUtils.mkdir_p save_path
puts "Saving tiles for map_tiles_data to #{save_path}..."
tile_extents.each do |extent|
(extent[:xmin]..extent[:xmax]).to_a.each do |x|
(extent[:ymin]..extent[:ymax]).to_a.each do |y|
file_name = "#{x}_#{y}_#{extent[:zoom]}_#{ELECTION_ID}.png"
if File.exists? "#{save_path}/#{file_name}"
total_tiles -= 1
else
file_url = "#{tile_url}/#{x}/#{y}/#{extent[:zoom]}/users/#{user}/layers/gadm1%7Cmap_tiles_data%7Cine_poly%7Cgadm2%7Cgadm1"
tile_request = Typhoeus::Request.new(file_url)
tile_request.on_complete do |response|
start_tiles += 1
File.open("#{save_path}/#{file_name}", "w+") do|f|
f.write response.body
#puts file_url
puts "#{start_tiles}/#{total_tiles}: #{save_path}/#{file_name}"
end
end
hydra.queue tile_request
end
end
end
end
hydra.run
time_end = Time.now
secs = time_end - time_start
puts "Total time: #{sprintf("%.2f", secs)} seconds (#{sprintf("%.2f", secs/60.0)} mins). #{sprintf("%.2f", total_tiles/secs)} tiles per second." |
require "csv"
require "pp"
data = Hash.new { |hash, key| hash[key] = [0]*15 }
CSV.foreach("data/extract1.csv", headers: true) do |row|
data[row["Cause"]][row["Year"].to_i - 1999] += row["All ages"].to_i
end
pp data.to_a.sample(100)
More mortality parsing
require "csv"
require "pp"
# Death codes
codes = {}
IO.foreach("data/icd10cm_order_2016.txt") do |line|
code = line[6..13].rstrip
next unless code.length == 4
desc = line[77..-1].rstrip
# p [code, desc]
codes[code] = desc
end
# Mortality data
data = Hash.new { |hash, key| hash[key] = [0]*15 }
CSV.foreach("data/extract1.csv", headers: true) do |row|
cause = row["Cause"]
cause = codes[cause]
data[cause][row["Year"].to_i - 1999] += row["All ages"].to_i
end
pp data.to_a.sample(100)
|
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{email_spec}
s.version = "0.1.3"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Ben Mabey", "Aaron Gibralter", "Mischa Fierer"]
s.date = %q{2009-04-15}
s.description = %q{Easily test email in rspec and cucumber}
s.email = %q{ben@benmabey.com}
s.extra_rdoc_files = ["README.rdoc", "MIT-LICENSE.txt"]
s.files = ["History.txt", "install.rb", "MIT-LICENSE.txt", "README.rdoc", "Rakefile", "lib/email_spec", "lib/email_spec/address_converter.rb", "lib/email_spec/cucumber.rb", "lib/email_spec/deliveries.rb", "lib/email_spec/email_viewer.rb", "lib/email_spec/helpers.rb", "lib/email_spec/matchers.rb", "lib/email_spec.rb", "rails_generators/email_spec", "rails_generators/email_spec/email_spec_generator.rb", "rails_generators/email_spec/templates", "rails_generators/email_spec/templates/email_steps.rb", "spec/email_spec", "spec/email_spec/matchers_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "examples/rails_root", "examples/rails_root/app", "examples/rails_root/app/controllers", "examples/rails_root/app/controllers/application.rb", "examples/rails_root/app/controllers/welcome_controller.rb", "examples/rails_root/app/helpers", "examples/rails_root/app/helpers/application_helper.rb", "examples/rails_root/app/helpers/welcome_helper.rb", "examples/rails_root/app/models", "examples/rails_root/app/models/user.rb", "examples/rails_root/app/models/user_mailer.rb", "examples/rails_root/app/views", "examples/rails_root/app/views/user_mailer", "examples/rails_root/app/views/user_mailer/signup.erb", "examples/rails_root/app/views/welcome", "examples/rails_root/app/views/welcome/confirm.html.erb", "examples/rails_root/app/views/welcome/index.html.erb", "examples/rails_root/app/views/welcome/signup.html.erb", "examples/rails_root/config", "examples/rails_root/config/boot.rb", "examples/rails_root/config/database.yml", "examples/rails_root/config/environment.rb", "examples/rails_root/config/environments", "examples/rails_root/config/environments/development.rb", "examples/rails_root/config/environments/production.rb", "examples/rails_root/config/environments/test.rb", "examples/rails_root/config/initializers", "examples/rails_root/config/initializers/inflections.rb", "examples/rails_root/config/initializers/mime_types.rb", "examples/rails_root/config/initializers/new_rails_defaults.rb", "examples/rails_root/config/routes.rb", "examples/rails_root/cucumber.yml", "examples/rails_root/db", "examples/rails_root/db/development.sqlite3", "examples/rails_root/db/migrate", "examples/rails_root/db/migrate/20090125013728_create_users.rb", "examples/rails_root/db/schema.rb", "examples/rails_root/db/test.sqlite3", "examples/rails_root/doc", "examples/rails_root/doc/README_FOR_APP", "examples/rails_root/features", "examples/rails_root/features/errors.feature", "examples/rails_root/features/example.feature", "examples/rails_root/features/step_definitions", "examples/rails_root/features/step_definitions/email_steps.rb", "examples/rails_root/features/step_definitions/user_steps.rb", "examples/rails_root/features/step_definitions/webrat_steps.rb", "examples/rails_root/features/support", "examples/rails_root/features/support/env.rb", "examples/rails_root/lib", "examples/rails_root/log", "examples/rails_root/log/development.log", "examples/rails_root/log/test.log", "examples/rails_root/public", "examples/rails_root/public/404.html", "examples/rails_root/public/422.html", "examples/rails_root/public/500.html", "examples/rails_root/public/dispatch.rb", "examples/rails_root/public/favicon.ico", "examples/rails_root/public/images", "examples/rails_root/public/images/rails.png", "examples/rails_root/public/javascripts", "examples/rails_root/public/javascripts/application.js", "examples/rails_root/public/javascripts/controls.js", "examples/rails_root/public/javascripts/dragdrop.js", "examples/rails_root/public/javascripts/effects.js", "examples/rails_root/public/javascripts/prototype.js", "examples/rails_root/public/robots.txt", "examples/rails_root/script", "examples/rails_root/script/about", "examples/rails_root/script/autospec", "examples/rails_root/script/console", "examples/rails_root/script/cucumber", "examples/rails_root/script/dbconsole", "examples/rails_root/script/destroy", "examples/rails_root/script/generate", "examples/rails_root/script/performance", "examples/rails_root/script/performance/benchmarker", "examples/rails_root/script/performance/profiler", "examples/rails_root/script/performance/request", "examples/rails_root/script/plugin", "examples/rails_root/script/process", "examples/rails_root/script/process/inspector", "examples/rails_root/script/process/reaper", "examples/rails_root/script/process/spawner", "examples/rails_root/script/runner", "examples/rails_root/script/server", "examples/rails_root/script/spec", "examples/rails_root/script/spec_server", "examples/rails_root/spec", "examples/rails_root/spec/controllers", "examples/rails_root/spec/controllers/welcome_controller_spec.rb", "examples/rails_root/spec/model_factory.rb", "examples/rails_root/spec/models", "examples/rails_root/spec/models/user_mailer_spec.rb", "examples/rails_root/spec/models/user_spec.rb", "examples/rails_root/spec/rcov.opts", "examples/rails_root/spec/spec.opts", "examples/rails_root/spec/spec_helper.rb", "examples/rails_root/stories", "examples/rails_root/stories/all.rb", "examples/rails_root/stories/helper.rb", "examples/rails_root/vendor", "examples/rails_root/vendor/plugins", "examples/rails_root/vendor/plugins/email_spec", "examples/rails_root/vendor/plugins/email_spec/rails_generators", "examples/rails_root/vendor/plugins/email_spec/rails_generators/email_spec", "examples/rails_root/vendor/plugins/email_spec/rails_generators/email_spec/email_spec_generator.rb", "examples/rails_root/vendor/plugins/email_spec/rails_generators/email_spec/templates", "examples/rails_root/vendor/plugins/email_spec/rails_generators/email_spec/templates/email_steps.rb"]
s.has_rdoc = true
s.homepage = %q{http://github.com/bmabey/email-spec/}
s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.1}
s.summary = %q{Easily test email in rspec and cucumber}
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 2
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
else
end
else
end
end
come on github.. build the gem for me...
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{email_spec}
s.version = "0.1.3"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Ben Mabey", "Aaron Gibralter", "Mischa Fierer"]
s.date = %q{2009-04-15}
s.description = %q{Easily test email in rspec and cucumber}
s.email = %q{ben@benmabey.com}
s.extra_rdoc_files = ["README.rdoc", "MIT-LICENSE.txt"]
s.files = ["History.txt", "install.rb", "MIT-LICENSE.txt", "README.rdoc", "Rakefile", "lib/email_spec", "lib/email_spec/address_converter.rb", "lib/email_spec/cucumber.rb", "lib/email_spec/deliveries.rb", "lib/email_spec/email_viewer.rb", "lib/email_spec/helpers.rb", "lib/email_spec/matchers.rb", "lib/email_spec.rb", "rails_generators/email_spec", "rails_generators/email_spec/email_spec_generator.rb", "rails_generators/email_spec/templates", "rails_generators/email_spec/templates/email_steps.rb", "spec/email_spec", "spec/email_spec/matchers_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "examples/rails_root", "examples/rails_root/app", "examples/rails_root/app/controllers", "examples/rails_root/app/controllers/application.rb", "examples/rails_root/app/controllers/welcome_controller.rb", "examples/rails_root/app/helpers", "examples/rails_root/app/helpers/application_helper.rb", "examples/rails_root/app/helpers/welcome_helper.rb", "examples/rails_root/app/models", "examples/rails_root/app/models/user.rb", "examples/rails_root/app/models/user_mailer.rb", "examples/rails_root/app/views", "examples/rails_root/app/views/user_mailer", "examples/rails_root/app/views/user_mailer/signup.erb", "examples/rails_root/app/views/welcome", "examples/rails_root/app/views/welcome/confirm.html.erb", "examples/rails_root/app/views/welcome/index.html.erb", "examples/rails_root/app/views/welcome/signup.html.erb", "examples/rails_root/config", "examples/rails_root/config/boot.rb", "examples/rails_root/config/database.yml", "examples/rails_root/config/environment.rb", "examples/rails_root/config/environments", "examples/rails_root/config/environments/development.rb", "examples/rails_root/config/environments/production.rb", "examples/rails_root/config/environments/test.rb", "examples/rails_root/config/initializers", "examples/rails_root/config/initializers/inflections.rb", "examples/rails_root/config/initializers/mime_types.rb", "examples/rails_root/config/initializers/new_rails_defaults.rb", "examples/rails_root/config/routes.rb", "examples/rails_root/cucumber.yml", "examples/rails_root/db", "examples/rails_root/db/migrate", "examples/rails_root/db/migrate/20090125013728_create_users.rb", "examples/rails_root/db/schema.rb", "examples/rails_root/doc", "examples/rails_root/doc/README_FOR_APP", "examples/rails_root/features", "examples/rails_root/features/errors.feature", "examples/rails_root/features/example.feature", "examples/rails_root/features/step_definitions", "examples/rails_root/features/step_definitions/email_steps.rb", "examples/rails_root/features/step_definitions/user_steps.rb", "examples/rails_root/features/step_definitions/webrat_steps.rb", "examples/rails_root/features/support", "examples/rails_root/features/support/env.rb", "examples/rails_root/lib", "examples/rails_root/log", "examples/rails_root/log/development.log", "examples/rails_root/log/test.log", "examples/rails_root/public", "examples/rails_root/public/404.html", "examples/rails_root/public/422.html", "examples/rails_root/public/500.html", "examples/rails_root/public/dispatch.rb", "examples/rails_root/public/favicon.ico", "examples/rails_root/public/images", "examples/rails_root/public/images/rails.png", "examples/rails_root/public/javascripts", "examples/rails_root/public/javascripts/application.js", "examples/rails_root/public/javascripts/controls.js", "examples/rails_root/public/javascripts/dragdrop.js", "examples/rails_root/public/javascripts/effects.js", "examples/rails_root/public/javascripts/prototype.js", "examples/rails_root/public/robots.txt", "examples/rails_root/script", "examples/rails_root/script/about", "examples/rails_root/script/autospec", "examples/rails_root/script/console", "examples/rails_root/script/cucumber", "examples/rails_root/script/dbconsole", "examples/rails_root/script/destroy", "examples/rails_root/script/generate", "examples/rails_root/script/performance", "examples/rails_root/script/performance/benchmarker", "examples/rails_root/script/performance/profiler", "examples/rails_root/script/performance/request", "examples/rails_root/script/plugin", "examples/rails_root/script/process", "examples/rails_root/script/process/inspector", "examples/rails_root/script/process/reaper", "examples/rails_root/script/process/spawner", "examples/rails_root/script/runner", "examples/rails_root/script/server", "examples/rails_root/script/spec", "examples/rails_root/script/spec_server", "examples/rails_root/spec", "examples/rails_root/spec/controllers", "examples/rails_root/spec/controllers/welcome_controller_spec.rb", "examples/rails_root/spec/model_factory.rb", "examples/rails_root/spec/models", "examples/rails_root/spec/models/user_mailer_spec.rb", "examples/rails_root/spec/models/user_spec.rb", "examples/rails_root/spec/rcov.opts", "examples/rails_root/spec/spec.opts", "examples/rails_root/spec/spec_helper.rb", "examples/rails_root/stories", "examples/rails_root/stories/all.rb", "examples/rails_root/stories/helper.rb", "examples/rails_root/vendor", "examples/rails_root/vendor/plugins", "examples/rails_root/vendor/plugins/email_spec", "examples/rails_root/vendor/plugins/email_spec/rails_generators", "examples/rails_root/vendor/plugins/email_spec/rails_generators/email_spec", "examples/rails_root/vendor/plugins/email_spec/rails_generators/email_spec/email_spec_generator.rb", "examples/rails_root/vendor/plugins/email_spec/rails_generators/email_spec/templates", "examples/rails_root/vendor/plugins/email_spec/rails_generators/email_spec/templates/email_steps.rb"]
s.has_rdoc = true
s.homepage = %q{http://github.com/bmabey/email-spec/}
s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.1}
s.summary = %q{Easily test email in rspec and cucumber}
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 2
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
else
end
else
end
end
|
require 'cinch'
require_relative '../utils/utils.rb'
class ASBNaturePlugin
include Cinch::Plugin
match /^(!|@)asbnature (\w+) ?(.*)?/i, method: :asbnature
match /^(!|@)findnature (.+)[ ]+(.+)/i, method: :findnature
def asbnature(m, msgtype, nature, moodycheck)
$naturesheet.rows.each do |row|
if BotUtils.condense_name(row[0]) == BotUtils.condense_name(nature)
if moodycheck == 'moody'
BotUtils.msgtype_reply(m, msgtype, "#{row[0]}: #{ row[2].gsub(/[\(\)]/, '') } with Moody activated.")
else
BotUtils.msgtype_reply(m, msgtype, "#{row[0]}: #{ row[1].gsub(/[\(\)]/, '') }")
end
return
end
end
BotUtils.msgtype_reply(m, msgtype, "Nature not found.")
end
def findnature(m, msgtype, boost1, boost2)
$naturesheet.rows.each do |row|
if BotUtils.condense_name(row[1]).include?(BotUtils.condense_name(boost1)) && BotUtils.condense_name(row[1]).include?(BotUtils.condense_name(boost2))
BotUtils.msgtype_reply(m, msgtype, "The corresponding nature is #{row[0]}.")
end
return
end
BotUtils.msgtype_reply(m, msgtype, "Nature not found.")
end
end
oops fix
require 'cinch'
require_relative '../utils/utils.rb'
class ASBNaturePlugin
include Cinch::Plugin
match /^(!|@)asbnature (\w+) ?(.*)?/i, method: :asbnature
match /^(!|@)findnature (.+)[ ]+(.+)/i, method: :findnature
def asbnature(m, msgtype, nature, moodycheck)
$naturesheet.rows.each do |row|
if BotUtils.condense_name(row[0]) == BotUtils.condense_name(nature)
if moodycheck == 'moody'
BotUtils.msgtype_reply(m, msgtype, "#{row[0]}: #{ row[2].gsub(/[\(\)]/, '') } with Moody activated.")
else
BotUtils.msgtype_reply(m, msgtype, "#{row[0]}: #{ row[1].gsub(/[\(\)]/, '') }")
end
return
end
end
BotUtils.msgtype_reply(m, msgtype, "Nature not found.")
end
def findnature(m, msgtype, boost1, boost2)
$naturesheet.rows.each do |row|
if BotUtils.condense_name(row[1]).include?(BotUtils.condense_name(boost1)) && BotUtils.condense_name(row[1]).include?(BotUtils.condense_name(boost2))
BotUtils.msgtype_reply(m, msgtype, "The corresponding nature is #{row[0]}.")
return
end
end
BotUtils.msgtype_reply(m, msgtype, "Nature not found.")
end
end |
require 'cinch'
require_relative '../utils/utils.rb'
def reduce_string str
str.downcase.gsub(/\s+/, "")
end
class ASBNaturePlugin
include Cinch::Plugin
match /^(!|@)asbnature (\w+) ?(.*)?/i, method: :asbnature
match /^(!|@)findnature (.+)[ ]+(.+)/i, method: :findnature
def asbnature(m, msgtype, nature, moodycheck)
$naturesheet.rows.each do |row|
if BotUtils.condense_name(row[0]) == BotUtils.condense_name(nature)
if moodycheck == 'moody'
BotUtils.msgtype_reply(m, msgtype, "#{row[0]}: #{ row[2].gsub(/[\(\)]/, '') } with Moody activated.")
else
BotUtils.msgtype_reply(m, msgtype, "#{row[0]}: #{ row[1].gsub(/[\(\)]/, '') }")
end
return
end
end
BotUtils.msgtype_reply(m, msgtype, "Nature not found.")
end
def findnature(m, msgtype, boost1, boost2)
$naturesheet.rows.each do |row|
if reduce_string(row[1]).include?(reduce_string(boost1)) && reduce_string(row[1]).include?(reduce_string(boost2))
BotUtils.msgtype_reply(m, msgtype, "The corresponding nature is #{row[0].strip}.")
return
end
end
BotUtils.msgtype_reply(m, msgtype, "Nature not found.")
end
end
debug
require 'cinch'
require_relative '../utils/utils.rb'
def reduce_string str
str.downcase.gsub(/\s+/, "")
end
class ASBNaturePlugin
include Cinch::Plugin
match /^(!|@)asbnature (\w+) ?(.*)?/i, method: :asbnature
match /^(!|@)findnature (.+)[ ]+(.+)/i, method: :findnature
def asbnature(m, msgtype, nature, moodycheck)
$naturesheet.rows.each do |row|
if BotUtils.condense_name(row[0]) == BotUtils.condense_name(nature)
if moodycheck == 'moody'
BotUtils.msgtype_reply(m, msgtype, "#{row[0]}: #{ row[2].gsub(/[\(\)]/, '') } with Moody activated.")
else
BotUtils.msgtype_reply(m, msgtype, "#{row[0]}: #{ row[1].gsub(/[\(\)]/, '') }")
end
return
end
end
BotUtils.msgtype_reply(m, msgtype, "Nature not found.")
end
def findnature(m, msgtype, boost1, boost2)
$naturesheet.rows.each do |row|
Botutils.msgtype_reply m, msgtype, reduce_string(boost1)
BotUtils.msgtype_reply m, msgtype, reduce_string(boost2)
BotUtils.msgtype_reply m, msgtype, reduce_string(row[1])
if reduce_string(row[1]).include?(reduce_string(boost1)) && reduce_string(row[1]).include?(reduce_string(boost2))
BotUtils.msgtype_reply(m, msgtype, "The corresponding nature is #{row[0].strip}.")
return
end
end
BotUtils.msgtype_reply(m, msgtype, "Nature not found.")
end
end |
Pod::Spec.new do |s|
s.name = "JTSCursorMovement"
s.version = "1.0.0"
s.summary = "A drop-in utility for adding convenient swipe gesture cursor movements to a UITextView."
s.homepage = "https://github.com/jaredsinclair/JTSCursorMovement"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Jared Sinclair" => "https://twitter.com/jaredsinclair" }
s.source = { :git => "https://github.com/jaredsinclair/JTSCursorMovement.git", :tag => s.version.to_s }
s.platform = :ios, '7.0'
s.requires_arc = true
s.frameworks = 'UIKit'
s.compiler_flags = "-fmodules"
s.ios.deployment_target = '7.0'
s.source_files = ['Source/*.{h,m}']
end
Update podspec.
Pod::Spec.new do |s|
s.name = "JTSCursorMovement"
s.version = "1.1.0"
s.summary = "A drop-in utility for adding convenient swipe gesture cursor movements to a UITextView."
s.homepage = "https://github.com/jaredsinclair/JTSCursorMovement"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Jared Sinclair" => "https://twitter.com/jaredsinclair" }
s.source = { :git => "https://github.com/jaredsinclair/JTSCursorMovement.git", :tag => s.version.to_s }
s.platform = :ios, '7.0'
s.requires_arc = true
s.frameworks = 'UIKit'
s.compiler_flags = "-fmodules"
s.ios.deployment_target = '7.0'
s.source_files = ['Source/*.{h,m}']
end
|
Gem::Specification.new do |s|
s.name = %q{consumer}
s.version = "0.8.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Woody Peterson"]
s.date = %q{2008-11-14}
s.default_executable = %q{consumer}
s.description = %q{FIX (describe your package)}
s.email = ["woody.peterson@gmail.com"]
s.executables = ["consumer"]
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "app_generators/consumer/templates/README.rdoc", "examples/active_record/README.txt", "website/index.txt"]
s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "app_generators/consumer/USAGE", "app_generators/consumer/consumer_generator.rb", "app_generators/consumer/templates/LICENSE", "app_generators/consumer/templates/README.rdoc", "app_generators/consumer/templates/Rakefile", "app_generators/consumer/templates/TODO", "app_generators/consumer/templates/config/config.yml", "app_generators/consumer/templates/config/config.yml.sample", "app_generators/consumer/templates/lib/base.rb", "app_generators/consumer/templates/rails/init.rb", "app_generators/consumer/templates/script/destroy", "app_generators/consumer/templates/script/generate", "app_generators/consumer/templates/spec/spec_helper.rb", "app_generators/consumer/templates/spec/ups_rate_request_spec.rb", "app_generators/consumer/templates/spec/xml/ups_rate_response.xml", "bin/consumer", "config/website.yml.sample", "consumer.gemspec", "consumer_generators/request/USAGE", "consumer_generators/request/request_generator.rb", "consumer_generators/request/templates/lib/request.rb", "consumer_generators/request/templates/lib/response.rb", "consumer_generators/request/templates/spec/request_spec.rb", "consumer_generators/request/templates/spec/response_spec.rb", "consumer_generators/request/templates/spec/xml/response.xml", "examples/active_record/README.txt", "examples/active_record/ar_spec.rb", "examples/active_record/database.sqlite", "examples/active_record/environment.rb", "examples/active_record/migration.rb", "examples/active_record/models/book.rb", "examples/active_record/models/contributor.rb", "examples/active_record/xml/book.xml", "examples/active_record/xml/book_with_contributors.xml", "examples/active_record/xml/contributor.xml", "examples/active_record/xml/contributor_with_books.xml", "examples/shipping/environment.rb", "examples/shipping/rate.rb", "examples/shipping/shipping.yml.sample", "examples/shipping/shipping_spec.rb", "examples/shipping/ups_rate_request.rb", "examples/shipping/ups_rate_response.xml", "lib/consumer.rb", "lib/consumer/helper.rb", "lib/consumer/mapping.rb", "lib/consumer/request.rb", "script/console", "script/destroy", "script/generate", "script/txt2html", "spec/helper_spec.rb", "spec/mapping_spec.rb", "spec/request_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/xml/rate_response.xml", "spec/xml/rate_response_error.xml", "tasks/rspec.rake", "test/test_consumer_generator.rb", "test/test_generator_helper.rb", "test/test_request_generator.rb", "website/index.html", "website/index.txt", "website/javascripts/rounded_corners_lite.inc.js", "website/stylesheets/screen.css", "website/template.html.erb"]
s.has_rdoc = true
s.homepage = %q{FIX (url)}
s.post_install_message = %q{PostInstall.txt}
s.rdoc_options = ["--main", "README.rdoc"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{consumer}
s.rubygems_version = %q{1.2.0}
s.summary = %q{FIX (describe your package)}
s.test_files = ["test/test_consumer_generator.rb", "test/test_generator_helper.rb", "test/test_request_generator.rb"]
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 2
if current_version >= 3 then
s.add_runtime_dependency(%q<activesupport>, [">= 2.0.2"])
s.add_runtime_dependency(%q<libxml-ruby>, [">= 0.8.3"])
s.add_runtime_dependency(%q<builder>, [">= 2.1.2"])
s.add_development_dependency(%q<newgem>, [">= 1.0.7"])
s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
else
s.add_dependency(%q<activesupport>, [">= 2.0.2"])
s.add_dependency(%q<libxml-ruby>, [">= 0.8.3"])
s.add_dependency(%q<builder>, [">= 2.1.2"])
s.add_dependency(%q<newgem>, [">= 1.0.7"])
s.add_dependency(%q<hoe>, [">= 1.8.0"])
end
else
s.add_dependency(%q<activesupport>, [">= 2.0.2"])
s.add_dependency(%q<libxml-ruby>, [">= 0.8.3"])
s.add_dependency(%q<builder>, [">= 2.1.2"])
s.add_dependency(%q<newgem>, [">= 1.0.7"])
s.add_dependency(%q<hoe>, [">= 1.8.0"])
end
end
gemspec version bump
Gem::Specification.new do |s|
s.name = %q{consumer}
s.version = "0.8.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Woody Peterson"]
s.date = %q{2009-01-29}
s.default_executable = %q{consumer}
s.description = %q{Consumer is a library for consuming xml resources via Builder, libxml, and some request sending / response marshaling glue. It comes with an app generator that creates an empty ready-for-rails gem that itself comes with a generator for making the request/response classes, config files, and specs (see script/generate after creating a new Consumer project).}
s.email = ["woody.peterson@gmail.com"]
s.executables = ["consumer"]
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "app_generators/consumer/templates/README.rdoc", "examples/active_record/README.txt", "website/index.txt"]
s.files = ["History.txt", "LICENSE", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "app_generators/consumer/USAGE", "app_generators/consumer/consumer_generator.rb", "app_generators/consumer/templates/LICENSE", "app_generators/consumer/templates/README.rdoc", "app_generators/consumer/templates/Rakefile", "app_generators/consumer/templates/TODO", "app_generators/consumer/templates/config/config.yml", "app_generators/consumer/templates/config/config.yml.sample", "app_generators/consumer/templates/lib/base.rb", "app_generators/consumer/templates/rails/init.rb", "app_generators/consumer/templates/script/destroy", "app_generators/consumer/templates/script/generate", "app_generators/consumer/templates/spec/spec_helper.rb", "bin/consumer", "config/website.yml.sample", "consumer.gemspec", "consumer_generators/request/USAGE", "consumer_generators/request/request_generator.rb", "consumer_generators/request/templates/lib/request.rb", "consumer_generators/request/templates/lib/response.rb", "consumer_generators/request/templates/spec/request_spec.rb", "consumer_generators/request/templates/spec/response_spec.rb", "consumer_generators/request/templates/spec/xml/response.xml", "examples/active_record/README.txt", "examples/active_record/ar_spec.rb", "examples/active_record/database.sqlite", "examples/active_record/environment.rb", "examples/active_record/migration.rb", "examples/active_record/models/book.rb", "examples/active_record/models/contributor.rb", "examples/active_record/xml/book.xml", "examples/active_record/xml/book_with_contributors.xml", "examples/active_record/xml/contributor.xml", "examples/active_record/xml/contributor_with_books.xml", "examples/shipping/environment.rb", "examples/shipping/rate.rb", "examples/shipping/shipping.yml.sample", "examples/shipping/shipping_spec.rb", "examples/shipping/ups_rate_request.rb", "examples/shipping/ups_rate_response.xml", "lib/consumer.rb", "lib/consumer/helper.rb", "lib/consumer/mapping.rb", "lib/consumer/request.rb", "rails_generators/request/USAGE", "rails_generators/request/request_generator.rb", "script/console", "script/destroy", "script/generate", "script/txt2html", "spec/helper_spec.rb", "spec/mapping_spec.rb", "spec/request_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/xml/rate_response.xml", "spec/xml/rate_response_error.xml", "tasks/rspec.rake", "test/test_consumer_generator.rb", "test/test_consumer_plugin_request_generator.rb", "test/test_generator_helper.rb", "test/test_rails_request_generator.rb", "website/index.html", "website/index.txt", "website/javascripts/rounded_corners_lite.inc.js", "website/stylesheets/screen.css", "website/template.html.erb"]
s.has_rdoc = true
s.homepage = %q{http://consumer.rubyforge.org}
s.post_install_message = %q{PostInstall.txt}
s.rdoc_options = ["--main", "README.rdoc"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{consumer}
s.rubygems_version = %q{1.2.0}
s.summary = %q{Consumer is a library for consuming xml resources via Builder, libxml, and some request sending / response marshaling glue}
s.test_files = ["test/test_consumer_generator.rb", "test/test_consumer_plugin_request_generator.rb", "test/test_generator_helper.rb", "test/test_rails_request_generator.rb"]
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 2
if current_version >= 3 then
s.add_runtime_dependency(%q<activesupport>, [">= 2.0.2"])
s.add_runtime_dependency(%q<libxml-ruby>, [">= 0.8.3"])
s.add_runtime_dependency(%q<builder>, [">= 2.1.2"])
s.add_development_dependency(%q<newgem>, [">= 1.0.7"])
s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
else
s.add_dependency(%q<activesupport>, [">= 2.0.2"])
s.add_dependency(%q<libxml-ruby>, [">= 0.8.3"])
s.add_dependency(%q<builder>, [">= 2.1.2"])
s.add_dependency(%q<newgem>, [">= 1.0.7"])
s.add_dependency(%q<hoe>, [">= 1.8.0"])
end
else
s.add_dependency(%q<activesupport>, [">= 2.0.2"])
s.add_dependency(%q<libxml-ruby>, [">= 0.8.3"])
s.add_dependency(%q<builder>, [">= 2.1.2"])
s.add_dependency(%q<newgem>, [">= 1.0.7"])
s.add_dependency(%q<hoe>, [">= 1.8.0"])
end
end
|
Add Makefile.builder
ifeq ($(PACKAGE_SET),dom0)
RPM_SPEC_FILES := $(addprefix rpm_spec/,core-dom0-doc.spec core-dom0.spec)
endif
|
#
# Be sure to run `pod lib lint Migrator.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = "Migrator"
s.version = "0.1.1"
s.summary = "Migrator"
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = <<-DESC
Migrator is a library for performing the migration of the data when the iOS app has been upgraded.
DESC
s.homepage = "https://github.com/radioboo/Migrator"
# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
s.license = 'MIT'
s.author = { "radioboo" => "sakai.atsushi@gmail.com" }
s.source = { :git => "https://github.com/radioboo/Migrator.git", :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.platform = :ios, '8.0'
s.requires_arc = true
s.source_files = 'Pod/Classes/**/*'
s.resource_bundles = {
'Migrator' => ['Pod/Assets/*.png']
}
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
s.dependency 'EDSemver'
end
fix podspec
#
# Be sure to run `pod lib lint Migrator.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = "Migrator"
s.version = "0.2.0"
s.summary = "iOS Application Migration Handler"
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = <<-DESC
Migrator is a library for performing the migration of the data when the iOS app has been upgraded.
DESC
s.homepage = "https://github.com/radioboo/Migrator"
# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
s.license = 'MIT'
s.author = { "radioboo" => "sakai.atsushi@gmail.com" }
s.source = { :git => "https://github.com/radioboo/Migrator.git", :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.platform = :ios, '8.0'
s.requires_arc = true
s.source_files = 'Pod/Classes/**/*'
s.resource_bundles = {
'Migrator' => ['Pod/Assets/*.png']
}
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
s.dependency 'EDSemver'
end
|
Pod::Spec.new do |s|
s.name = 'Mixpanel'
s.version = '3.7.1'
s.summary = 'iPhone tracking library for Mixpanel Analytics'
s.homepage = 'https://mixpanel.com'
s.license = 'Apache License, Version 2.0'
s.author = { 'Mixpanel, Inc' => 'support@mixpanel.com' }
s.source = { :git => 'https://github.com/mixpanel/mixpanel-iphone.git', :tag => "v#{s.version}" }
s.requires_arc = true
s.libraries = 'icucore'
s.swift_version = '4.2'
s.ios.deployment_target = '10.0'
s.ios.source_files = 'Mixpanel/**/*.{m,h}'
s.ios.exclude_files = 'Mixpanel/MixpanelWatchProperties.{m,h}'
s.ios.public_header_files = 'Mixpanel/Mixpanel.h', 'Mixpanel/MixpanelType.h', 'Mixpanel/MixpanelGroup.h', 'Mixpanel/MixpanelType.h', 'Mixpanel/MixpanelPeople.h'
s.ios.private_header_files = 'Mixpanel/MixpanelPeoplePrivate.h', 'Mixpanel/MixpanelGroupPrivate.h', 'Mixpanel/MPNetworkPrivate.h', 'Mixpanel/MixpanelPrivate.h', 'Mixpanel/SessionMetadata.h'
s.ios.frameworks = 'UIKit', 'Foundation', 'SystemConfiguration', 'CoreTelephony', 'Accelerate', 'CoreGraphics', 'QuartzCore', 'StoreKit'
s.tvos.deployment_target = '9.0'
s.tvos.source_files = 'Mixpanel/Mixpanel.{m,h}', 'Mixpanel/MixpanelPrivate.h', 'Mixpanel/MixpanelPeople.{m,h}', 'Mixpanel/MixpanelGroup.{m,h}', 'Mixpanel/MixpanelType.{m,h}', 'Mixpanel/MixpanelGroupPrivate.h', 'Mixpanel/MixpanelPeoplePrivate.h', 'Mixpanel/MPNetwork.{m,h}', 'Mixpanel/MPNetworkPrivate.h', 'Mixpanel/MPLogger.h', 'Mixpanel/MPFoundation.h', 'Mixpanel/MixpanelExceptionHandler.{m,h}', 'Mixpanel/SessionMetadata.{m,h}'
s.tvos.public_header_files = 'Mixpanel/Mixpanel.h', 'Mixpanel/MixpanelPeople.h', 'Mixpanel/MixpanelGroup.h', 'Mixpanel/MixpanelType.h'
s.tvos.private_header_files = 'Mixpanel/MixpanelPrivate.h', 'Mixpanel/MixpanelPeoplePrivate.h', 'Mixpanel/MPNetworkPrivate.h', 'Mixpanel/SessionMetadata.h', 'Mixapnel/MixpanelGroupPrivate.h'
s.tvos.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) MIXPANEL_TVOS'}
s.tvos.frameworks = 'UIKit', 'Foundation'
s.watchos.deployment_target = '3.0'
s.watchos.source_files = 'Mixpanel/MixpanelWatchProperties.{m,h}', 'Mixpanel/Mixpanel.{m,h}', 'Mixpanel/MixpanelPrivate.h', 'Mixpanel/MixpanelPeople.{m,h}', 'Mixpanel/MixpanelGroup.{m,h}', 'Mixpanel/MixpanelType.{m,h}', 'Mixpanel/MixpanelGroupPrivate.h', 'Mixpanel/MixpanelPeoplePrivate.h', 'Mixpanel/MPNetwork.{m,h}', 'Mixpanel/MPNetworkPrivate.h', 'Mixpanel/MPLogger.h', 'Mixpanel/MPFoundation.h', 'Mixpanel/MixpanelExceptionHandler.{m,h}', 'Mixpanel/SessionMetadata.{m,h}'
s.watchos.public_header_files = 'Mixpanel/Mixpanel.h', 'Mixpanel/MixpanelPeople.h', 'Mixpanel/MixpanelGroup.h', 'Mixpanel/MixpanelType.h'
s.watchos.private_header_files = 'Mixpanel/MixpanelPrivate.h', 'Mixpanel/MixpanelGroupPrivate.h', 'Mixpanel/MixpanelPeoplePrivate.h', 'Mixpanel/MPNetworkPrivate.h', 'Mixpanel/SessionMetadata.h'
s.watchos.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) MIXPANEL_WATCHOS'}
s.watchos.frameworks = 'WatchKit', 'Foundation'
s.osx.deployment_target = '10.10'
s.osx.source_files = 'Mixpanel/Mixpanel.{m,h}', 'Mixpanel/MixpanelPrivate.h', 'Mixpanel/MixpanelPeople.{m,h}', 'Mixpanel/MixpanelPeoplePrivate.h', 'Mixpanel/MixpanelGroup.{m,h}', 'Mixpanel/MixpanelType.{m,h}', 'Mixpanel/MixpanelGroupPrivate.h', 'Mixpanel/MPNetwork.{m,h}', 'Mixpanel/MPNetworkPrivate.h', 'Mixpanel/MPLogger.h', 'Mixpanel/MPFoundation.h', 'Mixpanel/MixpanelExceptionHandler.{m,h}', 'Mixpanel/SessionMetadata.{m,h}'
s.osx.public_header_files = 'Mixpanel/Mixpanel.h', 'Mixpanel/MixpanelPeople.h', 'Mixpanel/MixpanelGroup.h', 'Mixpanel/MixpanelType.h'
s.osx.private_header_files = 'Mixpanel/MixpanelPrivate.h', 'Mixpanel/MixpanelGroupPrivate.h', 'Mixpanel/MixpanelPeoplePrivate.h', 'Mixpanel/MPNetworkPrivate.h', 'Mixpanel/SessionMetadata.h'
s.osx.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) MIXPANEL_MACOS'}
s.osx.frameworks = 'Cocoa', 'Foundation', 'IOKit'
end
fix podspec
Pod::Spec.new do |s|
s.name = 'Mixpanel'
s.version = '3.7.1'
s.summary = 'iPhone tracking library for Mixpanel Analytics'
s.homepage = 'https://mixpanel.com'
s.license = 'Apache License, Version 2.0'
s.author = { 'Mixpanel, Inc' => 'support@mixpanel.com' }
s.source = { :git => 'https://github.com/mixpanel/mixpanel-iphone.git', :branch => "4.0.0.beta" }
s.requires_arc = true
s.libraries = 'icucore'
s.swift_version = '4.2'
s.ios.deployment_target = '10.0'
s.ios.source_files = 'Sources/**/*.{m,h}'
s.ios.exclude_files = 'Sources/MixpanelWatchProperties.{m,h}'
s.ios.public_header_files = 'Sources/Mixpanel.h', 'Sources/MixpanelType.h', 'Sources/MixpanelGroup.h', 'Sources/MixpanelType.h', 'Sources/MixpanelPeople.h'
s.ios.private_header_files = 'Sources/MixpanelPeoplePrivate.h', 'Sources/MixpanelGroupPrivate.h', 'Sources/MPNetworkPrivate.h', 'Sources/MixpanelPrivate.h', 'Sources/SessionMetadata.h'
s.ios.frameworks = 'UIKit', 'Foundation', 'SystemConfiguration', 'CoreTelephony', 'Accelerate', 'CoreGraphics', 'QuartzCore', 'StoreKit'
s.tvos.deployment_target = '9.0'
s.tvos.source_files = 'Sources/Mixpanel.{m,h}', 'Sources/MixpanelPrivate.h', 'Sources/MixpanelPeople.{m,h}', 'Sources/MixpanelGroup.{m,h}', 'Sources/MixpanelType.{m,h}', 'Sources/MixpanelGroupPrivate.h', 'Sources/MixpanelPeoplePrivate.h', 'Sources/MPNetwork.{m,h}', 'Sources/MPNetworkPrivate.h', 'Sources/MPLogger.h', 'Sources/MPFoundation.h', 'Sources/MixpanelExceptionHandler.{m,h}', 'Sources/SessionMetadata.{m,h}'
s.tvos.public_header_files = 'Sources/Mixpanel.h', 'Sources/MixpanelPeople.h', 'Sources/MixpanelGroup.h', 'Sources/MixpanelType.h'
s.tvos.private_header_files = 'Sources/MixpanelPrivate.h', 'Sources/MixpanelPeoplePrivate.h', 'Sources/MPNetworkPrivate.h', 'Sources/SessionMetadata.h', 'Sources/MixpanelGroupPrivate.h'
s.tvos.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) MIXPANEL_TVOS'}
s.tvos.frameworks = 'UIKit', 'Foundation'
s.watchos.deployment_target = '3.0'
s.watchos.source_files = 'Sources/MixpanelWatchProperties.{m,h}', 'Sources/Mixpanel.{m,h}', 'Sources/MixpanelPrivate.h', 'Sources/MixpanelPeople.{m,h}', 'Sources/MixpanelGroup.{m,h}', 'Sources/MixpanelType.{m,h}', 'Sources/MixpanelGroupPrivate.h', 'Sources/MixpanelPeoplePrivate.h', 'Sources/MPNetwork.{m,h}', 'Sources/MPNetworkPrivate.h', 'Sources/MPLogger.h', 'Sources/MPFoundation.h', 'Sources/MixpanelExceptionHandler.{m,h}', 'Sources/SessionMetadata.{m,h}'
s.watchos.public_header_files = 'Sources/Mixpanel.h', 'Sources/MixpanelPeople.h', 'Sources/MixpanelGroup.h', 'Sources/MixpanelType.h'
s.watchos.private_header_files = 'Sources/MixpanelPrivate.h', 'Sources/MixpanelGroupPrivate.h', 'Sources/MixpanelPeoplePrivate.h', 'Sources/MPNetworkPrivate.h', 'Sources/SessionMetadata.h'
s.watchos.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) MIXPANEL_WATCHOS'}
s.watchos.frameworks = 'WatchKit', 'Foundation'
s.osx.deployment_target = '10.10'
s.osx.source_files = 'Sources/Mixpanel.{m,h}', 'Sources/MixpanelPrivate.h', 'Sources/MixpanelPeople.{m,h}', 'Sources/MixpanelPeoplePrivate.h', 'Sources/MixpanelGroup.{m,h}', 'Sources/MixpanelType.{m,h}', 'Sources/MixpanelGroupPrivate.h', 'Sources/MPNetwork.{m,h}', 'Sources/MPNetworkPrivate.h', 'Sources/MPLogger.h', 'Sources/MPFoundation.h', 'Sources/MixpanelExceptionHandler.{m,h}', 'Sources/SessionMetadata.{m,h}'
s.osx.public_header_files = 'Sources/Mixpanel.h', 'Sources/MixpanelPeople.h', 'Sources/MixpanelGroup.h', 'Sources/MixpanelType.h'
s.osx.private_header_files = 'Sources/MixpanelPrivate.h', 'Sources/MixpanelGroupPrivate.h', 'Sources/MixpanelPeoplePrivate.h', 'Sources/MPNetworkPrivate.h', 'Sources/SessionMetadata.h'
s.osx.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) MIXPANEL_MACOS'}
s.osx.frameworks = 'Cocoa', 'Foundation', 'IOKit'
end
|
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "stylesheets"
sass_dir = "scss"
images_dir = "images"
javascripts_dir = "javascripts"
# output_style = :expanded or :nested or :compact or :compressed
output_style = :nested
# To enable relative paths to assets via compass helper functions. Uncomment:
relative_assets = true
# To disable debugging comments that display the original location of your selectors. Uncomment:
line_comments = false
Update config.rb
Typo
# You should be fine with these settings,
# feel welcomed to make your own structure if needed.
css_dir = "stylesheets"
sass_dir = "scss"
http_path = "/"
images_dir = "images"
javascripts_dir = "javascripts"
# Output: (:expanded) - (:nested) - (:compact) or (:compressed)
output_style = :nested
# Relative patch assets
relative_assets = true
# Show comments to localize scss in css
line_comments = false |
activate :google_analytics do |ga|
ga.tracking_id = 'ua-xxxxx'
ga.anonymize_ip = true
ga.debug = false
ga.development = false
ga.minify = true
end
require 'slim'
activate :livereload
activate :directory_indexes
set :js_dir, 'assets/javascripts'
set :css_dir, 'assets/stylesheets'
set :images_dir, 'assets/images'
# Add bower's directory to sprockets asset path
after_configuration do
@bower_config = JSON.parse(IO.read("#{root}/.bowerrc"))
sprockets.append_path File.join "#{root}", @bower_config["directory"]
end
# Build-specific configuration
configure :build do
activate :autoprefixer,
browsers: ['last 2 versions', 'ie 8', 'ie 9']
activate :minify_html
activate :minify_css
activate :minify_javascript
activate :asset_hash
activate :relative_assets
activate :gzip
end
Add GA
activate :google_analytics do |ga|
ga.tracking_id = 'UA-59738061-1'
ga.anonymize_ip = true
ga.debug = false
ga.development = false
ga.minify = true
end
require 'slim'
activate :livereload
activate :directory_indexes
set :js_dir, 'assets/javascripts'
set :css_dir, 'assets/stylesheets'
set :images_dir, 'assets/images'
# Add bower's directory to sprockets asset path
after_configuration do
@bower_config = JSON.parse(IO.read("#{root}/.bowerrc"))
sprockets.append_path File.join "#{root}", @bower_config["directory"]
end
# Build-specific configuration
configure :build do
activate :autoprefixer,
browsers: ['last 2 versions', 'ie 8', 'ie 9']
activate :minify_html
activate :minify_css
activate :minify_javascript
activate :asset_hash
activate :relative_assets
activate :gzip
end
|
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "public/css"
sass_dir = "public/sass"
images_dir = "public/img"
javascripts_dir = "public/js"
# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
# To disable debugging comments that display the original location of your selectors. Uncomment:
# line_comments = false
# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
Change sass_dir in config.rb
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "public/css"
sass_dir = "app/sass"
images_dir = "public/img"
javascripts_dir = "public/js"
# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
# To disable debugging comments that display the original location of your selectors. Uncomment:
# line_comments = false
# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
|
###
# Compass
###
# Susy grids in Compass
# First: gem install susy
# require 'susy'
# Change Compass configuration
# compass_config do |config|
# config.output_style = :compact
# end
###
# Page options, layouts, aliases and proxies
###
# Per-page layout changes:
#
# With no layout
# page "/path/to/file.html", :layout => false
#
# With alternative layout
# page "/path/to/file.html", :layout => :otherlayout
#
# A path which all have the same layout
# with_layout :admin do
# page "/admin/*"
# end
# Proxy (fake) files
# page "/this-page-has-no-template.html", :proxy => "/template-file.html" do
# @which_fake_page = "Rendering a fake page with a variable"
# end
###
# Helpers
###
# Automatic image dimensions on image_tag helper
# activate :automatic_image_sizes
# Methods defined in the helpers block are available in templates
# helpers do
# def some_helper
# "Helping"
# end
# end
set :css_dir, 'css'
set :js_dir, 'js'
set :images_dir, 'img'
# Build-specific configuration
configure :build do
# For example, change the Compass output style for deployment
activate :minify_css
# Minify Javascript on build
activate :minify_javascript
# Minify HTML
activate :minify_html
# Enable cache buster
# activate :cache_buster
# Use relative URLs
# activate :relative_assets
# Compress PNGs after build
# First: gem install middleman-smusher
# require "middleman-smusher"
# activate :smusher
# Or use a different image path
# set :http_path, "/Content/images/"
end
activate :deploy do |deploy|
deploy.method = :git
deploy.remote = 'gh-pages'
deploy.branch = 'master'
end
activate :livereload
Added assets fingerprinting
###
# Compass
###
# Susy grids in Compass
# First: gem install susy
# require 'susy'
# Change Compass configuration
# compass_config do |config|
# config.output_style = :compact
# end
###
# Page options, layouts, aliases and proxies
###
# Per-page layout changes:
#
# With no layout
# page "/path/to/file.html", :layout => false
#
# With alternative layout
# page "/path/to/file.html", :layout => :otherlayout
#
# A path which all have the same layout
# with_layout :admin do
# page "/admin/*"
# end
# Proxy (fake) files
# page "/this-page-has-no-template.html", :proxy => "/template-file.html" do
# @which_fake_page = "Rendering a fake page with a variable"
# end
###
# Helpers
###
# Automatic image dimensions on image_tag helper
# activate :automatic_image_sizes
# Methods defined in the helpers block are available in templates
# helpers do
# def some_helper
# "Helping"
# end
# end
set :css_dir, 'css'
set :js_dir, 'js'
set :images_dir, 'img'
# Build-specific configuration
configure :build do
# For example, change the Compass output style for deployment
activate :minify_css
# Minify Javascript on build
activate :minify_javascript
# Minify HTML
activate :minify_html
# Enable cache buster
# activate :cache_buster
# Use relative URLs
# activate :relative_assets
activate :asset_hash
# Compress PNGs after build
# First: gem install middleman-smusher
# require "middleman-smusher"
# activate :smusher
# Or use a different image path
# set :http_path, "/Content/images/"
end
activate :deploy do |deploy|
deploy.method = :git
deploy.remote = 'gh-pages'
deploy.branch = 'master'
end
activate :livereload
|
###
# Compass
###
# Change Compass configuration
# compass_config do |config|
# config.output_style = :compact
# end
###
# Page options, layouts, aliases and proxies
###
# Per-page layout changes:
#
# With no layout
# page "/path/to/file.html", :layout => false
#
# With alternative layout
# page "/path/to/file.html", :layout => :otherlayout
#
# A path which all have the same layout
# with_layout :admin do
# page "/admin/*"
# end
# Proxy pages (https://middlemanapp.com/advanced/dynamic_pages/)
# proxy "/this-page-has-no-template.html", "/template-file.html", :locals => {
# :which_fake_page => "Rendering a fake page with a local variable" }
###
# Helpers
###
# Automatic image dimensions on image_tag helper
# activate :automatic_image_sizes
# Reload the browser automatically whenever files change
# configure :development do
# activate :livereload
# end
# Methods defined in the helpers block are available in templates
# helpers do
# def some_helper
# "Helping"
# end
# end
set :css_dir, 'stylesheets'
set :js_dir, 'javascripts'
set :images_dir, 'images'
# Build-specific configuration
configure :build do
# For example, change the Compass output style for deployment
# activate :minify_css
# Minify Javascript on build
# activate :minify_javascript
# Enable cache buster
# activate :asset_hash
# Use relative URLs
# activate :relative_assets
# Or use a different image path
# set :http_prefix, "/Content/images/"
end
Activate live reload
###
# Compass
###
# Change Compass configuration
# compass_config do |config|
# config.output_style = :compact
# end
###
# Page options, layouts, aliases and proxies
###
# Per-page layout changes:
#
# With no layout
# page "/path/to/file.html", :layout => false
#
# With alternative layout
# page "/path/to/file.html", :layout => :otherlayout
#
# A path which all have the same layout
# with_layout :admin do
# page "/admin/*"
# end
# Proxy pages (https://middlemanapp.com/advanced/dynamic_pages/)
# proxy "/this-page-has-no-template.html", "/template-file.html", :locals => {
# :which_fake_page => "Rendering a fake page with a local variable" }
###
# Helpers
###
# Automatic image dimensions on image_tag helper
# activate :automatic_image_sizes
# Reload the browser automatically whenever files change
configure :development do
activate :livereload
end
# Methods defined in the helpers block are available in templates
# helpers do
# def some_helper
# "Helping"
# end
# end
set :css_dir, 'stylesheets'
set :js_dir, 'javascripts'
set :images_dir, 'images'
# Build-specific configuration
configure :build do
# For example, change the Compass output style for deployment
# activate :minify_css
# Minify Javascript on build
# activate :minify_javascript
# Enable cache buster
# activate :asset_hash
# Use relative URLs
# activate :relative_assets
# Or use a different image path
# set :http_prefix, "/Content/images/"
end
|
require 'sinatra'
require 'sass'
require 'builder'
require 'carrierwave_direct'
require 'dalli'
require 'rack-cache'
#
# Defined in ENV on Heroku. To try locally, start memcached and uncomment:
# ENV["MEMCACHE_SERVERS"] = "localhost"
if memcache_servers = ENV["MEMCACHE_SERVERS"]
use Rack::Cache,
verbose: true,
metastore: "memcached://#{memcache_servers}",
entitystore: "memcached://#{memcache_servers}"
# Flush the cache
Dalli::Client.new.flush
end
set :static_cache_control, [:public, max_age: 1800]
before do
cache_control :public, max_age: 1800 # 30 mins
end
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:aws_secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
config.fog_directory = ENV['AWS_FOG_DIRECTORY'] # bucket name
end
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWaveDirect::Uploader
end
get '/' do
haml :index
end
require 'httparty'
churchapp_headers = {"Content-type" => "application/json", "X-Account" => "winvin", "X-Application" => "Group Slideshow", "X-Auth" => ENV['CHURCHAPP_AUTH']}
get '/groups-slideshow/?' do
response = HTTParty.get('https://api.churchapp.co.uk/v1/smallgroups/groups?view=active', headers: churchapp_headers)
@groups = JSON.parse(response.body)["groups"]
haml :groups, layout: nil
end
get '/groups-signup/?' do
response = HTTParty.get('https://api.churchapp.co.uk/v1/addressbook/contacts?per_page=400', headers: churchapp_headers)
@contacts = JSON.parse(response.body)["contacts"]
response = HTTParty.get('https://api.churchapp.co.uk/v1/smallgroups/groups?view=active', headers: churchapp_headers)
@groups = JSON.parse(response.body)["groups"]
haml :groups_signup, layout: nil
end
post '/groups-signup/:group_id/:contact_id' do |group_id, contact_id|
body = {
"action" => "add",
"members" => {
"contacts" => [ contact_id.to_i ],
}
}.to_json
url = 'https://api.churchapp.co.uk/v1/smallgroups/group/'+group_id+'/members'
puts body, url
response = HTTParty.post(url, headers: churchapp_headers, body: body)
puts response.body
response.code
end
helpers do
def secs_until(n)
Time.parse(n['datetime']) - Time.now
end
end
SECONDS_IN_A_DAY = 86400
SECONDS_IN_A_WEEK = 86400 * 7
get '/feed.xml' do
require 'firebase'
firebase = Firebase::Client.new('https://winvin.firebaseio.com/')
all = firebase.get('news').body.values
soon = all.select do |n|
secs_until(n) >= 0 && secs_until(n) < SECONDS_IN_A_DAY
end
soon.each do |n|
n['id'] += '-soon'
n['pubDate'] = Time.parse(n['datetime']) - SECONDS_IN_A_DAY
end
upcoming = all.select do |n|
secs_until(n) >= SECONDS_IN_A_DAY && secs_until(n) < SECONDS_IN_A_WEEK
end
upcoming.each do |n|
n['id'] += '-upcoming'
n['pubDate'] = Time.parse(n['datetime']) - SECONDS_IN_A_WEEK
end
@news = soon + upcoming
builder :news
end
class Talk
attr :full_name, :who, :date, :download_url, :slides_url, :id, :slug, :series_name
def initialize(hash)
@id = hash['id']
@series_name = hash['series_name']
@full_name = (hash['series_name'].present? ? "[" + hash['series_name'] + "] " : "" ) + hash['title']
@who = hash['who']
@date = Time.parse(hash['datetime'])
@download_url = hash['download_url']
@slides_url = hash['slides_url']
@published = hash['published']
@slug = hash['slug']
end
def part_of_a_series?
@series_name.present?
end
def has_slides?
@slides_url.present?
end
def long_title
[
@date.strftime("%a %d %b %Y"),
": ",
@full_name,
" (",
@who,
")"
].join
end
def description
"Given by #{@who} on #{@date.strftime("%a %d %b %y")}."
end
def published?
!!@published
end
end
get '/talks/:slug' do |slug|
require 'firebase'
firebase = Firebase::Client.new('https://winvin.firebaseio.com/')
talk_id = firebase.get('talks-by-slug/' + slug ).body
halt 404 if (talk_id.nil?)
@talk = Talk.new(firebase.get('talks/' + talk_id).body)
halt 404 unless @talk.published?
@og_url = 'http://winvin.org.uk/talks/' + slug
@og_title = "Winchester Vineyard Talk: #{@talk.full_name}"
@og_description = @talk.description
haml :talk
end
helpers do
def get_talks
require 'firebase'
firebase = Firebase::Client.new('https://winvin.firebaseio.com/')
firebase.get('talks').body.values.map {|t| Talk.new(t) }.sort_by(&:date).reverse
end
end
get '/audio_plain' do
@talks = get_talks
haml :audio, :layout => false
end
get '/audio.xml' do
@talks = get_talks
builder :audio
end
get '/students/?' do
haml :students
end
get '/lifegroups/?' do
haml :lifegroups
end
get '/adventconspiracy/?' do
haml :adventconspiracy
end
get '/css/styles.css' do
scss :styles, :style => :expanded
end
get('/node/168/?') { redirect '/#wv-news' }
get('/node/2/?') { redirect '/#wv-sundays' }
get('/node/319/?') { redirect '/#wv-team' }
get('/node/74/?') { redirect '/#wv-growing' }
get '/node/?*' do
redirect '/'
end
not_found do
status 404
haml :not_found
end
get('/feedback/?') { redirect 'https://docs.google.com/forms/d/10iS6tahkIYb_rFu1uNUB9ytjsy_xS138PJcs915qASo/viewform?usp=send_form' }
get('/data-protection-policy/?') { redirect 'https://s3-eu-west-1.amazonaws.com/winchester-vineyard-website-assets/uploads/data-protection-policy.pdf' }
get('/makingithappen/?') { redirect 'https://docs.google.com/forms/d/12LKbZo-FXRk5JAPESu_Zfog7FAtCXtdMAfdHCbQ8OXs/viewform?c=0&w=1' }
get('/requestasozo/?') { redirect 'https://docs.google.com/forms/d/16l71KEmGGhZar84lQIMpkcZuR6bVxlzGB8r0-cSni7s/viewform?fbzx=-1795998873449154632' }
get('/landing-banner-code/?') { redirect '/students' }
get('/kidstea/?') { redirect 'https://winvin.churchapp.co.uk/events/pl5wgmwz' }
get '/audio/?*' do
redirect '/#wv-talks'
end
run Sinatra::Application
online connect card link
require 'sinatra'
require 'sass'
require 'builder'
require 'carrierwave_direct'
require 'dalli'
require 'rack-cache'
#
# Defined in ENV on Heroku. To try locally, start memcached and uncomment:
# ENV["MEMCACHE_SERVERS"] = "localhost"
if memcache_servers = ENV["MEMCACHE_SERVERS"]
use Rack::Cache,
verbose: true,
metastore: "memcached://#{memcache_servers}",
entitystore: "memcached://#{memcache_servers}"
# Flush the cache
Dalli::Client.new.flush
end
set :static_cache_control, [:public, max_age: 1800]
before do
cache_control :public, max_age: 1800 # 30 mins
end
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:aws_secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
config.fog_directory = ENV['AWS_FOG_DIRECTORY'] # bucket name
end
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWaveDirect::Uploader
end
get '/' do
haml :index
end
require 'httparty'
churchapp_headers = {"Content-type" => "application/json", "X-Account" => "winvin", "X-Application" => "Group Slideshow", "X-Auth" => ENV['CHURCHAPP_AUTH']}
get '/groups-slideshow/?' do
response = HTTParty.get('https://api.churchapp.co.uk/v1/smallgroups/groups?view=active', headers: churchapp_headers)
@groups = JSON.parse(response.body)["groups"]
haml :groups, layout: nil
end
get '/groups-signup/?' do
response = HTTParty.get('https://api.churchapp.co.uk/v1/addressbook/contacts?per_page=400', headers: churchapp_headers)
@contacts = JSON.parse(response.body)["contacts"]
response = HTTParty.get('https://api.churchapp.co.uk/v1/smallgroups/groups?view=active', headers: churchapp_headers)
@groups = JSON.parse(response.body)["groups"]
haml :groups_signup, layout: nil
end
post '/groups-signup/:group_id/:contact_id' do |group_id, contact_id|
body = {
"action" => "add",
"members" => {
"contacts" => [ contact_id.to_i ],
}
}.to_json
url = 'https://api.churchapp.co.uk/v1/smallgroups/group/'+group_id+'/members'
puts body, url
response = HTTParty.post(url, headers: churchapp_headers, body: body)
puts response.body
response.code
end
helpers do
def secs_until(n)
Time.parse(n['datetime']) - Time.now
end
end
SECONDS_IN_A_DAY = 86400
SECONDS_IN_A_WEEK = 86400 * 7
get '/feed.xml' do
require 'firebase'
firebase = Firebase::Client.new('https://winvin.firebaseio.com/')
all = firebase.get('news').body.values
soon = all.select do |n|
secs_until(n) >= 0 && secs_until(n) < SECONDS_IN_A_DAY
end
soon.each do |n|
n['id'] += '-soon'
n['pubDate'] = Time.parse(n['datetime']) - SECONDS_IN_A_DAY
end
upcoming = all.select do |n|
secs_until(n) >= SECONDS_IN_A_DAY && secs_until(n) < SECONDS_IN_A_WEEK
end
upcoming.each do |n|
n['id'] += '-upcoming'
n['pubDate'] = Time.parse(n['datetime']) - SECONDS_IN_A_WEEK
end
@news = soon + upcoming
builder :news
end
class Talk
attr :full_name, :who, :date, :download_url, :slides_url, :id, :slug, :series_name
def initialize(hash)
@id = hash['id']
@series_name = hash['series_name']
@full_name = (hash['series_name'].present? ? "[" + hash['series_name'] + "] " : "" ) + hash['title']
@who = hash['who']
@date = Time.parse(hash['datetime'])
@download_url = hash['download_url']
@slides_url = hash['slides_url']
@published = hash['published']
@slug = hash['slug']
end
def part_of_a_series?
@series_name.present?
end
def has_slides?
@slides_url.present?
end
def long_title
[
@date.strftime("%a %d %b %Y"),
": ",
@full_name,
" (",
@who,
")"
].join
end
def description
"Given by #{@who} on #{@date.strftime("%a %d %b %y")}."
end
def published?
!!@published
end
end
get '/talks/:slug' do |slug|
require 'firebase'
firebase = Firebase::Client.new('https://winvin.firebaseio.com/')
talk_id = firebase.get('talks-by-slug/' + slug ).body
halt 404 if (talk_id.nil?)
@talk = Talk.new(firebase.get('talks/' + talk_id).body)
halt 404 unless @talk.published?
@og_url = 'http://winvin.org.uk/talks/' + slug
@og_title = "Winchester Vineyard Talk: #{@talk.full_name}"
@og_description = @talk.description
haml :talk
end
helpers do
def get_talks
require 'firebase'
firebase = Firebase::Client.new('https://winvin.firebaseio.com/')
firebase.get('talks').body.values.map {|t| Talk.new(t) }.sort_by(&:date).reverse
end
end
get '/audio_plain' do
@talks = get_talks
haml :audio, :layout => false
end
get '/audio.xml' do
@talks = get_talks
builder :audio
end
get '/students/?' do
haml :students
end
get '/lifegroups/?' do
haml :lifegroups
end
get '/adventconspiracy/?' do
haml :adventconspiracy
end
get '/css/styles.css' do
scss :styles, :style => :expanded
end
get('/node/168/?') { redirect '/#wv-news' }
get('/node/2/?') { redirect '/#wv-sundays' }
get('/node/319/?') { redirect '/#wv-team' }
get('/node/74/?') { redirect '/#wv-growing' }
get '/node/?*' do
redirect '/'
end
not_found do
status 404
haml :not_found
end
get('/feedback/?') { redirect 'https://docs.google.com/forms/d/10iS6tahkIYb_rFu1uNUB9ytjsy_xS138PJcs915qASo/viewform?usp=send_form' }
get('/data-protection-policy/?') { redirect 'https://s3-eu-west-1.amazonaws.com/winchester-vineyard-website-assets/uploads/data-protection-policy.pdf' }
get('/makingithappen/?') { redirect 'https://docs.google.com/forms/d/12LKbZo-FXRk5JAPESu_Zfog7FAtCXtdMAfdHCbQ8OXs/viewform?c=0&w=1' }
get('/requestasozo/?') { redirect 'https://docs.google.com/forms/d/16l71KEmGGhZar84lQIMpkcZuR6bVxlzGB8r0-cSni7s/viewform?fbzx=-1795998873449154632' }
get('/connect/?') { redirect 'https://docs.google.com/forms/d/1KuBo4sLPU9tcNpCbihhY_jydWgCCKpCdx7X35sLgmgg/viewform' }
get('/landing-banner-code/?') { redirect '/students' }
get('/kidstea/?') { redirect 'https://winvin.churchapp.co.uk/events/pl5wgmwz' }
get '/audio/?*' do
redirect '/#wv-talks'
end
run Sinatra::Application
|
# frozen_string_literal: true
Gem::Specification.new do |spec|
spec.name = "gir_ffi-pango"
spec.version = "0.0.14"
spec.authors = ["Matijs van Zuijlen"]
spec.email = ["matijs@matijs.net"]
spec.summary = "GirFFI-based bindings for Pango"
spec.description =
"Bindings for Pango generated by GirFFI, with an eclectic set of overrides."
spec.homepage = "http://www.github.com/mvz/gir_ffi-pango"
spec.license = "LGPL-2.1"
spec.required_ruby_version = ">= 2.5.0"
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/mvz/gir_ffi-pango"
spec.metadata["changelog_uri"] = "https://github.com/mvz/gir_ffi-pango/blob/master/Changelog.md"
spec.files = File.read("Manifest.txt").split
spec.require_paths = ["lib"]
spec.add_runtime_dependency "gir_ffi", "~> 0.15.2"
spec.add_development_dependency "minitest", "~> 5.12"
spec.add_development_dependency "pry", "~> 0.13.1"
spec.add_development_dependency "rake", "~> 13.0"
spec.add_development_dependency "rake-manifest", "~> 0.1.0"
spec.add_development_dependency "rubocop", "~> 1.7.0"
spec.add_development_dependency "rubocop-minitest", "~> 0.10.1"
spec.add_development_dependency "rubocop-packaging", "~> 0.5.0"
spec.add_development_dependency "rubocop-performance", "~> 1.9.0"
spec.add_development_dependency "simplecov", "~> 0.21.0"
end
Update rubocop requirement from ~> 1.7.0 to ~> 1.8.0
Updates the requirements on [rubocop](https://github.com/rubocop-hq/rubocop) to permit the latest version.
- [Release notes](https://github.com/rubocop-hq/rubocop/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop/compare/v1.7.0...v1.8.0)
Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@github.com>
# frozen_string_literal: true
Gem::Specification.new do |spec|
spec.name = "gir_ffi-pango"
spec.version = "0.0.14"
spec.authors = ["Matijs van Zuijlen"]
spec.email = ["matijs@matijs.net"]
spec.summary = "GirFFI-based bindings for Pango"
spec.description =
"Bindings for Pango generated by GirFFI, with an eclectic set of overrides."
spec.homepage = "http://www.github.com/mvz/gir_ffi-pango"
spec.license = "LGPL-2.1"
spec.required_ruby_version = ">= 2.5.0"
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/mvz/gir_ffi-pango"
spec.metadata["changelog_uri"] = "https://github.com/mvz/gir_ffi-pango/blob/master/Changelog.md"
spec.files = File.read("Manifest.txt").split
spec.require_paths = ["lib"]
spec.add_runtime_dependency "gir_ffi", "~> 0.15.2"
spec.add_development_dependency "minitest", "~> 5.12"
spec.add_development_dependency "pry", "~> 0.13.1"
spec.add_development_dependency "rake", "~> 13.0"
spec.add_development_dependency "rake-manifest", "~> 0.1.0"
spec.add_development_dependency "rubocop", "~> 1.8.0"
spec.add_development_dependency "rubocop-minitest", "~> 0.10.1"
spec.add_development_dependency "rubocop-packaging", "~> 0.5.0"
spec.add_development_dependency "rubocop-performance", "~> 1.9.0"
spec.add_development_dependency "simplecov", "~> 0.21.0"
end
|
# frozen_string_literal: true
Gem::Specification.new do |spec|
spec.name = "gir_ffi-pango"
spec.version = "0.0.14"
spec.authors = ["Matijs van Zuijlen"]
spec.email = ["matijs@matijs.net"]
spec.summary = "GirFFI-based bindings for Pango"
spec.description =
"Bindings for Pango generated by GirFFI, with an eclectic set of overrides."
spec.homepage = "http://www.github.com/mvz/gir_ffi-pango"
spec.license = "LGPL-2.1"
spec.required_ruby_version = ">= 2.5.0"
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/mvz/gir_ffi-pango"
spec.metadata["changelog_uri"] = "https://github.com/mvz/gir_ffi-pango/blob/master/Changelog.md"
spec.files = File.read("Manifest.txt").split
spec.require_paths = ["lib"]
spec.add_runtime_dependency "gir_ffi", "~> 0.15.2"
spec.add_development_dependency "minitest", "~> 5.12"
spec.add_development_dependency "pry", "~> 0.14.0"
spec.add_development_dependency "rake", "~> 13.0"
spec.add_development_dependency "rake-manifest", "~> 0.2.0"
spec.add_development_dependency "rubocop", "~> 1.18.1"
spec.add_development_dependency "rubocop-minitest", "~> 0.13.0"
spec.add_development_dependency "rubocop-packaging", "~> 0.5.0"
spec.add_development_dependency "rubocop-performance", "~> 1.11.0"
spec.add_development_dependency "simplecov", "~> 0.21.0"
end
Update rubocop-minitest requirement from ~> 0.13.0 to ~> 0.14.0
Updates the requirements on [rubocop-minitest](https://github.com/rubocop/rubocop-minitest) to permit the latest version.
- [Release notes](https://github.com/rubocop/rubocop-minitest/releases)
- [Changelog](https://github.com/rubocop/rubocop-minitest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-minitest/compare/v0.13.0...v0.14.0)
---
updated-dependencies:
- dependency-name: rubocop-minitest
dependency-type: direct:development
...
Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@github.com>
# frozen_string_literal: true
Gem::Specification.new do |spec|
spec.name = "gir_ffi-pango"
spec.version = "0.0.14"
spec.authors = ["Matijs van Zuijlen"]
spec.email = ["matijs@matijs.net"]
spec.summary = "GirFFI-based bindings for Pango"
spec.description =
"Bindings for Pango generated by GirFFI, with an eclectic set of overrides."
spec.homepage = "http://www.github.com/mvz/gir_ffi-pango"
spec.license = "LGPL-2.1"
spec.required_ruby_version = ">= 2.5.0"
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/mvz/gir_ffi-pango"
spec.metadata["changelog_uri"] = "https://github.com/mvz/gir_ffi-pango/blob/master/Changelog.md"
spec.files = File.read("Manifest.txt").split
spec.require_paths = ["lib"]
spec.add_runtime_dependency "gir_ffi", "~> 0.15.2"
spec.add_development_dependency "minitest", "~> 5.12"
spec.add_development_dependency "pry", "~> 0.14.0"
spec.add_development_dependency "rake", "~> 13.0"
spec.add_development_dependency "rake-manifest", "~> 0.2.0"
spec.add_development_dependency "rubocop", "~> 1.18.1"
spec.add_development_dependency "rubocop-minitest", "~> 0.14.0"
spec.add_development_dependency "rubocop-packaging", "~> 0.5.0"
spec.add_development_dependency "rubocop-performance", "~> 1.11.0"
spec.add_development_dependency "simplecov", "~> 0.21.0"
end
|
Made setup-dir.
This script converts a directory to the format expected by the maker script.
#!/usr/bin/ruby -w
#
# Copyright (c) 2013 Andrew "Jamoozy" Correa,
#
# This file is part of Picture Viewer.
#
# Picture Viewer is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
require 'yaml'
require 'ftools'
require 'sqlite3'
require 'optparse'
require 'peach'
class Options
attr_accessor :verbose # verbose output
attr_accessor :dry_run # don't actually do anything
attr_accessor :procs # num of parallel processes
attr_accessor :files # image files to use
attr_accessor :full_size # full size images dir
attr_accessor :thumbs # thumbs dir
attr_accessor :size # image size
attr_accessor :thumb_size # thumb size
end
def parse_args
options = Options.new
options.verbose = false
options.dry_run = false
options.procs = 1
options.files = []
options.full_size = 'full-size'
options.thumbs = 'thumbs'
options.size = 1200
options.thumb_size = 200
OptionParser.new do |opts|
opts.banner = "Usage: #{__FILE__} [options]"
opts.on('-v', '--[no-]verbose', 'Run verbosely') do |v|
puts 'verbose: ' + v.to_s
options.verbose = v
end
opts.on('-d', '--dry-run', "Do a dry run (print commands but don't execute them)") do |d|
puts 'Dry run.'
options.dry_run = true;
end
opts.on('-pNUM', '--processes=NUM', 'Speicfy number of processes to run in parallel.') do |p|
puts 'procs: ' + p
options.procs = p.to_i
end
opts.on('-iF', '--include=F', 'Specify files to include.') do |f|
puts 'files: ' + f
options.files << Dir[File.expand_path(f)]
options.files.flatten!
end
opts.on('-fFS', '--full-size=DIR', 'Specify "full-size" dir name') do |d|
puts 'full-size: ' + d
options.full_size = File.expand_path(d)
end
opts.on('-tDIR', '--thumb-dir=DIR', 'Set thumbs dir.') do |d|
puts 'thumbs dir: ' + d
options.thumbs = d
end
opts.on('-sSIZE', '--size=SIZE', 'Specify "normal" image size') do |s|
puts 'size: ' + s
options.size = s.to_i
end
opts.on('-SSIZE', '--thumb-size=SIZE', 'Specify thumbnail size.') do |s|
puts 'thumb size: ' + s
options.thumb_size = s.to_i
end
end.parse!
if options.files.empty?
puts "Error: No input files."
exit
end
et = File.expand_path(options.thumbs)
ef = File.expand_path(options.full_size)
options.files.each do |f|
dn = File.dirname(f)
if et == dn
puts "Error: \"#{f}\" in thumbs dir \"#{options.thumbs}\""
exit
elsif ef == dn
puts "Error: \"#{f}\" in thumbs dir \"#{options.full_size}\""
exit
end
end
options
end
def run_cmd(cmd)
puts 'Running: ' + cmd if $opts.verbose or $opts.dry_run
`#{cmd}` unless $opts.dry_run
end
if __FILE__ == $0
$opts = parse_args
# Make thumbs/ and full-size/ dirs.
unless $opts.dry_run
File.makedirs($opts.full_size) unless File.directory?($opts.full_size)
File.makedirs($opts.thumbs) unless File.directory?($opts.thumbs)
end
# Generate data.yml
puts 'Generating data.yml ...'
data_file = File.new('data.yml', 'w')
$opts.files.each do |f|
local = File.basename(f)
data_file.puts("- - #{$opts.thumbs}/#{local}")
data_file.puts(" - #{local}")
data_file.puts(" - ''")
end
data_file.close
# Move current images to "full-size" dir.
run_cmd("mv #{$opts.files.reduce{|a,b|a+' '+b}} #{$opts.full_size}")
# Image resizes.
scripts_dir = File.dirname(__FILE__)
Dir.chdir($opts.dry_run ? '.' : $opts.full_size) do
$opts.files.peach($opts.procs) do |f|
local = File.basename(f)
run_cmd("#{scripts_dir}/resize.rb #{local} #{$opts.size} ../")
run_cmd("#{scripts_dir}/resize.rb #{local} #{$opts.thumb_size} ../#{$opts.thumbs}")
end
end
end
|
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "git_presenter"
s.version = "0.1.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Colin Gemmell"]
s.date = "2012-03-23"
s.description = "Code presentation tool using git"
s.email = "pythonandchips@gmail.com"
s.executables = ["git-presenter"]
s.extra_rdoc_files = [
"LICENSE.txt",
"README.markdown"
]
s.files = [
".rspec",
".travis.yml",
"Gemfile",
"Gemfile.lock",
"LICENSE.txt",
"README.markdown",
"Rakefile",
"VERSION",
"bin/git-presenter",
"git_presenter.gemspec",
"lib/git_presenter.rb",
"lib/git_presenter/parser.rb",
"lib/git_presenter/presentation.rb",
"lib/git_presenter/slide.rb",
"lib/git_presenter/writer.rb",
"spec/integration/initialize_presentation_spec.rb",
"spec/integration/moving_through_presentation_spec.rb",
"spec/integration/start_presentation_spec.rb",
"spec/lib/git_presenter/presentation_spec.rb",
"spec/lib/git_presenter/slide_spec.rb",
"spec/lib/git_presenter/writer_spec.rb",
"spec/spec_helper.rb",
"spec/support/repo_helpers.rb"
]
s.homepage = "http://github.com/pythonandchips/git-presenter"
s.licenses = ["MIT"]
s.require_paths = ["lib"]
s.rubygems_version = "1.8.15"
s.summary = "Code presentation tool using git"
if s.respond_to? :specification_version then
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<grit>, ["~> 2.4"])
s.add_development_dependency(%q<rspec>, ["~> 2.7"])
s.add_development_dependency(%q<bundler>, [">= 0"])
s.add_development_dependency(%q<jeweler>, ["~> 1.6"])
s.add_development_dependency(%q<rcov>, ["~> 0.9"])
else
s.add_dependency(%q<grit>, ["~> 2.4"])
s.add_dependency(%q<rspec>, ["~> 2.7"])
s.add_dependency(%q<bundler>, [">= 0"])
s.add_dependency(%q<jeweler>, ["~> 1.6"])
s.add_dependency(%q<rcov>, ["~> 0.9"])
end
else
s.add_dependency(%q<grit>, ["~> 2.4"])
s.add_dependency(%q<rspec>, ["~> 2.7"])
s.add_dependency(%q<bundler>, [">= 0"])
s.add_dependency(%q<jeweler>, ["~> 1.6"])
s.add_dependency(%q<rcov>, ["~> 0.9"])
end
end
updated gemspec, bumped version
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "git_presenter"
s.version = "0.2.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Colin Gemmell"]
s.date = "2012-03-26"
s.description = "Code presentation tool using git"
s.email = "pythonandchips@gmail.com"
s.executables = ["git-presenter"]
s.extra_rdoc_files = [
"LICENSE.txt",
"README.markdown"
]
s.files = [
".rspec",
".travis.yml",
"Gemfile",
"Gemfile.lock",
"LICENSE.txt",
"README.markdown",
"Rakefile",
"VERSION",
"bin/git-presenter",
"git_presenter.gemspec",
"lib/git_presenter.rb",
"lib/git_presenter/parser.rb",
"lib/git_presenter/presentation.rb",
"lib/git_presenter/slide.rb",
"lib/git_presenter/writer.rb",
"spec/integration/initialize_presentation_spec.rb",
"spec/integration/moving_through_presentation_spec.rb",
"spec/integration/start_presentation_spec.rb",
"spec/lib/git_presenter/presentation_spec.rb",
"spec/lib/git_presenter/slide_spec.rb",
"spec/lib/git_presenter/writer_spec.rb",
"spec/spec_helper.rb",
"spec/support/command_line_helper.rb",
"spec/support/git_helpers.rb"
]
s.homepage = "http://github.com/pythonandchips/git-presenter"
s.licenses = ["MIT"]
s.require_paths = ["lib"]
s.rubygems_version = "1.8.15"
s.summary = "Code presentation tool using git"
if s.respond_to? :specification_version then
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<grit>, ["~> 2.4"])
s.add_development_dependency(%q<rspec>, ["~> 2.7"])
s.add_development_dependency(%q<bundler>, [">= 0"])
s.add_development_dependency(%q<jeweler>, ["~> 1.6"])
s.add_development_dependency(%q<rcov>, ["~> 0.9"])
else
s.add_dependency(%q<grit>, ["~> 2.4"])
s.add_dependency(%q<rspec>, ["~> 2.7"])
s.add_dependency(%q<bundler>, [">= 0"])
s.add_dependency(%q<jeweler>, ["~> 1.6"])
s.add_dependency(%q<rcov>, ["~> 0.9"])
end
else
s.add_dependency(%q<grit>, ["~> 2.4"])
s.add_dependency(%q<rspec>, ["~> 2.7"])
s.add_dependency(%q<bundler>, [">= 0"])
s.add_dependency(%q<jeweler>, ["~> 1.6"])
s.add_dependency(%q<rcov>, ["~> 0.9"])
end
end
|
require 'test_helper'
class EditTest < ViewCase
fixtures :all
setup :visit_adminpanel_new_product_path
teardown :teardown
def test_submitting_with_same_information
assert_button("Actualizar #{adminpanel_products(:first).name}")
click_button("Actualizar #{adminpanel_products(:first).name}")
# p page.body
p adminpanel_products(:first)
assert_content( adminpanel_products(:first).name )
assert_content( adminpanel_products(:first).price )
end
def test_submitting_with_invalid_information
fill_in 'product_name', with: ''
fill_in 'product_price', with: ''
click_button("Actualizar #{adminpanel_products(:first).name}")
assert_content('Producto no pudo guardarse debido a 2 errores')
end
protected
def visit_adminpanel_new_product_path
visit adminpanel.signin_path
login
visit adminpanel.edit_product_path(adminpanel_products(:first))
end
end
:art:
require 'test_helper'
class EditTest < ViewCase
fixtures :all
setup :visit_adminpanel_new_product_path
teardown :teardown
def test_submitting_with_same_information
assert_button("Actualizar #{adminpanel_products(:first).name}")
click_button("Actualizar #{adminpanel_products(:first).name}")
assert_content( adminpanel_products(:first).name )
assert_content( adminpanel_products(:first).price )
end
def test_submitting_with_invalid_information
fill_in 'product_name', with: ''
fill_in 'product_price', with: ''
click_button("Actualizar #{adminpanel_products(:first).name}")
assert_content('Producto no pudo guardarse debido a 2 errores')
end
protected
def visit_adminpanel_new_product_path
visit adminpanel.signin_path
login
visit adminpanel.edit_product_path(adminpanel_products(:first))
end
end
|
require 'test_helper'
require 'poll_job'
include Devise::TestHelpers
class QueriesControllerTest < ActionController::TestCase
setup do
dump_database
@user = Factory(:user_with_queries)
@ids = @user.queries.map {|q| q.id}
@user_ids = [] << @user.id
@new_endpoint = Factory(:endpoint)
@unattached_query = Factory(:query)
@admin = Factory(:admin)
@unapproved_user = Factory(:unapproved_user)
end
test "should get index" do
sign_in @user
get :index
queries = assigns[:queries]
assert_equal @user.queries, queries
assert_response :success
end
test "should get index as admin" do
sign_in @admin
get :index
queries = assigns[:queries]
assert_equal Query.all, queries
assert_response :success
end
test "should get new" do
sign_in @user
get :new
assert_not_nil assigns[:query]
assert_not_nil assigns[:endpoints]
assert_response :success
end
test "should create query" do
sign_in @user
post :create, query: { title: 'Some title', description: "Some description"}
query = assigns(:query)
assert_not_nil query
query_from_db = Query.find(query.id)
assert_not_nil query_from_db
assert_equal query.title, 'Some title'
assert_equal query.title, query_from_db.title
assert_not_nil query_from_db.endpoints
assert_redirected_to(query_path(query))
end
test "should update query" do
sign_in @user
query_from_db = Query.find(@ids[0])
assert_not_equal query_from_db.title, 'Some title'
post :update, id: @ids[0], query: { title: 'Some title', description: "Some description"}
query = assigns(:query)
assert_not_nil query
query_from_db = Query.find(query.id)
assert_not_nil query_from_db
assert_equal query_from_db.title, 'Some title'
assert_equal query.title, 'Some title'
assert_redirected_to query_path(query)
end
test "should get show" do
sign_in @user
get :show, id: @ids[0]
query = assigns(:query)
assert_equal @ids[0], query.id
assert_response :success
end
test "should get edit" do
sign_in @user
get :edit, id: @ids[0]
query = assigns(:query)
assert_equal @ids[0], query.id
assert_not_nil assigns[:endpoints]
assert_response :success
end
test "should destroy query" do
sign_in @user
delete :destroy, id: @ids[0]
query = assigns(:query)
assert_equal @ids[0], query.id
assert (not Query.exists? :conditions => {id: @ids[0]})
assert_redirected_to(queries_url)
end
test "should remove endpoint" do
sign_in @user
query_from_db = Query.find(@ids[0])
assert_not_equal query_from_db.title, 'Some title'
assert_equal 2, query_from_db.endpoints.length
post :update, id: @ids[0], query: { title: 'Some title', description: "Some description", endpoint_ids: [query_from_db.endpoints[0].id] }
query = assigns(:query)
assert_not_nil query
query_from_db = Query.find(query.id)
assert_not_nil query_from_db
assert_equal 1, query_from_db.endpoints.length
assert_redirected_to query_path(query)
end
test "should add endpoint" do
sign_in @user
query_from_db = Query.find(@ids[0])
assert_not_equal query_from_db.title, 'Some title'
assert_equal 2, query_from_db.endpoints.length
post :update, id: @ids[0], query: { title: 'Some title', description: "Some description", endpoint_ids: [query_from_db.endpoints[0].id, query_from_db.endpoints[1].id, @new_endpoint.id] }
query = assigns(:query)
assert_not_nil query
query_from_db = Query.find(query.id)
assert_not_nil query_from_db
assert_equal 3, query_from_db.endpoints.length
assert_redirected_to query_path(query)
end
test "should execute query with notification" do
sign_in @user
FakeWeb.register_uri(:post, "http://127.0.0.1:3001/queues", :body => "FORCE ERROR")
query_from_db = Query.find(@ids[2])
post :execute, id: @ids[2], notification: false
query = assigns(:query)
assert_not_nil query
assert !query.last_execution.notification
query_from_db = Query.find(@ids[2])
# check that the query has an execution, and the execution has a result for each endpoint
assert_not_nil query.executions
assert_equal 1, query.executions.length
assert_equal query.endpoints.length, query.executions[0].results.length
assert_equal "POST", FakeWeb.last_request.method
assert_equal "multipart/form-data", FakeWeb.last_request.content_type
multipart_data = FakeWeb.last_request.body_stream.read
assert_equal 1, (multipart_data.scan /name="map"/).length
assert_equal 1, (multipart_data.scan /name="reduce"/).length
assert_equal 1, (multipart_data.scan /name="filter"/).length
assert_redirected_to(query_path(query.id))
end
test "should execute query without notification" do
sign_in @user
FakeWeb.register_uri(:post, "http://127.0.0.1:3001/queues", :body => "FORCE ERROR")
query_from_db = Query.find(@ids[2])
post :execute, id: @ids[2], notification: true
query = assigns(:query)
assert_not_nil query
assert query.last_execution.notification
query_from_db = Query.find(@ids[2])
# check that the query has an execution, and the execution has a result for each endpoint
assert_not_nil query.executions
assert_equal 1, query.executions.length
assert_equal query.endpoints.length, query.executions[0].results.length
assert_equal "POST", FakeWeb.last_request.method
assert_equal "multipart/form-data", FakeWeb.last_request.content_type
multipart_data = FakeWeb.last_request.body_stream.read
assert_equal 1, (multipart_data.scan /name="map"/).length
assert_equal 1, (multipart_data.scan /name="reduce"/).length
assert_equal 1, (multipart_data.scan /name="filter"/).length
assert_redirected_to(query_path(query.id))
end
test "log displays query log" do
sign_in @user
query_from_db = Query.find(@ids[1])
query_logger = QueryLogger.new
query_logger.add query_from_db, "test message"
get :log, id: @ids[1]
events = assigns[:events]
assert_not_nil events
assert "test message", events.last[:message]
end
test "should check all queries completed" do
sign_in @user
get :show, id: @ids[0]
query = assigns(:query)
assert_equal @ids[0], query.id
assert_response :success
end
test "should refresh execution with 0 pending" do
sign_in @user
# With no running queries, update_query_info should successfully return unfinished_query_count == 0
query = Query.find(@ids[0])
get :refresh_execution_results, id: query.id
assert_equal 0, assigns(:incomplete_results)
end
test "should refresh execution with 1 pending" do
sign_in @user
# One result's status will be 'Queued', so we should find that unfinished_query_count == 1
query = Query.find(@ids[3])
query.last_execution.results[0].status = Result::QUEUED
query.save!
get :refresh_execution_results, id: query.id
assert_equal 1, assigns(:incomplete_results)
end
test "should get execution history" do
sign_in @user
query = Query.find(@ids[4])
get :execution_history, id: query.id
assigned_query = assigns(:query);
assert_not_nil assigned_query
assert_response :success
end
test "should cancel endpoint results" do
sign_in @user
FakeWeb.register_uri(:post, "http://127.0.0.1:3001/queues", :body => "{}", :status => ["304"], :location=>"http://localhost:3001/queues")
query_from_db = Query.find(@ids[2])
# why is all of this here you ask, well becuse calling the method to post the execution actaully
# trys to call all of the endpoints which results in
post :execute, id: @ids[2], notification: true
query = assigns(:query)
assert_not_nil query
assert query.last_execution.notification
query_from_db = Query.find(@ids[2])
# check that the query has an execution, and the execution has a result for each endpoint
assert_not_nil query.executions
assert_equal 1, query.executions.length
assert_equal query.endpoints.length, query.executions[0].results.length
res_id = query.last_execution.results[0].id
delete :cancel, id: @ids[2], execution_id: query.last_execution.id, result_id:res_id
assert_equal Result::CANCELED, query.reload().last_execution.results.find(res_id).status
assert_redirected_to(query_path(query.id))
end
test "should cancel execution" do
sign_in @user
FakeWeb.register_uri(:post, "http://127.0.0.1:3001/queues", :body => "{}", :status => ["304"], :location=>"http://localhost:3001/queues")
query_from_db = Query.find(@ids[2])
# why is all of this here you ask, well becuse calling the method to post the execution actaully
# trys to call all of the endpoints which results in
post :execute, id: @ids[2], notification: true
query = assigns(:query)
assert_not_nil query
assert query.last_execution.notification
query_from_db = Query.find(@ids[2])
# check that the query has an execution, and the execution has a result for each endpoint
assert_not_nil query.executions
assert_equal 1, query.executions.length
assert_equal query.endpoints.length, query.executions[0].results.length
res_id = query.last_execution.results[0].id
delete :cancel_execution, id: @ids[2], execution_id: query.last_execution.id
assert_equal Result::CANCELED, query.reload().last_execution.results.find(res_id).status
assert_redirected_to(query_path(query.id))
end
end
My last commit was bundled with query builder code from when we created the branch. That code is now gone and this is the query controller test update. Hopefully CI is happy now.
require 'test_helper'
require 'poll_job'
include Devise::TestHelpers
class QueriesControllerTest < ActionController::TestCase
setup do
dump_database
@user = Factory(:user_with_queries)
@ids = @user.queries.map {|q| q.id}
@user_ids = [] << @user.id
@new_endpoint = Factory(:endpoint)
@unattached_query = Factory(:query)
@admin = Factory(:admin)
@unapproved_user = Factory(:unapproved_user)
end
test "should get index" do
sign_in @user
get :index
queries = assigns[:queries]
assert_response :success
assert_equal @user.queries.length, queries.length
queries.each do |query|
assert @user.queries.include?(query)
end
end
test "should get index as admin" do
sign_in @admin
get :index
queries = assigns[:queries]
assert_response :success
all_queries = Query.all
assert_equals all_queries.length, queries
queries.each do |query|
assert all_queries.include?(query)
end
end
test "should get new" do
sign_in @user
get :new
assert_not_nil assigns[:query]
assert_not_nil assigns[:endpoints]
assert_response :success
end
test "should create query" do
sign_in @user
post :create, query: { title: 'Some title', description: "Some description"}
query = assigns(:query)
assert_not_nil query
query_from_db = Query.find(query.id)
assert_not_nil query_from_db
assert_equal query.title, 'Some title'
assert_equal query.title, query_from_db.title
assert_not_nil query_from_db.endpoints
assert_redirected_to(query_path(query))
end
test "should update query" do
sign_in @user
query_from_db = Query.find(@ids[0])
assert_not_equal query_from_db.title, 'Some title'
post :update, id: @ids[0], query: { title: 'Some title', description: "Some description"}
query = assigns(:query)
assert_not_nil query
query_from_db = Query.find(query.id)
assert_not_nil query_from_db
assert_equal query_from_db.title, 'Some title'
assert_equal query.title, 'Some title'
assert_redirected_to query_path(query)
end
test "should get show" do
sign_in @user
get :show, id: @ids[0]
query = assigns(:query)
assert_equal @ids[0], query.id
assert_response :success
end
test "should get edit" do
sign_in @user
get :edit, id: @ids[0]
query = assigns(:query)
assert_equal @ids[0], query.id
assert_not_nil assigns[:endpoints]
assert_response :success
end
test "should destroy query" do
sign_in @user
delete :destroy, id: @ids[0]
query = assigns(:query)
assert_equal @ids[0], query.id
assert (not Query.exists? :conditions => {id: @ids[0]})
assert_redirected_to(queries_url)
end
test "should remove endpoint" do
sign_in @user
query_from_db = Query.find(@ids[0])
assert_not_equal query_from_db.title, 'Some title'
assert_equal 2, query_from_db.endpoints.length
post :update, id: @ids[0], query: { title: 'Some title', description: "Some description", endpoint_ids: [query_from_db.endpoints[0].id] }
query = assigns(:query)
assert_not_nil query
query_from_db = Query.find(query.id)
assert_not_nil query_from_db
assert_equal 1, query_from_db.endpoints.length
assert_redirected_to query_path(query)
end
test "should add endpoint" do
sign_in @user
query_from_db = Query.find(@ids[0])
assert_not_equal query_from_db.title, 'Some title'
assert_equal 2, query_from_db.endpoints.length
post :update, id: @ids[0], query: { title: 'Some title', description: "Some description", endpoint_ids: [query_from_db.endpoints[0].id, query_from_db.endpoints[1].id, @new_endpoint.id] }
query = assigns(:query)
assert_not_nil query
query_from_db = Query.find(query.id)
assert_not_nil query_from_db
assert_equal 3, query_from_db.endpoints.length
assert_redirected_to query_path(query)
end
test "should execute query with notification" do
sign_in @user
FakeWeb.register_uri(:post, "http://127.0.0.1:3001/queues", :body => "FORCE ERROR")
query_from_db = Query.find(@ids[2])
post :execute, id: @ids[2], notification: false
query = assigns(:query)
assert_not_nil query
assert !query.last_execution.notification
query_from_db = Query.find(@ids[2])
# check that the query has an execution, and the execution has a result for each endpoint
assert_not_nil query.executions
assert_equal 1, query.executions.length
assert_equal query.endpoints.length, query.executions[0].results.length
assert_equal "POST", FakeWeb.last_request.method
assert_equal "multipart/form-data", FakeWeb.last_request.content_type
multipart_data = FakeWeb.last_request.body_stream.read
assert_equal 1, (multipart_data.scan /name="map"/).length
assert_equal 1, (multipart_data.scan /name="reduce"/).length
assert_equal 1, (multipart_data.scan /name="filter"/).length
assert_redirected_to(query_path(query.id))
end
test "should execute query without notification" do
sign_in @user
FakeWeb.register_uri(:post, "http://127.0.0.1:3001/queues", :body => "FORCE ERROR")
query_from_db = Query.find(@ids[2])
post :execute, id: @ids[2], notification: true
query = assigns(:query)
assert_not_nil query
assert query.last_execution.notification
query_from_db = Query.find(@ids[2])
# check that the query has an execution, and the execution has a result for each endpoint
assert_not_nil query.executions
assert_equal 1, query.executions.length
assert_equal query.endpoints.length, query.executions[0].results.length
assert_equal "POST", FakeWeb.last_request.method
assert_equal "multipart/form-data", FakeWeb.last_request.content_type
multipart_data = FakeWeb.last_request.body_stream.read
assert_equal 1, (multipart_data.scan /name="map"/).length
assert_equal 1, (multipart_data.scan /name="reduce"/).length
assert_equal 1, (multipart_data.scan /name="filter"/).length
assert_redirected_to(query_path(query.id))
end
test "log displays query log" do
sign_in @user
query_from_db = Query.find(@ids[1])
query_logger = QueryLogger.new
query_logger.add query_from_db, "test message"
get :log, id: @ids[1]
events = assigns[:events]
assert_not_nil events
assert "test message", events.last[:message]
end
test "should check all queries completed" do
sign_in @user
get :show, id: @ids[0]
query = assigns(:query)
assert_equal @ids[0], query.id
assert_response :success
end
test "should refresh execution with 0 pending" do
sign_in @user
# With no running queries, update_query_info should successfully return unfinished_query_count == 0
query = Query.find(@ids[0])
get :refresh_execution_results, id: query.id
assert_equal 0, assigns(:incomplete_results)
end
test "should refresh execution with 1 pending" do
sign_in @user
# One result's status will be 'Queued', so we should find that unfinished_query_count == 1
query = Query.find(@ids[3])
query.last_execution.results[0].status = Result::QUEUED
query.save!
get :refresh_execution_results, id: query.id
assert_equal 1, assigns(:incomplete_results)
end
test "should get execution history" do
sign_in @user
query = Query.find(@ids[4])
get :execution_history, id: query.id
assigned_query = assigns(:query);
assert_not_nil assigned_query
assert_response :success
end
test "should cancel endpoint results" do
sign_in @user
FakeWeb.register_uri(:post, "http://127.0.0.1:3001/queues", :body => "{}", :status => ["304"], :location=>"http://localhost:3001/queues")
query_from_db = Query.find(@ids[2])
# why is all of this here you ask, well becuse calling the method to post the execution actaully
# trys to call all of the endpoints which results in
post :execute, id: @ids[2], notification: true
query = assigns(:query)
assert_not_nil query
assert query.last_execution.notification
query_from_db = Query.find(@ids[2])
# check that the query has an execution, and the execution has a result for each endpoint
assert_not_nil query.executions
assert_equal 1, query.executions.length
assert_equal query.endpoints.length, query.executions[0].results.length
res_id = query.last_execution.results[0].id
delete :cancel, id: @ids[2], execution_id: query.last_execution.id, result_id:res_id
assert_equal Result::CANCELED, query.reload().last_execution.results.find(res_id).status
assert_redirected_to(query_path(query.id))
end
test "should cancel execution" do
sign_in @user
FakeWeb.register_uri(:post, "http://127.0.0.1:3001/queues", :body => "{}", :status => ["304"], :location=>"http://localhost:3001/queues")
query_from_db = Query.find(@ids[2])
# why is all of this here you ask, well becuse calling the method to post the execution actaully
# trys to call all of the endpoints which results in
post :execute, id: @ids[2], notification: true
query = assigns(:query)
assert_not_nil query
assert query.last_execution.notification
query_from_db = Query.find(@ids[2])
# check that the query has an execution, and the execution has a result for each endpoint
assert_not_nil query.executions
assert_equal 1, query.executions.length
assert_equal query.endpoints.length, query.executions[0].results.length
res_id = query.last_execution.results[0].id
delete :cancel_execution, id: @ids[2], execution_id: query.last_execution.id
assert_equal Result::CANCELED, query.reload().last_execution.results.find(res_id).status
assert_redirected_to(query_path(query.id))
end
end
|
mapped pizzerias using nokogiri
|
require File.dirname(__FILE__) + '/../test_helper'
class StoriesControllerTest < ActionController::TestCase
def setup
@request.session[:login]='fubar'
end
def test_routes
assert_routing "/", :controller=>"stories",:action=>"index"
assert_routing "/stories/new", :controller=>"stories",:action=>"new"
assert_routing "/stories/1", :controller=>"stories",:action=>"show", :id=>"1"
assert_recognizes({:controller=>"stories",:action=>"create"}, :path=>"/stories", :method=>"post")
assert_recognizes({:controller=>"stories",:action=>"destroy", :id=>"1"}, :path=>"/stories/1", :method=>"delete")
assert_recognizes({:controller=>"stories",:action=>"update", :id=>"1"}, :path=>"/stories/1", :method=>"put")
assert_routing "/stories/1/edit", :controller=>"stories",:action=>"edit", :id=>"1"
end
def test_create
post :create, "story"=>{"title"=>"New Title", "description"=>"de", "swag"=>"2"}
assert assigns(:story)
story = assigns(:story)
assert_equal Story.find_by_description("de"), assigns(:story)
assert_response :redirect
assert_redirected_to stories_path
end
def test_create_invalid_title
post :create, "story"=>{"description"=>"de", "swag"=>"2"}
assert_response :success
assert_template "form"
assert assigns(:story)
story = assigns(:story)
assert_equal story.errors.on(:title), "is too short (minimum is 1 characters)"
assert_select "div[id=errorExplanation][class=errorExplanation]"
end
def test_requires_login
@request.session[:login]=nil
get :index
assert_response :redirect
assert_redirected_to new_session_path
@request.session[:login]='foo'
get :index
assert_response :success
assert_template 'index'
end
def test_index
get :index
assert assigns(:stories)
stories = assigns(:stories)
assert !stories.empty?
assert stories.kind_of?(Array)
assert_template "index"
assert_select "div[id=sum]", :text=>/7.7/
assert_select "table[id=stories]" do
stories.each do |s|
assert_select "tr" do
assert_select "td" do
assert_select "a[href=?]", story_path(s.id)
end
assert_select "td"
assert_select "td" do
assert_select "a[href=?]", story_path(s.id)
end
assert_select "td" do
assert_select "a[href=?]", edit_story_path(s.id)
end
end
end
end
assert_select "a[href=?]", new_story_path
end
def test_new
get :new
assert_response :success
assert_template "form"
assert assigns(:story)
assert assigns(:story).new_record?
assert_select "form[action=?][method=post]", stories_path do
assert_select "textarea[id=story_description]"
assert_select "input[type=text]"
assert_select "input[type=submit]"
assert_select "input[type=button][value=Cancel][onclick*=location]"
end
end
def test_show
get :show, :id=>stories(:one).id
assert assigns(:story)
assert_equal assigns(:story), stories(:one)
assert_template "show"
assert_select "a[href=?]", stories_path
assert_select "a[href=?]", edit_story_path(stories(:one).id)
assert_select "a[href=?][onclick*=confirm]", story_path(stories(:one))
end
def test_update
story = stories(:one)
put :update, :id=>story.id, :story=> {:title=>"New title", :description=>"New Description", :swag=>"9999.99" }
new_story = Story.find(story.id)
assert_equal "New title", new_story.title
assert_equal "New Description", new_story.description
assert_equal 9999.99, new_story.swag
assert_redirected_to stories_path
end
def test_update_invalid_title
story = stories(:one)
put :update, :id=>story.id, :story=> {:title=>"", :description=>"New Description", :swag=>"9999.99" }
assert_response :success
assert_template "form"
new_story = Story.find(story.id)
s = assigns(:story)
assert_equal s.errors.on(:title), "is too short (minimum is 1 characters)"
assert_select "div[id=errorExplanation][class=errorExplanation]"
end
def test_edit
get :edit,:id=>stories(:one).id
assert assigns(:story)
story = assigns(:story)
assert_equal stories(:one).id, story.id
end
def test_destroy
story = stories(:one)
delete :destroy, :id=>stories(:one).id
assert !Story.exists?(story.id)
assert_redirected_to stories_path
end
def test_edit_view
get :edit,:id=>stories(:one).id
assert assigns(:story)
story = assigns(:story)
assert_select "form[action=?][method=post]", story_path do
assert_select "input[name=_method][type=hidden][value=put]"
assert_select "textarea[id=story_description]", {:text=>story.description}
assert_select "input[type=text][value=?]", story.swag
assert_select "input[type=submit]"
end
end
end
converted to new assert_routing
git-svn-id: 74b774d35ddf11762c1cca35b78a907250f8d9f4@2681 4e22fdd3-d838-0410-b171-8f2b50891703
require File.dirname(__FILE__) + '/../test_helper'
class StoriesControllerTest < ActionController::TestCase
def setup
@request.session[:login]='fubar'
end
def test_routes
assert_routing "/", :controller=>"stories",:action=>"index"
assert_routing "/stories/new", :controller=>"stories",:action=>"new"
assert_routing "/stories/1", :controller=>"stories",:action=>"show", :id=>"1"
assert_routing({:path=>'/stories', :method=>'post'}, {:controller=>"stories",:action=>"create"})
assert_routing({:path=>'/stories/1', :method=>'delete'}, {:controller=>"stories",:action=>"destroy", :id=>'1'})
assert_routing({:path=>'/stories/1', :method=>'put'}, {:controller=>"stories",:action=>"update", :id=>'1'})
assert_routing "/stories/1/edit", :controller=>"stories",:action=>"edit", :id=>"1"
end
def test_create
post :create, "story"=>{"title"=>"New Title", "description"=>"de", "swag"=>"2"}
assert assigns(:story)
story = assigns(:story)
assert_equal Story.find_by_description("de"), assigns(:story)
assert_response :redirect
assert_redirected_to stories_path
end
def test_create_invalid_title
post :create, "story"=>{"description"=>"de", "swag"=>"2"}
assert_response :success
assert_template "form"
assert assigns(:story)
story = assigns(:story)
assert_equal story.errors.on(:title), "is too short (minimum is 1 characters)"
assert_select "div[id=errorExplanation][class=errorExplanation]"
end
def test_requires_login
@request.session[:login]=nil
get :index
assert_response :redirect
assert_redirected_to new_session_path
@request.session[:login]='foo'
get :index
assert_response :success
assert_template 'index'
end
def test_index
get :index
assert assigns(:stories)
stories = assigns(:stories)
assert !stories.empty?
assert stories.kind_of?(Array)
assert_template "index"
assert_select "div[id=sum]", :text=>/7.7/
assert_select "table[id=stories]" do
stories.each do |s|
assert_select "tr" do
assert_select "td" do
assert_select "a[href=?]", story_path(s.id)
end
assert_select "td"
assert_select "td" do
assert_select "a[href=?]", story_path(s.id)
end
assert_select "td" do
assert_select "a[href=?]", edit_story_path(s.id)
end
end
end
end
assert_select "a[href=?]", new_story_path
end
def test_new
get :new
assert_response :success
assert_template "form"
assert assigns(:story)
assert assigns(:story).new_record?
assert_select "form[action=?][method=post]", stories_path do
assert_select "textarea[id=story_description]"
assert_select "input[type=text]"
assert_select "input[type=submit]"
assert_select "input[type=button][value=Cancel][onclick*=location]"
end
end
def test_show
get :show, :id=>stories(:one).id
assert assigns(:story)
assert_equal assigns(:story), stories(:one)
assert_template "show"
assert_select "a[href=?]", stories_path
assert_select "a[href=?]", edit_story_path(stories(:one).id)
assert_select "a[href=?][onclick*=confirm]", story_path(stories(:one))
end
def test_update
story = stories(:one)
put :update, :id=>story.id, :story=> {:title=>"New title", :description=>"New Description", :swag=>"9999.99" }
new_story = Story.find(story.id)
assert_equal "New title", new_story.title
assert_equal "New Description", new_story.description
assert_equal 9999.99, new_story.swag
assert_redirected_to stories_path
end
def test_update_invalid_title
story = stories(:one)
put :update, :id=>story.id, :story=> {:title=>"", :description=>"New Description", :swag=>"9999.99" }
assert_response :success
assert_template "form"
new_story = Story.find(story.id)
s = assigns(:story)
assert_equal s.errors.on(:title), "is too short (minimum is 1 characters)"
assert_select "div[id=errorExplanation][class=errorExplanation]"
end
def test_edit
get :edit,:id=>stories(:one).id
assert assigns(:story)
story = assigns(:story)
assert_equal stories(:one).id, story.id
end
def test_destroy
story = stories(:one)
delete :destroy, :id=>stories(:one).id
assert !Story.exists?(story.id)
assert_redirected_to stories_path
end
def test_edit_view
get :edit,:id=>stories(:one).id
assert assigns(:story)
story = assigns(:story)
assert_select "form[action=?][method=post]", story_path do
assert_select "input[name=_method][type=hidden][value=put]"
assert_select "textarea[id=story_description]", {:text=>story.description}
assert_select "input[type=text][value=?]", story.swag
assert_select "input[type=submit]"
end
end
end
|
Gem::Specification.new do |s|
s.name = "sinatra-content-for"
s.version = "0.1"
s.date = "2009-05-07"
s.description = "Small Sinatra extension to add a content_for helper similar to Rails'"
s.summary = "Small Sinatra extension to add a content_for helper similar to Rails'"
s.homepage = "http://sinatrarb.com"
s.authors = ["Nicolás Sanguinetti"]
s.email = "contacto@nicolassanguinetti.info"
s.require_paths = ["lib"]
s.rubyforge_project = "sinatra-ditties"
s.has_rdoc = true
s.rubygems_version = "1.3.1"
s.add_dependency "sinatra"
if s.respond_to?(:add_development_dependency)
s.add_development_dependency "contest"
s.add_development_dependency "sr-mg"
s.add_development_dependency "redgreen"
end
s.files = %w[
.gitignore
LICENSE
README.rdoc
sinatra-content-for.gemspec
lib/sinatra/content_for.rb
test/content_for_test.rb
]
end
Push version to 0.2
This release adds:
* Support for HAML
* Support to yield values into the content blocks
Gem::Specification.new do |s|
s.name = "sinatra-content-for"
s.version = "0.2"
s.date = "2009-05-09"
s.description = "Small Sinatra extension to add a content_for helper similar to Rails'"
s.summary = "Small Sinatra extension to add a content_for helper similar to Rails'"
s.homepage = "http://sinatrarb.com"
s.authors = ["Nicolás Sanguinetti"]
s.email = "contacto@nicolassanguinetti.info"
s.require_paths = ["lib"]
s.rubyforge_project = "sinatra-ditties"
s.has_rdoc = true
s.rubygems_version = "1.3.1"
s.add_dependency "sinatra"
if s.respond_to?(:add_development_dependency)
s.add_development_dependency "contest"
s.add_development_dependency "sr-mg"
s.add_development_dependency "redgreen"
end
s.files = %w[
.gitignore
LICENSE
README.rdoc
sinatra-content-for.gemspec
lib/sinatra/content_for.rb
test/content_for_test.rb
]
end
|
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'fancy_to_proc/version'
Gem::Specification.new do |spec|
spec.name = "fancy_to_proc"
spec.version = FancyToProc::VERSION
spec.authors = ["Simon George"]
spec.email = ["simon@sfcgeorge.co.uk"]
spec.summary = %q{TODO: Write a short summary, because Rubygems requires one.}
spec.description = %q{TODO: Write a longer description or delete this line.}
spec.homepage = "TODO: Put your gem's website or public repo URL here."
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
# delete this section to allow pushing this gem to any host.
if spec.respond_to?(:metadata)
spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
else
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
end
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.9"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "minitest"
end
Update gemspec
# coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "fancy_to_proc/version"
Gem::Specification.new do |spec|
spec.name = "fancy_to_proc"
spec.version = FancyToProc::VERSION
spec.authors = ["Simon George"]
spec.email = ["simon@sfcgeorge.co.uk"]
spec.summary = %q{Makes Symbol#to_proc chainable and take arguments}
spec.description = %q{Have you ever wished Symbol#to_proc was chainable and took arguments? Now it does.}
spec.homepage = "https://github.com/sfcgeorge/fancy_to_proc"
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.9"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "minitest"
end
|
# -*- encoding: utf-8 -*-
$:.push File.expand_path('../lib', __FILE__)
require 'flying_sphinx/version'
Gem::Specification.new do |s|
s.name = 'flying-sphinx'
s.version = FlyingSphinx::Version
s.authors = ['Pat Allan']
s.email = 'pat@freelancing-gods.com'
s.summary = 'Sphinx in the Cloud'
s.description = 'Hooks Thinking Sphinx into the Flying Sphinx service'
s.homepage = 'https://flying-sphinx.com'
s.extra_rdoc_files = ['README.textile']
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.require_paths = ['lib']
s.executables = ['flying-sphinx']
s.add_runtime_dependency 'thinking-sphinx'
s.add_runtime_dependency 'riddle', ['>= 1.5.5']
s.add_runtime_dependency 'multi_json', ['>= 1.3.0']
s.add_runtime_dependency 'faraday_middleware', ['~> 0.7']
s.add_runtime_dependency 'rash', ['~> 0.3.0']
s.add_runtime_dependency 'pusher-client', ['~> 0.3']
s.add_development_dependency 'rake', ['~> 0.9.2']
s.add_development_dependency 'rspec', ['~> 2.11']
s.add_development_dependency 'rspec-fire', ['~> 1.1.0']
s.add_development_dependency 'yajl-ruby', ['~> 0.8.2']
s.add_development_dependency 'fakeweb', ['~> 1.3.0']
s.add_development_dependency 'fakeweb-matcher', ['~> 1.2.2']
s.post_install_message = <<-MESSAGE
If you're upgrading, you should rebuild your Sphinx setup when deploying:
$ heroku rake fs:rebuild
MESSAGE
end
Updating Riddle dependency.
# -*- encoding: utf-8 -*-
$:.push File.expand_path('../lib', __FILE__)
require 'flying_sphinx/version'
Gem::Specification.new do |s|
s.name = 'flying-sphinx'
s.version = FlyingSphinx::Version
s.authors = ['Pat Allan']
s.email = 'pat@freelancing-gods.com'
s.summary = 'Sphinx in the Cloud'
s.description = 'Hooks Thinking Sphinx into the Flying Sphinx service'
s.homepage = 'https://flying-sphinx.com'
s.extra_rdoc_files = ['README.textile']
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.require_paths = ['lib']
s.executables = ['flying-sphinx']
s.add_runtime_dependency 'thinking-sphinx'
s.add_runtime_dependency 'riddle', ['>= 1.5.6']
s.add_runtime_dependency 'multi_json', ['>= 1.3.0']
s.add_runtime_dependency 'faraday_middleware', ['~> 0.7']
s.add_runtime_dependency 'rash', ['~> 0.3.0']
s.add_runtime_dependency 'pusher-client', ['~> 0.3']
s.add_development_dependency 'rake', ['~> 0.9.2']
s.add_development_dependency 'rspec', ['~> 2.11']
s.add_development_dependency 'rspec-fire', ['~> 1.1.0']
s.add_development_dependency 'yajl-ruby', ['~> 0.8.2']
s.add_development_dependency 'fakeweb', ['~> 1.3.0']
s.add_development_dependency 'fakeweb-matcher', ['~> 1.2.2']
s.post_install_message = <<-MESSAGE
If you're upgrading, you should rebuild your Sphinx setup when deploying:
$ heroku rake fs:rebuild
MESSAGE
end
|
#!/usr/bin/ruby
# Test unitaire Basedonnee.rb
# Auteur : Grude Victorien, TAHRI Ahmed
require 'test/unit'
load './class/registre.class.rb'
#Vos tests dans ce fichier
#https://github.com/olbrich/ruby-units
class Testbasedonnee < Test::Unit::TestCase
def test_bdd_creation
kBase = Basedonnee.creer('test.db')
assert_equal(true, File.exist?('test.db'))
end
def test_bdd_key
i = 0
kBase = Basedonnee.creer('test.db')
5.times {
assert(kBase.addParam('test'+i.to_s, 3))
assert_equal(3, kBase.getValue('test'+i.to_s))
i += 1
}
end
end
Ajout de tests pour la classe Registre (diversification des types)
#!/usr/bin/ruby
# Test unitaire Basedonnee.rb
# Auteur : Grude Victorien, TAHRI Ahmed
require 'test/unit'
load './class/registre.class.rb'
#Vos tests dans ce fichier
#https://github.com/olbrich/ruby-units
class Testbasedonnee < Test::Unit::TestCase
def test_bdd_creation
kBase = Basedonnee.creer('test.db')
assert_equal(true, File.exist?('test.db'))
end
def test_bdd_key
i = 0
kBase = Basedonnee.creer('test.db')
assert(kBase.addParam('nbJours', 81))
assert_equal(81, kBase.getValue('nbJours'))
assert(kBase.addParam('typeCarte', 'VISA'))
assert_equal('VISA', kBase.getValue('typeCarte'))
assert(kBase.addParam('qteArgent', 1872.21))
assert_equal(1872.21, kBase.getValue('qteArgent'))
end
end
|
stdlib = [
'abbrev',
'base64',
'benchmark',
'bigdecimal',
'cgi',
'cmath',
'coverage',
'csv',
'date',
'dbm',
'delegate',
'digest',
'drb',
'e2mmap',
'erb',
'etc',
'expect',
'fcntl',
'fiddle',
'fileutils',
'find',
'forwardable',
'gdbm',
'getoptlong',
'io/console',
'io/nonblock',
'io/wait',
'ipaddr',
'irb',
'json',
'logger',
'mathn',
'matrix',
'mkmf',
'monitor',
'mutex_m',
'net/ftp',
'net/http',
'net/imap',
'net/pop',
'net/smtp',
'net/telnet',
'nkf',
'objspace',
'observer',
'open-uri',
'open3',
'openssl',
'optparse',
'ostruct',
'pathname',
'pp',
'prettyprint',
'prime',
#'profile', # prints all sorts of info to stderr, not easy to test right now
'profiler',
'pstore',
'psych',
'pty',
'rake',
'rdoc',
'readline',
'resolv',
'resolv-replace',
'ripper',
'rss',
'rubygems',
'scanf',
'sdbm',
'securerandom',
'set',
'shell',
'shellwords',
'singleton',
'socket',
'stringio',
'strscan',
'sync',
'syslog',
'tempfile',
'thread',
'thwait',
'time',
'timeout',
'tmpdir',
'tracer',
'tsort',
'un',
'uri',
'weakref',
'webrick',
'xmlrpc/client',
'xmlrpc/server',
'yaml',
'zlib',
]
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
# these libraries don't work or don't exist on JRuby ATM
stdlib.delete('dbm')
stdlib.delete('gdbm')
stdlib.delete('mkmf')
stdlib.delete('objspace')
stdlib.delete('sdbm')
else
require 'rubygems/version'
if Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('2.5')
stdlib.delete('mathn')
end
end
result = 'ok'
stdlib.each do |lib|
#puts "Testing #{lib}"
begin
require lib
rescue Exception => e
result = 'failure'
STDERR.puts "\n\nrequire '#{lib}' failed: #{e.message}\n"
STDERR.puts e.backtrace.join("\n")
STDERR.puts "\n"
end
end
exit(1) unless result == 'ok'
puts result
Fix a minor oversight in "ruby-standard-libs"
We should always remove "mathn" if our effective Ruby version is 2.5+.
See https://github.com/docker-library/official-images/pull/4392
stdlib = [
'abbrev',
'base64',
'benchmark',
'bigdecimal',
'cgi',
'cmath',
'coverage',
'csv',
'date',
'dbm',
'delegate',
'digest',
'drb',
'e2mmap',
'erb',
'etc',
'expect',
'fcntl',
'fiddle',
'fileutils',
'find',
'forwardable',
'gdbm',
'getoptlong',
'io/console',
'io/nonblock',
'io/wait',
'ipaddr',
'irb',
'json',
'logger',
'mathn',
'matrix',
'mkmf',
'monitor',
'mutex_m',
'net/ftp',
'net/http',
'net/imap',
'net/pop',
'net/smtp',
'net/telnet',
'nkf',
'objspace',
'observer',
'open-uri',
'open3',
'openssl',
'optparse',
'ostruct',
'pathname',
'pp',
'prettyprint',
'prime',
#'profile', # prints all sorts of info to stderr, not easy to test right now
'profiler',
'pstore',
'psych',
'pty',
'rake',
'rdoc',
'readline',
'resolv',
'resolv-replace',
'ripper',
'rss',
'rubygems',
'scanf',
'sdbm',
'securerandom',
'set',
'shell',
'shellwords',
'singleton',
'socket',
'stringio',
'strscan',
'sync',
'syslog',
'tempfile',
'thread',
'thwait',
'time',
'timeout',
'tmpdir',
'tracer',
'tsort',
'un',
'uri',
'weakref',
'webrick',
'xmlrpc/client',
'xmlrpc/server',
'yaml',
'zlib',
]
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
# these libraries don't work or don't exist on JRuby ATM
stdlib.delete('dbm')
stdlib.delete('gdbm')
stdlib.delete('mkmf')
stdlib.delete('objspace')
stdlib.delete('sdbm')
end
require 'rubygems/version'
if Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('2.5')
stdlib.delete('mathn')
end
result = 'ok'
stdlib.each do |lib|
#puts "Testing #{lib}"
begin
require lib
rescue Exception => e
result = 'failure'
STDERR.puts "\n\nrequire '#{lib}' failed: #{e.message}\n"
STDERR.puts e.backtrace.join("\n")
STDERR.puts "\n"
end
end
exit(1) unless result == 'ok'
puts result
|
Add SST unit tests
require 'test_helper'
require 'xlsxtream/shared_string_table'
module Xlsxtream
class SharedStringTableTest < Minitest::Test
def test_references
sst = SharedStringTable.new
assert_equal 0, sst.references
sst['hello']
sst['hello']
sst['world']
assert_equal 3, sst.references
end
def test_size
sst = SharedStringTable.new
assert_equal 0, sst.size
sst['hello']
sst['hello']
sst['world']
assert_equal 2, sst.size
end
def test_value
sst = SharedStringTable.new
assert_equal 0, sst['hello']
assert_equal 1, sst['world']
assert_equal 0, sst['hello']
end
end
end
|
#
# glib2.rb
# Copyright(C) 2005 Ruby-GNOME2 Project.
#
# This program is licenced under the same
# license of Ruby-GNOME2.
#
# for dropline GTK2-Runtime DLL
# http://www.dropline.net/gtk/
if /mingw|mswin|mswin32/ =~ RUBY_PLATFORM
begin
require 'win32/registry'
begin
GTK2Dir =
Win32::Registry::HKEY_CURRENT_USER.open('Software\GTK\2.0')['Path']
ENV['PATH'] = %w(bin lib).collect{|dir|
"#{GTK2Dir}\\#{dir};"
}.join('') + ENV['PATH']
rescue Win32::Registry::Error
end
rescue LoadError
end
end
module GLib
def check_binding_version?(major, minor, micro)
BINDING_VERSION[0] > major ||
(BINDING_VERSION[0] == major &&
BINDING_VERSION[1] > minor) ||
(BINDING_VERSION[0] == major &&
BINDING_VERSION[1] == minor &&
BINDING_VERSION[2] >= micro)
end
module_function :check_binding_version?
def self.__add_one_arg_setter(klass)
#for Instance methods.
ary = klass.instance_methods(false)
ary.each do |m|
if /^set_(.*)/ =~ m and not ary.include? "#{$1}=" and klass.instance_method(m).arity == 1
begin
klass.module_eval("def #{$1}=(val); set_#{$1}(val); val; end\n")
rescue SyntaxError
$stderr.print "Couldn't create #{klass}\##{$1}=(v).\n" if $DEBUG
end
end
end
#for Class methods/Module functions.
if Object.method(:methods).arity == -1
ary = klass.methods(false)
else
ary = klass.methods
end
ary.each do |m|
if /^set_(.*)/ =~ m and not ary.include? "#{$1}=" and klass.method(m).arity == 1
begin
klass.module_eval("def self.#{$1}=(val); set_#{$1}(val); val; end\n")
rescue SyntaxError
$stderr.print "Couldn't create #{klass}\##{$1}=(v).\n" if $DEBUG
end
end
end
end
end
require 'glib2.so'
module GLib
class Type
def decendants
[self] + children.map{|t| t.decendants }.flatten
end
def ancestors
# ([self] + interfaces + (parent ? parent.ancestors : [])).reverse.uniq.reverse
[self] + (parent ? parent.ancestors : [])
end
end
class Enum
def _dump(limit)
Marshal.dump(to_i, limit)
end
def self._load(obj)
new(Marshal.load(obj))
end
end
class Flags
def _dump(limit)
Marshal.dump(to_i, limit)
end
def self._load(obj)
new(Marshal.load(obj))
end
# FIXME
def inspect
values = self.class.values
if values.find{|x| x == self }
body = nick
else
a = values.select{|x| self >= x }
a = a.reject{|x| a.find{|y| y > x } }
body = a.empty? ? '{}' : a.map{|x| x.nick }.join('|')
end
format('#<%s %s>', self.class.inspect, body)
end
end
module Log
DOMAIN = "Ruby/GLib"
LEVELS = {
LEVEL_ERROR => "ERROR",
LEVEL_CRITICAL => "CRITICAL",
LEVEL_WARNING => "WARNING",
LEVEL_MESSAGE => "MESSAGE",
LEVEL_INFO => "INFO",
LEVEL_DEBUG => "DEBUG"
}
module_function
def error(str)
log(DOMAIN, LEVEL_ERROR, caller(1)[0] << ": " << str)
end
def message(str)
log(DOMAIN, LEVEL_MESSAGE, caller(1)[0] << ": " << str)
end
def critical(str)
log(DOMAIN, LEVEL_CRITICAL, caller(1)[0] << ": " << str)
end
def warning(str)
log(DOMAIN, LEVEL_WARNING, caller(1)[0] << ": " << str)
end
def set_log_domain(domain)
level = GLib::Log::LEVEL_CRITICAL
if $DEBUG
level = 255
elsif $VERBOSE
level = 127
end
GLib::Log.set_handler(domain, level)
end
end
LOG_DOMAIN = "GLib"
class Object
LOG_DOMAIN = "GLib-GObject"
end
module Thread
LOG_DOMAIN = "GThread"
end
module Module
LOG_DOMAIN = "GModule"
end
end
GLib::Log.set_log_domain(nil)
GLib::Log.set_log_domain(GLib::LOG_DOMAIN)
GLib::Log.set_log_domain(GLib::Object::LOG_DOMAIN)
GLib::Log.set_log_domain(GLib::Thread::LOG_DOMAIN)
GLib::Log.set_log_domain(GLib::Module::LOG_DOMAIN)
ObjectSpace.define_finalizer(GLib) {
GLib::Log.cancel_handler
puts "GLib::Log.cancel_handler was called." if $DEBUG
}
* src/lib/glib2.rb: Removed to call GLib::Log.cancel_handler.
#
# glib2.rb
# Copyright(C) 2005 Ruby-GNOME2 Project.
#
# This program is licenced under the same
# license of Ruby-GNOME2.
#
# for dropline GTK2-Runtime DLL
# http://www.dropline.net/gtk/
if /mingw|mswin|mswin32/ =~ RUBY_PLATFORM
begin
require 'win32/registry'
begin
GTK2Dir =
Win32::Registry::HKEY_CURRENT_USER.open('Software\GTK\2.0')['Path']
ENV['PATH'] = %w(bin lib).collect{|dir|
"#{GTK2Dir}\\#{dir};"
}.join('') + ENV['PATH']
rescue Win32::Registry::Error
end
rescue LoadError
end
end
module GLib
def check_binding_version?(major, minor, micro)
BINDING_VERSION[0] > major ||
(BINDING_VERSION[0] == major &&
BINDING_VERSION[1] > minor) ||
(BINDING_VERSION[0] == major &&
BINDING_VERSION[1] == minor &&
BINDING_VERSION[2] >= micro)
end
module_function :check_binding_version?
def self.__add_one_arg_setter(klass)
#for Instance methods.
ary = klass.instance_methods(false)
ary.each do |m|
if /^set_(.*)/ =~ m and not ary.include? "#{$1}=" and klass.instance_method(m).arity == 1
begin
klass.module_eval("def #{$1}=(val); set_#{$1}(val); val; end\n")
rescue SyntaxError
$stderr.print "Couldn't create #{klass}\##{$1}=(v).\n" if $DEBUG
end
end
end
#for Class methods/Module functions.
if Object.method(:methods).arity == -1
ary = klass.methods(false)
else
ary = klass.methods
end
ary.each do |m|
if /^set_(.*)/ =~ m and not ary.include? "#{$1}=" and klass.method(m).arity == 1
begin
klass.module_eval("def self.#{$1}=(val); set_#{$1}(val); val; end\n")
rescue SyntaxError
$stderr.print "Couldn't create #{klass}\##{$1}=(v).\n" if $DEBUG
end
end
end
end
end
require 'glib2.so'
module GLib
class Type
def decendants
[self] + children.map{|t| t.decendants }.flatten
end
def ancestors
# ([self] + interfaces + (parent ? parent.ancestors : [])).reverse.uniq.reverse
[self] + (parent ? parent.ancestors : [])
end
end
class Enum
def _dump(limit)
Marshal.dump(to_i, limit)
end
def self._load(obj)
new(Marshal.load(obj))
end
end
class Flags
def _dump(limit)
Marshal.dump(to_i, limit)
end
def self._load(obj)
new(Marshal.load(obj))
end
# FIXME
def inspect
values = self.class.values
if values.find{|x| x == self }
body = nick
else
a = values.select{|x| self >= x }
a = a.reject{|x| a.find{|y| y > x } }
body = a.empty? ? '{}' : a.map{|x| x.nick }.join('|')
end
format('#<%s %s>', self.class.inspect, body)
end
end
module Log
DOMAIN = "Ruby/GLib"
LEVELS = {
LEVEL_ERROR => "ERROR",
LEVEL_CRITICAL => "CRITICAL",
LEVEL_WARNING => "WARNING",
LEVEL_MESSAGE => "MESSAGE",
LEVEL_INFO => "INFO",
LEVEL_DEBUG => "DEBUG"
}
module_function
def error(str)
log(DOMAIN, LEVEL_ERROR, caller(1)[0] << ": " << str)
end
def message(str)
log(DOMAIN, LEVEL_MESSAGE, caller(1)[0] << ": " << str)
end
def critical(str)
log(DOMAIN, LEVEL_CRITICAL, caller(1)[0] << ": " << str)
end
def warning(str)
log(DOMAIN, LEVEL_WARNING, caller(1)[0] << ": " << str)
end
def set_log_domain(domain)
level = GLib::Log::LEVEL_CRITICAL
if $DEBUG
level = 255
elsif $VERBOSE
level = 127
end
GLib::Log.set_handler(domain, level)
end
end
LOG_DOMAIN = "GLib"
class Object
LOG_DOMAIN = "GLib-GObject"
end
module Thread
LOG_DOMAIN = "GThread"
end
module Module
LOG_DOMAIN = "GModule"
end
end
GLib::Log.set_log_domain(nil)
GLib::Log.set_log_domain(GLib::LOG_DOMAIN)
GLib::Log.set_log_domain(GLib::Object::LOG_DOMAIN)
GLib::Log.set_log_domain(GLib::Thread::LOG_DOMAIN)
GLib::Log.set_log_domain(GLib::Module::LOG_DOMAIN)
=begin
Don't we need this?
ObjectSpace.define_finalizer(GLib) {
GLib::Log.cancel_handler
puts "GLib::Log.cancel_handler was called." if $DEBUG
}
=end
|
cocoapod 지원
@version = "1.0"
Pod::Spec.new do |s|
s.name = "KMYoutubeActivity"
s.version = @version
s.summary = "KMYoutubeActivity"
s.homepage = "https://github.com/jangsy7883/KMYoutubeActivity"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "hmhv" => "jangsy7883@gmail.com" }
s.source = { :git => "https://github.com/jangsy7883/KMYoutubeActivity.git", :tag => @version }
s.source_files = 'KMYoutubeActivity/*.{h,m}'
s.requires_arc = true
s.ios.deployment_target = '7.0'
end |
if RUBY_PLATFORM =~ /darwin/ then
# fix for scrapi on Mac OS X
require "rubygems"
require "tidy"
Tidy.path = "/usr/lib/libtidy.dylib"
end
require 'rubygems'
require 'scrapi'
require 'yaml'
require 'htmlentities'
require 'ostruct'
class Array
def to_perly_hash()
h = {}
self.each_index { |i| g
next if i % 2 != 0
h[ self[i] ] = self[i+1]
}
return h
end
end
module PluginMethods
def strip_tags(html)
HTMLEntities.new.decode(
html.gsub(/<.+?>/,'').
gsub(/<br *\/>/m, '')
)
end
def fetchurl(url)
puts "< fetching: #{url}"
uri = url.kind_of?(String) ? URI.parse(URI.escape(url)) : url
http = Net::HTTP.new(uri.host, uri.port)
http.start do |http|
req = Net::HTTP::Get.new(uri.path + '?' + (uri.query || ''), {"User-Agent" => "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10"})
res = http.request(req)
if res.key?('location') then
puts "< following redir: " + res['location']
return fetchurl(URI.join(uri.to_s, res['location']))
end
return res.body
end
end
# alternate to fetchurl() above
def f(url)
uri = URI.parse(URI.escape(url))
res = Net::HTTP.start(uri.host, uri.port) {|http|
http.get(uri.path + '?' + uri.query)
}
return res.body
end
def strip_html_entities(str)
str.gsub!(/ /, ' ')
str.gsub!(/&[#0-9a-z]+;/, '')
str
end
def cleanup_html(str, strip_entities = false)
str.gsub!(/ /, '')
str = strip_html_entities(str) if strip_entities
str = strip_tags(str)
str.strip!
str.squeeze!(" \n\r")
return str
end
end
class Plugin
def map(*args)
end
def debug(msg)
puts "DEBUG: #{msg}"
end
def log(msg)
puts "INFO: #{msg}"
end
def warn(msg)
puts "WARN: #{msg}"
end
def error(msg)
puts "ERROR: #{msg}"
end
def registry=(obj)
@registry = obj
end
end
class Msg
def reply(str)
puts "reply: #{str}"
end
def sourcenick
"crown"
end
def sourceaddress
"freetibet@lando.pixelcop.org"
end
end
$: << File.join(File.expand_path(".."))
def load_plugin(file)
require(file)
File.open(File.join(File.expand_path(".."), "#{file}.rb")).readlines.each{ |l|
if l =~ /^class (.+?) </ then
Kernel.const_get($1).class_exec {
include PluginMethods
}
plugin = Kernel.const_get($1).new
plugin.registry = {}
return plugin
end
}
end
added awesome_print
if RUBY_PLATFORM =~ /darwin/ then
# fix for scrapi on Mac OS X
require "rubygems"
require "tidy"
Tidy.path = "/usr/lib/libtidy.dylib"
end
require 'rubygems'
require 'scrapi'
require 'yaml'
require 'htmlentities'
require 'ostruct'
require 'awesome_print'
class Array
def to_perly_hash()
h = {}
self.each_index { |i| g
next if i % 2 != 0
h[ self[i] ] = self[i+1]
}
return h
end
end
module PluginMethods
def strip_tags(html)
HTMLEntities.new.decode(
html.gsub(/<.+?>/,'').
gsub(/<br *\/>/m, '')
)
end
def fetchurl(url)
puts "< fetching: #{url}"
uri = url.kind_of?(String) ? URI.parse(URI.escape(url)) : url
http = Net::HTTP.new(uri.host, uri.port)
http.start do |http|
req = Net::HTTP::Get.new(uri.path + '?' + (uri.query || ''), {"User-Agent" => "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10"})
res = http.request(req)
if res.key?('location') then
puts "< following redir: " + res['location']
return fetchurl(URI.join(uri.to_s, res['location']))
end
return res.body
end
end
# alternate to fetchurl() above
def f(url)
uri = URI.parse(URI.escape(url))
res = Net::HTTP.start(uri.host, uri.port) {|http|
http.get(uri.path + '?' + uri.query)
}
return res.body
end
def strip_html_entities(str)
str.gsub!(/ /, ' ')
str.gsub!(/&[#0-9a-z]+;/, '')
str
end
def cleanup_html(str, strip_entities = false)
str.gsub!(/ /, '')
str = strip_html_entities(str) if strip_entities
str = strip_tags(str)
str.strip!
str.squeeze!(" \n\r")
return str
end
end
class Plugin
def map(*args)
end
def debug(msg)
puts "DEBUG: #{msg}"
end
def log(msg)
puts "INFO: #{msg}"
end
def warn(msg)
puts "WARN: #{msg}"
end
def error(msg)
puts "ERROR: #{msg}"
end
def registry=(obj)
@registry = obj
end
end
class Msg
def reply(str)
puts "reply: #{str}"
end
def sourcenick
"crown"
end
def sourceaddress
"freetibet@lando.pixelcop.org"
end
end
$: << File.join(File.expand_path(".."))
def load_plugin(file)
require(file)
File.open(File.join(File.expand_path(".."), "#{file}.rb")).readlines.each{ |l|
if l =~ /^class (.+?) </ then
Kernel.const_get($1).class_exec {
include PluginMethods
}
plugin = Kernel.const_get($1).new
plugin.registry = {}
return plugin
end
}
end
|
Pod::Spec.new do |s|
s.name = 'LGPlusButtonsView'
s.version = '1.1.1'
s.platform = :ios, '6.0'
s.license = 'MIT'
s.homepage = 'https://github.com/Friend-LGA/LGPlusButtonsView'
s.author = { 'Grigory Lutkov' => 'Friend.LGA@gmail.com' }
s.source = { :git => 'https://github.com/Friend-LGA/LGPlusButtonsView.git', :tag => s.version }
s.summary = 'iOS implementation of Floating Action Button (Google Plus Button, fab), that shows more options'
s.requires_arc = true
s.source_files = 'LGPlusButtonsView/*.{h,m}'
end
Updated podspec.
Pod::Spec.new do |s|
s.name = 'LGPlusButtonsView'
s.version = '1.1.2'
s.platform = :ios, '6.0'
s.license = 'MIT'
s.homepage = 'https://github.com/Friend-LGA/LGPlusButtonsView'
s.author = { 'Grigory Lutkov' => 'Friend.LGA@gmail.com' }
s.source = { :git => 'https://github.com/Friend-LGA/LGPlusButtonsView.git', :tag => s.version }
s.summary = 'iOS implementation of Floating Action Button (Google Plus Button, fab), that shows more options'
s.requires_arc = true
s.source_files = 'LGPlusButtonsView/*.{h,m}'
end
|
#
# Be sure to run `pod spec lint LLBinaryOperators.podspec' to ensure this is a
# valid spec and remove all comments before submitting the spec.
#
# To learn more about the attributes see http://docs.cocoapods.org/specification.html
#
Pod::Spec.new do |s|
s.name = "LLBinaryOperators"
s.version = "0.0.1"
s.summary = "Binary Enumeration Operators, since NSArray only supports object equality"
s.homepage = "https://github.com/lawrencelomax/LLBinaryOperators"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Lawrence Lomax" => "lomax.lawrence@gmail.com" }
s.source = { :git => "https://github.com/lawrencelomax/LLBinaryOperators.git", :commit => "82e8fea710f483b7f741bbe68eef692a911c60ca" }
s.source_files = 'LLBinaryOperators/Classes/*.{h,m}'
s.requires_arc = true
end
Remove comment
Pod::Spec.new do |s|
s.name = "LLBinaryOperators"
s.version = "0.0.1"
s.summary = "Binary Enumeration Operators, since NSArray only supports object equality"
s.homepage = "https://github.com/lawrencelomax/LLBinaryOperators"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Lawrence Lomax" => "lomax.lawrence@gmail.com" }
s.source = { :git => "https://github.com/lawrencelomax/LLBinaryOperators.git", :commit => "82e8fea710f483b7f741bbe68eef692a911c60ca" }
s.source_files = 'LLBinaryOperators/Classes/*.{h,m}'
s.requires_arc = true
end
|
class Anjuta < Formula
desc "GNOME Integrated Development Environment"
homepage "http://anjuta.org"
url "https://download.gnome.org/sources/anjuta/3.18/anjuta-3.18.0.tar.xz"
sha256 "6a3fec0963f04bc62a9dfb951e577a3276d39c3414083ef73163c3fea8e741ba"
bottle do
revision 1
sha256 "b19db8006b5ac7f253e3d548a213eef974b94357a8797de5a4702454f4098392" => :yosemite
sha256 "1b169dce85612b811e3e27395a45140ef8a9b70f0d229804f57f00b72b1151f3" => :mavericks
sha256 "f845183ca3a722b08b7aff7d729d9457d3b0a353072eb41cc43025d8dad9bbd0" => :mountain_lion
end
depends_on "pkg-config" => :build
depends_on "intltool" => :build
depends_on "itstool" => :build
depends_on "gtksourceview3"
depends_on "libxml2" => "with-python"
depends_on "libgda"
depends_on "gdl"
depends_on "vte3"
depends_on "hicolor-icon-theme"
depends_on "gnome-icon-theme"
depends_on "gnome-themes-standard" => :optional
depends_on "shared-mime-info"
depends_on :python if MacOS.version <= :snow_leopard
depends_on "vala" => :recommended
depends_on "autogen" => :recommended
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--disable-schemas-compile"
ENV.append_path "PYTHONPATH", "#{Formula["libxml2"].opt_lib}/python2.7/site-packages"
system "make", "install"
end
def post_install
system "#{Formula["glib"].opt_bin}/glib-compile-schemas", "#{HOMEBREW_PREFIX}/share/glib-2.0/schemas"
system "#{Formula["gtk+3"].opt_bin}/gtk3-update-icon-cache", "-f", "-t", "#{HOMEBREW_PREFIX}/share/icons/hicolor"
# HighContrast is provided by gnome-themes-standard
if File.file?("#{HOMEBREW_PREFIX}/share/icons/HighContrast/.icon-theme.cache")
system "#{Formula["gtk+3"].opt_bin}/gtk3-update-icon-cache", "-f", "-t", "#{HOMEBREW_PREFIX}/share/icons/HighContrast"
end
system "#{Formula["shared-mime-info"].opt_bin}/update-mime-database", "#{HOMEBREW_PREFIX}/share/mime"
end
test do
system "#{bin}/anjuta", "--version"
end
end
anjuta: update 3.18.0 bottle.
class Anjuta < Formula
desc "GNOME Integrated Development Environment"
homepage "http://anjuta.org"
url "https://download.gnome.org/sources/anjuta/3.18/anjuta-3.18.0.tar.xz"
sha256 "6a3fec0963f04bc62a9dfb951e577a3276d39c3414083ef73163c3fea8e741ba"
bottle do
sha256 "22e821a109a25b33b7f72f351cd302eab8ede6cb094a30ba681580eb7f7077b2" => :el_capitan
sha256 "c5e4bd90df721536f8246c526fa0706ccf0aa1b60b8c8727e5dec5f4f3be9c47" => :yosemite
sha256 "993d2a4bc85eb28f5771458ece73d8b25eb4ff55ac865a4fee6ec3c5dc59a7ae" => :mavericks
end
depends_on "pkg-config" => :build
depends_on "intltool" => :build
depends_on "itstool" => :build
depends_on "gtksourceview3"
depends_on "libxml2" => "with-python"
depends_on "libgda"
depends_on "gdl"
depends_on "vte3"
depends_on "hicolor-icon-theme"
depends_on "gnome-icon-theme"
depends_on "gnome-themes-standard" => :optional
depends_on "shared-mime-info"
depends_on :python if MacOS.version <= :snow_leopard
depends_on "vala" => :recommended
depends_on "autogen" => :recommended
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--disable-schemas-compile"
ENV.append_path "PYTHONPATH", "#{Formula["libxml2"].opt_lib}/python2.7/site-packages"
system "make", "install"
end
def post_install
system "#{Formula["glib"].opt_bin}/glib-compile-schemas", "#{HOMEBREW_PREFIX}/share/glib-2.0/schemas"
system "#{Formula["gtk+3"].opt_bin}/gtk3-update-icon-cache", "-f", "-t", "#{HOMEBREW_PREFIX}/share/icons/hicolor"
# HighContrast is provided by gnome-themes-standard
if File.file?("#{HOMEBREW_PREFIX}/share/icons/HighContrast/.icon-theme.cache")
system "#{Formula["gtk+3"].opt_bin}/gtk3-update-icon-cache", "-f", "-t", "#{HOMEBREW_PREFIX}/share/icons/HighContrast"
end
system "#{Formula["shared-mime-info"].opt_bin}/update-mime-database", "#{HOMEBREW_PREFIX}/share/mime"
end
test do
system "#{bin}/anjuta", "--version"
end
end
|
class Awscli < Formula
desc "Official Amazon AWS command-line interface"
homepage "https://aws.amazon.com/cli/"
url "https://pypi.python.org/packages/source/a/awscli/awscli-1.9.20.tar.gz"
mirror "https://github.com/aws/aws-cli/archive/1.9.20.tar.gz"
sha256 "489e8cb1a8d8ba8bb46278b6d2aa7c17806ca5ec4b9a19517faebb3c479a3b38"
bottle do
cellar :any_skip_relocation
sha256 "c4a981f42a6767354b4c3db4340fd6484a0e5978ca04a3c51bbd2531072e2a72" => :el_capitan
sha256 "59fb86533dda0b3dd52375976acb3a67dcc186c23c3af5831fe5520630eb5685" => :yosemite
sha256 "3c3fc3186f86f79212d2fc7afed0e24159138a036c48fb3ebdb57cf7ac72d080" => :mavericks
end
head do
url "https://github.com/aws/aws-cli.git", :branch => "develop"
resource "botocore" do
url "https://github.com/boto/botocore.git", :branch => "develop"
end
resource "jmespath" do
url "https://github.com/boto/jmespath.git", :branch => "develop"
end
end
# Use :python on Lion to avoid urllib3 warning
# https://github.com/Homebrew/homebrew/pull/37240
depends_on :python if MacOS.version <= :lion
resource "six" do
url "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz"
sha256 "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a"
end
resource "python-dateutil" do
url "https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.4.2.tar.gz"
sha256 "3e95445c1db500a344079a47b171c45ef18f57d188dffdb0e4165c71bea8eb3d"
end
resource "colorama" do
url "https://pypi.python.org/packages/source/c/colorama/colorama-0.3.6.tar.gz"
sha256 "ec9efcccb086a1d727876384f94ee6358d2f3f096688c1ba18b0f318f2b453b5"
end
resource "jmespath" do
url "https://pypi.python.org/packages/source/j/jmespath/jmespath-0.9.0.tar.gz"
sha256 "08dfaa06d4397f283a01e57089f3360e3b52b5b9da91a70e1fd91e9f0cdd3d3d"
end
resource "botocore" do
url "https://pypi.python.org/packages/source/b/botocore/botocore-1.3.20.tar.gz"
sha256 "9760d883611110a05f5f8346c7b2198aef87be9117d4cbe1e4ee6608a560c4a2"
end
resource "docutils" do
url "https://pypi.python.org/packages/source/d/docutils/docutils-0.12.tar.gz"
sha256 "c7db717810ab6965f66c8cf0398a98c9d8df982da39b4cd7f162911eb89596fa"
end
resource "pyasn1" do
url "https://pypi.python.org/packages/source/p/pyasn1/pyasn1-0.1.9.tar.gz"
sha256 "853cacd96d1f701ddd67aa03ecc05f51890135b7262e922710112f12a2ed2a7f"
end
resource "rsa" do
url "https://pypi.python.org/packages/source/r/rsa/rsa-3.2.3.tar.gz"
sha256 "14db288cc40d6339dedf60d7a47053ab004b4a8976a5c59402a211d8fc5bf21f"
end
def install
ENV["PYTHONPATH"] = libexec/"lib/python2.7/site-packages"
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages"
resources.each do |r|
r.stage do
system "python", *Language::Python.setup_install_args(libexec/"vendor")
end
end
system "python", *Language::Python.setup_install_args(libexec)
# Install zsh completion
zsh_completion.install "bin/aws_zsh_completer.sh" => "_aws"
# Install the examples
pkgshare.install "awscli/examples"
bin.install Dir[libexec/"bin/*"]
bin.env_script_all_files(libexec+"bin", :PYTHONPATH => ENV["PYTHONPATH"])
end
def caveats; <<-EOS.undent
The "examples" directory has been installed to:
#{HOMEBREW_PREFIX}/share/awscli/examples
Add the following to ~/.bashrc to enable bash completion:
complete -C aws_completer aws
Add the following to ~/.zshrc to enable zsh completion:
source #{HOMEBREW_PREFIX}/share/zsh/site-functions/_aws
Before using awscli, you need to tell it about your AWS credentials.
The easiest way to do this is to run:
aws configure
More information:
https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
EOS
end
test do
system "#{bin}/aws", "--version"
end
end
awscli: update 1.9.20 bottle.
class Awscli < Formula
desc "Official Amazon AWS command-line interface"
homepage "https://aws.amazon.com/cli/"
url "https://pypi.python.org/packages/source/a/awscli/awscli-1.9.20.tar.gz"
mirror "https://github.com/aws/aws-cli/archive/1.9.20.tar.gz"
sha256 "489e8cb1a8d8ba8bb46278b6d2aa7c17806ca5ec4b9a19517faebb3c479a3b38"
bottle do
cellar :any_skip_relocation
sha256 "37ed68e7e3f1b41af176037875a7efe67c84a18edd1833709ae9a87cfa9c47ca" => :el_capitan
sha256 "af68225b323bd15cb0ef68104aa76d90721ff63144d0fda29b9236ae1b334f3d" => :yosemite
sha256 "2d21193a31c6af7ce3b73c4c3a40b15d14d08f60127f6161682df09f91d055df" => :mavericks
end
head do
url "https://github.com/aws/aws-cli.git", :branch => "develop"
resource "botocore" do
url "https://github.com/boto/botocore.git", :branch => "develop"
end
resource "jmespath" do
url "https://github.com/boto/jmespath.git", :branch => "develop"
end
end
# Use :python on Lion to avoid urllib3 warning
# https://github.com/Homebrew/homebrew/pull/37240
depends_on :python if MacOS.version <= :lion
resource "six" do
url "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz"
sha256 "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a"
end
resource "python-dateutil" do
url "https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.4.2.tar.gz"
sha256 "3e95445c1db500a344079a47b171c45ef18f57d188dffdb0e4165c71bea8eb3d"
end
resource "colorama" do
url "https://pypi.python.org/packages/source/c/colorama/colorama-0.3.6.tar.gz"
sha256 "ec9efcccb086a1d727876384f94ee6358d2f3f096688c1ba18b0f318f2b453b5"
end
resource "jmespath" do
url "https://pypi.python.org/packages/source/j/jmespath/jmespath-0.9.0.tar.gz"
sha256 "08dfaa06d4397f283a01e57089f3360e3b52b5b9da91a70e1fd91e9f0cdd3d3d"
end
resource "botocore" do
url "https://pypi.python.org/packages/source/b/botocore/botocore-1.3.20.tar.gz"
sha256 "9760d883611110a05f5f8346c7b2198aef87be9117d4cbe1e4ee6608a560c4a2"
end
resource "docutils" do
url "https://pypi.python.org/packages/source/d/docutils/docutils-0.12.tar.gz"
sha256 "c7db717810ab6965f66c8cf0398a98c9d8df982da39b4cd7f162911eb89596fa"
end
resource "pyasn1" do
url "https://pypi.python.org/packages/source/p/pyasn1/pyasn1-0.1.9.tar.gz"
sha256 "853cacd96d1f701ddd67aa03ecc05f51890135b7262e922710112f12a2ed2a7f"
end
resource "rsa" do
url "https://pypi.python.org/packages/source/r/rsa/rsa-3.2.3.tar.gz"
sha256 "14db288cc40d6339dedf60d7a47053ab004b4a8976a5c59402a211d8fc5bf21f"
end
def install
ENV["PYTHONPATH"] = libexec/"lib/python2.7/site-packages"
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages"
resources.each do |r|
r.stage do
system "python", *Language::Python.setup_install_args(libexec/"vendor")
end
end
system "python", *Language::Python.setup_install_args(libexec)
# Install zsh completion
zsh_completion.install "bin/aws_zsh_completer.sh" => "_aws"
# Install the examples
pkgshare.install "awscli/examples"
bin.install Dir[libexec/"bin/*"]
bin.env_script_all_files(libexec+"bin", :PYTHONPATH => ENV["PYTHONPATH"])
end
def caveats; <<-EOS.undent
The "examples" directory has been installed to:
#{HOMEBREW_PREFIX}/share/awscli/examples
Add the following to ~/.bashrc to enable bash completion:
complete -C aws_completer aws
Add the following to ~/.zshrc to enable zsh completion:
source #{HOMEBREW_PREFIX}/share/zsh/site-functions/_aws
Before using awscli, you need to tell it about your AWS credentials.
The easiest way to do this is to run:
aws configure
More information:
https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
EOS
end
test do
system "#{bin}/aws", "--version"
end
end
|
class Enemy
SPEED = 4
attr_reader :x, :y, :radius
def initialize(window)
@image = Gosu::Image.new('images/enemy.png')
@window = window
@radius = 20
@x = rand(@window.width - 2 * @radius) + @radius
@y = 0
end
def move
@y += SPEED
end
def onscreen?
@y < @window.height + @radius
end
def draw
@image.draw(@x - @radius, @y - @radius, 1)
end
end
Add random speeds to enemies
class Enemy
MAX_SPEED = 6
attr_reader :x, :y, :radius
def initialize(window)
@image = Gosu::Image.new('images/enemy.png')
@window = window
@speed = rand(1..MAX_SPEED)
@radius = 20
@x = rand(@window.width - 2 * @radius) + @radius
@y = 0
end
def move
@y += @speed
end
def onscreen?
@y < @window.height + @radius
end
def draw
@image.draw(@x - @radius, @y - @radius, 1)
end
end
|
class Awscli < Formula
desc "Official Amazon AWS command-line interface"
homepage "https://aws.amazon.com/cli/"
url "https://pypi.python.org/packages/source/a/awscli/awscli-1.8.6.tar.gz"
mirror "https://github.com/aws/aws-cli/archive/1.8.6.tar.gz"
sha256 "6037781488370e9bdfaacb73c0b580e240499accdc1376db77e9e066b05872cb"
bottle do
cellar :any_skip_relocation
sha256 "8b2e38f9dd7bb72b1440230dae7f82f714c6b2eb0550da37d84854992603a539" => :el_capitan
sha256 "5c25c3aa54ecff513240bee2718c30602f5b8b34ac02972fef15ed6914d48cb1" => :yosemite
sha256 "ea4e8f9c0ecb21fbc532015b22cde253947b9e410b1e079cb36882022e3fe2eb" => :mavericks
end
head do
url "https://github.com/aws/aws-cli.git", :branch => "develop"
resource "botocore" do
url "https://github.com/boto/botocore.git", :branch => "develop"
end
resource "bcdoc" do
url "https://github.com/boto/bcdoc.git", :branch => "develop"
url "https://github.com/boto/jmespath.git", :branch => "develop"
end
end
# Use :python on Lion to avoid urllib3 warning
# https://github.com/Homebrew/homebrew/pull/37240
depends_on :python if MacOS.version <= :lion
resource "six" do
url "https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz"
sha256 "e24052411fc4fbd1f672635537c3fc2330d9481b18c0317695b46259512c91d5"
end
resource "python-dateutil" do
url "https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.4.2.tar.gz"
sha256 "3e95445c1db500a344079a47b171c45ef18f57d188dffdb0e4165c71bea8eb3d"
end
resource "colorama" do
url "https://pypi.python.org/packages/source/c/colorama/colorama-0.3.3.tar.gz"
sha256 "eb21f2ba718fbf357afdfdf6f641ab393901c7ca8d9f37edd0bee4806ffa269c"
end
resource "jmespath" do
url "https://pypi.python.org/packages/source/j/jmespath/jmespath-0.7.1.tar.gz"
sha256 "cd5a12ee3dfa470283a020a35e69e83b0700d44fe413014fd35ad5584c5f5fd1"
end
resource "botocore" do
url "https://pypi.python.org/packages/source/b/botocore/botocore-1.2.4.tar.gz"
sha256 "6330dec53831e4f961e2503a4d9bfe9e790e1e7ac716f8edc07f1b37ff2765da"
end
resource "docutils" do
url "https://pypi.python.org/packages/source/d/docutils/docutils-0.12.tar.gz"
sha256 "c7db717810ab6965f66c8cf0398a98c9d8df982da39b4cd7f162911eb89596fa"
end
resource "bcdoc" do
url "https://pypi.python.org/packages/source/b/bcdoc/bcdoc-0.16.0.tar.gz"
sha256 "f568c182e06883becf7196f227052435cffd45604700c82362ca77d3427b6202"
end
resource "pyasn1" do
url "https://pypi.python.org/packages/source/p/pyasn1/pyasn1-0.1.8.tar.gz"
sha256 "5d33be7ca0ec5997d76d29ea4c33b65c00c0231407fff975199d7f40530b8347"
end
resource "rsa" do
url "https://pypi.python.org/packages/source/r/rsa/rsa-3.1.4.tar.gz"
sha256 "e2b0b05936c276b1edd2e1525553233b666df9e29b5c3ba223eed738277c82a0"
end
def install
ENV["PYTHONPATH"] = libexec/"lib/python2.7/site-packages"
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages"
resources.each do |r|
r.stage do
system "python", *Language::Python.setup_install_args(libexec/"vendor")
end
end
system "python", *Language::Python.setup_install_args(libexec)
# Install zsh completion
zsh_completion.install "bin/aws_zsh_completer.sh" => "_aws"
# Install the examples
pkgshare.install "awscli/examples"
bin.install Dir[libexec/"bin/*"]
bin.env_script_all_files(libexec+"bin", :PYTHONPATH => ENV["PYTHONPATH"])
end
def caveats; <<-EOS.undent
The "examples" directory has been installed to:
#{HOMEBREW_PREFIX}/share/awscli/examples
Add the following to ~/.bashrc to enable bash completion:
complete -C aws_completer aws
Add the following to ~/.zshrc to enable zsh completion:
source #{HOMEBREW_PREFIX}/share/zsh/site-functions/_aws
Before using awscli, you need to tell it about your AWS credentials.
The easiest way to do this is to run:
aws configure
More information:
https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
EOS
end
test do
system "#{bin}/aws", "--version"
end
end
awscli 1.8.7
Closes #44326.
Signed-off-by: Tim D. Smith <46f1a0bd5592a2f9244ca321b129902a06b53e03@tim-smith.us>
class Awscli < Formula
desc "Official Amazon AWS command-line interface"
homepage "https://aws.amazon.com/cli/"
url "https://pypi.python.org/packages/source/a/awscli/awscli-1.8.7.tar.gz"
mirror "https://github.com/aws/aws-cli/archive/1.8.7.tar.gz"
sha256 "6ae4170c48ec768465afd2b9e70c6db4cd45673aa5b2f1ee2b0513e94a0d96cd"
bottle do
cellar :any_skip_relocation
sha256 "8b2e38f9dd7bb72b1440230dae7f82f714c6b2eb0550da37d84854992603a539" => :el_capitan
sha256 "5c25c3aa54ecff513240bee2718c30602f5b8b34ac02972fef15ed6914d48cb1" => :yosemite
sha256 "ea4e8f9c0ecb21fbc532015b22cde253947b9e410b1e079cb36882022e3fe2eb" => :mavericks
end
head do
url "https://github.com/aws/aws-cli.git", :branch => "develop"
resource "botocore" do
url "https://github.com/boto/botocore.git", :branch => "develop"
end
resource "bcdoc" do
url "https://github.com/boto/bcdoc.git", :branch => "develop"
url "https://github.com/boto/jmespath.git", :branch => "develop"
end
end
# Use :python on Lion to avoid urllib3 warning
# https://github.com/Homebrew/homebrew/pull/37240
depends_on :python if MacOS.version <= :lion
resource "six" do
url "https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz"
sha256 "e24052411fc4fbd1f672635537c3fc2330d9481b18c0317695b46259512c91d5"
end
resource "python-dateutil" do
url "https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.4.2.tar.gz"
sha256 "3e95445c1db500a344079a47b171c45ef18f57d188dffdb0e4165c71bea8eb3d"
end
resource "colorama" do
url "https://pypi.python.org/packages/source/c/colorama/colorama-0.3.3.tar.gz"
sha256 "eb21f2ba718fbf357afdfdf6f641ab393901c7ca8d9f37edd0bee4806ffa269c"
end
resource "jmespath" do
url "https://pypi.python.org/packages/source/j/jmespath/jmespath-0.7.1.tar.gz"
sha256 "cd5a12ee3dfa470283a020a35e69e83b0700d44fe413014fd35ad5584c5f5fd1"
end
resource "botocore" do
url "https://pypi.python.org/packages/source/b/botocore/botocore-1.2.5.tar.gz"
sha256 "f9e173ff2193bfe712478afb44a04673895a6b1823586f5993332ed155a82e0d"
end
resource "docutils" do
url "https://pypi.python.org/packages/source/d/docutils/docutils-0.12.tar.gz"
sha256 "c7db717810ab6965f66c8cf0398a98c9d8df982da39b4cd7f162911eb89596fa"
end
resource "bcdoc" do
url "https://pypi.python.org/packages/source/b/bcdoc/bcdoc-0.16.0.tar.gz"
sha256 "f568c182e06883becf7196f227052435cffd45604700c82362ca77d3427b6202"
end
resource "pyasn1" do
url "https://pypi.python.org/packages/source/p/pyasn1/pyasn1-0.1.8.tar.gz"
sha256 "5d33be7ca0ec5997d76d29ea4c33b65c00c0231407fff975199d7f40530b8347"
end
resource "rsa" do
url "https://pypi.python.org/packages/source/r/rsa/rsa-3.1.4.tar.gz"
sha256 "e2b0b05936c276b1edd2e1525553233b666df9e29b5c3ba223eed738277c82a0"
end
def install
ENV["PYTHONPATH"] = libexec/"lib/python2.7/site-packages"
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages"
resources.each do |r|
r.stage do
system "python", *Language::Python.setup_install_args(libexec/"vendor")
end
end
system "python", *Language::Python.setup_install_args(libexec)
# Install zsh completion
zsh_completion.install "bin/aws_zsh_completer.sh" => "_aws"
# Install the examples
pkgshare.install "awscli/examples"
bin.install Dir[libexec/"bin/*"]
bin.env_script_all_files(libexec+"bin", :PYTHONPATH => ENV["PYTHONPATH"])
end
def caveats; <<-EOS.undent
The "examples" directory has been installed to:
#{HOMEBREW_PREFIX}/share/awscli/examples
Add the following to ~/.bashrc to enable bash completion:
complete -C aws_completer aws
Add the following to ~/.zshrc to enable zsh completion:
source #{HOMEBREW_PREFIX}/share/zsh/site-functions/_aws
Before using awscli, you need to tell it about your AWS credentials.
The easiest way to do this is to run:
aws configure
More information:
https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
EOS
end
test do
system "#{bin}/aws", "--version"
end
end
|
class Blink1 < Formula
desc "Control blink(1) indicator light"
homepage "http://thingm.com/products/blink-1.html"
url "https://github.com/todbot/blink1/archive/v1.97.tar.gz"
sha256 "974722b466249ee47ec27659b160d2e4fd0c2bc3732d009f180f8ffb53dc5d92"
head "https://github.com/todbot/blink1.git"
bottle do
cellar :any
sha1 "68e5d21d7afd4378a3b6ee7a5ef94dc6f917bbcf" => :yosemite
sha1 "eeeeb080650caefd4c221999b57a67f0dfc10e6f" => :mavericks
sha1 "4de3e19fe8ff7d3a4736c8a947adcd05dd37abf2" => :mountain_lion
end
def install
cd "commandline" do
system "make"
bin.install "blink1-tool"
lib.install "libBlink1.dylib"
include.install "blink1-lib.h"
end
end
test do
system bin/"blink1-tool", "--version"
end
end
blink1: update 1.97 bottle.
class Blink1 < Formula
desc "Control blink(1) indicator light"
homepage "http://thingm.com/products/blink-1.html"
url "https://github.com/todbot/blink1/archive/v1.97.tar.gz"
sha256 "974722b466249ee47ec27659b160d2e4fd0c2bc3732d009f180f8ffb53dc5d92"
head "https://github.com/todbot/blink1.git"
bottle do
cellar :any
sha256 "2e9f712db6e0443831f0a11388eaa39d427436dba52fae83761090d13140c47f" => :yosemite
sha256 "354dfc245bab10e35bc8c62e8d44fe883b7b8dff43c7962655b88571f044f448" => :mavericks
sha256 "214dd7f114200d9425bfa51bf52b7c46f48f4bd4668e193aaf3fb5a8fcfdb94d" => :mountain_lion
end
def install
cd "commandline" do
system "make"
bin.install "blink1-tool"
lib.install "libBlink1.dylib"
include.install "blink1-lib.h"
end
end
test do
system bin/"blink1-tool", "--version"
end
end
|
require 'formula'
class Clamav <Formula
url 'http://downloads.sourceforge.net/clamav/clamav-0.96.5.tar.gz'
homepage 'http://www.clamav.net/'
md5 '202e51d47298779e5babacc443102c6a'
def install
system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
system "make install"
end
end
Updated clamav to version 0.97
Signed-off-by: David Höppner <017ae80272b4e52efdec6713a2cb2af11a9c7ddd@gmail.com>
require 'formula'
class Clamav <Formula
url 'http://downloads.sourceforge.net/clamav/clamav-0.97.tar.gz'
homepage 'http://www.clamav.net/'
md5 '605ed132b2f8e89df11064adea2b183b'
def install
system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
system "make install"
end
end
|
# encoding: UTF-8
Gem::Specification.new do |s|
s.name = 'remove_stale_gems'
s.version = '1.0.1'
s.summary = %q{Remove unused gems}
s.description = %q{Remove gems for which last use time is too old}
s.homepage = "http://github.com/toy/#{s.name}"
s.authors = ['Ivan Kuchin']
s.license = 'MIT'
s.rubyforge_project = s.name
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = %w[lib]
end
v1.0.2
# encoding: UTF-8
Gem::Specification.new do |s|
s.name = 'remove_stale_gems'
s.version = '1.0.2'
s.summary = %q{Remove unused gems}
s.description = %q{Remove gems for which last use time is too old}
s.homepage = "http://github.com/toy/#{s.name}"
s.authors = ['Ivan Kuchin']
s.license = 'MIT'
s.rubyforge_project = s.name
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = %w[lib]
end
|
require 'formula'
class Cscope < Formula
homepage 'http://cscope.sourceforge.net/'
url 'https://downloads.sourceforge.net/project/cscope/cscope/15.8a/cscope-15.8a.tar.gz'
sha1 '00f76825791b895532778f720c509cd13b9d6846'
# Patch from http://bugs.gentoo.org/show_bug.cgi?ctype=html&id=111621
def patches; DATA; end
def install
system "./configure", "--prefix=#{prefix}",
"--mandir=#{man}"
system "make install"
end
end
__END__
diff --git a/src/constants.h b/src/constants.h
index 7ad8005..844836e 100644
--- a/src/constants.h
+++ b/src/constants.h
@@ -103,7 +103,7 @@
#define INCLUDES 8
#define FIELDS 10
-#if (BSD || V9) && !__NetBSD__ && !__FreeBSD__
+#if (BSD || V9) && !__NetBSD__ && !__FreeBSD__ && !__MACH__
# define TERMINFO 0 /* no terminfo curses */
#else
# define TERMINFO 1
--
1.6.4
cscope: use patch DSL
require 'formula'
class Cscope < Formula
homepage 'http://cscope.sourceforge.net/'
url 'https://downloads.sourceforge.net/project/cscope/cscope/15.8a/cscope-15.8a.tar.gz'
sha1 '00f76825791b895532778f720c509cd13b9d6846'
# Patch from http://bugs.gentoo.org/show_bug.cgi?ctype=html&id=111621
patch :DATA
def install
system "./configure", "--prefix=#{prefix}",
"--mandir=#{man}"
system "make install"
end
end
__END__
diff --git a/src/constants.h b/src/constants.h
index 7ad8005..844836e 100644
--- a/src/constants.h
+++ b/src/constants.h
@@ -103,7 +103,7 @@
#define INCLUDES 8
#define FIELDS 10
-#if (BSD || V9) && !__NetBSD__ && !__FreeBSD__
+#if (BSD || V9) && !__NetBSD__ && !__FreeBSD__ && !__MACH__
# define TERMINFO 0 /* no terminfo curses */
#else
# define TERMINFO 1
--
1.6.4
|
SOURCE = File.expand_path "~/Downloads/Data"
DESTINATION = File.expand_path "~/Poker"
require 'zip'
require 'date'
require 'shellwords'
CURRENT_YEAR = Date.today.year
YEARS = 2010.upto(CURRENT_YEAR).to_a
LIMITS = {
"3-6" => '-3-6-',
"4-8" => '-4-8-',
"5-10" => '-5-10-',
"7.50-15" => '-7.50-15-',
"8-16" => '-8-16-',
"10-10" => '-10-10-',
"10-20" => '-10-20-',
"15-30" => '-15-30-',
"20-20" => '-20-20-',
"20-40" => '-20-40-',
"25-50" => '-25-50-',
"30-60" => '-30-60-',
"50-100" => '-50-100-',
"75-150" => '-75-150-',
"100-200" => '-100-200-',
"200-400" => '-200-400-',
"250-500" => '-250-500-',
"300-600" => '-300-600-',
"400-800" => '-400-800-',
"500-1000" => '-500-1,000-',
"1000-2000" => '-1,000-2,000-',
"2000-4000" => '-2,000-4,000-'
}
POKER_MAPPING = {
"NL Holdem-PokerStars" => [
"NL Holdem-PokerStars",
"NoLimitHoldem-PokerStars",
"PokerStars-NoLimitHoldem"
],
"FL Holdem-PokerStars" => [
"FL Holdem-PokerStars",
"FixedLimitHoldem-PokerStars",
"PokerStars-FixedLimitHoldem",
"FixedLimitHoldem-Stars"
],
"FL Holdem-PartyPoker" => [
"FixedLimitHoldem-PartyPoker",
"FL Holdem-PartyPoker",
"FixedLimitHoldem-Party"
],
"PL Omaha-FullTilt" => [
"PotLimitOmaha-FullTilt",
"FullTilt-PotLimitOmaha"
],
"PL Omaha-Pacific" => [
"PotLimitOmaha-Pacific",
"Pacific-PotLimitOmaha"
],
"PL Omaha-PokerStars" => [
"PLO-PokerStars",
"PotLimitOmaha-PokerStars",
"PokerStars-PotLimitOmaha"
],
"PL Omaha-IPoker" => [
"PotLimitOmaha-IPoker"
],
"PL Omaha-MicroGaming" => [
"MicroGaming-PotLimitOmaha",
"PotLimitOmaha-MicroGaming"
],
"PL Omaha-OnGame" => [
"PotLimitOmaha-OnGame",
"OnGame-PotLimitOmaha",
"PLO-OnGame"
],
"FL Holdem-OnGame" => [
"FL Holdem-OnGame",
"FixedLimitHoldem-OnGame",
"OnGame-FixedLimitHoldem"
],
"NL Holdem-OnGame" => [
"NoLimitHoldem-OnGame",
"NL Holdem-OnGame",
"OnGame-NoLimitHoldem"
],
"NL Holdem-FullTilt" => [
"NoLimitHoldem-FullTilt",
"FullTilt-NoLimitHoldem"
],
"NL Holdem-Pacific" => [
"NoLimitHoldem-Pacific",
"Pacific-NoLimitHoldem",
"NL Holdem-Pacific"
],
"FL Holdem-Pacific" => [
"FixedLimitHoldem-Pacific",
"Pacific-FixedLimitHoldem"
],
"FL Omaha Hi-Lo-PokerStars" => [
"FixedLimitOmahaHiLo-PokerStars",
"FL Omaha Hi-Lo-PokerStars",
"PokerStars-FixedLimitOmahaHiLo"
],
"FL Holdem-FullTilt" => [
"FixedLimitHoldem-FullTilt",
"FullTilt-FixedLimitHoldem"
],
"NL Holdem-MicroGaming" => [
"NoLimitHoldem-MicroGaming",
"MicroGaming-NoLimitHoldem"
],
"FL Holdem-IPoker" => [
"FixedLimitHoldem-IPoker",
],
"NL Holdem-IPoker" => [
"NoLimitHoldem-IPoker",
],
"FL Holdem-MicroGaming" => [
"FixedLimitHoldem-MicroGaming",
"MicroGaming-FixedLimitHoldem"
],
"PL Holdem-PokerStars" => [
"PotLimitHoldem-PokerStars",
"Pot Limit Holdem-PokerStars",
"PokerStars-PotLimitHoldem"
]
}
def poker_pattern_limit
acc = []
POKER_MAPPING.each do |type, patterns|
patterns.each do |pattern|
LIMITS.each_key do |limit|
acc << [type, pattern, limit]
end
end
end
return acc
end
def get_content_from_zip zipped_file, name
require 'zip'
Zip::File.open zipped_file do |zipfile|
entry = zipfile.entries.select {|e| e.name == name}.first
entry.get_input_stream.read
end
end
def poker_regexps
acc = {}
poker_pattern_limit.each do |poker, poker_pattern, limit|
limit_pattern = LIMITS[limit]
# -$5-$10- pattern
dollar_pattern = limit_pattern.gsub(/\d+/) {|s| "\\$#{s}"}
YEARS.each do |year|
patterns = [
# Finsen II CAP,20-50 bb-5-10-Cap NL Holdem-PokerStars-1-15-2014.txt
# Aglasun 817033778-20-40-EURO-FixedLimitHoldem-IPoker-1-16-2014.txt
# Posadas (Real Money)-50-100-NL Holdem-Pacific-5-18-2012.txt
%r|.*(?<gameinfo>.*)(?<limit>#{limit_pattern})(?<spam>.*)#{poker_pattern}(?<date_info>.*)(?<year>-#{year}).*|,
%r|.*(?<gameinfo>.*)(?<limit>#{dollar_pattern})(?<spam>.*)#{poker_pattern}(?<date_info>.*)(?<year>-#{year}).*|,
%r|.*(?<gameinfo>.*)(?<limit>#{limit_pattern})#{poker_pattern}(?<date_info>.*)(?<year>-#{year}).*|,
%r|.*(?<gameinfo>.*)(?<limit>#{limit_pattern})USD-#{poker_pattern}(?<date_info>.*)(?<year>-#{year}).*|,
%r|.*(?<gameinfo>.*)(?<limit>#{limit_pattern})EURO-#{poker_pattern}(?<date_info>.*)(?<year>-#{year}).*|,
].each do |pattern|
acc[pattern] = {
:poker => poker,
:limit => limit,
:year => year
}
end
end
end
return acc
end
POKER_REGEXPS = poker_regexps()
def parse_by_name filepath
filename = File.basename filepath
log2 "processing #{filename}"
POKER_REGEXPS.each do |pattern, data|
match = pattern.match filepath
next if match.nil?
return data
end
return nil
end
def names_with_suffix filepath
ext = File.extname filepath
name = File.basename filepath, ext
path = File.dirname filepath
suffix = 0
suffix_name = nil
acc = [filepath]
while true
suffix += 1
suffix_name = File.join(path, "#{name}_#{suffix}#{ext}")
acc << suffix_name
break unless File.exists? suffix_name
end
acc
end
def log2 msg
log msg
$stderr.puts msg
end
def empty_dir? folder
f = Shellwords.escape folder
Dir.glob("#{f}/*").empty?
end
STATS = {
moved_files: 0,
moved_files_other: 0,
deleted_files: 0,
deleted_folders: 0,
}
def log_move
STATS[:moved_files] += 1
end
def log_folder_delete
STATS[:deleted_files] +=1
end
def log_file_delete
STATS[:deleted_folders] +=1
end
def log_move_other
STATS[:moved_files_other] +=1
end
def kind_move source_file, dest_folder
require 'fileutils'
dest_folder = File.expand_path dest_folder
basename = File.basename source_file
dest_file = File.join dest_folder, basename
unless File.exists? dest_file
mkdir dest_folder
return rename2 source_file, dest_file
end
names = names_with_suffix dest_file
is_unique = names.select do |n|
File.exists?(n) && FileUtils.cmp(n, source_file)
end.empty?
if is_unique
uniq_name = names.last
log2 "Synonym found, copying to #{uniq_name}"
mkdir dest_folder
rename2 source_file, uniq_name
else
log2 "Duplicate found, removing #{File.basename source_file}"
remove2 source_file
end
end
def remove2 path
if Dir.exists? path
log_folder_delete
else
log_file_delete
end
remove path
end
def rename2 src, dest
rename src, dest
log_move
end
def show_stats
log2 "=" * 80
log2 "STATS:"
log2 "#{STATS[:moved_files]} file(s) moved, #{STATS[:moved_files_other]} of them to 'other' folder"
log2 "#{STATS[:deleted_files]} file(s) removed"
log2 "#{STATS[:deleted_folders]} folders(s) removed"
end
def process_file path
match = parse_by_name path
if match.nil?
destination = File.join(DESTINATION, 'other')
log_move_other
else
destination = File.join(DESTINATION, match[:poker], match[:limit], match[:year].to_s)
end
kind_move path, destination
end
def is_empty_tree folder
entries = (Dir.entries(folder) - %w(. .. .DS_Store ._.DS_Store))
subfolders = []
entries.each do |entry|
e = File.join folder, entry
if File.directory? e
subfolders << e
else
return false
end
end
subfolders.each do |subfolder|
return false unless is_empty_tree(subfolder)
end
return true
end
def process_zip_file path
Dir.mktmpdir 'poker_' do |tempdir|
Zip::File.open(path) do |ziphandle|
total = ziphandle.entries.length
name = File.basename path
ziphandle.each_with_index do |zipped_file, idx|
log2 "[#{idx}/#{total}] processing #{name}"
filename = File.basename zipped_file.name
next if filename.end_with? '/'
next if filename.end_with? '.icloud'
next if filename.include? '.DS_Store'
output_file = File.join tempdir, filename
zipped_file.extract output_file
# Do not process if it's directory
next if Dir.exists? output_file
ext = File.extname output_file
if ['.txt', '.dat'].include? ext
process_file output_file
elsif ext == '.zip'
process_zip_file output_file
else
raise "Enable to process #{output_file}"
end
end
end
remove2 path
end
end
Maid.rules do
rule "Process TXT files" do
dir("#{SOURCE}/**/*.txt").each do |path|
process_file path
end
end
rule "Process DAT files" do
dir("#{SOURCE}/**/*.dat").each do |path|
process_file path
end
end
rule "Process ZIP files" do
dir("#{SOURCE}/**/*.zip").each do |path|
log2 "processing zip #{path}"
process_zip_file path
end
end
rule "Delete .cloud files" do
dir("#{SOURCE}/**/.*").each do |path|
ext = File.extname path
remove2 path if ext == '.icloud'
end
end
rule "Delete Empty folders" do
dir("#{SOURCE}/**/*/").each do |folder|
next unless Dir.exist? folder
remove2 folder if is_empty_tree folder
end
end
rule "Show stats" do
show_stats
end
end
CAP poker types parsing
SOURCE = File.expand_path "~/Downloads/Data"
DESTINATION = File.expand_path "~/Poker"
require 'zip'
require 'date'
require 'shellwords'
CURRENT_YEAR = Date.today.year
YEARS = 2010.upto(CURRENT_YEAR).to_a
LIMITS = {
"3-6" => '-3-6-',
"4-8" => '-4-8-',
"5-10" => '-5-10-',
"7.50-15" => '-7.50-15-',
"8-16" => '-8-16-',
"10-10" => '-10-10-',
"10-20" => '-10-20-',
"15-30" => '-15-30-',
"20-20" => '-20-20-',
"20-40" => '-20-40-',
"25-50" => '-25-50-',
"30-60" => '-30-60-',
"50-100" => '-50-100-',
"75-150" => '-75-150-',
"100-200" => '-100-200-',
"200-400" => '-200-400-',
"250-500" => '-250-500-',
"300-600" => '-300-600-',
"400-800" => '-400-800-',
"500-1000" => '-500-1,000-',
"1000-2000" => '-1,000-2,000-',
"2000-4000" => '-2,000-4,000-'
}
POKER_MAPPING = {
"NL Holdem-PokerStars" => [
"NL Holdem-PokerStars",
"NoLimitHoldem-PokerStars",
"PokerStars-NoLimitHoldem"
],
"FL Holdem-PokerStars" => [
"FL Holdem-PokerStars",
"FixedLimitHoldem-PokerStars",
"PokerStars-FixedLimitHoldem",
"FixedLimitHoldem-Stars"
],
"FL Holdem-PartyPoker" => [
"FixedLimitHoldem-PartyPoker",
"FL Holdem-PartyPoker",
"FixedLimitHoldem-Party"
],
"PL Omaha-FullTilt" => [
"PotLimitOmaha-FullTilt",
"FullTilt-PotLimitOmaha"
],
"PL Omaha-Pacific" => [
"PotLimitOmaha-Pacific",
"Pacific-PotLimitOmaha"
],
"PL Omaha-PokerStars" => [
"PLO-PokerStars",
"PotLimitOmaha-PokerStars",
"PokerStars-PotLimitOmaha"
],
"PL Omaha-IPoker" => [
"PotLimitOmaha-IPoker"
],
"PL Omaha-MicroGaming" => [
"MicroGaming-PotLimitOmaha",
"PotLimitOmaha-MicroGaming"
],
"PL Omaha-OnGame" => [
"PotLimitOmaha-OnGame",
"OnGame-PotLimitOmaha",
"PLO-OnGame"
],
"FL Holdem-OnGame" => [
"FL Holdem-OnGame",
"FixedLimitHoldem-OnGame",
"OnGame-FixedLimitHoldem"
],
"NL Holdem-OnGame" => [
"NoLimitHoldem-OnGame",
"NL Holdem-OnGame",
"OnGame-NoLimitHoldem"
],
"NL Holdem-FullTilt" => [
"NoLimitHoldem-FullTilt",
"FullTilt-NoLimitHoldem"
],
"NL Holdem-Pacific" => [
"NoLimitHoldem-Pacific",
"Pacific-NoLimitHoldem",
"NL Holdem-Pacific"
],
"FL Holdem-Pacific" => [
"FixedLimitHoldem-Pacific",
"Pacific-FixedLimitHoldem"
],
"FL Omaha Hi-Lo-PokerStars" => [
"FixedLimitOmahaHiLo-PokerStars",
"FL Omaha Hi-Lo-PokerStars",
"PokerStars-FixedLimitOmahaHiLo"
],
"FL Holdem-FullTilt" => [
"FixedLimitHoldem-FullTilt",
"FullTilt-FixedLimitHoldem"
],
"NL Holdem-MicroGaming" => [
"NoLimitHoldem-MicroGaming",
"MicroGaming-NoLimitHoldem"
],
"FL Holdem-IPoker" => [
"FixedLimitHoldem-IPoker",
],
"NL Holdem-IPoker" => [
"NoLimitHoldem-IPoker",
],
"FL Holdem-MicroGaming" => [
"FixedLimitHoldem-MicroGaming",
"MicroGaming-FixedLimitHoldem"
],
"PL Holdem-PokerStars" => [
"PotLimitHoldem-PokerStars",
"Pot Limit Holdem-PokerStars",
"PokerStars-PotLimitHoldem"
]
}
def poker_pattern_limit
acc = []
POKER_MAPPING.each do |type, patterns|
patterns.each do |pattern|
LIMITS.each_key do |limit|
acc << [type, pattern, limit]
end
end
end
return acc
end
def get_content_from_zip zipped_file, name
require 'zip'
Zip::File.open zipped_file do |zipfile|
entry = zipfile.entries.select {|e| e.name == name}.first
entry.get_input_stream.read
end
end
def poker_cap_regexps
acc = {}
poker_pattern_limit.each do |poker, poker_pattern, limit|
limit_pattern = LIMITS[limit]
# -$5-$10- pattern
# dollar_pattern = limit_pattern.gsub(/\d+/) {|s| "\\$#{s}"}
# 'NL Holdem CAP-PokerStars' instead of 'NL Holdem-PokerStars'
prefix, suffix = poker.split('-')
cap_poker = [prefix + ' CAP', suffix].join('-')
YEARS.each do |year|
patterns = [
# Finsen II CAP,20-50 bb-5-10-Cap NL Holdem-PokerStars-1-15-2014.txt
%r|(?<gameinfo_0>.*)CAP,(?<gameinfo_1>.*)(?<limit>#{limit_pattern})(?<spam>.*)#{poker_pattern}(?<date_info>.*)(?<year>-#{year}).*|,
%r|(?<gameinfo_0>.*)\(CAP\)(?<gameinfo_1>.*)(?<limit>#{limit_pattern})(?<spam>.*)#{poker_pattern}(?<date_info>.*)(?<year>-#{year}).*|,
# %r|.*(?<gameinfo>.*)(?<limit>#{dollar_pattern})(?<spam>.*)#{poker_pattern}(?<date_info>.*)(?<year>-#{year}).*|,
# %r|.*(?<gameinfo>.*)(?<limit>#{limit_pattern})#{poker_pattern}(?<date_info>.*)(?<year>-#{year}).*|,
# %r|.*(?<gameinfo>.*)(?<limit>#{limit_pattern})USD-#{poker_pattern}(?<date_info>.*)(?<year>-#{year}).*|,
# %r|.*(?<gameinfo>.*)(?<limit>#{limit_pattern})EURO-#{poker_pattern}(?<date_info>.*)(?<year>-#{year}).*|,
].each do |pattern|
acc[pattern] = {
:poker => cap_poker,
:limit => limit,
:year => year
}
end
end
end
return acc
end
def poker_regexps
acc = {}
poker_pattern_limit.each do |poker, poker_pattern, limit|
limit_pattern = LIMITS[limit]
# -$5-$10- pattern
dollar_pattern = limit_pattern.gsub(/\d+/) {|s| "\\$#{s}"}
YEARS.each do |year|
patterns = [
# Finsen II CAP,20-50 bb-5-10-Cap NL Holdem-PokerStars-1-15-2014.txt
# Aglasun 817033778-20-40-EURO-FixedLimitHoldem-IPoker-1-16-2014.txt
# Posadas (Real Money)-50-100-NL Holdem-Pacific-5-18-2012.txt
%r|.*(?<gameinfo>.*)(?<limit>#{limit_pattern})(?<spam>.*)#{poker_pattern}(?<date_info>.*)(?<year>-#{year}).*|,
%r|.*(?<gameinfo>.*)(?<limit>#{dollar_pattern})(?<spam>.*)#{poker_pattern}(?<date_info>.*)(?<year>-#{year}).*|,
%r|.*(?<gameinfo>.*)(?<limit>#{limit_pattern})#{poker_pattern}(?<date_info>.*)(?<year>-#{year}).*|,
%r|.*(?<gameinfo>.*)(?<limit>#{limit_pattern})USD-#{poker_pattern}(?<date_info>.*)(?<year>-#{year}).*|,
%r|.*(?<gameinfo>.*)(?<limit>#{limit_pattern})EURO-#{poker_pattern}(?<date_info>.*)(?<year>-#{year}).*|,
].each do |pattern|
acc[pattern] = {
:poker => poker,
:limit => limit,
:year => year
}
end
end
end
return acc
end
POKER_CAP_REGEXPS = poker_cap_regexps()
POKER_REGEXPS = poker_regexps()
def parse_by_name filepath
filename = File.basename filepath
log2 "processing #{filename}"
POKER_CAP_REGEXPS.each do |pattern, data|
match = pattern.match filepath
next if match.nil?
return data
end
POKER_REGEXPS.each do |pattern, data|
match = pattern.match filepath
next if match.nil?
return data
end
return nil
end
def names_with_suffix filepath
ext = File.extname filepath
name = File.basename filepath, ext
path = File.dirname filepath
suffix = 0
suffix_name = nil
acc = [filepath]
while true
suffix += 1
suffix_name = File.join(path, "#{name}_#{suffix}#{ext}")
acc << suffix_name
break unless File.exists? suffix_name
end
acc
end
def log2 msg
log msg
$stderr.puts msg
end
def empty_dir? folder
f = Shellwords.escape folder
Dir.glob("#{f}/*").empty?
end
STATS = {
moved_files: 0,
moved_files_other: 0,
deleted_files: 0,
deleted_folders: 0,
}
def log_move
STATS[:moved_files] += 1
end
def log_folder_delete
STATS[:deleted_files] +=1
end
def log_file_delete
STATS[:deleted_folders] +=1
end
def log_move_other
STATS[:moved_files_other] +=1
end
def kind_move source_file, dest_folder
require 'fileutils'
dest_folder = File.expand_path dest_folder
basename = File.basename source_file
dest_file = File.join dest_folder, basename
unless File.exists? dest_file
mkdir dest_folder
return rename2 source_file, dest_file
end
names = names_with_suffix dest_file
is_unique = names.select do |n|
File.exists?(n) && FileUtils.cmp(n, source_file)
end.empty?
if is_unique
uniq_name = names.last
log2 "Synonym found, copying to #{uniq_name}"
mkdir dest_folder
rename2 source_file, uniq_name
else
log2 "Duplicate found, removing #{File.basename source_file}"
remove2 source_file
end
end
def remove2 path
if Dir.exists? path
log_folder_delete
else
log_file_delete
end
remove path
end
def rename2 src, dest
rename src, dest
log_move
end
def show_stats
log2 "=" * 80
log2 "STATS:"
log2 "#{STATS[:moved_files]} file(s) moved, #{STATS[:moved_files_other]} of them to 'other' folder"
log2 "#{STATS[:deleted_files]} file(s) removed"
log2 "#{STATS[:deleted_folders]} folders(s) removed"
end
def process_file path
match = parse_by_name path
if match.nil?
destination = File.join(DESTINATION, 'other')
log_move_other
else
destination = File.join(DESTINATION, match[:poker], match[:limit], match[:year].to_s)
end
kind_move path, destination
end
def is_empty_tree folder
entries = (Dir.entries(folder) - %w(. .. .DS_Store ._.DS_Store))
subfolders = []
entries.each do |entry|
e = File.join folder, entry
if File.directory? e
subfolders << e
else
return false
end
end
subfolders.each do |subfolder|
return false unless is_empty_tree(subfolder)
end
return true
end
def process_zip_file path
Dir.mktmpdir 'poker_' do |tempdir|
Zip::File.open(path) do |ziphandle|
total = ziphandle.entries.length
name = File.basename path
ziphandle.each_with_index do |zipped_file, idx|
log2 "[#{idx}/#{total}] processing #{name}"
filename = File.basename zipped_file.name
next if filename.end_with? '/'
next if filename.end_with? '.icloud'
next if filename.include? '.DS_Store'
output_file = File.join tempdir, filename
zipped_file.extract output_file
# Do not process if it's directory
next if Dir.exists? output_file
ext = File.extname output_file
if ['.txt', '.dat'].include? ext
process_file output_file
elsif ext == '.zip'
process_zip_file output_file
else
raise "Enable to process #{output_file}"
end
end
end
remove2 path
end
end
Maid.rules do
rule "Process TXT files" do
dir("#{SOURCE}/**/*.txt").each do |path|
process_file path
end
end
rule "Process DAT files" do
dir("#{SOURCE}/**/*.dat").each do |path|
process_file path
end
end
rule "Process ZIP files" do
dir("#{SOURCE}/**/*.zip").each do |path|
log2 "processing zip #{path}"
process_zip_file path
end
end
rule "Delete .cloud files" do
dir("#{SOURCE}/**/.*").each do |path|
ext = File.extname path
remove2 path if ext == '.icloud'
end
end
rule "Delete Empty folders" do
dir("#{SOURCE}/**/*/").each do |folder|
next unless Dir.exist? folder
remove2 folder if is_empty_tree folder
end
end
rule "Show stats" do
show_stats
end
end
|
class Dialog < Formula
desc "Display user-friendly dialog boxes from shell scripts"
homepage "http://invisible-island.net/dialog/"
url "ftp://invisible-island.net/dialog/dialog-1.2-20150528.tgz"
sha256 "a8cd7a66bdb41e53a3145cbb0eb370c5ce7300fe0e9ad6d3e8d3b9e16ff16418"
bottle do
end
def install
system "./configure", "--prefix=#{prefix}"
system "make", "install-full"
end
end
dialog: update 1.2-20150528 bottle.
class Dialog < Formula
desc "Display user-friendly dialog boxes from shell scripts"
homepage "http://invisible-island.net/dialog/"
url "ftp://invisible-island.net/dialog/dialog-1.2-20150528.tgz"
sha256 "a8cd7a66bdb41e53a3145cbb0eb370c5ce7300fe0e9ad6d3e8d3b9e16ff16418"
bottle do
cellar :any
sha256 "f1f50b2dc04d66fbff91db59d9e1fecfee3f54d9ec33614015582745e4d6dbd8" => :yosemite
sha256 "fd3feefe57a2bf2f0592e8cc818e4510a71f5ad39989395eb2ec5d24bf8ee93e" => :mavericks
sha256 "6da0c61033ca4eb531f943f12f61dd4e16fd92f6408a1e247494e6af6b22fae4" => :mountain_lion
end
def install
system "./configure", "--prefix=#{prefix}"
system "make", "install-full"
end
end
|
require 'formula'
# Major releases of erlang should typically start out as separate formula in
# Homebrew-versions, and only be merged to master when things like couchdb and
# elixir are compatible.
class Erlang < Formula
homepage 'http://www.erlang.org'
# Download tarball from GitHub; it is served faster than the official tarball.
url "https://github.com/erlang/otp/archive/OTP-17.3.tar.gz"
sha1 "655e23a4f98b8ba4976dc417f0e876b40df74a7b"
head 'https://github.com/erlang/otp.git', :branch => 'master'
bottle do
end
resource "man" do
url "http://www.erlang.org/download/otp_doc_man_17.3.tar.gz"
sha1 "3f7717186f572bb6431e1a1e5bc6c0f5ffd53171"
end
resource "html" do
url "http://www.erlang.org/download/otp_doc_html_17.3.tar.gz"
sha1 "fee5762225ef990e8c07aa4baa563a57208b0198"
end
option 'disable-hipe', "Disable building hipe; fails on various OS X systems"
option 'with-native-libs', 'Enable native library compilation'
option 'with-dirty-schedulers', 'Enable experimental dirty schedulers'
option 'no-docs', 'Do not install documentation'
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "openssl"
depends_on "unixodbc" if MacOS.version >= :mavericks
depends_on "fop" => :optional # enables building PDF docs
depends_on "wxmac" => :recommended # for GUI apps like observer
fails_with :llvm
def install
# Unset these so that building wx, kernel, compiler and
# other modules doesn't fail with an unintelligable error.
%w[LIBS FLAGS AFLAGS ZFLAGS].each { |k| ENV.delete("ERL_#{k}") }
ENV["FOP"] = "#{HOMEBREW_PREFIX}/bin/fop" if build.with? 'fop'
# Do this if building from a checkout to generate configure
system "./otp_build autoconf" if File.exist? "otp_build"
args = %W[
--disable-debug
--disable-silent-rules
--prefix=#{prefix}
--enable-kernel-poll
--enable-threads
--enable-sctp
--enable-dynamic-ssl-lib
--with-ssl=#{Formula["openssl"].opt_prefix}
--enable-shared-zlib
--enable-smp-support
]
args << "--enable-darwin-64bit" if MacOS.prefer_64_bit?
args << "--enable-native-libs" if build.with? "native-libs"
args << "--enable-dirty-schedulers" if build.with? "dirty-schedulers"
args << "--enable-wx" if build.with? "wxmac"
if MacOS.version >= :snow_leopard and MacOS::CLT.installed?
args << "--with-dynamic-trace=dtrace"
end
if build.include? 'disable-hipe'
# HIPE doesn't strike me as that reliable on OS X
# http://syntatic.wordpress.com/2008/06/12/macports-erlang-bus-error-due-to-mac-os-x-1053-update/
# http://www.erlang.org/pipermail/erlang-patches/2008-September/000293.html
args << '--disable-hipe'
else
args << '--enable-hipe'
end
system "./configure", *args
system "make"
ENV.j1 # Install is not thread-safe; can try to create folder twice and fail
system "make install"
unless build.include? 'no-docs'
(lib/'erlang').install resource('man').files('man')
doc.install resource('html')
end
end
def caveats; <<-EOS.undent
Man pages can be found in:
#{opt_lib}/erlang/man
Access them with `erl -man`, or add this directory to MANPATH.
EOS
end
test do
system "#{bin}/erl", "-noshell", "-eval", "crypto:start().", "-s", "init", "stop"
end
end
erlang: add upstream patch to fix SSL issue
require 'formula'
# Major releases of erlang should typically start out as separate formula in
# Homebrew-versions, and only be merged to master when things like couchdb and
# elixir are compatible.
class Erlang < Formula
homepage 'http://www.erlang.org'
stable do
# Download tarball from GitHub; it is served faster than the official tarball.
url "https://github.com/erlang/otp/archive/OTP-17.3.tar.gz"
sha1 "655e23a4f98b8ba4976dc417f0e876b40df74a7b"
# Upstream patch to fix http://erlang.org/pipermail/erlang-questions/2014-September/081176.html
patch do
url "https://github.com/erlang/otp/commit/b196730a325cfe74312c3a5f4b1273ba7c705ed6.diff"
sha1 "382fcaf4502adaac4f4c00dd46f64adb0ae84212"
end
end
head 'https://github.com/erlang/otp.git', :branch => 'master'
bottle do
end
resource "man" do
url "http://www.erlang.org/download/otp_doc_man_17.3.tar.gz"
sha1 "3f7717186f572bb6431e1a1e5bc6c0f5ffd53171"
end
resource "html" do
url "http://www.erlang.org/download/otp_doc_html_17.3.tar.gz"
sha1 "fee5762225ef990e8c07aa4baa563a57208b0198"
end
option 'disable-hipe', "Disable building hipe; fails on various OS X systems"
option 'with-native-libs', 'Enable native library compilation'
option 'with-dirty-schedulers', 'Enable experimental dirty schedulers'
option 'no-docs', 'Do not install documentation'
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "openssl"
depends_on "unixodbc" if MacOS.version >= :mavericks
depends_on "fop" => :optional # enables building PDF docs
depends_on "wxmac" => :recommended # for GUI apps like observer
fails_with :llvm
def install
# Unset these so that building wx, kernel, compiler and
# other modules doesn't fail with an unintelligable error.
%w[LIBS FLAGS AFLAGS ZFLAGS].each { |k| ENV.delete("ERL_#{k}") }
ENV["FOP"] = "#{HOMEBREW_PREFIX}/bin/fop" if build.with? 'fop'
# Do this if building from a checkout to generate configure
system "./otp_build autoconf" if File.exist? "otp_build"
args = %W[
--disable-debug
--disable-silent-rules
--prefix=#{prefix}
--enable-kernel-poll
--enable-threads
--enable-sctp
--enable-dynamic-ssl-lib
--with-ssl=#{Formula["openssl"].opt_prefix}
--enable-shared-zlib
--enable-smp-support
]
args << "--enable-darwin-64bit" if MacOS.prefer_64_bit?
args << "--enable-native-libs" if build.with? "native-libs"
args << "--enable-dirty-schedulers" if build.with? "dirty-schedulers"
args << "--enable-wx" if build.with? "wxmac"
if MacOS.version >= :snow_leopard and MacOS::CLT.installed?
args << "--with-dynamic-trace=dtrace"
end
if build.include? 'disable-hipe'
# HIPE doesn't strike me as that reliable on OS X
# http://syntatic.wordpress.com/2008/06/12/macports-erlang-bus-error-due-to-mac-os-x-1053-update/
# http://www.erlang.org/pipermail/erlang-patches/2008-September/000293.html
args << '--disable-hipe'
else
args << '--enable-hipe'
end
system "./configure", *args
system "make"
ENV.j1 # Install is not thread-safe; can try to create folder twice and fail
system "make install"
unless build.include? 'no-docs'
(lib/'erlang').install resource('man').files('man')
doc.install resource('html')
end
end
def caveats; <<-EOS.undent
Man pages can be found in:
#{opt_lib}/erlang/man
Access them with `erl -man`, or add this directory to MANPATH.
EOS
end
test do
system "#{bin}/erl", "-noshell", "-eval", "crypto:start().", "-s", "init", "stop"
end
end
|
require 'formula'
class Fdupes < Formula
url 'http://fdupes.googlecode.com/files/fdupes-1.40.tar.gz'
homepage 'http://code.google.com/p/fdupes/'
sha1 'e1bce9bdf50d7bf700dda3eb8a3d218b181b3931'
def install
inreplace "Makefile", "gcc", "#{ENV.cc} #{ENV.cflags}"
system "make fdupes"
bin.install "fdupes"
man1.install "fdupes.1"
end
end
fdupes: style nits
require 'formula'
class Fdupes < Formula
homepage 'http://code.google.com/p/fdupes/'
url 'http://fdupes.googlecode.com/files/fdupes-1.40.tar.gz'
sha1 'e1bce9bdf50d7bf700dda3eb8a3d218b181b3931'
def install
inreplace "Makefile", "gcc", "#{ENV.cc} #{ENV.cflags}"
system "make fdupes"
bin.install "fdupes"
man1.install "fdupes.1"
end
end
|
gem "builder"
require "builder"
require File.join(File.join(File.dirname(__FILE__), "controllers"), "feeds")
require File.join(File.join(File.dirname(__FILE__), "controllers"), "feed_settings")
require File.join(File.join(File.dirname(__FILE__), "helpers"), "global_helpers")
require File.join(File.join(File.dirname(__FILE__), "models"), "feed_setting")
include Merb::GlobalHelpers
Merb::Router.prepend do |r|
r.match("/articles.:format").to(:controller => "Feeds", :action => "articles")
r.match("/rss").to(:controller => "Feeds", :action => "articles")
r.match("/atom").to(:controller => "Feeds", :action => "articles", :format => "atom")
r.match("/comments.:format").to(:controller => "Feeds", :action => "comments")
r.namespace :admin do |admin|
admin.resource :feed_settings
end
end
Hooks::View.register_partial_view "head", "feed_link"
Hooks::View.register_partial_view "sidebar", "feed_link"
Hooks::Menu.add_menu_item "Feed Settings", "/admin/feed_settings"
fix for the /rss route
gem "builder"
require "builder"
require File.join(File.join(File.dirname(__FILE__), "controllers"), "feeds")
require File.join(File.join(File.dirname(__FILE__), "controllers"), "feed_settings")
require File.join(File.join(File.dirname(__FILE__), "helpers"), "global_helpers")
require File.join(File.join(File.dirname(__FILE__), "models"), "feed_setting")
include Merb::GlobalHelpers
Merb::Router.prepend do |r|
r.match("/articles.:format").to(:controller => "Feeds", :action => "articles")
r.match("/rss").to(:controller => "Feeds", :action => "articles", :format => "rss")
r.match("/atom").to(:controller => "Feeds", :action => "articles", :format => "atom")
r.match("/comments.:format").to(:controller => "Feeds", :action => "comments")
r.namespace :admin do |admin|
admin.resource :feed_settings
end
end
Hooks::View.register_partial_view "head", "feed_link"
Hooks::View.register_partial_view "sidebar", "feed_link"
Hooks::Menu.add_menu_item "Feed Settings", "/admin/feed_settings" |
ipinfo 1.1 (new formula)
require "formula"
class Ipinfo < Formula
homepage "http://kyberdigi.cz/projects/ipinfo/"
url "http://kyberdigi.cz/projects/ipinfo/files/ipinfo-1.1.tar.gz"
sha1 "371800b2dfebb7de4ed0cca8d66c77d46477a596"
def install
system "make", "BINDIR=#{bin}",
"MANDIR=#{man1}",
"install"
end
test do
system "ipinfo", "127.0.0.1"
end
end
|
$:.push File.expand_path('../lib', __FILE__)
# Maintain your gem's version:
require 'discuss/version'
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = 'discuss'
s.version = Discuss::VERSION
s.authors = ['Elle Meredith', 'Garrett Heinlen', 'Nick Sutterer']
s.email = ['elle.meredith@blake.com.au']
s.homepage = 'http://labs.blake.com.au'
s.summary = 'Messaging engine'
s.description = 'Messaging engine'
s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md']
s.test_files = Dir['test/**/*']
s.add_dependency 'rails', '~> 4.0.0.beta1'
s.add_dependency 'ancestry', '~> 1.3.0'
s.add_dependency 'haml', '~> 4.0.2'
s.add_dependency 'simple_form', '~> 1.4.1'
s.add_development_dependency 'capybara'
s.add_development_dependency 'debugger'
s.add_development_dependency 'sqlite3'
s.add_development_dependency 'minitest-reporters'
end
rails 4 is up to rc1
$:.push File.expand_path('../lib', __FILE__)
# Maintain your gem's version:
require 'discuss/version'
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = 'discuss'
s.version = Discuss::VERSION
s.authors = ['Elle Meredith', 'Garrett Heinlen', 'Nick Sutterer']
s.email = ['elle.meredith@blake.com.au']
s.homepage = 'http://labs.blake.com.au'
s.summary = 'Messaging engine'
s.description = 'Messaging engine'
s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md']
s.test_files = Dir['test/**/*']
s.add_dependency 'rails', '~> 4.0.0.rc1'
#s.add_dependency 'ancestry', '~> 1.3'
s.add_dependency 'haml', '~> 4.0'
s.add_dependency 'simple_form', '~> 1.4'
s.add_development_dependency 'capybara'
s.add_development_dependency 'debugger'
s.add_development_dependency 'sqlite3'
s.add_development_dependency 'minitest-reporters'
end
|
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'escapement/version'
Gem::Specification.new do |spec|
spec.name = "escapement"
spec.version = Escapement::VERSION
spec.authors = ["Ryan LeFevre"]
spec.email = ["ryan@hodinkee.com"]
spec.summary = %q{Extract child entities from an HTML string.}
spec.description = %q{Given a HTML formatted string, escapement will extract descendant tags into a device agnostic attributes array that can be used for formatting the text anywhere.}
spec.homepage = "https://github.com/hodinkee/escapement"
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.required_ruby_version = ">= 2.0.0"
spec.add_dependency "nokogiri", "~> 1.6"
spec.add_development_dependency "bundler", "~> 1.9"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3"
end
Loosen bundler dependency
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'escapement/version'
Gem::Specification.new do |spec|
spec.name = "escapement"
spec.version = Escapement::VERSION
spec.authors = ["Ryan LeFevre"]
spec.email = ["ryan@hodinkee.com"]
spec.summary = %q{Extract child entities from an HTML string.}
spec.description = %q{Given a HTML formatted string, escapement will extract descendant tags into a device agnostic attributes array that can be used for formatting the text anywhere.}
spec.homepage = "https://github.com/hodinkee/escapement"
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.required_ruby_version = ">= 2.0.0"
spec.add_dependency "nokogiri", "~> 1.6"
spec.add_development_dependency "bundler"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3"
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.