helply 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 96a605c791f58b4a509dc4e4de70ac4c87c06e52010234670d33854c7b84251d
4
+ data.tar.gz: f9da25d4f39f3a9ec00899f661b2de1396efef69981ad09994992156e18e641a
5
+ SHA512:
6
+ metadata.gz: 73964d3b6baaf738bc235b7cc73d754d3c835be770cf270bdfcd972e133843834c3ca8bc2395d01d377157bed36cbdbe580c9e21307a76b5d43862640e547f44
7
+ data.tar.gz: c7d1a2eb34116da2ab3336780a67bcc6a38cbdcb5dd81fc03f4c33a607bea7aa98c84893c5617d136c4c4b41b1de3bfc01567a1d186839abd843cc3c4473cd42
@@ -0,0 +1,20 @@
1
+ Copyright 2020 Kirill Shevchenko
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.
@@ -0,0 +1,31 @@
1
+ # Helply
2
+ Intercom-like helpdesk for Rails
3
+
4
+ ## Installation
5
+ Add this line to your application's `Gemfile` and then execute `bundle install`:
6
+
7
+ ```ruby
8
+ gem 'helply'
9
+ ```
10
+
11
+ Then copy helply migrations:
12
+
13
+ ```sh
14
+ rails helply:install:migrations
15
+ rails db:migrate
16
+ ```
17
+
18
+ ## Usage
19
+ Mount Engine:
20
+
21
+ `config/routes.rb`
22
+ ```ruby
23
+ Rails.application.routes.draw do
24
+ mount Helply::Engine => '/helpdesk'
25
+ end
26
+ ```
27
+
28
+ Look up on `/helpdesk` route.
29
+
30
+ ## License
31
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -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 = 'Helply'
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('./spec/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 << 'spec'
28
+ t.pattern = 'spec/**/*_test.rb'
29
+ t.verbose = false
30
+ end
31
+
32
+ task default: :test
@@ -0,0 +1 @@
1
+ //= link_directory ../stylesheets/helply .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 Helply
2
+ class ApplicationController < ActionController::Base
3
+ protect_from_forgery with: :exception
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ require_dependency 'helply/application_controller'
2
+
3
+ module Helply
4
+ class ArticlesController < ApplicationController
5
+ def show
6
+ @article = Helply::Article.find_by(id: params[:id])
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ require_dependency 'helply/application_controller'
2
+
3
+ module Helply
4
+ class CollectionsController < ApplicationController
5
+ def index
6
+ @collections = Helply::Collection.index_list
7
+ end
8
+
9
+ def show
10
+ @collection = Helply::Collection.with_articles(params[:id])
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,4 @@
1
+ module Helply
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Helply
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module Helply
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: 'from@example.com'
4
+ layout 'mailer'
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Helply
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ module Helply
2
+ class Article < ApplicationRecord
3
+ belongs_to :collection
4
+
5
+ validates :title, :subtitle, :content, presence: true
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ module Helply
2
+ class Collection < ApplicationRecord
3
+ has_many :articles
4
+
5
+ scope :index_list, -> { select(:id, :title, :description) }
6
+ scope :with_articles, ->(id) { where(id: id).includes(:articles).last }
7
+
8
+ validates :title, :description, presence: true
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ Article:
2
+
3
+ <div>
4
+ <%= @article.title %>
5
+ <%= @article.subtitle %>
6
+ <%= @article.content%>
7
+ </div>
@@ -0,0 +1,11 @@
1
+ <h1>Helply</h1>
2
+ <h2>Collections:<h2>
3
+
4
+ <% @collections.each do |collection| %>
5
+ <div>
6
+ <p>
7
+ <%= link_to collection.title, collection_path(collection) %>
8
+ <%= collection.description %>
9
+ <p>
10
+ <div>
11
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <h1>
2
+ <%= @collection.title %>
3
+ </h1>
4
+ <h3>
5
+ <%= @collection.description %>
6
+ </h3>
7
+
8
+ Articles:
9
+
10
+ <% @collection.articles.each do |article| %>
11
+ <div>
12
+ <%= link_to article.title, article_path(article) %>
13
+ <%= article.subtitle %>
14
+ </div>
15
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Helply</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag "application", media: "all" %>
9
+ </head>
10
+ <body>
11
+
12
+ <%= yield %>
13
+
14
+ </body>
15
+ </html>
@@ -0,0 +1,6 @@
1
+ Helply::Engine.routes.draw do
2
+ root 'collections#index'
3
+
4
+ resources :collections, only: %w[show]
5
+ resources :articles, only: %w[show]
6
+ end
@@ -0,0 +1,10 @@
1
+ class CreateHelplyCollections < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :helply_collections do |t|
4
+ t.string :title, null: false
5
+ t.string :description, null: false
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ class CreateHelplyArticles < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :helply_articles do |t|
4
+ t.string :title, null: false
5
+ t.string :subtitle, null: false
6
+ t.text :content, null: false
7
+
8
+ t.references :collection
9
+
10
+ t.timestamps
11
+ end
12
+
13
+ add_foreign_key :helply_articles, :helply_collections, column: :collection_id
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ require 'helply/engine'
2
+
3
+ module Helply
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,18 @@
1
+ begin
2
+ require 'factory_bot_rails'
3
+ rescue LoadError
4
+ end
5
+
6
+ module Helply
7
+ class Engine < ::Rails::Engine
8
+ isolate_namespace Helply
9
+
10
+ config.generators do |g|
11
+ g.test_framework :rspec
12
+ end
13
+
14
+ if defined?(FactoryBotRails)
15
+ config.factory_bot.definition_file_paths += [File.expand_path('../factories', __FILE__)]
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ module Helply
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :helply do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,208 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: helply
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Kirill Shevchenko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-03-22 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: '5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">"
25
+ - !ruby/object:Gem::Version
26
+ version: '5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 4.0.0.beta3
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 4.0.0.beta3
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: faker
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: shoulda-matchers
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: factory_bot_rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: byebug
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: capybara
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: capybara-selenium
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description: Intercom-like Helpdesk for Rails apps
154
+ email:
155
+ - hello@kirillshevch.com
156
+ executables: []
157
+ extensions: []
158
+ extra_rdoc_files: []
159
+ files:
160
+ - MIT-LICENSE
161
+ - README.md
162
+ - Rakefile
163
+ - app/assets/config/helply_manifest.js
164
+ - app/assets/stylesheets/helply/application.css
165
+ - app/controllers/helply/application_controller.rb
166
+ - app/controllers/helply/articles_controller.rb
167
+ - app/controllers/helply/collections_controller.rb
168
+ - app/helpers/helply/application_helper.rb
169
+ - app/jobs/helply/application_job.rb
170
+ - app/mailers/helply/application_mailer.rb
171
+ - app/models/helply/application_record.rb
172
+ - app/models/helply/article.rb
173
+ - app/models/helply/collection.rb
174
+ - app/views/helply/articles/show.html.erb
175
+ - app/views/helply/collections/index.html.erb
176
+ - app/views/helply/collections/show.html.erb
177
+ - app/views/layouts/helply/application.html.erb
178
+ - config/routes.rb
179
+ - db/migrate/20200305125915_create_helply_collections.rb
180
+ - db/migrate/20200305125925_create_helply_articles.rb
181
+ - lib/helply.rb
182
+ - lib/helply/engine.rb
183
+ - lib/helply/version.rb
184
+ - lib/tasks/helply_tasks.rake
185
+ homepage: https://github.com/kirillshevch/helply
186
+ licenses:
187
+ - MIT
188
+ metadata: {}
189
+ post_install_message:
190
+ rdoc_options: []
191
+ require_paths:
192
+ - lib
193
+ required_ruby_version: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ required_rubygems_version: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ version: '0'
203
+ requirements: []
204
+ rubygems_version: 3.0.6
205
+ signing_key:
206
+ specification_version: 4
207
+ summary: Intercom-like Helpdesk for Rails apps
208
+ test_files: []