grape_bootstrap 0.0.2 → 0.0.3

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTExMWM1NWQ2OWZhODJjN2I4OWY5MThhMjU1ODI3YjEzZDNiYzMyYw==
4
+ OGFmNDA3OTExMDM5MWFlZDg1ZGMyODQ3YTM1NDdmODUxMzJlZTJiOA==
5
5
  data.tar.gz: !binary |-
6
- MzEzM2ZhYThlZTAxN2VlODE2M2M3MTI1MDNhODM4OTYxZjFjNzBhOQ==
6
+ MmIwMWY4ODg0MzY5NjBhNjdjYWFiNzdlMWZlYjBiZDA2ZGU0ZjhkZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZmMyYTJjY2EzNDNkNWRiY2Y2ODMwOGY1NTBhZGM0YTEzNmU1MDQ4NWI2NTRm
10
- YmQ1NDEzZTMxODBiZjMxNzI2M2IxNzUzMDY4MzQ5NzliN2EwMjA0YzdiYjQ3
11
- ZjJlNWQ4OWY2ZTRjNGZlMWJhM2VmYmVhNjk5MWJkNDcwYWIxOTQ=
9
+ NjE3YWZiM2E0N2RkNjczZWFkZDczNGEwNzM4YTI4ZWI1ZTVmMTdhMWVhMjk1
10
+ YmVmYmFhOWIzYmYzYTViZjVhZmM2OWM4MGY0NzE2Zjg3MWRmOWVlODViNTAz
11
+ NjlmYmU0NWE2ZTdiMGFjZjdiM2QyNjA5ZmJjY2E4MjI1MTZjZTE=
12
12
  data.tar.gz: !binary |-
13
- ZDk2MzhlM2UxMDcxYmFkMWRiZWFmYzUwOGEyMWFlZmQ5MjYxZDg0ODY5MzU3
14
- YWUyMDQ2ZjJlM2Q5YTNiNjA1MDE1MGE4YTZjM2JkNTllNDQyNjA1ODNjN2Mx
15
- NjkxOTA0YTlhMmI4OTE2NDMyNjY2NzNlYjRhMWVjZGUxODUwMDU=
13
+ NDY2OTY2YTM0MjcyMWQwMjM1Nzc0NjgwYmFmYjg2MmVmM2FjOTNmMjJhNmI5
14
+ M2U0ZGYxMWQ0MDFjN2IwMjA0ODVkN2E0ZDEyODAyOWUyNTZmZmQ0YWUyOTdj
15
+ Mzg3MGRjNjBiZWIyMWVkZGRjMzc5OTIxOWQ2ODBkZDg5MWE3OWQ=
@@ -4,15 +4,13 @@ require 'active_support/core_ext'
4
4
  module GrapeBootstrap
5
5
  module Commands
6
6
  class Generate < Base
7
- alias_method :model, :render_template
8
- alias_method :api, :render_template
9
-
10
7
  def initialize path, type, options=[]
11
8
  super path, options
12
9
  if type.nil?
13
10
  throw "Type not specified"
14
11
  end
15
- @type = type
12
+ # Ugly hack for models vs api
13
+ @type = 'model' == type ? 'models' : type
16
14
  @name = options.shift
17
15
 
18
16
  if @name.nil?
@@ -34,16 +32,19 @@ module GrapeBootstrap
34
32
  "..",
35
33
  "templates",
36
34
  "app",
37
- template_type.pluralize,
35
+ template_type,
38
36
  "new.rb.erb"
39
37
  ].join('/')
40
38
  tpl = ERB.new(File.read(template_path))
41
- target_path = "app/#{template_type.pluralize}/#{name.underscore}.rb"
39
+ target_path = "app/#{template_type}/#{name.underscore}.rb"
42
40
 
43
- File.open("#{@path}/#{target_path}", 'w') do |file|
41
+ File.open("#{@path}/#{target_path}", 'w+') do |file|
44
42
  file << tpl.result(erb_binding.call)
45
43
  end
46
44
  end
45
+
46
+ alias_method :models, :render_template
47
+ alias_method :api, :render_template
47
48
  end
48
49
  end
49
50
  end
@@ -1,6 +1,6 @@
1
1
  class API::<%= name %> < API::Base
2
2
  desc "<%= name %> GET"
3
- get '/<%= name.downcasae %>' do
3
+ get '/<%= name.downcase %>' do
4
4
  { }
5
5
  end
6
6
  end
@@ -1,3 +1,3 @@
1
1
  module GrapeBootstrap
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mate Marjai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-05 00:00:00.000000000 Z
11
+ date: 2014-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape