shepherd-rails 0.0.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/MIT-LICENSE +20 -0
- data/README.md +53 -0
- data/Rakefile +16 -0
- data/app/assets/config/sr_manifest.js +1 -0
- data/app/assets/stylesheets/sr/application.css +15 -0
- data/app/controllers/shepherd_rails/application_controller.rb +4 -0
- data/app/controllers/shepherd_rails/tour_statuses_controller.rb +13 -0
- data/app/helpers/shepherd_rails/application_helper.rb +14 -0
- data/app/jobs/sr/application_job.rb +4 -0
- data/app/mailers/sr/application_mailer.rb +6 -0
- data/app/models/sr/application_record.rb +5 -0
- data/app/views/layouts/sr/application.html.erb +15 -0
- data/config/routes.rb +3 -0
- data/config/shepherd_rails_initializer.rb +4 -0
- data/lib/generators/shepherd_rails_generator.rb +8 -0
- data/lib/shepherd-rails/config.rb +6 -0
- data/lib/shepherd-rails/engine.rb +23 -0
- data/lib/shepherd-rails/version.rb +3 -0
- data/lib/shepherd-rails.rb +14 -0
- data/lib/tasks/shepherd_rails_tasks.rake +4 -0
- metadata +82 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3a728e7d696c667e4674bddb3bcc691c8be34662ff082f3c54621be6e43ada88
|
4
|
+
data.tar.gz: 6dfebbf1006baf525767deb3245517759f74e02191d7389a71696671d0ec1761
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e54bc3d14db62f7805ab1c155c2a2a1483400700c4d7e4b9ef4f75e2c5d3f3a2a8503eac0eea0988cfc294ba573ff8e29c7542df300f3f24220dd2cb6cf0db9e
|
7
|
+
data.tar.gz: 0b30ecac0b5b8b575f9757f06d6a65dd96110a3ca6a1c42812ac2c73978f8f6e1cc24aa9afe2931606bc359d794d545769ff42afe096d04151bc1fe822a3e2ba
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2023 Catalin Ionescu
|
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.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Shepherd-Rails
|
2
|
+
A modern wrapper for using [Shepherd.js](https://shepherdjs.dev/) with Ruby on Rails.
|
3
|
+
|
4
|
+
# Installation
|
5
|
+
|
6
|
+
### 1. Add this line to your application's Gemfile:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
gem "shepherd-rails"
|
10
|
+
```
|
11
|
+
|
12
|
+
### 2. Then execute:
|
13
|
+
```bash
|
14
|
+
$ bundle
|
15
|
+
```
|
16
|
+
|
17
|
+
### 1.1. Or install it yourself as:
|
18
|
+
```bash
|
19
|
+
$ gem install shepherd-rails
|
20
|
+
```
|
21
|
+
|
22
|
+
### 3. Generate an initializer with:
|
23
|
+
|
24
|
+
```bash
|
25
|
+
bundle exec rails generate shepherd_rails
|
26
|
+
```
|
27
|
+
|
28
|
+
### 4. Then you need to install the JavaScript package:
|
29
|
+
```bash
|
30
|
+
$ yarn add shepherd-rails
|
31
|
+
```
|
32
|
+
|
33
|
+
### 5. Import the stimulus controller to your controllers entry-point (eg: _app/javascript/controllers/index.js_):
|
34
|
+
```js
|
35
|
+
import ShepherdRails from "shepherd-rails"
|
36
|
+
application.register("shepherd-rails", ShepherdRails)
|
37
|
+
```
|
38
|
+
|
39
|
+
# Usage
|
40
|
+
|
41
|
+
ShepherdRails is a fairly opinionated way to use ShepherdJs. If you have suggestions/requests for alternative flows, feel free open an issue.
|
42
|
+
|
43
|
+
# Dependencies
|
44
|
+
- [Stimulus](https://stimulus.hotwired.dev/)
|
45
|
+
- [ShepherdJs](https://shepherdjs.dev/)
|
46
|
+
|
47
|
+
# 🙏🏻 Contributing
|
48
|
+
|
49
|
+
If you have an issue you'd like to submit, please do so using the issue tracker in GitHub. For us to help you in the best way possible, please be as detailed as you can.
|
50
|
+
|
51
|
+
# 📝 License
|
52
|
+
|
53
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
|
3
|
+
APP_RAKEFILE = File.expand_path('spec/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 'rspec/core'
|
11
|
+
require 'rspec/core/rake_task'
|
12
|
+
|
13
|
+
desc 'Run all specs in spec directory (excluding plugin specs)'
|
14
|
+
RSpec::Core::RakeTask.new(spec: 'app:db:test:prepare')
|
15
|
+
|
16
|
+
task default: :spec
|
@@ -0,0 +1 @@
|
|
1
|
+
//= link_directory ../stylesheets/sr .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,13 @@
|
|
1
|
+
module ShepherdRails
|
2
|
+
class TourStatusesController < ShepherdRails.configuration.base_controller.constantize
|
3
|
+
def create
|
4
|
+
tour_name = params.require(:tour)
|
5
|
+
case params.require(:event)
|
6
|
+
when 'complete'
|
7
|
+
ShepherdRails.configuration.on_tour_complete.call(self, tour_name)
|
8
|
+
end
|
9
|
+
|
10
|
+
head :ok
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ShepherdRails
|
4
|
+
module ApplicationHelper
|
5
|
+
def shepherd_tour tour:
|
6
|
+
tag.div nil, data: {
|
7
|
+
controller: 'shepherd-rails',
|
8
|
+
'shepherd-rails-tour-name-value' => tour,
|
9
|
+
'shepherd-rails-endpoint-value' => shepherd_rails.tour_statuses_path,
|
10
|
+
'shepherd-rails-config-value' => I18n.t(tour, scope: 'shepherd_rails')
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
class ShepherdRailsGenerator < Rails::Generators::Base
|
2
|
+
source_root File.expand_path('../..', __dir__)
|
3
|
+
|
4
|
+
desc 'Generate an initializer'
|
5
|
+
def create_initializer_file
|
6
|
+
copy_file 'config/shepherd_rails_initializer.rb', 'config/initializers/shepherd_rails.rb'
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ShepherdRails
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
isolate_namespace ShepherdRails
|
6
|
+
|
7
|
+
config.generators do |g|
|
8
|
+
g.test_framework :rspec
|
9
|
+
g.assets false
|
10
|
+
g.helper false
|
11
|
+
end
|
12
|
+
|
13
|
+
initializer 'shepherd_rails' do |app|
|
14
|
+
ActiveSupport.on_load :action_controller do
|
15
|
+
helper ShepherdRails::ApplicationHelper
|
16
|
+
end
|
17
|
+
|
18
|
+
app.routes.append do
|
19
|
+
mount ShepherdRails::Engine => '/shepherd-rails'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'shepherd-rails/version'
|
2
|
+
require 'shepherd-rails/engine'
|
3
|
+
require 'shepherd-rails/config'
|
4
|
+
|
5
|
+
module ShepherdRails
|
6
|
+
class << self
|
7
|
+
attr_accessor :configuration
|
8
|
+
|
9
|
+
def configure
|
10
|
+
self.configuration ||= Config.new
|
11
|
+
yield(configuration)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: shepherd-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Catalin Ionescu
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-03-15 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: 7.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 7.0.0
|
27
|
+
description: A modern wrapper for using Shepherd.js with Ruby on Rails
|
28
|
+
email:
|
29
|
+
- catalin.ionescu282@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- MIT-LICENSE
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- app/assets/config/sr_manifest.js
|
38
|
+
- app/assets/stylesheets/sr/application.css
|
39
|
+
- app/controllers/shepherd_rails/application_controller.rb
|
40
|
+
- app/controllers/shepherd_rails/tour_statuses_controller.rb
|
41
|
+
- app/helpers/shepherd_rails/application_helper.rb
|
42
|
+
- app/jobs/sr/application_job.rb
|
43
|
+
- app/mailers/sr/application_mailer.rb
|
44
|
+
- app/models/sr/application_record.rb
|
45
|
+
- app/views/layouts/sr/application.html.erb
|
46
|
+
- config/routes.rb
|
47
|
+
- config/shepherd_rails_initializer.rb
|
48
|
+
- lib/generators/shepherd_rails_generator.rb
|
49
|
+
- lib/shepherd-rails.rb
|
50
|
+
- lib/shepherd-rails/config.rb
|
51
|
+
- lib/shepherd-rails/engine.rb
|
52
|
+
- lib/shepherd-rails/version.rb
|
53
|
+
- lib/tasks/shepherd_rails_tasks.rake
|
54
|
+
homepage: https://github.com/cionescu/shepherd-rails
|
55
|
+
licenses:
|
56
|
+
- MIT
|
57
|
+
metadata:
|
58
|
+
allowed_push_host: https://rubygems.org
|
59
|
+
homepage_uri: https://github.com/cionescu/shepherd-rails
|
60
|
+
source_code_uri: https://github.com/cionescu/shepherd-rails
|
61
|
+
changelog_uri: https://github.com/cionescu/shepherd-rails
|
62
|
+
rubygems_mfa_required: 'true'
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 2.7.0
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubygems_version: 3.4.7
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: A modern wrapper for using Shepherd.js with Ruby on Rails
|
82
|
+
test_files: []
|