railspress 0.1.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 +7 -0
- data/README.md +28 -0
- data/Rakefile +18 -0
- data/app/assets/config/railspress_manifest.js +1 -0
- data/app/assets/stylesheets/railspress/application.css +15 -0
- data/app/controllers/railspress/application_controller.rb +4 -0
- data/app/helpers/railspress/application_helper.rb +4 -0
- data/app/jobs/railspress/application_job.rb +4 -0
- data/app/mailers/railspress/application_mailer.rb +6 -0
- data/app/models/railspress/application_record.rb +5 -0
- data/app/models/railspress/comment.rb +5 -0
- data/app/models/railspress/post.rb +10 -0
- data/app/models/railspress/vote.rb +6 -0
- data/app/views/layouts/railspress/application.html.erb +15 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20210618025918_create_railspress_posts.rb +10 -0
- data/db/migrate/20210618030739_create_railspress_votes.rb +10 -0
- data/db/migrate/20210618030817_create_railspress_comments.rb +10 -0
- data/lib/railspress/configuration.rb +38 -0
- data/lib/railspress/engine.rb +5 -0
- data/lib/railspress/version.rb +3 -0
- data/lib/railspress.rb +6 -0
- data/lib/tasks/railspress_tasks.rake +4 -0
- metadata +108 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 91da481a90115a5afc178573a7b7662a043599912b5e668c0aa8c3f82f3037fd
|
4
|
+
data.tar.gz: b889839e9190727ccd853fe439dcbad09e0eb448e4650f2ec5da29a05f702410
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '09ae7d91bd9ceadbba0bf5cde85b8792422d7b111d0b1147e9b0ba0dba9f14905ce9ac8ded0b5c6605f18260e24b8d2e2fa946e88ef29cda058af1c4237724e5'
|
7
|
+
data.tar.gz: aadc763d3f3539bf0694a4e6f9f40a1677f9e60f1dd0e7251801f8336693dd2466e2bbf6b832bf95d3c3e55b3a93031749809488f8df47a5f102a8ad5baab8aa
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Railspress
|
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 'railspress'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install railspress
|
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,18 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
|
3
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
4
|
+
load "rails/tasks/engine.rake"
|
5
|
+
|
6
|
+
load "rails/tasks/statistics.rake"
|
7
|
+
|
8
|
+
require "bundler/gem_tasks"
|
9
|
+
|
10
|
+
require "rake/testtask"
|
11
|
+
|
12
|
+
Rake::TestTask.new(:test) do |t|
|
13
|
+
t.libs << 'test'
|
14
|
+
t.pattern = 'test/**/*_test.rb'
|
15
|
+
t.verbose = false
|
16
|
+
end
|
17
|
+
|
18
|
+
task default: :test
|
@@ -0,0 +1 @@
|
|
1
|
+
//= link_directory ../stylesheets/railspress .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,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Railspress
|
4
|
+
class Post < ApplicationRecord
|
5
|
+
belongs_to :user, proc { readonly(true) }, class_name: Railspress.user_class.to_s, foreign_key: :user_id, optional: true
|
6
|
+
has_many :comments
|
7
|
+
|
8
|
+
validates :title, presence: true
|
9
|
+
end
|
10
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Railspress
|
4
|
+
include ActiveSupport::Configurable
|
5
|
+
|
6
|
+
config_accessor :validate_source_url, :comments_per_page, :posts_per_page,
|
7
|
+
:post_teaser_length, :share_this_key, :page_url
|
8
|
+
|
9
|
+
self.validate_source_url = false
|
10
|
+
self.comments_per_page = 10
|
11
|
+
self.posts_per_page = 10
|
12
|
+
self.post_teaser_length = 250
|
13
|
+
self.share_this_key = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
14
|
+
self.page_url = "/blog"
|
15
|
+
|
16
|
+
# Refinery::User isn't available when this line gets hit, so we use static methods instead
|
17
|
+
@@user_class_name = nil
|
18
|
+
class << self
|
19
|
+
def user_class=(class_name)
|
20
|
+
if class_name.is_a?(Class)
|
21
|
+
raise TypeError, "You can't set user_class to be a class, e.g., User. Instead, please use a string like 'User'"
|
22
|
+
elsif class_name.is_a?(String)
|
23
|
+
@@user_class_name = class_name
|
24
|
+
else
|
25
|
+
raise TypeError, "Invalid type for user_class. Please use a string like 'User'"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def user_class
|
30
|
+
class_name = @@user_class_name
|
31
|
+
begin
|
32
|
+
Object.const_get(class_name) if class_name.present?
|
33
|
+
rescue NameError
|
34
|
+
class_name.constantize
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/railspress.rb
ADDED
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: railspress
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pedro Souza
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-06-18 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.1.3
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 6.1.3.2
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 6.1.3
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 6.1.3.2
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: ransack
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '2.4'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 2.4.2
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '2.4'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.4.2
|
53
|
+
description: RailsPress is a Rails Engine that provide Blog features to your project
|
54
|
+
email:
|
55
|
+
- opedrosouza@hotmail.com
|
56
|
+
executables: []
|
57
|
+
extensions: []
|
58
|
+
extra_rdoc_files: []
|
59
|
+
files:
|
60
|
+
- README.md
|
61
|
+
- Rakefile
|
62
|
+
- app/assets/config/railspress_manifest.js
|
63
|
+
- app/assets/stylesheets/railspress/application.css
|
64
|
+
- app/controllers/railspress/application_controller.rb
|
65
|
+
- app/helpers/railspress/application_helper.rb
|
66
|
+
- app/jobs/railspress/application_job.rb
|
67
|
+
- app/mailers/railspress/application_mailer.rb
|
68
|
+
- app/models/railspress/application_record.rb
|
69
|
+
- app/models/railspress/comment.rb
|
70
|
+
- app/models/railspress/post.rb
|
71
|
+
- app/models/railspress/vote.rb
|
72
|
+
- app/views/layouts/railspress/application.html.erb
|
73
|
+
- config/routes.rb
|
74
|
+
- db/migrate/20210618025918_create_railspress_posts.rb
|
75
|
+
- db/migrate/20210618030739_create_railspress_votes.rb
|
76
|
+
- db/migrate/20210618030817_create_railspress_comments.rb
|
77
|
+
- lib/railspress.rb
|
78
|
+
- lib/railspress/configuration.rb
|
79
|
+
- lib/railspress/engine.rb
|
80
|
+
- lib/railspress/version.rb
|
81
|
+
- lib/tasks/railspress_tasks.rake
|
82
|
+
homepage: https://github.com/opedrosouza/railspress
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata:
|
86
|
+
homepage_uri: https://github.com/opedrosouza/railspress
|
87
|
+
source_code_uri: https://github.com/opedrosouza/railspress
|
88
|
+
changelog_uri: https://github.com/opedrosouza/railspress/CHANGELOG.md
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubygems_version: 3.1.6
|
105
|
+
signing_key:
|
106
|
+
specification_version: 4
|
107
|
+
summary: https://github.com/opedrosouza/railspress
|
108
|
+
test_files: []
|