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 +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +2 -2
- data/lib/starter/builder/templates/activerecord.rb +7 -7
- data/lib/starter/builder/templates/sequel.rb +16 -5
- data/lib/starter/config.rb +2 -0
- data/lib/starter/version.rb +1 -1
- data/template/.gitignore +8 -0
- data/template/.rubocop.yml +1 -2
- data/template/Rakefile +8 -6
- data/template/config.ru +1 -1
- data/template/config/environment.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c784e58c2cc7e636d53f3f780155ad9b63c67ea4
|
4
|
+
data.tar.gz: 9d73dd73328a762aaccb3d8a7a5189d4050137e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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/
|
169
|
-
3. An entry in the description of the [`
|
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
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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 =
|
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.
|
69
|
-
$stdout.print "\n"
|
80
|
+
$stdout.puts version
|
70
81
|
end
|
71
82
|
|
72
83
|
desc 'Run all migrations in db/migrations'
|
data/lib/starter/config.rb
CHANGED
data/lib/starter/version.rb
CHANGED
data/template/.gitignore
ADDED
data/template/.rubocop.yml
CHANGED
data/template/Rakefile
CHANGED
@@ -2,23 +2,25 @@
|
|
2
2
|
|
3
3
|
require 'rake'
|
4
4
|
|
5
|
-
require '
|
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
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.
|
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-
|
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
|