easycomments 1.0.1 → 1.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a75da80c881fc020f2f5bb5aadb4a2402669e9bf
4
- data.tar.gz: 17b46c901e56b0f9d950b746c807858d18f0c56c
3
+ metadata.gz: 6c4e7fb9a16243a48eee3be7cc2437dd33d4a262
4
+ data.tar.gz: d0835f6862727a41b739466ef5509b2d576184e0
5
5
  SHA512:
6
- metadata.gz: 79d4b7adc8a9148d2874fb0abf00cd6d2af6ceaa937230df218d38f4a997837b97a9a50a61c9ed6ac5c0397133abc8dc7a819709ed0f5de4337afaebb8d01351
7
- data.tar.gz: 54a4acaea68bc66e7ce58521e3a49c495bba55414e994b95a2009c3b9a652fa0758cc95dc37da024ddde2896c322403614af1c346e068a32d92791fa676cdf4a
6
+ metadata.gz: 2b0e68bea14ead823241412ef0d364f10b833f6b62f75609d9f657df6b7fd9fd80da52c7e963502adadc8d25f933c74802fb78ce1b8070a60f3af65a336e17be
7
+ data.tar.gz: 20aa83d33f54d3b1bc8646f2188e167867a1f574561e39033ea65a454a77d1aac3148e584801d6209ae45553e65385a5c43b053ef88f2bfd691105d6eb99bba2
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
- Gemfile.lock
1
+ Gemfile.lock
2
+ blog.db
data/Gemfile CHANGED
@@ -7,8 +7,3 @@ gem 'rack-contrib'
7
7
  gem 'sequel'
8
8
  gem 'rack-cors'
9
9
  gem 'bcrypt'
10
-
11
- group :test, :development do
12
- gem 'sqlite3'
13
- gem 'airborne'
14
- end
data/Gemfile.dev ADDED
@@ -0,0 +1,14 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'sinatra'
4
+ gem 'rack-protection'
5
+ gem 'multi_json'
6
+ gem 'rack-contrib'
7
+ gem 'sequel'
8
+ gem 'rack-cors'
9
+ gem 'bcrypt'
10
+
11
+ group :test, :development do
12
+ gem 'sqlite3'
13
+ gem 'airborne'
14
+ end
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
1
  # EasyComments
