bongo 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c59589bd172826410ac4850dd51c8ff92fcb0e4dbd5bf97466f1f874bb6972fd
4
+ data.tar.gz: cef232e90c81878353f0be618abcbc5927cf3de3da00612911f2da62787d1103
5
+ SHA512:
6
+ metadata.gz: 62cdb4e242a6c8e8dffcc00b5452d6a7ddaa92c5e78db491cd0fabcd43b111303e10ea89eacb58b22e01b1badedc8e5c7ab208f4440042ebd1b0ea0695db33ab
7
+ data.tar.gz: cd3734f4227fd9d010d7a0b393f8591cd11746f3dec80ca62168f6f5b96773141e4a822f7afbf59aca1c993796a76bdd13213ff76dfc983ff0d96f7dec086d4e
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2020 Thomas Hutterer
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # Bongo
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'bongo'
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install bongo
22
+ ```
23
+
24
+ ## Contributing
25
+ Contribution directions go here.
26
+
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,32 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Bongo'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+ load 'rails/tasks/statistics.rake'
21
+
22
+ require 'bundler/gem_tasks'
23
+
24
+ require 'rake/testtask'
25
+
26
+ Rake::TestTask.new(:test) do |t|
27
+ t.libs << 'test'
28
+ t.pattern = 'test/**/*_test.rb'
29
+ t.verbose = false
30
+ end
31
+
32
+ task default: :test
@@ -0,0 +1 @@
1
+ //= link_directory ../stylesheets/bongo .css
@@ -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 other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
1
+ module Bongo
2
+ class ApplicationController < ActionController::Base
3
+ protect_from_forgery with: :exception
4
+ end
5
+ end
@@ -0,0 +1,55 @@
1
+ require_dependency "bongo/application_controller"
2
+
3
+ module Bongo
4
+ class ArticlesController < ApplicationController
5
+ before_action :authenticate_user!, except: [:index, :show]
6
+
7
+ before_action :set_article, only: [:show, :edit, :update, :destroy]
8
+
9
+ def index
10
+ @articles = Article.all.order(publish_at: :desc)
11
+ end
12
+
13
+ def show
14
+ end
15
+
16
+ def new
17
+ @article = Article.new
18
+ end
19
+
20
+ def edit
21
+ end
22
+
23
+ def create
24
+ @article = Article.new(article_params)
25
+
26
+ if @article.save
27
+ redirect_to @article, notice: 'Article was successfully created.'
28
+ else
29
+ render :new
30
+ end
31
+ end
32
+
33
+ def update
34
+ if @article.update(article_params)
35
+ redirect_to @article, notice: 'Article was successfully updated.'
36
+ else
37
+ render :edit
38
+ end
39
+ end
40
+
41
+ def destroy
42
+ @article.destroy
43
+ redirect_to articles_url, notice: 'Article was successfully destroyed.'
44
+ end
45
+
46
+ private
47
+ def set_article
48
+ @article = Article.find(params[:id])
49
+ end
50
+
51
+ def article_params
52
+ params.require(:article).permit(:title, :text, :publish_at)
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,7 @@
1
+ module Bongo
2
+ module ApplicationHelper
3
+ def engine_name
4
+ "bongo"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ module Bongo
2
+ module ArticlesHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Bongo
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module Bongo
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: 'from@example.com'
4
+ layout 'mailer'
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ module Bongo
2
+ class Article
3
+ include Mongoid::Document
4
+
5
+ field :title, type: String
6
+ field :text, type: String
7
+ field :publish_at, type: Date
8
+ end
9
+ end
@@ -0,0 +1,28 @@
1
+ <%= form_with(model: article, local: true) do |form| %>
2
+ <% if article.errors.any? %>
3
+ <header>
4
+ <h4><%= pluralize(article.errors.count, "error") %> prohibited this article from being saved:</h4>
5
+
6
+ <ul>
7
+ <% article.errors.full_messages.each do |message| %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </header>
12
+ <% end %>
13
+
14
+ <%= form.label :title %>
15
+ <%= form.text_field :title, required: true %>
16
+
17
+ <%= form.label :text %>
18
+ <%= form.text_area :text, required: true %>
19
+
20
+ <%= form.label :publish_at %>
21
+ <%= form.date_field :publish_at %>
22
+
23
+ <button type="submit">Save</button>
24
+
25
+ <%= link_to articles_path do %>
26
+ <em>Back</em>
27
+ <% end %>
28
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <%- if notice.present? %>
2
+ <blockquote>
3
+ <p><em><%= notice %></em></p>
4
+ </blockquote>
5
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <section>
2
+ <header>
3
+ <h3>Editing Article</h3>
4
+ </header>
5
+
6
+ <%= render 'form', article: @article %>
7
+ </section>
@@ -0,0 +1,14 @@
1
+ <% @articles.each do |article| %>
2
+ <article>
3
+ <h2><%= link_to article.title, article %></h2>
4
+ <small><%= article.publish_at ? l(article.publish_at, format: :long) : "Unpublished draft"%></small>
5
+ <p><%= simple_format truncate(article.text, length: 500) %></p>
6
+ </article>
7
+ <br>
8
+ <% end %>
9
+
10
+ <br>
11
+
12
+ <%= link_to new_article_path do %>
13
+ <b>New Article</b>
14
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <section>
2
+ <header>
3
+ <h3>New Article</h3>
4
+ </header>
5
+
6
+ <%= render 'form', article: @article %>
7
+ </section>
@@ -0,0 +1,21 @@
1
+ <article>
2
+ <header>
3
+ <h2><%= @article.title %></h2>
4
+ <small><%= @article.publish_at ? l(@article.publish_at, format: :long) : "Unpublished draft"%></small>
5
+ </header>
6
+ <main><%= simple_format @article.text %></main>
7
+ </article>
8
+
9
+ <br>
10
+
11
+ <%= link_to edit_article_path(@article) do %>
12
+ <b>Edit</b>
13
+ <% end %>
14
+
15
+ <%= link_to @article, method: :delete, data: {confirm: "Are you sure?"} do %>
16
+ <em>Delete</em>
17
+ <% end %>
18
+
19
+ <%= link_to articles_path do %>
20
+ <em>Back</em>
21
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <% content_for :title do %>
2
+ Blog
3
+ <% end %>
4
+
5
+ <%= render template: "layouts/application" %>
data/config/routes.rb ADDED
@@ -0,0 +1,4 @@
1
+ Bongo::Engine.routes.draw do
2
+ root to: "articles#index"
3
+ resources :articles
4
+ end
@@ -0,0 +1,5 @@
1
+ module Bongo
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Bongo
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module Bongo
2
+ VERSION = '0.0.1'
3
+ end
data/lib/bongo.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "bongo/engine"
2
+
3
+ module Bongo
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :bongo do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bongo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Thomas Hutterer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-05-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 6.0.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 6.0.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: mongoid
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 7.0.5
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 7.0.5
41
+ description: Bongo is a mountable Rails engine for blogging using MongoDB.
42
+ email:
43
+ - tohu@tuta.io
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - MIT-LICENSE
49
+ - README.md
50
+ - Rakefile
51
+ - app/assets/config/bongo_manifest.js
52
+ - app/assets/stylesheets/bongo/application.css
53
+ - app/controllers/bongo/application_controller.rb
54
+ - app/controllers/bongo/articles_controller.rb
55
+ - app/helpers/bongo/application_helper.rb
56
+ - app/helpers/bongo/articles_helper.rb
57
+ - app/jobs/bongo/application_job.rb
58
+ - app/mailers/bongo/application_mailer.rb
59
+ - app/models/bongo/article.rb
60
+ - app/views/bongo/articles/_form.html.erb
61
+ - app/views/bongo/articles/_notice.html.erb
62
+ - app/views/bongo/articles/edit.html.erb
63
+ - app/views/bongo/articles/index.html.erb
64
+ - app/views/bongo/articles/new.html.erb
65
+ - app/views/bongo/articles/show.html.erb
66
+ - app/views/layouts/bongo/application.html.erb
67
+ - config/routes.rb
68
+ - lib/bongo.rb
69
+ - lib/bongo/engine.rb
70
+ - lib/bongo/version.rb
71
+ - lib/tasks/bongo_tasks.rake
72
+ homepage: https://rubygems.org/gems/bongo
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubygems_version: 3.1.2
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: A blogging engine
95
+ test_files: []