blogg 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +40 -0
  5. data/app/assets/javascripts/blogg/application.js +15 -0
  6. data/app/assets/javascripts/blogg/posts.js +2 -0
  7. data/app/assets/stylesheets/blogg/application.css +13 -0
  8. data/app/assets/stylesheets/blogg/posts.css +4 -0
  9. data/app/assets/stylesheets/scaffold.css +56 -0
  10. data/app/controllers/blogg/application_controller.rb +4 -0
  11. data/app/controllers/blogg/posts_controller.rb +87 -0
  12. data/app/helpers/blogg/application_helper.rb +4 -0
  13. data/app/helpers/blogg/posts_helper.rb +4 -0
  14. data/app/models/blogg/post.rb +5 -0
  15. data/app/views/blogg/posts/_form.html.erb +25 -0
  16. data/app/views/blogg/posts/edit.html.erb +6 -0
  17. data/app/views/blogg/posts/index.html.erb +25 -0
  18. data/app/views/blogg/posts/new.html.erb +5 -0
  19. data/app/views/blogg/posts/show.html.erb +15 -0
  20. data/app/views/layouts/blogg/application.html.erb +14 -0
  21. data/config/routes.rb +4 -0
  22. data/db/migrate/20151127152905_create_blogg_posts.rb +10 -0
  23. data/lib/blogg/engine.rb +5 -0
  24. data/lib/blogg/version.rb +3 -0
  25. data/lib/blogg.rb +4 -0
  26. data/lib/tasks/blogg_tasks.rake +4 -0
  27. data/test/blogg_test.rb +7 -0
  28. data/test/dummy/README.rdoc +261 -0
  29. data/test/dummy/Rakefile +7 -0
  30. data/test/dummy/app/assets/javascripts/application.js +15 -0
  31. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  32. data/test/dummy/app/controllers/application_controller.rb +3 -0
  33. data/test/dummy/app/helpers/application_helper.rb +2 -0
  34. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  35. data/test/dummy/config/application.rb +59 -0
  36. data/test/dummy/config/boot.rb +10 -0
  37. data/test/dummy/config/database.yml +25 -0
  38. data/test/dummy/config/environment.rb +5 -0
  39. data/test/dummy/config/environments/development.rb +37 -0
  40. data/test/dummy/config/environments/production.rb +67 -0
  41. data/test/dummy/config/environments/test.rb +37 -0
  42. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  43. data/test/dummy/config/initializers/inflections.rb +15 -0
  44. data/test/dummy/config/initializers/mime_types.rb +5 -0
  45. data/test/dummy/config/initializers/secret_token.rb +7 -0
  46. data/test/dummy/config/initializers/session_store.rb +8 -0
  47. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  48. data/test/dummy/config/locales/en.yml +5 -0
  49. data/test/dummy/config/routes.rb +4 -0
  50. data/test/dummy/config.ru +4 -0
  51. data/test/dummy/db/development.sqlite3 +0 -0
  52. data/test/dummy/db/schema.rb +16 -0
  53. data/test/dummy/log/development.log +5 -0
  54. data/test/dummy/public/404.html +26 -0
  55. data/test/dummy/public/422.html +26 -0
  56. data/test/dummy/public/500.html +25 -0
  57. data/test/dummy/public/favicon.ico +0 -0
  58. data/test/dummy/script/rails +6 -0
  59. data/test/fixtures/blogg/posts.yml +9 -0
  60. data/test/functional/blogg/posts_controller_test.rb +51 -0
  61. data/test/integration/navigation_test.rb +10 -0
  62. data/test/test_helper.rb +15 -0
  63. data/test/unit/blogg/post_test.rb +9 -0
  64. data/test/unit/helpers/blogg/posts_helper_test.rb +6 -0
  65. metadata +179 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MDZmZDQ5MjQzYmY2YzI5MGNlMjc4YjMxZjZhODIyMjlkNDkzNzc5Mw==
