alexa_plugin_generator 0.1.4 → 0.2.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 +4 -4
- data/lib/alexa_plugin_generator/cli.rb +22 -38
- data/lib/alexa_plugin_generator/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c022b93dd013e08bb600f5c64615e462161068c5
|
4
|
+
data.tar.gz: 0476de460cb60a1649b778b305ea93a0e30ad175
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31619d633ab457b2025138c045e0a65622d6c30a0a38c17dd17c414ea2871cbaed2b67c1f73dea4e71c13190f92a91da7c5c56cc36dcc96718e62108a4c7ed7a
|
7
|
+
data.tar.gz: 9c0fe79b08c3487ca964bafc3b4dd01bc4d9754816d161fd521c7bc711fbc59e57d84ea1fe0f0383dbad132baad62147a9762408df7ad078dfb1d2ea716172b7
|
@@ -3,19 +3,17 @@ require 'active_support/core_ext/string'
|
|
3
3
|
|
4
4
|
module AlexaPluginGenerator
|
5
5
|
class HammerOfTheGods < Thor
|
6
|
-
desc "
|
7
|
-
long_desc <<-
|
6
|
+
desc "new NAME", "Will create all files need to build a SingingAssistant alexa plugin."
|
7
|
+
long_desc <<-ALEXA_PLUGIN_GENERATOR
|
8
8
|
|
9
|
-
`
|
9
|
+
`new NAME` will create all files to build a SingingAssitant alexa plugin.
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
developed at Bell Labs a few years before the publication of
|
15
|
-
Kernighan and Ritchie's C book in 1972.
|
11
|
+
All you need to do is define the methods that match up to the intent name of your
|
12
|
+
action. You will also need to define your sample_utterances, custom_slots and intent_schema
|
13
|
+
for your alexa skill.
|
16
14
|
|
17
|
-
http://
|
18
|
-
|
15
|
+
http://github.com/kylegrantlucas/alexa_plugin_generator
|
16
|
+
ALEXA_PLUGIN_GENERATOR
|
19
17
|
def new( name )
|
20
18
|
name = name[6..-1] if name[0..5] == "alexa_"
|
21
19
|
gemname = "alexa_#{name}"
|
@@ -32,18 +30,18 @@ module AlexaPluginGenerator
|
|
32
30
|
file.split("\n").each_with_index do |line, index|
|
33
31
|
line_number = index+1
|
34
32
|
if filename == "lib/#{gemname}.rb"
|
35
|
-
if line_number ==
|
36
|
-
new_file << "require 'sinatra/
|
33
|
+
if line_number == 1
|
34
|
+
new_file << "require 'sinatra/extension'\n"
|
37
35
|
new_file << "require 'alexa_objects'\n\n"
|
38
36
|
elsif line_number == 3
|
39
|
-
new_file << "module
|
40
|
-
new_file << "
|
41
|
-
new_file << "
|
42
|
-
new_file << "
|
43
|
-
new_file << "
|
37
|
+
new_file << "module #{name.camelize}\n"
|
38
|
+
new_file << " extend Sinatra::Extension\n\n"
|
39
|
+
new_file << " helpers do\n"
|
40
|
+
new_file << " # TODO: Change to new intent name\n"
|
41
|
+
new_file << " def intent_name\n"
|
42
|
+
new_file << " # TODO: Implement intent\n"
|
44
43
|
new_file << " end\n"
|
45
|
-
new_file << " end\n
|
46
|
-
new_file << " register #{name.camelize}\n"
|
44
|
+
new_file << " end\n"
|
47
45
|
new_file << "end\n"
|
48
46
|
elsif line_number == 4
|
49
47
|
elsif line_number == 5
|
@@ -53,8 +51,8 @@ module AlexaPluginGenerator
|
|
53
51
|
end
|
54
52
|
elsif filename == "#{gemname}.gemspec"
|
55
53
|
if line_number == 24
|
56
|
-
new_file << " spec.
|
57
|
-
new_file << " spec.
|
54
|
+
new_file << " spec.add_runtime_dependency 'sinatra-contrib'\n"
|
55
|
+
new_file << " spec.add_runtime_dependency 'alexa_objects'\n\n"
|
58
56
|
elsif line_number == 28
|
59
57
|
new_file << "#{line[0...-1]}, \"skills_config\"]\n"
|
60
58
|
elsif line_number.between?(17, 23)
|
@@ -75,29 +73,15 @@ module AlexaPluginGenerator
|
|
75
73
|
puts "Created ./#{gemname}/skills_config/#{skill_file}.txt" if system "touch ./#{gemname}/skills_config/#{skill_file}.txt"
|
76
74
|
|
77
75
|
file = File.open("./#{gemname}/lib/#{gemname}/#{skill_file}.rb", 'w') do |file|
|
78
|
-
file << "module
|
79
|
-
file << "
|
80
|
-
file << "
|
81
|
-
file << " File.read(File.expand_path('../../../skills_config/#{skill_file}.txt', __FILE__))\n"
|
82
|
-
file << " end\n"
|
76
|
+
file << "module #{name.camelize}\n"
|
77
|
+
file << " def self.#{skill_file}\n"
|
78
|
+
file << " File.read(File.expand_path('../../../skills_config/#{skill_file}.txt', __FILE__))\n"
|
83
79
|
file << " end\n"
|
84
80
|
file << "end\n"
|
85
81
|
end
|
86
82
|
|
87
83
|
puts "Created ./#{gemname}/lib/#{gemname}/#{skill_file}.rb" if file
|
88
84
|
end
|
89
|
-
|
90
|
-
file = File.open("./#{gemname}/lib/#{gemname}/endpoint.rb", 'w') do |file|
|
91
|
-
file << "module Sinatra\n"
|
92
|
-
file << " module #{name.camelize}\n"
|
93
|
-
file << " def self.endpoint\n"
|
94
|
-
file << " '/alexa_#{gemname}'\n"
|
95
|
-
file << " end\n"
|
96
|
-
file << " end\n"
|
97
|
-
file << "end\n"
|
98
|
-
end
|
99
|
-
|
100
|
-
puts "Created ./#{gemname}/lib/#{gemname}/endpoint.rb" if file
|
101
85
|
end
|
102
86
|
end
|
103
87
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alexa_plugin_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kylegrantlucas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -130,3 +130,4 @@ signing_key:
|
|
130
130
|
specification_version: 4
|
131
131
|
summary: A command line tool for generating singing_assistant middleware templates.
|
132
132
|
test_files: []
|
133
|
+
has_rdoc:
|