2
+ [![Gem Version](https://badge.fury.io/rb/easycomments.svg)](http://badge.fury.io/rb/easycomments)
3
+
2
4
  EasyComments(EC) is an easy to use comment system with a simple api
3
5
  for posting and retrieving comments.It also comes bundled with a dashboard
4
6
  for moderating your comments.
@@ -12,8 +14,12 @@ and then(if you installed the gem) in a directory run
12
14
  ```ruby
13
15
  ec install
14
16
  ```
15
- (pass the --dev flag if you also want the spec suite)
16
-
17
+ (pass the --dev flag if you also want the spec suite)
18
+ Then
19
+ ```ruby
20
+ bundle install
21
+ ```
22
+ and you are ready.
17
23
  ##Configuring
18
24
  Edit _config.yml and add your database (all adapters supported by sequel can be used)
19
25
  and change any other option you need.
@@ -67,7 +73,10 @@ timestamp_format: "%d/%m/%Y - %H:%M"
67
73
  allow_cors: false
68
74
 
69
75
  #see available formats here https://github.com/cyu/rack-cors
70
- cors_origin: "*"
76
+ cors_origin: "*"
77
+
78
+ #set to false to not automatically escape html in comment bodys
79
+ auto_escape_html: true
71
80
  ```
72
81
 
73
82
  ## Updating
@@ -81,6 +90,11 @@ It will recopy all the files but keeps your _config.yml and Gemfile.
81
90
  'rake adduser' you should always run this and not adding new users in _config.yml
82
91
  by hand since it also bcypts your passwords!
83
92
 
93
+ ##TODO:
94
+ * pagination in GET /comments
95
+ * markdown support
96
+ * dynamic fields in POST /comment
97
+
84
98
  ## Contributing
85
99
  1. Fork it
86
100
  2. Create your feature branch (`git checkout -b my-new-feature`)
data/_config.yml CHANGED
@@ -3,8 +3,9 @@ connection: "sqlite://blog.db"
3
3
  approve_by_default: false
4
4
  allow_anonymous_post: false
5
5
  timestamp_format: "%d/%m/%Y - %H:%M"
6
- allow_cors: false
6
+ allow_cors: true
7
7
  cors_origin: "*"
8
+ auto_escape_html: true
8
9
  :users:
9
10
  #
10
11
  ##connection : database connection url to be passed to sequel's connect method.
@@ -22,6 +23,8 @@ cors_origin: "*"
22
23
  #
23
24
  ##cors_origin : see available formats here https://github.com/cyu/rack-cors
24
25
  #
26
+ ##auto_escape_html : automatically escape html in comment bodys
27
+ #
25
28
  ##users : do not edit this by hand use 'rake adduser' instead.
26
29
  #
27
30
  ##if you edit this file after 'rake init' use 'rake update' for the changes to take effect.
data/bin/ec CHANGED
@@ -5,7 +5,7 @@ require 'fileutils'
5
5
  local_path = File.expand_path("../../", __FILE__)
6
6
  users_path = Dir.pwd
7
7
 
8
- files = %w(ec.rb dashboard.rb config.ru _config.yml Rakefile Gemfile)
8
+ files = %w(ec.rb dashboard.rb config.ru _config.yml Rakefile Gemfile README.md LICENSE)
9
9
 
10
10
  def copy_files(local_path, users_path, files, dev=false)
11
11
  files.each do |filename|
@@ -17,6 +17,9 @@ def copy_files(local_path, users_path, files, dev=false)
17
17
  if dev
18
18
  FileUtils.cp_r local_path + "/spec", users_path, :verbose => true
19
19
  FileUtils.cp_r local_path + '/.rspec', users_path, :verbose => true
20
+ if ARGV[0] == 'install'
21
+ FileUtils.cp_r local_path + '/Gemfile.dev', users_path + "/Gemfile", :verbose => true
22
+ end
20
23
  end
21
24
  end
22
25
 
@@ -36,10 +39,10 @@ elsif ARGV[0] == 'update'
36
39
  copy_files(local_path, users_path, files)
37
40
  end
38
41
  puts "done!"
39
- end
40
-
41
- if ARGV[0] == '--help' || ARGV[0] == '-h' || ARGV[0].nil?
42
+ elsif ARGV[0] == '--help' || ARGV[0] == '-h' || ARGV[0].nil?
42
43
  puts 'ec install, copies all the required files in the current directory.'
43
44
  puts 'ec update, same as install but skips _config.yml and Gemfile.'
44
45
  puts 'pass the --dev flag to "ec install" or "ec update" to also copy the test suite.'
46
+ else
47
+ puts "Uknown command : #{ARGV[0]}, see ec --help for available commands."
45
48
  end
data/easycomments.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'easycomments'
3
- s.version = '1.0.1'
3
+ s.version = '1.0.2'
4
4
  s.date = '2015-03-30'
5
5
  s.summary = "Simple and easy to use comment system"
6
6
  s.description = <<EOF
@@ -12,9 +12,6 @@ EOF
12
12
  s.files = `git ls-files`.split("\n")
13
13
  s.executables << 'ec'
14
14
 
15
- s.add_development_dependency 'airborne', '~> 0.1', '>=0.1.15'
16
- s.add_development_dependency "rake", '~> 10.4', '>= 10.4.2'
17
-
18
15
  s.authors = ["Zisis Maras"]
19
16
  s.email = 'zisismaras@gmail.com'
20
17
  s.homepage = 'https://github.com/zisismaras/easycomments'
@@ -13,6 +13,7 @@ module Configuration
13
13
  PASSWORD = CONFIG["password"]
14
14
  ALLOW_CORS = CONFIG["allow_cors"]
15
15
  CORS_ORIGIN = CONFIG["cors_origin"]
16
+ AUTO_ESCAPE_HTML = CONFIG["auto_escape_html"]
16
17
 
17
18
  #wall of help text to be added in _config.yml
18
19
  def comment_wall
@@ -33,6 +34,8 @@ comments = <<COMMENTS
33
34
  #
34
35
  ##cors_origin : see available formats here https://github.com/cyu/rack-cors
35
36
  #
37
+ ##auto_escape_html : automatically escape html in comment bodys
38
+ #
36
39
  ##users : do not edit this by hand use 'rake adduser' instead.
37
40
  #
38
41
  ##if you edit this file after 'rake init' use 'rake update' for the changes to take effect.
@@ -35,7 +35,7 @@ module ECModel
35
35
  end
36
36
 
37
37
  def save_comment(comment)
38
- comment = escape_comment(comment)
38
+ comment = escape_comment(comment) if AUTO_ESCAPE_HTML
39
39
  DB[:comments].insert(:post => comment[:post],
40
40
  :name => comment[:name],
41
41
  :email => comment[:email],
data/lib/easycomments.rb CHANGED
@@ -7,7 +7,7 @@ require 'rack/protection'
7
7
  require 'bcrypt'
8
8
  require_relative "easycomments/ec_configuration.rb"
9
9
 
10
- VERSION = "1.0.1"
10
+ VERSION = "1.0.2"
11
11
 
12
12
  include Configuration
13
13
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easycomments
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zisis Maras
@@ -9,47 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2015-03-30 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: airborne
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '0.1'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 0.1.15
23
- type: :development
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '0.1'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 0.1.15
33
- - !ruby/object:Gem::Dependency
34
- name: rake
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '10.4'
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 10.4.2
43
- type: :development
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '10.4'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 10.4.2
12
+ dependencies: []
53
13
  description: |
54
14
  EasyComments(EC) is an easy to use comment system with a simple api
55
15
  for posting and retrieving comments.It also comes bundled with a dashboard
@@ -63,6 +23,7 @@ files:
63
23
  - ".gitignore"
64
24
  - ".rspec"
65
25
  - Gemfile
26
+ - Gemfile.dev
66
27
  - LICENSE
67
28
  - README.md
68
29
  - Rakefile