5
+ data.tar.gz: !binary |-
6
+ YWU4MTdlNmRjZWZjZDEyMjk0MDc5OTYxNTZhODA4NjFiMmE3OWY1Mw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YjI0OTJhYWZjYTA2OTk4OGNkYTg0ODM3MWRiOGVlYWQ4OWNlZDJiMjA5MmY4
10
+ NzE2Yjg5MjU4MGQzZmQ3OTFmY2IxNDQ0MGJmODE5ZDYxY2JmNWY0OTU2Zjdk
11
+ NDZiNWNjN2FiYTgyYTAzYTFmOGM1YTczMjQ3NjkzZTUxNWIwOTQ=
12
+ data.tar.gz: !binary |-
13
+ YWRiMmFmOGMzYzViNDdkY2Y1ZDE4ZjJhNzViZDMzOTI2YWEwZTVjNmMxM2Iz
14
+ NjM1MWE1OGUzODU0NTFhZmE5YTliZTZkMzgwNDM1Y2U0ZWU4NmM4OTAzMmI4
15
+ NmZjMzg2NTZkYTJiODU5OTlmYTE0NjZmN2RlMDQyYmExOGQ1YzQ=
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2015 YOURNAME
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.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = Blogg
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Blogg'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
30
+ require 'rake/testtask'
31
+
32
+ Rake::TestTask.new(:test) do |t|
33
+ t.libs << 'lib'
34
+ t.libs << 'test'
35
+ t.pattern = 'test/**/*_test.rb'
36
+ t.verbose = false
37
+ end
38
+
39
+
40
+ task :default => :test
@@ -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 vendor/assets/javascripts of plugins, if any, 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
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,13 @@
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 vendor/assets/stylesheets of plugins, if any, 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 top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,56 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ div.field, div.actions {
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ #notice {
24
+ color: green;
25
+ }
26
+
27
+ .field_with_errors {
28
+ padding: 2px;
29
+ background-color: red;
30
+ display: table;
31
+ }
32
+
33
+ #error_explanation {
34
+ width: 450px;
35
+ border: 2px solid red;
36
+ padding: 7px;
37
+ padding-bottom: 0;
38
+ margin-bottom: 20px;
39
+ background-color: #f0f0f0;
40
+ }
41
+
42
+ #error_explanation h2 {
43
+ text-align: left;
44
+ font-weight: bold;
45
+ padding: 5px 5px 5px 15px;
46
+ font-size: 12px;
47
+ margin: -7px;
48
+ margin-bottom: 0px;
49
+ background-color: #c00;
50
+ color: #fff;
51
+ }
52
+
53
+ #error_explanation ul li {
54
+ font-size: 12px;
55
+ list-style: square;
56
+ }
@@ -0,0 +1,4 @@
1
+ module Blogg
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,87 @@
1
+ require_dependency "blogg/application_controller"
2
+
3
+ module Blogg
4
+ class PostsController < ApplicationController
5
+ # GET /posts
6
+ # GET /posts.json
7
+ def index
8
+ @posts = Post.all
9
+
10
+ respond_to do |format|
11
+ format.html # index.html.erb
12
+ format.json { render json: @posts }
13
+ end
14
+ end
15
+
16
+ # GET /posts/1
17
+ # GET /posts/1.json
18
+ def show
19
+ @post = Post.find(params[:id])
20
+
21
+ respond_to do |format|
22
+ format.html # show.html.erb
23
+ format.json { render json: @post }
24
+ end
25
+ end
26
+
27
+ # GET /posts/new
28
+ # GET /posts/new.json
29
+ def new
30
+ @post = Post.new
31
+
32
+ respond_to do |format|
33
+ format.html # new.html.erb
34
+ format.json { render json: @post }
35
+ end
36
+ end
37
+
38
+ # GET /posts/1/edit
39
+ def edit
40
+ @post = Post.find(params[:id])
41
+ end
42
+
43
+ # POST /posts
44
+ # POST /posts.json
45
+ def create
46
+ @post = Post.new(params[:post])
47
+
48
+ respond_to do |format|
49
+ if @post.save
50
+ format.html { redirect_to @post, notice: 'Post was successfully created.' }
51
+ format.json { render json: @post, status: :created, location: @post }
52
+ else
53
+ format.html { render action: "new" }
54
+ format.json { render json: @post.errors, status: :unprocessable_entity }
55
+ end
56
+ end
57
+ end
58
+
59
+ # PUT /posts/1
60
+ # PUT /posts/1.json
61
+ def update
62
+ @post = Post.find(params[:id])
63
+
64
+ respond_to do |format|
65
+ if @post.update_attributes(params[:post])
66
+ format.html { redirect_to @post, notice: 'Post was successfully updated.' }
67
+ format.json { head :no_content }
68
+ else
69
+ format.html { render action: "edit" }
70
+ format.json { render json: @post.errors, status: :unprocessable_entity }
71
+ end
72
+ end
73
+ end
74
+
75
+ # DELETE /posts/1
76
+ # DELETE /posts/1.json
77
+ def destroy
78
+ @post = Post.find(params[:id])
79
+ @post.destroy
80
+
81
+ respond_to do |format|
82
+ format.html { redirect_to posts_url }
83
+ format.json { head :no_content }
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,4 @@
1
+ module Blogg
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Blogg
2
+ module PostsHelper
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+ module Blogg
2
+ class Post < ActiveRecord::Base
3
+ attr_accessible :text, :title
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ <%= form_for(@post) do |f| %>
2
+ <% if @post.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @post.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :title %><br />
16
+ <%= f.text_field :title %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :text %><br />
20
+ <%= f.text_area :text %>
21
+ </div>
22
+ <div class="actions">
23
+ <%= f.submit %>
24
+ </div>
25
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing post</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @post %> |
6
+ <%= link_to 'Back', posts_path %>
@@ -0,0 +1,25 @@
1
+ <h1>Listing posts</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Title</th>
6
+ <th>Text</th>
7
+ <th></th>
8
+ <th></th>
9
+ <th></th>
10
+ </tr>
11
+
12
+ <% @posts.each do |post| %>
13
+ <tr>
14
+ <td><%= post.title %></td>
15
+ <td><%= post.text %></td>
16
+ <td><%= link_to 'Show', post %></td>
17
+ <td><%= link_to 'Edit', edit_post_path(post) %></td>
18
+ <td><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' } %></td>
19
+ </tr>
20
+ <% end %>
21
+ </table>
22
+
23
+ <br />
24
+
25
+ <%= link_to 'New Post', new_post_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New post</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', posts_path %>
@@ -0,0 +1,15 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Title:</b>
5
+ <%= @post.title %>
6
+ </p>
7
+
8
+ <p>
9
+ <b>Text:</b>
10
+ <%= @post.text %>
11
+ </p>
12
+
13
+
14
+ <%= link_to 'Edit', edit_post_path(@post) %> |
15
+ <%= link_to 'Back', posts_path %>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Blogg</title>
5
+ <%= stylesheet_link_tag "blogg/application", :media => "all" %>
6
+ <%= javascript_include_tag "blogg/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,4 @@
1
+ Blogg::Engine.routes.draw do
2
+ resources :posts
3
+ root :to => "posts#index"
4
+ end
@@ -0,0 +1,10 @@
1
+ class CreateBloggPosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :blogg_posts do |t|
4
+ t.string :title
5
+ t.text :text
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ module Blogg
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Blogg
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module Blogg
2
+ VERSION = "0.0.2"
3
+ end
data/lib/blogg.rb ADDED
@@ -0,0 +1,4 @@
1
+ require "blogg/engine"
2
+
3
+ module Blogg
4
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :blogg do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class BloggTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, Blogg
6
+ end
7
+ end