Skip to content

Commit

Permalink
before test cases 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Manvendra committed May 23, 2019
1 parent 1330976 commit b1d81c8
Show file tree
Hide file tree
Showing 240 changed files with 19,026 additions and 0 deletions.
128 changes: 128 additions & 0 deletions Batch2/Rails/8th.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
heroku deployment
Integrating javascript libraries like vue
gem 'webpacker'
gem 'foreman'
rails webpacker:install
rails webpacker:install:vue
yarn install
// app/javascript/packs/application.js

import Vue from 'vue/dist/vue.esm'
import App from '../components/app.vue'

document.addEventListener('DOMContentLoaded', () => {
document.body.appendChild(document.createElement('app'))
const app = new Vue({
el: 'app',
template: '<App/>',
components: { App }
})

console.log(app)
})
//later stage

import Vue from 'vue/dist/vue.esm'
import App from '../app.vue'
import Router from 'vue-router'
import Signin from '../components/Signin.vue'
Vue.use(Router)

const NotFound = { template: '<p>Page not found</p>' }

const routes = {
'/': App
}

document.addEventListener('DOMContentLoaded', () => {
document.body.appendChild(document.createElement('app'))
const app = new Vue({
el: 'app',
data: {
currentRoute: window.location.pathname
},
computed: {
ViewComponent () {
return routes[this.currentRoute] || NotFound
}
},
render (h) { return h(this.ViewComponent) }
})

console.log(app)
})

# Procfile
backend: bin/rails s -p 3000
frontend: bin/webpack-dev-server

foreman start
<%= javascript_pack_tag 'application' %>


Active jobs
GuestsCleanupJob.set(wait_until: Date.tomorrow.noon).perform_later(guest)
GuestsCleanupJob.set(wait: 1.week).perform_later(guest)
config.active_job.queue_adapter = :sidekiq
self.queue_adapter = :resque
queue_as :urgent
queue_as :low_priority
queue_as :default
Rails by default comes with an asynchronous queuing implementation that runs jobs with an in-process thread pool.
Jobs will run asynchronously, but any jobs in the queue will be dropped upon restart.
Available callbacks
before_enqueue
around_enqueue
after_enqueue
before_perform
around_perform
after_perform

Exception handelling
rescue_from(ActiveRecord::RecordNotFound) do |exception|
# Do something with the exception
end

retry_on CustomAppException # defaults to 3s wait, 5 attempts
discard_on ActiveJob::DeserializationError


Caching
page caching
action caching
fragment caching
gem:
actionpack-page_caching
actionpack-action_caching
caches_page :index
config.action_controller.perform_caching = true


Puma web server
workers
thread


Thread in rails

I18n

Day - 9
Ruby's Test Framework
From Minitest to Rails Testing
Functional Tests
Rspec (matchers, assertions, mocks, factory-girl)
Creating your Own gem
How to debug/patch a gem






Day - 10

Module - prepped extended, included , inherited
Metaprogramming


31 changes: 31 additions & 0 deletions Batch2/Rails/devise_app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore uploaded files in development
/storage/*
!/storage/.keep

/node_modules
/yarn-error.log

/public/assets
.byebug_history

# Ignore master key for decrypting credentials and more.
/config/master.key
1 change: 1 addition & 0 deletions Batch2/Rails/devise_app/.ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.4.0
65 changes: 65 additions & 0 deletions Batch2/Rails/devise_app/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.4.0'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.3'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
gem 'devise'
gem 'bootstrap-sass'
gem 'autoprefixer-rails'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'mini_racer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
# Easy installation and use of chromedriver to run system tests with Chrome
gem 'chromedriver-helper'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Loading

0 comments on commit b1d81c8

Please sign in to comment.