grape-starter 0.2.0 → 0.2.1

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: 52f430416f92875210e64914e6fe61c29d4c3e56
4
- data.tar.gz: 77f33daa8ca7ef7f49e4415acaf2261edc888969
3
+ metadata.gz: 7d3e32d8587660f9d656a31b1bcf03e99d5ecee0
4
+ data.tar.gz: 1333de3788b1b547f9c78d3074d7e21a221677a7
5
5
  SHA512:
6
- metadata.gz: 94908b48037df0376311ddb26b61e408e99b9fd65e017fbb484a121cdaacea7fc65fe12fc7eae1930ba5239becefddf5555ecca2d02599ec9b05cafe570ae48a
7
- data.tar.gz: f089a230198355841150ae7353973e0fc8180c50e2e742f98ed63363c193b48ac199f46694238e2a516ebd0ce970028e876bcae079f97962820c500962919b90
6
+ metadata.gz: db05a5a91a6021ad5f66cd04b1f011a97ca6270c48a45af16ed213f3f5ae9624519704c061afa1352e0ca830edf76ec30c045af680979967874b019a1391dc99
7
+ data.tar.gz: 8bd05f3a709cda3d3c53c33b56f4bcf6686126dd12cc496805ea24d7993c2d9aceb17fe3be95923454ca53519d86d5d6bd26389da420b779ea7ad4e28495fa64
data/CHANGELOG.md CHANGED
@@ -1,27 +1,19 @@
1
- ### 0.1.8
1
+ ### 0.2.1
2
2
 
3
- - adds request specs shared examples
3
+ - allows entity removing
4
4
 
5
- ### 0.1.7
5
+ ### 0.2.0
6
6
 
7
- - corrects path param for specific endpoints
7
+ - adds `remove` command
8
8
 
9
- ### 0.1.6
9
+ ### < 0.2.0
10
10
 
11
+ - adds request specs shared examples
12
+ - corrects path param for specific endpoints
11
13
  - corrects adding of endpoints, if no http verb was given
12
-
13
- ### 0.1.5
14
-
15
14
  - adds flag for entity creating
16
-
17
- ### 0.1.4
18
-
19
- - version bump v0.1.4
20
15
  - moves back dependencies to gemspec
21
16
  - adds rubygems badge
22
- - cleans up dependencies
23
- - updates readme
24
- - version bump v0.1.2
17
+ - cleans up dependencies
25
18
  - adds `force` option to add
26
- - version bump v0.1.1
27
19
  - adds specifying http verbs
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
  [![Gem Version](https://badge.fury.io/rb/grape-starter.svg)](https://badge.fury.io/rb/grape-starter)
3
3
  [![Inline docs](http://inch-ci.org/github/LeFnord/grape-starter.svg?branch=master)](http://inch-ci.org/github/LeFnord/grape-starter)
4
4
 
5
+
5
6
  # Grape Starter
6
7
 
7
8
  Is a tool to help you to build up a skeleton for a [Grape](http://github.com/ruby-grape/grape) API mounted on [Rack](https://github.com/rack/rack) ready to run.
@@ -15,6 +16,7 @@ Is a tool to help you to build up a skeleton for a [Grape](http://github.com/rub
15
16
  $ gem install grape-starter
16
17
  ```
17
18
 
19
+
18
20
  #### Create a new project
19
21
  ```
20
22
  $ grape-starter new awesome_api
@@ -52,6 +54,7 @@ the API is now accessible under: [http://localhost:9292/api/v1/root](http://loca
52
54
 
53
55
  More could be found in [README](template/README.md).
54
56
 
57
+
55
58
  #### Add resources
56
59
  ```
57
60
  $ grape-starter add foo
@@ -60,6 +63,14 @@ to add CRUD endpoints for resource foo. For more options, see command help.
60
63
 
61
64
  This adds endpoint and lib file and belonging specs, and a mount entry in base.rb.
62
65
 
66
+
67
+ #### Remove a resource
68
+ ```
69
+ $ grape-starter remove foo
70
+ ```
71
+ to remove previous generated files for a resource.
72
+
73
+
63
74
  ## Contributing
64
75
 
65
76
  Bug reports and pull requests are welcome on GitHub at https://github.com/LeFnord/grape-starter.
data/bin/grape-starter CHANGED
@@ -81,14 +81,14 @@ end
81
81
  desc 'Removes a resource - run from inside the project'
82
82
  arg_name 'resource'
83
83
  command :remove do |c|
84
- # c.desc 'adds entity file'
85
- # c.switch [:e, :entity], negatable: false
84
+ c.desc 'removes also entity file'
85
+ c.switch [:e, :entity], negatable: false
86
86
 
87
87
  c.action do |global_options, options, args|
88
88
  exit_now! 'no resource given' if args.empty?
89
89
  resource = args.first
90
90
 
91
- Starter::Builder.remove!(resource)
91
+ Starter::Builder.remove!(resource, options)
92
92
 
93
93
  $stdout.puts "removed resource: #{resource}"
94
94
  end
@@ -23,11 +23,17 @@ module Starter
23
23
  self
24
24
  end
25
25
 
26
- def remove!(resource)
26
+ def remove!(resource, options = {})
27
27
  @resource = resource
28
+ @entity = options[:entity]
28
29
 
29
- files_to_remove = file_list.map { |x| send("#{x}_name") }
30
- FileUtils.rm files_to_remove
30
+ file_list.map { |x| send("#{x}_name") }.each do |file_to_remove|
31
+ begin
32
+ FileUtils.rm file_to_remove
33
+ rescue => error
34
+ $stdout.puts error.to_s
35
+ end
36
+ end
31
37
  end
32
38
 
33
39
  def save
@@ -52,7 +52,6 @@ module Starter
52
52
  require 'spec_helper'
53
53
 
54
54
  RSpec.describe Api::#{klass_name} do
55
- pending 'write specs'
56
55
  #{endpoint_specs}
57
56
  end
58
57
  FILE
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Starter
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
data/template/Gemfile CHANGED
@@ -7,7 +7,7 @@ gem 'rack'
7
7
  gem 'rack-cors'
8
8
 
9
9
  # TODO: revert to gem after mörge and release
10
- gem 'grape', git: 'git@github.com:LeFnord/grape.git', branch: 'delete_204'
10
+ gem 'grape', git: 'git@github.com:ruby-grape/grape.git'
11
11
  # gem 'grape', '~> 0.18'
12
12
  gem 'grape-entity', '~> 0.6'
13
13
  gem 'grape-swagger', '~> 0.25'
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.0
4
+ version: 0.2.1
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-04 00:00:00.000000000 Z
11
+ date: 2016-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli