grape-starter 0.8.3 → 0.8.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: b45c7d30a7066e73e414c2bcb86c55c781706ebb
4
- data.tar.gz: e627e85fecf7a6112048732c46673eb556cc4dc4
3
+ metadata.gz: c784e58c2cc7e636d53f3f780155ad9b63c67ea4
4
+ data.tar.gz: 9d73dd73328a762aaccb3d8a7a5189d4050137e7
5
5
  SHA512:
6
- metadata.gz: 412db3a0f60310e1460d739dc7153c97220606faf4f8f61af81a92e08f76435518d8a1e6162b5af129f3a7adad5a06826e553eedeae3fddca6a0aeb26c87b339
7
- data.tar.gz: 73c23fcda010e7d74eabe9fcd232d749afe9d6ff051e93d6c5ca89c2b36230fc1b722855fc10f8f4cbebaad91301832b02fec82e5a996bdd745c5f00d4519318
6
+ metadata.gz: 9cf56c31de8fb7a4d5d0c17d20481ebbcb3b72de3589b33b800ebd7ac5cb08a1473f7fe85ea3b620a0c5ff5f3743315af1cf964c52a48989b5be8ba4765a311f
7
+ data.tar.gz: 9f3f9f378ba76af98a8313b2a84ec668655e496089eaacc5427f0602e109c84e243f71e5f4b94aa1214bdbe0698c7672252ebc298ca13acdb3b6dae3a1556937
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  - contributions
4
4
 
