utter_events 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +12 -0
- data/Gemfile +4 -0
- data/Guardfile +70 -0
- data/README.md +110 -0
- data/Rakefile +1 -0
- data/bin/console +8 -0
- data/bin/setup +8 -0
- data/lib/utter.rb +47 -0
- data/lib/utter/version.rb +3 -0
- data/sample_rails_app/.gitignore +17 -0
- data/sample_rails_app/Gemfile +17 -0
- data/sample_rails_app/Gemfile.lock +157 -0
- data/sample_rails_app/README.rdoc +28 -0
- data/sample_rails_app/Rakefile +6 -0
- data/sample_rails_app/app/assets/images/.keep +0 -0
- data/sample_rails_app/app/assets/javascripts/application.js +15 -0
- data/sample_rails_app/app/assets/javascripts/articles.js +2 -0
- data/sample_rails_app/app/assets/javascripts/comments.js +2 -0
- data/sample_rails_app/app/assets/javascripts/welcome.js +2 -0
- data/sample_rails_app/app/assets/stylesheets/application.css +15 -0
- data/sample_rails_app/app/assets/stylesheets/articles.scss +3 -0
- data/sample_rails_app/app/assets/stylesheets/comments.scss +3 -0
- data/sample_rails_app/app/assets/stylesheets/welcome.scss +3 -0
- data/sample_rails_app/app/controllers/application_controller.rb +5 -0
- data/sample_rails_app/app/controllers/articles_controller.rb +51 -0
- data/sample_rails_app/app/controllers/comments_controller.rb +19 -0
- data/sample_rails_app/app/controllers/concerns/.keep +0 -0
- data/sample_rails_app/app/controllers/welcome_controller.rb +4 -0
- data/sample_rails_app/app/helpers/application_helper.rb +2 -0
- data/sample_rails_app/app/helpers/articles_helper.rb +2 -0
- data/sample_rails_app/app/helpers/comments_helper.rb +2 -0
- data/sample_rails_app/app/helpers/welcome_helper.rb +2 -0
- data/sample_rails_app/app/mailers/.keep +0 -0
- data/sample_rails_app/app/models/.keep +0 -0
- data/sample_rails_app/app/models/article.rb +5 -0
- data/sample_rails_app/app/models/comment.rb +3 -0
- data/sample_rails_app/app/models/concerns/.keep +0 -0
- data/sample_rails_app/app/views/articles/_form.html.erb +31 -0
- data/sample_rails_app/app/views/articles/edit.html.erb +5 -0
- data/sample_rails_app/app/views/articles/index.html.erb +21 -0
- data/sample_rails_app/app/views/articles/new.html.erb +5 -0
- data/sample_rails_app/app/views/articles/show.html.erb +18 -0
- data/sample_rails_app/app/views/comments/_comment.html.erb +15 -0
- data/sample_rails_app/app/views/comments/_form.html.erb +13 -0
- data/sample_rails_app/app/views/layouts/application.html.erb +14 -0
- data/sample_rails_app/app/views/welcome/index.html.erb +2 -0
- data/sample_rails_app/bin/bundle +3 -0
- data/sample_rails_app/bin/rails +9 -0
- data/sample_rails_app/bin/rake +9 -0
- data/sample_rails_app/bin/setup +29 -0
- data/sample_rails_app/bin/spring +15 -0
- data/sample_rails_app/config.ru +4 -0
- data/sample_rails_app/config/application.rb +35 -0
- data/sample_rails_app/config/boot.rb +3 -0
- data/sample_rails_app/config/database.yml +25 -0
- data/sample_rails_app/config/environment.rb +5 -0
- data/sample_rails_app/config/environments/development.rb +41 -0
- data/sample_rails_app/config/environments/production.rb +79 -0
- data/sample_rails_app/config/environments/test.rb +42 -0
- data/sample_rails_app/config/initializers/assets.rb +11 -0
- data/sample_rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/sample_rails_app/config/initializers/cookies_serializer.rb +3 -0
- data/sample_rails_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/sample_rails_app/config/initializers/inflections.rb +16 -0
- data/sample_rails_app/config/initializers/mime_types.rb +4 -0
- data/sample_rails_app/config/initializers/session_store.rb +3 -0
- data/sample_rails_app/config/initializers/utter.rb +8 -0
- data/sample_rails_app/config/initializers/wrap_parameters.rb +14 -0
- data/sample_rails_app/config/locales/en.yml +23 -0
- data/sample_rails_app/config/routes.rb +7 -0
- data/sample_rails_app/config/secrets.yml +22 -0
- data/sample_rails_app/db/migrate/20160218085536_create_articles.rb +10 -0
- data/sample_rails_app/db/migrate/20160222061605_create_comments.rb +11 -0
- data/sample_rails_app/db/schema.rb +33 -0
- data/sample_rails_app/db/seeds.rb +7 -0
- data/sample_rails_app/lib/assets/.keep +0 -0
- data/sample_rails_app/lib/tasks/.keep +0 -0
- data/sample_rails_app/log/.keep +0 -0
- data/sample_rails_app/public/404.html +67 -0
- data/sample_rails_app/public/422.html +67 -0
- data/sample_rails_app/public/500.html +66 -0
- data/sample_rails_app/public/favicon.ico +0 -0
- data/sample_rails_app/public/robots.txt +5 -0
- data/sample_rails_app/vendor/assets/javascripts/.keep +0 -0
- data/sample_rails_app/vendor/assets/stylesheets/.keep +0 -0
- data/utter.gemspec +31 -0
- metadata +221 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class ArticlesController < ApplicationController
|
2
|
+
include Utter
|
3
|
+
def index
|
4
|
+
utter(:index_viewed, params: params)
|
5
|
+
@articles = Article.all
|
6
|
+
end
|
7
|
+
|
8
|
+
def show
|
9
|
+
@article = Article.find(params[:id])
|
10
|
+
end
|
11
|
+
|
12
|
+
def new
|
13
|
+
@article = Article.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def edit
|
17
|
+
@article = Article.find(params[:id])
|
18
|
+
end
|
19
|
+
|
20
|
+
def create
|
21
|
+
@article = Article.new(article_params)
|
22
|
+
|
23
|
+
if @article.save
|
24
|
+
redirect_to @article
|
25
|
+
else
|
26
|
+
render 'new'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def update
|
31
|
+
@article = Article.find(params[:id])
|
32
|
+
|
33
|
+
if @article.update(article_params)
|
34
|
+
redirect_to @article
|
35
|
+
else
|
36
|
+
render 'edit'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def destroy
|
41
|
+
@article = Article.find(params[:id])
|
42
|
+
@article.destroy
|
43
|
+
|
44
|
+
redirect_to articles_path
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
def article_params
|
49
|
+
params.require(:article).permit(:title, :text)
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CommentsController < ApplicationController
|
2
|
+
def create
|
3
|
+
@article = Article.find(params[:article_id])
|
4
|
+
@comment = @article.comments.create(comment_params)
|
5
|
+
redirect_to article_path(@article)
|
6
|
+
end
|
7
|
+
|
8
|
+
def destroy
|
9
|
+
@article = Article.find(params[:article_id])
|
10
|
+
@comment = @article.comments.find(params[:id])
|
11
|
+
@comment.destroy
|
12
|
+
redirect_to article_path(@article)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
def comment_params
|
17
|
+
params.require(:comment).permit(:commenter, :body)
|
18
|
+
end
|
19
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<%= form_for @article do |f| %>
|
2
|
+
|
3
|
+
<% if @article.errors.any? %>
|
4
|
+
<div id="error_explanation">
|
5
|
+
<h2>
|
6
|
+
<%= pluralize(@article.errors.count, "error") %> prohibited
|
7
|
+
this article from being saved:
|
8
|
+
</h2>
|
9
|
+
<ul>
|
10
|
+
<% @article.errors.full_messages.each do |msg| %>
|
11
|
+
<li><%= msg %></li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<p>
|
18
|
+
<%= f.label :title %><br>
|
19
|
+
<%= f.text_field :title %>
|
20
|
+
</p>
|
21
|
+
|
22
|
+
<p>
|
23
|
+
<%= f.label :text %><br>
|
24
|
+
<%= f.text_area :text %>
|
25
|
+
</p>
|
26
|
+
|
27
|
+
<p>
|
28
|
+
<%= f.submit %>
|
29
|
+
</p>
|
30
|
+
|
31
|
+
<% end %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<h1>Listing Articles</h1>
|
2
|
+
<%= link_to 'New article', new_article_path %>
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Title</th>
|
6
|
+
<th>Text</th>
|
7
|
+
<th colspan="3"></th>
|
8
|
+
</tr>
|
9
|
+
|
10
|
+
<% @articles.each do |article| %>
|
11
|
+
<tr>
|
12
|
+
<td><%= article.title %></td>
|
13
|
+
<td><%= article.text %></td>
|
14
|
+
<td><%= link_to 'Show', article_path(article) %></td>
|
15
|
+
<td><%= link_to 'Edit', edit_article_path(article) %></td>
|
16
|
+
<td><%= link_to 'Destroy', article_path(article),
|
17
|
+
method: :delete,
|
18
|
+
data: { confirm: 'Are you sure?' } %></td>
|
19
|
+
</tr>
|
20
|
+
<% end %>
|
21
|
+
</table>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<p>
|
2
|
+
<strong>Title:</strong>
|
3
|
+
<%= @article.title %>
|
4
|
+
</p>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<strong>Text:</strong>
|
8
|
+
<%= @article.text %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<h2>Comments</h2>
|
12
|
+
<%= render @article.comments %>
|
13
|
+
|
14
|
+
<h2>Add a comment:</h2>
|
15
|
+
<%= render 'comments/form' %>
|
16
|
+
|
17
|
+
<%= link_to 'Edit', edit_article_path(@article) %> |
|
18
|
+
<%= link_to 'Back', articles_path %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<p>
|
2
|
+
<strong>Commenter:</strong>
|
3
|
+
<%= comment.commenter %>
|
4
|
+
</p>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<strong>Comment:</strong>
|
8
|
+
<%= comment.body %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<%= link_to 'Destroy Comment', [comment.article, comment],
|
13
|
+
method: :delete,
|
14
|
+
data: { confirm: 'Are you sure?' } %>
|
15
|
+
</p>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
begin
|
3
|
+
load File.expand_path('../spring', __FILE__)
|
4
|
+
rescue LoadError => e
|
5
|
+
raise unless e.message.include?('spring')
|
6
|
+
end
|
7
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
8
|
+
require_relative '../config/boot'
|
9
|
+
require 'rails/commands'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# This file loads spring without using Bundler, in order to be fast.
|
4
|
+
# It gets overwritten when you run the `spring binstub` command.
|
5
|
+
|
6
|
+
unless defined?(Spring)
|
7
|
+
require 'rubygems'
|
8
|
+
require 'bundler'
|
9
|
+
|
10
|
+
if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m))
|
11
|
+
Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq }
|
12
|
+
gem 'spring', match[1]
|
13
|
+
require 'spring/binstub'
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "rails"
|
4
|
+
# Pick the frameworks you want:
|
5
|
+
require "active_model/railtie"
|
6
|
+
require "active_job/railtie"
|
7
|
+
require "active_record/railtie"
|
8
|
+
require "action_controller/railtie"
|
9
|
+
require "action_mailer/railtie"
|
10
|
+
require "action_view/railtie"
|
11
|
+
require "sprockets/railtie"
|
12
|
+
# require "rails/test_unit/railtie"
|
13
|
+
|
14
|
+
# Require the gems listed in Gemfile, including any gems
|
15
|
+
# you've limited to :test, :development, or :production.
|
16
|
+
Bundler.require(*Rails.groups)
|
17
|
+
|
18
|
+
module SampleApp
|
19
|
+
class Application < Rails::Application
|
20
|
+
# Settings in config/environments/* take precedence over those specified here.
|
21
|
+
# Application configuration should go into files in config/initializers
|
22
|
+
# -- all .rb files in that directory are automatically loaded.
|
23
|
+
|
24
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
25
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
26
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
27
|
+
|
28
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
29
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
30
|
+
# config.i18n.default_locale = :de
|
31
|
+
|
32
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
33
|
+
config.active_record.raise_in_transactional_callbacks = true
|
34
|
+
end
|
35
|
+
end
|