Module: Starter::Builder::Files
- Included in:
- Starter::Build
- Defined in:
- lib/starter/builder/files.rb
Instance Method Summary collapse
-
#api_file ⇒ Object
API template for resource.
- #api_spec ⇒ Object
-
#base_namespace_file ⇒ Object
LIB template for resource.
- #entity_file ⇒ Object
- #lib_file ⇒ Object
- #lib_spec ⇒ Object
Instance Method Details
#api_file ⇒ Object
API template for resource
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/starter/builder/files.rb', line 7 def api_file <<-FILE.strip_heredoc # frozen_string_literal: true module Api module Endpoints class #{@naming.klass_name} < Grape::API namespace :#{resource.downcase} do #{endpoints} end end end end FILE end |
#api_spec ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/starter/builder/files.rb', line 58 def api_spec prefix = base_prefix ? "/#{base_prefix}" : '' <<-FILE.strip_heredoc # frozen_string_literal: true require 'spec_helper' RSpec.describe '#{prefix}/#{base_version}/#{resource.downcase}' do #{endpoint_specs} end FILE end |
#base_namespace_file ⇒ Object
LIB template for resource
37 38 39 40 41 42 43 44 45 |
# File 'lib/starter/builder/files.rb', line 37 def base_namespace_file <<-FILE.strip_heredoc # frozen_string_literal: true module #{@naming.klass_name} VERSION = '0.1.0' end FILE end |
#entity_file ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/starter/builder/files.rb', line 23 def entity_file <<-FILE.strip_heredoc # frozen_string_literal: true module Api module Entities class #{@naming.klass_name} < Grape::Entity end end end FILE end |
#lib_file ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/starter/builder/files.rb', line 47 def lib_file <<-FILE.strip_heredoc # frozen_string_literal: true module Models class #{@naming.lib_klass_name} end end FILE end |
#lib_spec ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/starter/builder/files.rb', line 71 def lib_spec <<-FILE.strip_heredoc # frozen_string_literal: true require 'spec_helper' RSpec.describe Models::#{@naming.klass_name} do pending 'write specs' end FILE end |