5
+ ### 0.8.4
6
+
7
+ - [d8e13](https://github.com/LeFnord/grape-starter/commit/1f5faef958799704163b7db25db07c569cad8e13) -
8
+ fixes error on configuration
9
+
10
+ - [6baba](https://github.com/LeFnord/grape-starter/commit/e00433dee97509e71c1685a0da9134ce2a66baba) -
11
+ minor re-working of Rakefile and initializer templates
12
+
5
13
  ### 0.8.3
6
14
 
7
15
  - [3fe13](https://github.com/LeFnord/grape-starter/commit/3fe134c6ce0666dfd86165b5d2c1a219a4629862) - improves sequel rake tasks
data/README.md CHANGED
@@ -165,8 +165,8 @@ To add an new ORM, it needs following steps:
165
165
  see as example [sequel.rb](lib/starter/builder/templates/sequel.rb), there the return value of each method would be written into the
166
166
  corresponding file (see: [orms.rb](lib/starter/builder/orms.rb)).
167
167
 
168
- 2. An additional switch in the [`Starter::Orms.build`](https://github.com/LeFnord/grape-starter/blob/67738438ba9278b280a6eac402096fcb74526ab3/lib/starter/builder/orms.rb#L7-L13) method to choose the template.
169
- 3. An entry in the description of the [`add` command](https://github.com/LeFnord/grape-starter/blob/master/bin/grape-starter#L30), when it would be called with `-h`
168
+ 2. An additional switch in the [`Starter::Orms.build`](https://github.com/LeFnord/grape-starter/blob/ef45133e6d2254efee06ae4f17ede2fc5c06bebb/lib/starter/builder/orms.rb#L7-L18) and [`Starter::Names.lib_klass_name`](https://github.com/LeFnord/grape-starter/blob/ef45133e6d2254efee06ae4f17ede2fc5c06bebb/lib/starter/builder/names.rb#L13-L24) methods to choose the right template.
169
+ 3. An entry in the description of the [`new` command](https://github.com/LeFnord/grape-starter/blob/fa62c8a2ff72f984144b2336859d3e0b397398bd/bin/grape-starter#L28), when it would be called with `-h`
170
170
 
171
171
  ## License
172
172
 
@@ -20,13 +20,13 @@ module Starter
20
20
 
21
21
  ActiveRecord::Base.establish_connection db_conf[env]
22
22
  logger = if %w[development test].include? env
23
- log_dir = File.join(Dir.getwd, 'log')
24
- log_file = File.join(log_dir, 'db.log')
25
- FileUtils.mkdir(log_dir) unless Dir.exist?(log_dir)
26
- Logger.new(File.open(log_file, 'a'))
27
- else
28
- Logger.new(STDOUT)
29
- end
23
+ log_dir = File.join(Dir.getwd, 'log')
24
+ log_file = File.join(log_dir, 'db.log'))
25
+ FileUtils.mkdir(log_dir) unless Dir.exist?(log_dir)
26
+ Logger.new(File.open(log_file, 'a'))
27
+ else
28
+ Logger.new(STDOUT)
29
+ end
30
30
 
31
31
  ActiveRecord::Base.logger = logger
32
32
 
@@ -17,9 +17,23 @@ module Starter
17
17
  settings = YAML.load_file('config/database.yml')
18
18
  DB = Sequel.connect(settings[ENV['RACK_ENV']])
19
19
 
20
+ env = ENV['RACK_ENV'] || 'development'
21
+
22
+ logger = if %w[development test].include? env
23
+ log_dir = File.join(Dir.getwd, 'log')
24
+ log_file = File.join(log_dir, 'db.log')
25
+ FileUtils.mkdir(log_dir) unless Dir.exist?(log_dir)
26
+ Logger.new(File.open(log_file, 'a'))
27
+ else
28
+ Logger.new($stdout)
29
+ end
30
+
31
+ DB.loggers << logger
32
+
20
33
  # FIXME: maybe remove it later …
21
34
  # see: https://groups.google.com/forum/#!topic/sequel-talk/QIIv5qoltjs
22
35
  Sequel::Model.require_valid_table = false
36
+ Sequel::Model.plugin :force_encoding, 'UTF-8'
23
37
  FILE
24
38
  end
25
39
 
@@ -60,13 +74,10 @@ module Starter
60
74
 
61
75
  desc "Prints current schema version"
62
76
  task version: :connect do
63
- version = if DB.tables.include?(:schema_info)
64
- DB[:schema_info].first[:version]
65
- end || 0
77
+ version = DB.tables.include?(:schema_info) ? DB[:schema_info].first[:version] : 0
66
78
 
67
79
  $stdout.print 'Schema Version: '
68
- $stdout.print version
69
- $stdout.print "\n"
80
+ $stdout.puts version
70
81
  end
71
82
 
72
83
  desc 'Run all migrations in db/migrations'
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'yaml'
4
+
3
5
  module Starter
4
6
  class Config
5
7
  class << self
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Starter
4
- VERSION = '0.8.3'
4
+ VERSION = '0.8.4'
5
5
  end
@@ -0,0 +1,8 @@
1
+ .DS_Store
2
+ .rvmrc
3
+ .redcar
4
+ .irbrc
5
+ .bundle
6
+ Gemfile.lock
7
+ tmp/
8
+ log/
@@ -10,8 +10,7 @@ AllCops:
10
10
  TargetRubyVersion: 2.4
11
11
 
12
12
  Metrics/BlockLength:
13
- Exclude:
14
- - 'api/endpoints/**/*'
13
+ Enabled: false
15
14
 
16
15
  Metrics/LineLength:
17
16
  Max: 120
data/template/Rakefile CHANGED
@@ -2,23 +2,25 @@
2
2
 
3
3
  require 'rake'
4
4
 
5
- require 'rspec/core'
6
- require 'rspec/core/rake_task'
7
-
8
- RSpec::Core::RakeTask.new(:spec)
5
+ require File.expand_path('../config/environment', __FILE__)
9
6
 
10
7
  task :environment do
11
8
  ENV['RACK_ENV'] ||= 'development'
12
- require File.expand_path('../config/environment', __FILE__)
13
9
  end
14
10
 
11
+ # rspec tasks
12
+ require 'rspec/core'
13
+ require 'rspec/core/rake_task'
14
+ RSpec::Core::RakeTask.new(:spec)
15
+
16
+ # rubocop tasks
15
17
  require 'rubocop/rake_task'
16
18
  RuboCop::RakeTask.new(:rubocop)
17
19
 
18
20
  task default: [:spec, :rubocop]
19
21
 
20
- require File.expand_path('../config/environment', __FILE__)
21
22
 
23
+ # grape-swagger tasks
22
24
  require 'grape-swagger/rake/oapi_tasks'
23
25
  GrapeSwagger::Rake::OapiTasks.new(::Api::Base)
24
26
 
data/template/config.ru CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  require 'rack/cors'
4
- require_relative 'config/application'
4
+ require_relative 'config/environment'
5
5
 
6
6
  use Rack::CommonLogger
7
7
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- ENV['RACK_ENV'] ||= 'test'
3
+ ENV['RACK_ENV'] ||= 'development'
4
4
 
5
- require File.expand_path('../application', __FILE__)
5
+ require_relative 'application'
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.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - LeFnord
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-06 00:00:00.000000000 Z
11
+ date: 2017-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -101,6 +101,7 @@ files:
101
101
  - lib/starter/rake/grape_tasks.rb
102
102
  - lib/starter/rspec/request_specs.rb
103
103
  - lib/starter/version.rb
104
+ - template/.gitignore
104
105
  - template/.rubocop.yml
105
106
  - template/.rubocop_todo.yml
106
107
  - template/Gemfile