grape-starter 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.inch.yml +5 -0
- data/CHANGELOG.md +10 -0
- data/lib/starter/builder.rb +30 -13
- data/lib/starter/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: 8c3293eb8eefc93cf9a64b2e2851da7cb5c364f0
|
4
|
+
data.tar.gz: 2db137846716c95614976ba46ed6d3d86b560ddc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da6534c89f52d0304370501edad3b0a3a3dabaefea1c53daf26771c81239bb3b9862852eeb2a596b9f08bccee317d9e6587b707bf78ba161dfa67d2f7860a5d2
|
7
|
+
data.tar.gz: '019e919f98c4eb89b63d19ea457fe63eff12b6c9d26367f18aa5dd0985a24e7cda635613997f500e49f14928e01981d2f25109d54e195f0d7dd3267d1b0fe533'
|
data/.gitignore
CHANGED
data/.inch.yml
ADDED
data/CHANGELOG.md
CHANGED
data/lib/starter/builder.rb
CHANGED
@@ -13,7 +13,14 @@ module Starter
|
|
13
13
|
|
14
14
|
class << self
|
15
15
|
attr_reader :resource, :set, :force, :entity
|
16
|
-
|
16
|
+
# would be called on add command
|
17
|
+
#
|
18
|
+
# resource - A String as name
|
19
|
+
# options - A Hash to provide some optional arguments (default: {})
|
20
|
+
# :set – whitespace separated list of http verbs
|
21
|
+
# (default: nil, possible: post, get, put, patch, delete)
|
22
|
+
# :force - A Boolean, if given existent files should be overwriten (default: nil -> false)
|
23
|
+
# :entity - A Boolean, if given an entity file would be created (default: nil -> false)
|
17
24
|
def call!(resource, options = {})
|
18
25
|
@resource = resource
|
19
26
|
@set = options[:set]
|
@@ -23,6 +30,24 @@ module Starter
|
|
23
30
|
self
|
24
31
|
end
|
25
32
|
|
33
|
+
# would also be called on add command,
|
34
|
+
# it saves the files
|
35
|
+
def save
|
36
|
+
created_files = file_list.each_with_object([]) do |new_file, memo|
|
37
|
+
memo << send("#{new_file}_name")
|
38
|
+
save_file(new_file)
|
39
|
+
end
|
40
|
+
|
41
|
+
add_mount_point
|
42
|
+
|
43
|
+
created_files
|
44
|
+
end
|
45
|
+
|
46
|
+
# would be called on rm command
|
47
|
+
#
|
48
|
+
# resource - A String, which indicates the resource to remove
|
49
|
+
# options - A Hash to provide some optional arguments (default: {})
|
50
|
+
# :entity - A Boolean, if given an entity file would also be removed (default: nil -> false)
|
26
51
|
def remove!(resource, options = {})
|
27
52
|
@resource = resource
|
28
53
|
@entity = options[:entity]
|
@@ -30,28 +55,20 @@ module Starter
|
|
30
55
|
file_list.map { |x| send("#{x}_name") }.each do |file_to_remove|
|
31
56
|
begin
|
32
57
|
FileUtils.rm file_to_remove
|
33
|
-
remove_mount_point
|
34
58
|
rescue => error
|
35
59
|
$stdout.puts error.to_s
|
36
60
|
end
|
37
61
|
end
|
38
|
-
end
|
39
62
|
|
40
|
-
|
41
|
-
created_files = file_list.each_with_object([]) do |new_file, memo|
|
42
|
-
memo << send("#{new_file}_name")
|
43
|
-
save_file(new_file)
|
44
|
-
end
|
45
|
-
|
46
|
-
add_mount_point
|
47
|
-
|
48
|
-
created_files
|
63
|
+
remove_mount_point
|
49
64
|
end
|
50
65
|
|
66
|
+
# provides the endpoints for he given resource
|
51
67
|
def endpoints
|
52
68
|
content(endpoint_set).join("\n\n")
|
53
69
|
end
|
54
70
|
|
71
|
+
# privdes the specs for the endpoints of the resource
|
55
72
|
def endpoint_specs
|
56
73
|
content(endpoint_set.map { |x| "#{x}_spec" }).join("\n")
|
57
74
|
end
|
@@ -97,7 +114,7 @@ module Starter
|
|
97
114
|
# manipulating API Base file
|
98
115
|
# … adding
|
99
116
|
def add_to_base(file)
|
100
|
-
occurence = file.scan(/(\s+mount.*?\n)/).last.first
|
117
|
+
occurence = file.scan(/(\s+mount\s.*?\n)/).last.first
|
101
118
|
replacement = occurence + mount_point
|
102
119
|
file.sub!(occurence, replacement)
|
103
120
|
end
|
data/lib/starter/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-starter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LeFnord
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -145,6 +145,7 @@ extensions: []
|
|
145
145
|
extra_rdoc_files: []
|
146
146
|
files:
|
147
147
|
- ".gitignore"
|
148
|
+
- ".inch.yml"
|
148
149
|
- ".rubocop.yml"
|
149
150
|
- ".rubocop_todo.yml"
|
150
151
|
- ".travis.yml"
|