easycomments 1.0.4 → 1.0.5
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 +4 -4
- data/.editorconfig +18 -0
- data/.travis.yml +2 -2
- data/README.md +2 -1
- data/_config.yml +2 -1
- data/easycomments.gemspec +4 -3
- data/lib/easycomments.rb +1 -1
- data/lib/easycomments/ec_configuration.rb +47 -30
- data/spec/ec/ec_utils_spec.rb +34 -0
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1dcc9d3104da94075bb4659a6a8f1a307f001e90
|
|
4
|
+
data.tar.gz: c61f97f06e4fd639b2115c8479cf90e393872b09
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8837509b3294dcc74b2e27d98f431b70b3c972ade6542a96bcdb1775312a4f999cee5a380a31549f84ecc19ffe8364c2118221c14c608ba989130c113cdcd7bf
|
|
7
|
+
data.tar.gz: da0767ab75667a0c0db7ee0be3a3a716a482a89acb267099e43b792c9eb46ae2834e654d6de75b03a3098d4bcafb32e318bbf2326e7acd8094b6fb9a3078c707
|
data/.editorconfig
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# EditorConfig helps developers define and maintain consistent
|
|
2
|
+
# coding styles between different editors and IDEs
|
|
3
|
+
# editorconfig.org
|
|
4
|
+
|
|
5
|
+
root = true
|
|
6
|
+
|
|
7
|
+
[*]
|
|
8
|
+
|
|
9
|
+
indent_style = space
|
|
10
|
+
indent_size = 2
|
|
11
|
+
|
|
12
|
+
end_of_line = lf
|
|
13
|
+
charset = utf-8
|
|
14
|
+
trim_trailing_whitespace = true
|
|
15
|
+
insert_final_newline = true
|
|
16
|
+
|
|
17
|
+
[*.md]
|
|
18
|
+
trim_trailing_whitespace = false
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
|
@@ -62,6 +62,7 @@ in _config.yml you can change the following
|
|
|
62
62
|
#database connection url to be passed to sequel's connect method.
|
|
63
63
|
#check http://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html
|
|
64
64
|
#all adapters supported by sequel can be used
|
|
65
|
+
#you can also use an enviroment variable formatted as ENV["variable"] or just "variable" holding your db's url
|
|
65
66
|
connection: "sqlite://blog.db"
|
|
66
67
|
|
|
67
68
|
#set to true to allow all coments to be posted without moderation.
|
|
@@ -113,7 +114,7 @@ by hand since it also bcrypts your passwords!
|
|
|
113
114
|
5. Create new Pull Request
|
|
114
115
|
|
|
115
116
|
###Tested with
|
|
116
|
-
* Ruby 2.2.
|
|
117
|
+
* Ruby 2.2.2
|
|
117
118
|
* Ruby 2.1.5
|
|
118
119
|
* Ruby 2.0.0
|
|
119
120
|
|
data/_config.yml
CHANGED
|
@@ -12,6 +12,7 @@ comments_per_page: 10
|
|
|
12
12
|
##connection : database connection url to be passed to sequel's connect method.
|
|
13
13
|
##check http://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html
|
|
14
14
|
##all adapters supported by sequel can be used
|
|
15
|
+
##you can also use an enviroment variable formatted as ENV["variable"] or just "variable" holding your db's url
|
|
15
16
|
#
|
|
16
17
|
##approve_by_default : set to true to allow all coments to be posted without moderation.
|
|
17
18
|
#
|
|
@@ -24,7 +25,7 @@ comments_per_page: 10
|
|
|
24
25
|
#
|
|
25
26
|
##cors_origin : see available formats here https://github.com/cyu/rack-cors
|
|
26
27
|
#
|
|
27
|
-
##auto_escape_html : automatically escape html in comment
|
|
28
|
+
##auto_escape_html : automatically escape html in comment bodies
|
|
28
29
|
#
|
|
29
30
|
##paginate : set to true to have pagination support in comment retrieval
|
|
30
31
|
#
|
data/easycomments.gemspec
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'easycomments'
|
|
3
|
-
s.version = '1.0.
|
|
4
|
-
s.date = '2015-04-
|
|
3
|
+
s.version = '1.0.5'
|
|
4
|
+
s.date = '2015-04-24'
|
|
5
|
+
s.required_ruby_version = '>= 2.0.0'
|
|
5
6
|
s.summary = "Simple and easy to use comment system"
|
|
6
7
|
s.description = <<EOF
|
|
7
8
|
EasyComments(EC) is an easy to use comment system with a simple api
|
|
@@ -16,4 +17,4 @@ EOF
|
|
|
16
17
|
s.email = 'zisismaras@gmail.com'
|
|
17
18
|
s.homepage = 'https://github.com/zisismaras/easycomments'
|
|
18
19
|
s.license = 'MIT'
|
|
19
|
-
end
|
|
20
|
+
end
|
data/lib/easycomments.rb
CHANGED
|
@@ -4,8 +4,24 @@ module Configuration
|
|
|
4
4
|
|
|
5
5
|
extend self
|
|
6
6
|
|
|
7
|
+
#allows enviroment variables to be used as a connection option
|
|
8
|
+
def check_env_var(var)
|
|
9
|
+
if var =~ /ENV\[(.*)/ || var !~ /(:+)|(\/+)/
|
|
10
|
+
env_var = var.sub("ENV[", "").sub("]","")
|
|
11
|
+
var_seq = []
|
|
12
|
+
env_var.split(//).each do |char|
|
|
13
|
+
if char =~ /[0-9a-zA-Z]/
|
|
14
|
+
var_seq.push(char)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
var = ENV[var_seq.join]
|
|
18
|
+
end
|
|
19
|
+
var
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
#configuration constants holding user options from _config.yml
|
|
7
23
|
CONFIG = YAML.load_file('_config.yml')
|
|
8
|
-
CONNECTION = CONFIG["connection"]
|
|
24
|
+
CONNECTION = check_env_var(CONFIG["connection"])
|
|
9
25
|
APPROVE_BY_DEFAULT = CONFIG["approve_by_default"]
|
|
10
26
|
ALLOW_ANONYMOUS_POST = CONFIG["allow_anonymous_post"]
|
|
11
27
|
TIMESTAMP_FORMAT = CONFIG["timestamp_format"]
|
|
@@ -17,35 +33,36 @@ module Configuration
|
|
|
17
33
|
PAGINATE = CONFIG["paginate"]
|
|
18
34
|
COMMENTS_PER_PAGE = CONFIG["comments_per_page"].to_i
|
|
19
35
|
|
|
20
|
-
#wall of help text to be added in _config.yml
|
|
36
|
+
#wall of help text to be added in _config.yml
|
|
21
37
|
def comment_wall
|
|
22
|
-
comments =
|
|
23
|
-
#
|
|
24
|
-
##connection : database connection url to be passed to sequel's connect method.
|
|
25
|
-
##check http://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html
|
|
26
|
-
##all adapters supported by sequel can be used
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
##
|
|
34
|
-
#
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
comments = <<-COMMENTS
|
|
39
|
+
#
|
|
40
|
+
##connection : database connection url to be passed to sequel's connect method.
|
|
41
|
+
##check http://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html
|
|
42
|
+
##all adapters supported by sequel can be used
|
|
43
|
+
##you can also use an enviroment variable formatted as ENV["variable"] or just "variable" holding your db's url
|
|
44
|
+
#
|
|
45
|
+
##approve_by_default : set to true to allow all coments to be posted without moderation.
|
|
46
|
+
#
|
|
47
|
+
##allow_anonymous_post : set to true to allow comments without a name.
|
|
48
|
+
#
|
|
49
|
+
##timestamp_format : datetime format to be passed to strftime.
|
|
50
|
+
##see availabe options here http://ruby-doc.org/core-2.2.1/Time.html#method-i-strftime
|
|
51
|
+
#
|
|
52
|
+
##allow_cors : set to true to enable cross-origin resource sharing.
|
|
53
|
+
#
|
|
54
|
+
##cors_origin : see available formats here https://github.com/cyu/rack-cors
|
|
55
|
+
#
|
|
56
|
+
##auto_escape_html : automatically escape html in comment bodies
|
|
57
|
+
#
|
|
58
|
+
##paginate : set to true to have pagination support in comment retrieval
|
|
59
|
+
#
|
|
60
|
+
##comments_per_page : how many comments to return per page if paginate is true
|
|
61
|
+
#
|
|
62
|
+
##users : do not edit this by hand use 'rake adduser' instead.
|
|
63
|
+
#
|
|
64
|
+
##if you edit this file after 'rake init' use 'rake update' for the changes to take effect.
|
|
65
|
+
#
|
|
66
|
+
COMMENTS
|
|
50
67
|
end
|
|
51
68
|
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require_relative '../spec_helper.rb'
|
|
2
|
+
|
|
3
|
+
RSpec.configure do |config|
|
|
4
|
+
config.before(:all){
|
|
5
|
+
#set an example env variable
|
|
6
|
+
ENV["MYDB"] = "sqlite://blog.db"
|
|
7
|
+
}
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe "allow enviroment variables as a connection option" do
|
|
11
|
+
let(:conn_url) { "sqlite://blog.db" }
|
|
12
|
+
context "with ENV[]" do
|
|
13
|
+
context "with quotes" do
|
|
14
|
+
it "returns the corrent connection url" do
|
|
15
|
+
expect(Configuration::check_env_var("ENV[\"MYDB\"]")).to be == conn_url
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
context "without quotes" do
|
|
19
|
+
it "returns the corrent connection url" do
|
|
20
|
+
expect(Configuration::check_env_var("ENV[MYDB]")).to be == conn_url
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
context "without ENV[]" do
|
|
25
|
+
it "returns the corrent connection url" do
|
|
26
|
+
expect(Configuration::check_env_var("MYDB")).to be == conn_url
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
context "normal URL" do
|
|
30
|
+
it "returns the corrent connection url" do
|
|
31
|
+
expect(Configuration::check_env_var(conn_url)).to be == conn_url
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: easycomments
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Zisis Maras
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-04-
|
|
11
|
+
date: 2015-04-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |
|
|
14
14
|
EasyComments(EC) is an easy to use comment system with a simple api
|
|
@@ -20,6 +20,7 @@ executables:
|
|
|
20
20
|
extensions: []
|
|
21
21
|
extra_rdoc_files: []
|
|
22
22
|
files:
|
|
23
|
+
- ".editorconfig"
|
|
23
24
|
- ".gitignore"
|
|
24
25
|
- ".rspec"
|
|
25
26
|
- ".travis.yml"
|
|
@@ -398,6 +399,7 @@ files:
|
|
|
398
399
|
- public/polymer-loader.vulcanized.html
|
|
399
400
|
- spec/ec/ec_dashboard_spec.rb
|
|
400
401
|
- spec/ec/ec_spec.rb
|
|
402
|
+
- spec/ec/ec_utils_spec.rb
|
|
401
403
|
- spec/spec_helper.rb
|
|
402
404
|
- views/index.html
|
|
403
405
|
homepage: https://github.com/zisismaras/easycomments
|
|
@@ -412,7 +414,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
412
414
|
requirements:
|
|
413
415
|
- - ">="
|
|
414
416
|
- !ruby/object:Gem::Version
|
|
415
|
-
version:
|
|
417
|
+
version: 2.0.0
|
|
416
418
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
417
419
|
requirements:
|
|
418
420
|
- - ">="
|