grape-starter 0.8.0 → 0.8.1

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45c1d0a951be87c5be14c08499f38ae04ccfbbdb
4
- data.tar.gz: 4b9a797047eaf1271ab0d46a5eb7438043fbddcf
3
+ metadata.gz: 41354a0a87f47c0f974e5c7b84d125a9200003d5
4
+ data.tar.gz: 16f9c3dd2cab7d87c13e0b0af299bb5a13667e81
5
5
  SHA512:
6
- metadata.gz: 3c1d2224a49b34e3a9971c663dfd61acbb82f0f487d6e405ce7c83424d050c5227efe0307327e40599724c5f9264f2b5d8e1e0eec6fad535fe7adc1b87f6a473
7
- data.tar.gz: bc11c7f804027886528c7c2872a68d224b6a02c5e335a582709d2260e34678d0715dfe8bdc287b09e5322cd759d9f311d2758949727a7cf62f536b156e72377c
6
+ metadata.gz: ba03f0e812e45ef087221cb970bb252d617e5ccb13e98b8463d480707f2c6279d1b9ba4f2a107fb8fe9683d4cf12086e7e4ab103653ba4cbf35b505fb8d0394f
7
+ data.tar.gz: 62dfe961d9b4494c09cc61b84ea230065ad33675037e8364e35f868092e7ae11dc88c6b6ef788c3c7d308f1d0cadb81a0d112839dcd4ef09306d0ed0f355bf1f
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  - contributions
4
4
 
5
+ ### 0.8.1
6
+
7
+ - [6b16c…](https://github.com/LeFnord/grape-starter/commit/6b16c0bf38e4cad8d486e805269157dcbaefbb64) - removes default ORM value, minor corrections
8
+
5
9
  ### 0.8.0
6
10
 
7
11
  - [#15](https://github.com/LeFnord/grape-starter/pull/15), [2af09…](https://github.com/LeFnord/grape-starter/commit/2af09dddf97f756e96c80c745ee68aad5ab4ccc3) **breaking change** prefix option on create is optional, no default
data/bin/grape-starter CHANGED
@@ -25,7 +25,6 @@ command :new do |c|
25
25
  c.flag [:p, :prefix],
26
26
  desc: 'sets the prefix of the API'
27
27
  c.flag [:o, :orm],
28
- default_value: 'sequel',
29
28
  desc: 'prepares for the given ORM (Sequel -> sequel, ActiveRecord -> ar)'
30
29
 
31
30
  c.action do |global_options, options, args|
@@ -39,7 +39,7 @@ module Starter
39
39
  end
40
40
 
41
41
  Orms.build(destination, options[:orm]) if options[:orm]
42
- Starter::Config.save(content: { prefix: prefix })
42
+ Starter::Config.save(dest: destination, content: { prefix: prefix })
43
43
 
44
44
  self
45
45
  end
@@ -26,10 +26,7 @@ module Starter
26
26
 
27
27
  # parses out the prefix from base api file
28
28
  def base_prefix
29
- base_file
30
- scan = base_file.scan(/prefix\s+(:.+)\n/)
31
- scan.first.first.delete!(':') unless scan.empty?
32
- # Starter::Config.read[:prefix]
29
+ Starter::Config.read[:prefix]
33
30
  end
34
31
 
35
32
  # parses out the version from base api file
@@ -22,6 +22,7 @@ module Starter
22
22
  append_to_file(File.join(dest, 'Rakefile'), rakefile)
23
23
  append_to_file(File.join(dest, 'Gemfile'), gemfile)
24
24
  prepare_for_migrations(File.join(dest, 'db'))
25
+
25
26
  Starter::Config.save(dest: dest, content: { orm: orm.downcase })
26
27
  end
27
28
 
@@ -2,17 +2,23 @@
2
2
 
3
3
  module Starter
4
4
  class Config
5
- CONFIG_FILE = File.join(Dir.getwd, '.config')
6
5
  class << self
7
- def read
8
- return {} unless File.exist?(CONFIG_FILE)
9
- YAML.load_file(CONFIG_FILE)
6
+ def read(dest: Dir.getwd)
7
+ @dest = dest
8
+ return {} unless File.exist?(config_file)
9
+ YAML.load_file(config_file)
10
10
  end
11
11
 
12
12
  def save(dest: Dir.getwd, content: nil)
13
+ @dest = dest
13
14
  return if content.nil? || content.empty? || !content.is_a?(Hash)
14
- content = read.merge(content)
15
- File.open(File.join(dest, '.config'), 'w') { |f| f.write(YAML.dump(content)) }
15
+ existent = File.exist?(config_file) ? YAML.load_file(config_file) : {}
16
+ content = existent.merge(content)
17
+ File.open(config_file, 'w') { |f| f.write(YAML.dump(content)) }
18
+ end
19
+
20
+ def config_file
21
+ File.join(@dest, '.config')
16
22
  end
17
23
  end
18
24
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Starter
4
- VERSION = '0.8.0'
4
+ VERSION = '0.8.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-starter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - LeFnord