asker-tool 2.4.5 → 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -13
- data/lib/asker/ai/stages/stage_d.rb +18 -8
- data/lib/asker/exporter/output_file_exporter.rb +3 -5
- data/lib/asker/files/asker.ini +1 -0
- data/lib/asker/files/example-concept.haml +3 -3
- data/lib/asker/files/language/ca/templates.yaml +3 -3
- data/lib/asker/files/language/du/templates.yaml +3 -3
- data/lib/asker/files/language/en/templates.yaml +3 -3
- data/lib/asker/files/language/es/templates.yaml +3 -3
- data/lib/asker/files/language/fr/templates.yaml +3 -3
- data/lib/asker/loader/embedded_file.rb +106 -19
- data/lib/asker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecd775d21f7d85f15daa5307be5947fc9d36d22dccd8448bf477c885ea639758
|
4
|
+
data.tar.gz: d145bb6b6ae9af56a917f9c98ccd8f33e09b0e9640c93382854d20c733714bd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87f02c406e8a659bcad86e246982b1192aae902476939fb77e69f533fb648b7962054068a5084f06c0ac6f8cf8349bce8602e55f8e2f20d973f645801cbc6a09
|
7
|
+
data.tar.gz: b030b96ca377a1170961dbf1c6aa1026493756baea1e58a455e4bf454e13cb7af47a53f72807d66f2dbb8c0b93d12ff10881bda617897205f69fb0a977f83844
|
data/README.md
CHANGED
@@ -11,7 +11,6 @@ ASKER helps trainers to create a huge amount of questions, from a definitions (_
|
|
11
11
|
|
12
12
|
* Free Software [LICENSE](LICENSE).
|
13
13
|
* Multiplatform.
|
14
|
-
* [Ruby program](https://rubygems.org/gems/asker-tool)
|
15
14
|
|
16
15
|
## Installation
|
17
16
|
|
@@ -22,20 +21,14 @@ ASKER helps trainers to create a huge amount of questions, from a definitions (_
|
|
22
21
|
|
23
22
|
## Usage
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
1. Run _asker_ and get the results into `output` directory.
|
29
|
-
|
30
|
-
Example: Running `asker` with our example input file as argument (`acdc.haml`):
|
31
|
-
|
32
|
-
```
|
24
|
+
1. **Create input file** with your content (_conceptual map_). Examples at [Asker inputs folder](./docs/examples).
|
25
|
+
2. **Run `asker PATH/TO/INPUT`**. Example: Create questions from ACDC input example file:
|
26
|
+
```bash
|
33
27
|
asker docs/examples/bands/acdc.haml
|
34
28
|
```
|
29
|
+
3. Output files created into the `output` folder.
|
35
30
|
|
36
|
-
|
37
|
-
* More [example input files](./docs/examples).
|
38
|
-
* More asker input files at [github/dvarrui/asker-inputs](https://github.com/dvarrui/asker-inputs) repository.
|
31
|
+
> More input examples at [dvarrui/asker-input](https://github.com/dvarrui/asker-inputs) repository.
|
39
32
|
|
40
33
|
## Documentation
|
41
34
|
|
@@ -43,6 +36,7 @@ asker docs/examples/bands/acdc.haml
|
|
43
36
|
* [Videos](docs/videos.md)
|
44
37
|
* [Inputs](docs/inputs/README.md)
|
45
38
|
* [Usage](docs/usage.md)
|
39
|
+
* [Reference](docs/reference.md)
|
46
40
|
* [Contributions](docs/contributions.md)
|
47
41
|
* [Problem to solve](docs/idea.md)
|
48
42
|
* [History](docs/history.md)
|
@@ -50,4 +44,3 @@ asker docs/examples/bands/acdc.haml
|
|
50
44
|
## Contact
|
51
45
|
|
52
46
|
* **Email**: `teuton.software@protonmail.com`
|
53
|
-
* **Twitter**: `@SoftwareTeuton`
|
@@ -5,7 +5,8 @@ require 'set'
|
|
5
5
|
require_relative 'base_stage'
|
6
6
|
require_relative '../question'
|
7
7
|
|
8
|
-
|
8
|
+
##
|
9
|
+
# range d1-d4: d1choice, d1none-misspelled, d1none
|
9
10
|
class StageD < BaseStage
|
10
11
|
def run
|
11
12
|
# Stage D: process every definition, I mean every <def> tag
|
@@ -15,6 +16,7 @@ class StageD < BaseStage
|
|
15
16
|
lang = concept.lang
|
16
17
|
# for every <text> do this
|
17
18
|
concept.texts.each do |t|
|
19
|
+
# s => concept name, none and neighbors
|
18
20
|
s = Set.new [name(:raw), lang.text_for(:none)]
|
19
21
|
concept.neighbors.each { |n| s.add n[:concept].name(:decorated) }
|
20
22
|
a = s.to_a
|
@@ -81,13 +83,20 @@ class StageD < BaseStage
|
|
81
83
|
|
82
84
|
# Question choice => true
|
83
85
|
q = Question.new(:choice)
|
84
|
-
q.name = "#{name(:id)}-#{num}-d2true"
|
86
|
+
q.name = "#{name(:id)}-#{num}-d2true-misspelled"
|
85
87
|
q.text = random_image_for(name(:raw)) + lang.text_for(:d2, name(:raw), t)
|
86
88
|
q.good = lang.text_for(:true)
|
87
89
|
q.bads << lang.text_for(:misspelling)
|
88
90
|
q.bads << lang.text_for(:false)
|
89
91
|
questions << q
|
90
92
|
|
93
|
+
# Question boolean => true
|
94
|
+
q = Question.new(:boolean)
|
95
|
+
q.name = "#{name(:id)}-#{num}-d2true"
|
96
|
+
q.text = random_image_for(name(:raw)) + lang.text_for(:d2, name(:raw), t)
|
97
|
+
q.good = 'TRUE'
|
98
|
+
questions << q
|
99
|
+
|
91
100
|
# Question choice => false
|
92
101
|
if a.size > 1
|
93
102
|
q = Question.new(:choice)
|
@@ -97,6 +106,13 @@ class StageD < BaseStage
|
|
97
106
|
q.bads << lang.text_for(:misspelling)
|
98
107
|
q.bads << lang.text_for(:true)
|
99
108
|
questions << q
|
109
|
+
|
110
|
+
# Question boolean => false
|
111
|
+
q = Question.new(:boolean)
|
112
|
+
q.name = "#{name(:id)}-#{num}-d2false"
|
113
|
+
q.text = random_image_for(name(:raw)) + lang.text_for(:d2, a[1], t)
|
114
|
+
q.good = 'FALSE'
|
115
|
+
questions << q
|
100
116
|
end
|
101
117
|
|
102
118
|
# Question hidden name questions
|
@@ -130,10 +146,4 @@ class StageD < BaseStage
|
|
130
146
|
|
131
147
|
questions
|
132
148
|
end
|
133
|
-
# rubocop:enable Lint/BooleanSymbol
|
134
|
-
# rubocop:enable Metrics/MethodLength
|
135
|
-
# rubocop:enable Metrics/AbcSize
|
136
|
-
# rubocop:enable Metrics/BlockLength
|
137
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
138
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
139
149
|
end
|
@@ -3,11 +3,9 @@ require_relative 'concept_doc_exporter'
|
|
3
3
|
require_relative 'data_gift_exporter'
|
4
4
|
require_relative 'data_moodle_exporter'
|
5
5
|
|
6
|
-
|
7
|
-
#
|
8
|
-
# * YAML
|
9
|
-
# * Doc (txt)
|
10
|
-
# * Moodle XML (ConceptAI, Code)
|
6
|
+
##
|
7
|
+
# Export Output data files
|
8
|
+
# * YAML, Doc (txt), Gift (ConceptAI, Code) and Moodle XML (ConceptAI, Code)
|
11
9
|
module OutputFileExporter
|
12
10
|
def self.export(data, project)
|
13
11
|
config = Application.instance.config
|
data/lib/asker/files/asker.ini
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
%names AC/DC, ACDC
|
5
5
|
%tags rock, band, australia
|
6
6
|
%def Australian rock band formed by Scottish-born brothers Malcolm and Angus Young
|
7
|
-
%table{ fields: 'members'}
|
7
|
+
%table{ fields: 'members' }
|
8
8
|
%row Bon Scott
|
9
9
|
%row Angus Young
|
10
10
|
%row Malcolm Young
|
11
11
|
%row Phil Rudd
|
12
12
|
%row Cliff Williams
|
13
|
-
%table{ fields: 'attribute, value'}
|
13
|
+
%table{ fields: 'attribute, value' }
|
14
14
|
%row
|
15
15
|
%col Genres
|
16
16
|
%col Hard rock blues rock rock and roll
|
@@ -20,7 +20,7 @@
|
|
20
20
|
%row
|
21
21
|
%col Formed in
|
22
22
|
%col Sydney
|
23
|
-
%table{ fields: 'Albums', sequence: 'Albums sorted by date'}
|
23
|
+
%table{ fields: 'Albums', sequence: 'Albums sorted by date' }
|
24
24
|
%row Albums High Voltage
|
25
25
|
%row Powerage
|
26
26
|
%row Highway to Hell
|
@@ -12,9 +12,9 @@
|
|
12
12
|
:f1: 'Els seguents elements son "<%=text2%>" del concepte <b><%=text1%></b>:<ul><li><%=text3%></li></ul>'
|
13
13
|
:f2: "Els seguents elements son \"<%=text2%>\".<br/>Selecciona l'opció que no pertanyi al concepte <b><%=text1%></b>."
|
14
14
|
:f3: 'Els seguents elements son "<%=text2%>" del concepte <b><%=text1%></b>:<br><p><%=text3%></p>(Coloca cada paraula a la seva posició correcta dins el text)'
|
15
|
-
:i1: "<%=text1%><br/>Escull l'opció que millor es correspongui amb
|
16
|
-
:i2: '<%=text1%><br/>
|
17
|
-
:i3: "<%=text1%><br/>Escriu l'opció <%=text2%>, que millor correspongui amb
|
15
|
+
:i1: "<%=text1%><br/>Escull l'opció que millor es correspongui amb el fitxer anterior.<br/>"
|
16
|
+
:i2: '<%=text1%><br/>El fitxer anterior correspo a <b><%=text2%></b>.'
|
17
|
+
:i3: "<%=text1%><br/>Escriu l'opció <%=text2%>, que millor correspongui amb el fitxer imatge anterior.<br/>"
|
18
18
|
:i4: '<%=text1%><br/>Definició: <i><%=text2%></i><br/><br/>(Coloca cada palabra en su posición correcta dentro del texto)'
|
19
19
|
:s1: 'En relació al concepte <b><%=text1%></b>, ordena cada/les/els "<%=text2%>" per tal que es compleixi el criteri "<%=text3%>".<br/>'
|
20
20
|
:t1table: "Concepte <b><%=text1%></b><br/><%=text2%>: [*]<br/><%=text3%>: \"<%=text4%>\"<br/>Escull l'opció correcta.<br/>"
|
@@ -12,9 +12,9 @@
|
|
12
12
|
:f1: 'Die folgenden Elemente sind "<%=text2%>" des Begriffs <b><%=text1%></b>:<ul><li><%=text3%></li></ul>'
|
13
13
|
:f2: 'Die folgenden Elemente sind "<%=text2%>".<br/>Wählen Sie die Antwortmöglichkeit aus, die nicht zum Begriff <b><%=text1%></b> passt.'
|
14
14
|
:f3: 'Die folgenden Elemente sind "<%=text2%>" des Begriffs <b><%=text1%></b>:<br><p><%=text3%></p>(Setzen Sie die Wörter in die Lücken ein)'
|
15
|
-
:i1: '<%=text1%><br/>EWählen Sie die Antwortmöglichkeit, die am besten zu dem gezeigten
|
16
|
-
:i2: '<%=text1%><br/>Das gezeigte
|
17
|
-
:i3: '<%=text1%><br/>Setzen Sie die Antwort ein <%=text2%>, qdie am besten zu dem gezeigten
|
15
|
+
:i1: '<%=text1%><br/>EWählen Sie die Antwortmöglichkeit, die am besten zu dem gezeigten Datei passt.<br/>'
|
16
|
+
:i2: '<%=text1%><br/>Das gezeigte Datei gehört zu <b><%=text2%></b>.'
|
17
|
+
:i3: '<%=text1%><br/>Setzen Sie die Antwort ein <%=text2%>, qdie am besten zu dem gezeigten Datei passt.<br/>'
|
18
18
|
:i4: '<%=text1%><br/>Bedeutung: <i><%=text2%></i><br/><br/>(Setzen Sie die Wörter in die Lücken ein)'
|
19
19
|
:s1: 'Beziehen Sie sich auf den Begriff <b><%=text1%></b>, und ordnen Sie die "<%=text2%>" richtigen Lösungen zu "<%=text3%>".<br/>'
|
20
20
|
:t1table: 'Begriff <b><%=text1%></b><br/><%=text2%>: [*]<br/><%=text3%>: "<%=text4%>"<br/>Wählen Sie die richtige Lösung aus.<br/>'
|
@@ -12,9 +12,9 @@
|
|
12
12
|
:f1: 'The next items are "<%=text2%>" from <b><%=text1%></b> concept:<br/><ul><li><%=text3%></li></ul>'
|
13
13
|
:f2: 'The next items are "<%=text2%>".<br/>Choose the option that not belongs concept <b><%=text1%></b>.'
|
14
14
|
:f3: 'The next items are "<%=text2%>" from <b><%=text1%></b> concept:<br><p><%=text3%></p>(Put every word into the right position)'
|
15
|
-
:i1: '<%=text1%><br/>Choose the best association for the previous
|
16
|
-
:i2: '<%=text1%><br/>The previous
|
17
|
-
:i3: '<%=text1%><br/>Write the best answer <%=text2%>, for the previous
|
15
|
+
:i1: '<%=text1%><br/>Choose the best association for the previous file.<br/>'
|
16
|
+
:i2: '<%=text1%><br/>The previous file corresponds to <b><%=text2%></b>.'
|
17
|
+
:i3: '<%=text1%><br/>Write the best answer <%=text2%>, for the previous file.<br/>'
|
18
18
|
:i4: '<%=text1%><br/>Definition:<br/> <i><%=text2%></i><br/><br/>(Put every word in the right text position)'
|
19
19
|
:s1: "About <b><%=text1%></b> concept, sort every \"<%=text2%>\", so It is true that \"<%=text3%>\".<br/>"
|
20
20
|
:t1table: '<b>Concept <%=text1%></b><br/><%=text2%>: [*]<br/><%=text3%>: "<%=text4%>"<br/>Choose the right answer.<br/>'
|
@@ -12,9 +12,9 @@
|
|
12
12
|
:f1: 'Los siguientes elementos son "<%=text2%>" del concepto <b><%=text1%></b>:<ul><li><%=text3%></li></ul>'
|
13
13
|
:f2: 'Los siguientes elementos son "<%=text2%>".<br/>Selecciona la opción que no pertenezca al concepto <b><%=text1%></b>.'
|
14
14
|
:f3: 'Los siguientes elementos son "<%=text2%>" del concepto <b><%=text1%></b>:<br><p><%=text3%></p>(Coloca cada palabra en su posición correcta dentro del texto)'
|
15
|
-
:i1: '<%=text1%><br/>Elige la opción que mejor se corresponda con
|
16
|
-
:i2: '<%=text1%><br/>
|
17
|
-
:i3: '<%=text1%><br/>Escribe la opción <%=text2%>, que mejor corresponda con
|
15
|
+
:i1: '<%=text1%><br/>Elige la opción que mejor se corresponda con el fichero anterior.<br/>'
|
16
|
+
:i2: '<%=text1%><br/>El fichero anterior corresponde a <b><%=text2%></b>.'
|
17
|
+
:i3: '<%=text1%><br/>Escribe la opción <%=text2%>, que mejor corresponda con el fichero anterior.<br/>'
|
18
18
|
:i4: '<%=text1%><br/>Definición: <i><%=text2%></i><br/><br/>(Coloca cada palabra en su posición correcta dentro del texto)'
|
19
19
|
:s1: 'En relación al concepto <b><%=text1%></b>, ordena cada/las/los "<%=text2%>" de modo que se cumpla el criterio "<%=text3%>".<br/>'
|
20
20
|
:t1table: 'Concepto <b><%=text1%></b><br/><%=text2%>: [*]<br/><%=text3%>: "<%=text4%>"<br/>Elige la opción correcta.<br/>'
|
@@ -12,9 +12,9 @@
|
|
12
12
|
:f1: 'Les éléments suivants sont "<%=text2%>" du concept <b><%=text1%></b>:<ul><li><%=text3%></li></ul>'
|
13
13
|
:f2: "Les éléments suivants sont \"<%=text2%>\".<br/>Sélectionnez l'option qui n'appartient pas au concept <b><%=text1%></b>."
|
14
14
|
:f3: 'Les éléments suivants sont "<%=text2%>" du concept <b><%=text1%></b>:<br><p><%=text3%></p>(Mettez chaque mot à la bonne position dans le texte)'
|
15
|
-
:i1: "<%=text1%><br/>Choisissez l'option qui correspond le mieux à
|
16
|
-
:i2: "<%=text1%><br/>
|
17
|
-
:i3: "<%=text1%><br/>Écrivez l'option <%=text2%>, qui correspond le mieux à
|
15
|
+
:i1: "<%=text1%><br/>Choisissez l'option qui correspond le mieux à le fichier précédente.<br/>"
|
16
|
+
:i2: "<%=text1%><br/>Le fichier précédente correspond à <b><%=text2%></b>."
|
17
|
+
:i3: "<%=text1%><br/>Écrivez l'option <%=text2%>, qui correspond le mieux à le fichier précédente.<br/>"
|
18
18
|
:i4: '<%=text1%><br/>Définition: <i><%=text2%></i><br/><br/>(Mettez chaque mot à la bonne position dans le texte)'
|
19
19
|
:s1: "Par rapport au concept <b><%=text1%></b>, mettez dans l'ordre chaque \"<%=text2%>\" afin que le critère soit rempli \"<%=text3%>\".<br/>"
|
20
20
|
:t1table: "Concept <b><%=text1%></b><br/><%=text2%>: [*]<br/><%=text3%>: \"<%=text4%>\"<br/>Choisissez l'option correcte.<br/>"
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
1
|
|
3
2
|
require 'base64'
|
4
3
|
|
@@ -11,32 +10,120 @@ module EmbeddedFile
|
|
11
10
|
# @param value (String)
|
12
11
|
# @param localdir (String) Input file base folder
|
13
12
|
# @return Hash
|
14
|
-
# rubocop:disable Metrics/MethodLength
|
15
|
-
# rubocop:disable Metrics/AbcSize
|
16
13
|
def self.load(value, localdir)
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
return load_image(value, localdir) if is_image? value
|
15
|
+
return load_audio(value, localdir) if is_audio? value
|
16
|
+
return load_video(value, localdir) if is_video? value
|
17
|
+
|
18
|
+
if is_url? value
|
19
|
+
Logger.verbose Rainbow("[ERROR] Unkown URL type!: #{value}").red.bright
|
20
|
+
exit 1
|
21
|
+
end
|
22
|
+
|
23
|
+
filepath = File.join(localdir, value)
|
24
|
+
unless File.exist?(filepath)
|
25
|
+
Logger.verbose Rainbow("[ERROR] File does not exist!: #{filepath}").red.bright
|
26
|
+
# return { text: "URI error", file: :none, type: :unkown }
|
27
|
+
exit 1
|
28
|
+
end
|
29
|
+
|
30
|
+
# Suposse that filename is TEXT file
|
31
|
+
return { text: "<pre>#{File.read(filepath)}</pre>", file: :none, type: :text }
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.is_audio?(filename)
|
35
|
+
extens = ['.mp3', '.ogg', '.wav']
|
36
|
+
extens.each {|ext| return true if filename.downcase.end_with?(ext) }
|
37
|
+
false
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.is_image?(filename)
|
41
|
+
extens = ['.jpg', '.jpeg', '.png']
|
42
|
+
extens.each {|ext| return true if filename.downcase.end_with?(ext) }
|
43
|
+
false
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.is_video?(filename)
|
47
|
+
extens = ['.mp4', '.ogv']
|
48
|
+
extens.each {|ext| return true if filename.downcase.end_with?(ext) }
|
49
|
+
false
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.is_url?(value)
|
53
|
+
return true if value.start_with?('https://') || value.start_with?('http://')
|
54
|
+
false
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.load_audio(value, localdir)
|
58
|
+
output = { text: :error, file: :none, type: :audio}
|
59
|
+
|
60
|
+
if is_url? value
|
61
|
+
output[:text] = "<audio src=\"#{value}\" controls></audio>"
|
62
|
+
output[:file] = :none
|
63
|
+
output[:type] = :url
|
64
|
+
return output
|
65
|
+
end
|
66
|
+
|
67
|
+
filepath = File.join(localdir, value)
|
68
|
+
unless File.exist?(filepath)
|
69
|
+
Logger.verbose Rainbow("[ERROR] Audio file no exists!: #{filepath}").red.bright
|
70
|
+
exit 1
|
71
|
+
end
|
72
|
+
output[:text] = '<audio controls><source src="@@PLUGINFILE@@/' + File.basename(filepath) \
|
73
|
+
+ '">Your browser does not support the audio tag.</audio>'
|
74
|
+
output[:file] = '<file name="' + File.basename(filepath) \
|
75
|
+
+ '" path="/" encoding="base64">' \
|
76
|
+
+ Base64.strict_encode64(File.open(filepath, 'rb').read) + '</file>'
|
77
|
+
output[:type] = :audio
|
78
|
+
output
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.load_image(value, localdir)
|
82
|
+
output = { text: :error, file: :none, type: :image}
|
83
|
+
|
84
|
+
if is_url? value
|
85
|
+
output[:text] = "<img src=\"#{value}\" alt=\"image\" width=\"400\" height=\"300\">"
|
86
|
+
output[:file] = :none
|
87
|
+
output[:type] = :url
|
88
|
+
return output
|
20
89
|
end
|
21
90
|
|
22
91
|
filepath = File.join(localdir, value)
|
23
92
|
unless File.exist?(filepath)
|
24
|
-
# When filename is unkown!
|
25
93
|
Logger.verbose Rainbow("[ERROR] Unknown file! #{filepath}").red.bright
|
26
94
|
exit 1
|
27
95
|
end
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
96
|
+
output[:text] = '<img src="@@PLUGINFILE@@/' + File.basename(filepath) \
|
97
|
+
+ '" alt="imagen" class="img-responsive atto_image_button_text-bottom">'
|
98
|
+
output[:file] = '<file name="' + File.basename(filepath) \
|
99
|
+
+ '" path="/" encoding="base64">' \
|
100
|
+
+ Base64.strict_encode64(File.open(filepath, 'rb').read) + '</file>'
|
101
|
+
output[:type] = :image
|
102
|
+
output
|
103
|
+
end
|
104
|
+
|
105
|
+
def self.load_video(value, localdir)
|
106
|
+
output = { text: :error, file: :none, type: :video}
|
107
|
+
|
108
|
+
if is_url? value
|
109
|
+
output[:text] = "<video controls width=\"400\" height=\"300\">" \
|
110
|
+
+ "<source src=\"#{value}\"/></video>"
|
111
|
+
output[:file] = :none
|
112
|
+
output[:type] = :url
|
113
|
+
return output
|
114
|
+
end
|
115
|
+
|
116
|
+
filepath = File.join(localdir, value)
|
117
|
+
unless File.exist?(filepath)
|
118
|
+
Logger.verbose Rainbow("[ERROR] Unknown file! #{filepath}").red.bright
|
119
|
+
exit 1
|
36
120
|
end
|
37
|
-
|
38
|
-
|
121
|
+
output[:text] = '<video controls><source src="@@PLUGINFILE@@/' + File.basename(filepath) \
|
122
|
+
+ '"/>Your browser does not support the video tag.</video>'
|
123
|
+
output[:file] = '<file name="' + File.basename(filepath) \
|
124
|
+
+ '" path="/" encoding="base64">' \
|
125
|
+
+ Base64.strict_encode64(File.open(filepath, 'rb').read) + '</file>'
|
126
|
+
output[:type] = :video
|
127
|
+
output
|
39
128
|
end
|
40
|
-
# rubocop:enable Metrics/MethodLength
|
41
|
-
# rubocop:enable Metrics/AbcSize
|
42
129
|
end
|
data/lib/asker/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asker-tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Vargas Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: haml
|