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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48b2d656a0abf765b24c458a64d4d3a973a02f47
4
- data.tar.gz: c094ccfd1860944a60aa8090dd0fec4a7c3cfd33
3
+ metadata.gz: 8c3293eb8eefc93cf9a64b2e2851da7cb5c364f0
4
+ data.tar.gz: 2db137846716c95614976ba46ed6d3d86b560ddc
5
5
  SHA512:
6
- metadata.gz: 1d7783455e1d96a48e752ab6ec0e5a14bcb8506b4cdd66151e707821421e0c1162b7dc94eb9301838a166691cabb14997a7769e24ce657042494acd9718d1afc
7
- data.tar.gz: 1c96c6d62e6b1356ab8d3195a282f5236c9f86bcb8ee4078d30a47f6dbdefe9b6286121b4bb73c01fd047cb503a24954f1d22cf104697e70eeb27c11d38678b7
6
+ metadata.gz: da6534c89f52d0304370501edad3b0a3a3dabaefea1c53daf26771c81239bb3b9862852eeb2a596b9f08bccee317d9e6587b707bf78ba161dfa67d2f7860a5d2
7
+ data.tar.gz: '019e919f98c4eb89b63d19ea457fe63eff12b6c9d26367f18aa5dd0985a24e7cda635613997f500e49f14928e01981d2f25109d54e195f0d7dd3267d1b0fe533'
data/.gitignore CHANGED
@@ -10,3 +10,4 @@ Dockerfile
10
10
  tmp/
11
11
  .rspec
12
12
  pkg/
13
+ template/Gemfile.lock
data/.inch.yml ADDED
@@ -0,0 +1,5 @@
1
+ files:
2
+ excluded:
3
+ - lib/starter/builder/template_endpoints.rb
4
+ - lib/starter/builder/template_files.rb
5
+ - lib/starter/rake/grape_tasks.rb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ### 0.2.4
2
+
3
+ - fix: add mount point to api base
4
+ - adds inch.yml
5
+ - improves specs
6
+
7
+ ### 0.2.3
8
+
9
+ - fix: removes mount point from api base
10
+
1
11
  ### 0.2.2
2
12
 
3
13
  - renames `remove` to `rm`
@@ -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
- def save
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Starter
3
- VERSION = '0.2.3'
3
+ VERSION = '0.2.4'
4
4
  end
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.3
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-09 00:00:00.000000000 Z
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"