abraham 2.3.0.beta → 2.4.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6e2b0fdbb25af11f86da525702df7f8c2d9464367eb54498293eca7241f84eb
|
4
|
+
data.tar.gz: 22ef247ce7aafbd7a3ca924e2276e1b4e72177e88a8220918f642f98d299de41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32d4be8a289fba23b74c39c6179167835f74951f70e4744b5bf1a15bc88d0c4583d8027469e09b98e4789ebdbca59b7565a9f634d167a86941414255916ee7c5
|
7
|
+
data.tar.gz: 2daafd2638b951436faf4b904ecf4aeb57c73034a3783debc77337b67de3dc7bd3ec037f2c4e31e05d08e7a6cc56e3959ac9a6eb6ea534306a18a944535b4fa3
|
data/README.md
CHANGED
@@ -78,12 +78,15 @@ Tell Abraham where to insert its generated JavaScript in `app/views/layouts/appl
|
|
78
78
|
|
79
79
|
## Defining your tours
|
80
80
|
|
81
|
-
Define your tours in the `config/tours` directory corresponding to the views defined in your application. Its directory structure mirrors your application's controllers, and the tour files mirror your actions/views.
|
81
|
+
Define your tours in the `config/tours` directory corresponding to the views defined in your application. Its directory structure mirrors your application's controllers, and the tour files mirror your actions/views. (As of version 2.4.0, Abraham respects controllers organized into modules.)
|
82
82
|
|
83
83
|
```
|
84
84
|
config/
|
85
85
|
└── tours/
|
86
|
-
|
86
|
+
├── admin/
|
87
|
+
│ └── articles/
|
88
|
+
│ └── edit.en.yml
|
89
|
+
├── blog/
|
87
90
|
│ ├── show.en.yml
|
88
91
|
│ └── show.es.yml
|
89
92
|
└── articles/
|
@@ -147,7 +150,8 @@ Abraham tries to be helpful when your tour steps attach to page elements that ar
|
|
147
150
|
|
148
151
|
### Automatic vs. manual tours
|
149
152
|
|
150
|
-
By default, Abraham will automatically start a tour that the current user hasn't seen yet.
|
153
|
+
By default, Abraham will automatically start a tour that the current user hasn't seen yet.
|
154
|
+
You can instead define a tour to be triggered manually using the `trigger` option:
|
151
155
|
|
152
156
|
```yml
|
153
157
|
walkthrough:
|
@@ -193,7 +197,18 @@ end
|
|
193
197
|
|
194
198
|
We provide a [small example app](https://github.com/actmd/abraham-example) that implements Abraham, so you can see it in action.
|
195
199
|
|
196
|
-
## Upgrading
|
200
|
+
## Upgrading
|
201
|
+
|
202
|
+
### From version 2.3.0 or earlier
|
203
|
+
|
204
|
+
Abraham 2.4.0 introduced an updated initializer that supports controllers organized into modules.
|
205
|
+
Rerun the generator with these options to replace the old initializer:
|
206
|
+
|
207
|
+
```
|
208
|
+
$ rails generate abraham:install --skip-migration --skip-config
|
209
|
+
```
|
210
|
+
|
211
|
+
### From version 1
|
197
212
|
|
198
213
|
Abraham v1 was built using Shepherd 1.8, v2 now uses Shepherd 6 – quite a jump, yes.
|
199
214
|
|
@@ -249,7 +264,7 @@ gem 'abraham', path: '~/Workspace/abraham'
|
|
249
264
|
|
250
265
|
#### Automated testing
|
251
266
|
|
252
|
-
We use
|
267
|
+
We use GitHub Actions to automatically test this engine with Rails 5.2, 6.0, and 6.1.
|
253
268
|
|
254
269
|
### Releasing
|
255
270
|
|
@@ -3,15 +3,15 @@
|
|
3
3
|
module AbrahamHelper
|
4
4
|
def abraham_tour
|
5
5
|
# Do we have tours for this controller/action in the user's locale?
|
6
|
-
tours = Rails.configuration.abraham.tours["#{
|
6
|
+
tours = Rails.configuration.abraham.tours["#{controller_path}.#{action_name}.#{I18n.locale}"]
|
7
7
|
# Otherwise, default to the default locale
|
8
|
-
tours ||= Rails.configuration.abraham.tours["#{
|
8
|
+
tours ||= Rails.configuration.abraham.tours["#{controller_path}.#{action_name}.#{I18n.default_locale}"]
|
9
9
|
|
10
10
|
if tours
|
11
11
|
# Have any automatic tours been completed already?
|
12
12
|
completed = AbrahamHistory.where(
|
13
13
|
creator_id: current_user.id,
|
14
|
-
controller_name:
|
14
|
+
controller_name: controller_path,
|
15
15
|
action_name: action_name
|
16
16
|
)
|
17
17
|
|
@@ -33,7 +33,7 @@ module AbrahamHelper
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def abraham_cookie_prefix
|
36
|
-
"abraham-#{fetch_application_name.to_s.underscore}-#{current_user.id}-#{
|
36
|
+
"abraham-#{fetch_application_name.to_s.underscore}-#{current_user.id}-#{controller_path}-#{action_name}"
|
37
37
|
end
|
38
38
|
|
39
39
|
def fetch_application_name
|
@@ -44,7 +44,6 @@ module AbrahamHelper
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
47
|
def abraham_domain
|
49
48
|
request.host
|
50
49
|
end
|
@@ -9,7 +9,7 @@
|
|
9
9
|
headers: { 'Content-Type': 'application/json' },
|
10
10
|
body: JSON.stringify({
|
11
11
|
authenticity_token: '<%= form_authenticity_token %>',
|
12
|
-
controller_name: '<%=
|
12
|
+
controller_name: '<%= controller_path %>',
|
13
13
|
action_name: '<%= action_name %>',
|
14
14
|
tour_name: '<%= tour_name %>'
|
15
15
|
})
|
data/lib/abraham/version.rb
CHANGED
@@ -10,6 +10,7 @@ module Abraham
|
|
10
10
|
|
11
11
|
class_option :'skip-migration', type: :boolean, desc: "Don't generate a migration for the histories table"
|
12
12
|
class_option :'skip-initializer', type: :boolean, desc: "Don't generate an initializer"
|
13
|
+
class_option :'skip-config', type: :boolean, desc: "Don't generate a config file"
|
13
14
|
|
14
15
|
source_root File.expand_path(File.join(File.dirname(__FILE__), "templates"))
|
15
16
|
|
@@ -24,6 +25,11 @@ module Abraham
|
|
24
25
|
return if options["skip-initializer"]
|
25
26
|
|
26
27
|
copy_file "initializer.rb", "config/initializers/abraham.rb"
|
28
|
+
end
|
29
|
+
|
30
|
+
def create_config
|
31
|
+
return if options["skip-config"]
|
32
|
+
|
27
33
|
copy_file "abraham.yml", "config/abraham.yml"
|
28
34
|
end
|
29
35
|
end
|
@@ -2,18 +2,18 @@
|
|
2
2
|
|
3
3
|
Rails.application.configure do
|
4
4
|
tours = {}
|
5
|
+
tours_root = Pathname.new(Rails.root.join("config/tours"))
|
5
6
|
|
6
|
-
if Rails.root.join(
|
7
|
-
Dir
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
7
|
+
if Rails.root.join("config/tours").exist?
|
8
|
+
Dir.glob(Rails.root.join("config/tours/**/*.yml")).each do |yml|
|
9
|
+
relative_filename = Pathname.new(yml).relative_path_from(tours_root)
|
10
|
+
# `controller_path` is either "controller_name" or "module_name/controller_name"
|
11
|
+
controller_path, filename = relative_filename.split
|
12
|
+
file_parts = filename.to_s.split(".")
|
13
|
+
action = file_parts[0]
|
14
|
+
locale = file_parts[1]
|
15
|
+
t = YAML.load_file(yml)
|
16
|
+
tours["#{controller_path}.#{action}.#{locale}"] = t
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abraham
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Abbett
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sassc-rails
|
@@ -126,9 +126,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: '0'
|
132
132
|
requirements: []
|
133
133
|
rubygems_version: 3.0.8
|
134
134
|
signing_key:
|