babaloa 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6dfa2ceb70c00495a1b6a702fe5d5ba5b69b37d41086f60230112603caf592bc
4
+ data.tar.gz: 59b2e1729b54655849b58f753c9de74bec202c90202d8a3a4d908b741f273301
5
+ SHA512:
6
+ metadata.gz: f02b2153b16e6d047cbdb4293d68c541a77f5efc0183e0ba7f11ee43d456539f230a216fd92ca57893779e362bcb09b5db799b221d1f2633beafe73111c6d9f5
7
+ data.tar.gz: b27e8beed3308fd5ca307ce5086c6906b5f45416bec87a1e26cafff120cb06fe181801389e17c28e969c40fb2e275ce4c55ea99b1901e905674514726d5c98a9
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .byebug_history
13
+ .gem
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.0
7
+ before_install: gem install bundler -v 2.0.1
data/Dockerfile ADDED
@@ -0,0 +1,21 @@
1
+ # use ruby version 2.6.3
2
+ FROM ruby:2.6.3
3
+
4
+ # using japanese on rails console
5
+ ENV LANG C.UTF-8
6
+
7
+ # remove warn
8
+ ENV DEBCONF_NOWARNINGS yes
9
+ ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE yes
10
+ ENV XDG_CACHE_HOME /tmp
11
+ EXPOSE 3000
12
+
13
+ # install package to docker container
14
+ RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
15
+
16
+ # setting work directory
17
+ RUN mkdir /app
18
+ WORKDIR /app
19
+ COPY . /app
20
+
21
+ RUN gem install bundler && bundle install
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in babaloa.gemspec
4
+ gemspec
5
+
6
+ gem "byebug", platform: :mri, group: %i(development test)
data/Gemfile.lock ADDED
@@ -0,0 +1,37 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ babaloa (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ byebug (11.0.1)
10
+ diff-lcs (1.3)
11
+ rake (10.5.0)
12
+ rspec (3.8.0)
13
+ rspec-core (~> 3.8.0)
14
+ rspec-expectations (~> 3.8.0)
15
+ rspec-mocks (~> 3.8.0)
16
+ rspec-core (3.8.0)
17
+ rspec-support (~> 3.8.0)
18
+ rspec-expectations (3.8.3)
19
+ diff-lcs (>= 1.2.0, < 2.0)
20
+ rspec-support (~> 3.8.0)
21
+ rspec-mocks (3.8.0)
22
+ diff-lcs (>= 1.2.0, < 2.0)
23
+ rspec-support (~> 3.8.0)
24
+ rspec-support (3.8.0)
25
+
26
+ PLATFORMS
27
+ ruby
28
+
29
+ DEPENDENCIES
30
+ babaloa!
31
+ bundler (~> 2.0)
32
+ byebug
33
+ rake (~> 10.0)
34
+ rspec (~> 3.0)
35
+
36
+ BUNDLED WITH
37
+ 2.0.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 takuma_bishan.abewadana
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Babaloa
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/babaloa`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'babaloa'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install babaloa
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/babaloa.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/babaloa.gemspec ADDED
@@ -0,0 +1,42 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "babaloa/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "babaloa"
8
+ spec.version = Babaloa::VERSION
9
+ spec.authors = ["belion-freee"]
10
+ spec.email = ["belion.freee@gmail.com"]
11
+
12
+ spec.summary = %q{CSV generator gem for ActiveRecord}
13
+ spec.description = %q{CSV generator gem for ActiveRecord}
14
+ spec.homepage = "https://github.com/belion-freee/babaloa"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ # if spec.respond_to?(:metadata)
20
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
21
+ #
22
+ # spec.metadata["homepage_uri"] = spec.homepage
23
+ # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
24
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
25
+ # else
26
+ # raise "RubyGems 2.0 or newer is required to protect against " \
27
+ # "public gem pushes."
28
+ # end
29
+
30
+ # Specify which files should be added to the gem when it is released.
31
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
32
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
33
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
34
+ end
35
+ spec.bindir = "exe"
36
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
+ spec.require_paths = ["lib"]
38
+
39
+ spec.add_development_dependency "bundler", "~> 2.0"
40
+ spec.add_development_dependency "rake", "~> 10.0"
41
+ spec.add_development_dependency "rspec", "~> 3.0"
42
+ end
data/bin/console ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "babaloa"
5
+ require "irb"
6
+
7
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ docker-compose build
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,8 @@
1
+ version: "3"
2
+ services:
3
+ app:
4
+ build: .
5
+ volumes:
6
+ - .:/app
7
+ environment:
8
+ HOME: /app
data/lib/babaloa.rb ADDED
@@ -0,0 +1,101 @@
1
+ require "babaloa/version"
2
+ require "babaloa/config"
3
+ require "csv"
4
+ require "byebug" # TODO: debugger
5
+ module Babaloa
6
+ class BabaloaError < StandardError; end
7
+
8
+ class << self
9
+ def to_csv(data, h = true, **options)
10
+ raise ArgumentError, "data must be Array" unless data.is_a?(Array)
11
+ raise ArgumentError, "content must be Array or Hash" unless data.empty? || data.first.is_a?(Array) || data.first.is_a?(Hash)
12
+
13
+ if h && !data.empty?
14
+ if data.first.is_a?(Hash)
15
+ header = data.first.keys.map(&:to_sym)
16
+ header = only_by(header, **options)
17
+ header = except_by(header, **options)
18
+ else
19
+ header = data.first.map(&:to_sym)
20
+ data = data.drop(1)
21
+ end
22
+
23
+ data = order_by(data, header, **options)
24
+ end
25
+
26
+ CSV.generate do |csv|
27
+ csv << transrate_by(header, **options) if h && header
28
+ data.each{|res|
29
+ if res.is_a?(Hash)
30
+ raise ArgumentError, "Header required if content is Hash" unless h
31
+ csv << header.map {|k| res[k] || res[k.to_s] }
32
+ else
33
+ csv << res
34
+ end
35
+ }
36
+ end
37
+ end
38
+
39
+ def order_by(data, header, **options)
40
+ sort = options[:sort] || configuration.define(options[:name], :sort) || configuration.default[:sort]
41
+ return data unless sort
42
+
43
+ if sort.is_a?(Hash)
44
+ k, v = sort.first
45
+ k = header.index(k.to_sym) if data.first.is_a?(Array)
46
+ data.sort_by! {|col| col[k] }
47
+ data.reverse! if v == :desc
48
+ elsif sort.is_a?(Symbol) || sort.is_a?(String)
49
+ sort = header.index(sort.to_sym) if data.first.is_a?(Array)
50
+ data.sort_by! {|col| col[sort] }
51
+ else
52
+ raise ArgumentError, "sort option must be Hash, Symbol, String."
53
+ end
54
+
55
+ data
56
+ end
57
+
58
+ def only_by(header, **options)
59
+ only = options[:only] || configuration.define(options[:name], :only) || configuration.default[:only]
60
+ return header unless only
61
+
62
+ if only.is_a?(Array)
63
+ header.select! {|k| only.include?(k) }
64
+ elsif only.is_a?(Symbol)
65
+ header.select! {|k| only == k }
66
+ else
67
+ raise ArgumentError, "only option must be Array, Symbol"
68
+ end
69
+
70
+ header
71
+ end
72
+
73
+ def except_by(header, **options)
74
+ except = options[:except] || configuration.define(options[:name], :except) || configuration.default[:except]
75
+ return header unless except
76
+
77
+ if except.is_a?(Array)
78
+ header.reject! {|k| except.include?(k) }
79
+ elsif except.is_a?(Symbol)
80
+ header.reject! {|k| except == k }
81
+ else
82
+ raise ArgumentError, "except option must be Array, Symbol"
83
+ end
84
+
85
+ header
86
+ end
87
+
88
+ def transrate_by(header, **options)
89
+ t = options[:t] || configuration.define(options[:name], :t) || configuration.default[:t]
90
+ return header unless t
91
+
92
+ if t.is_a?(Hash)
93
+ header.map! {|k| t[k] || t[k.to_s] }.compact!
94
+ else
95
+ raise ArgumentError, "t option must be Hash"
96
+ end
97
+
98
+ header
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,25 @@
1
+ module Babaloa
2
+ class << self
3
+ def configure
4
+ yield(configuration)
5
+ end
6
+
7
+ def configuration
8
+ @configuration ||= Configuration.new
9
+ end
10
+ end
11
+
12
+ class Configuration
13
+ attr_accessor :default, :definition
14
+
15
+ def initialize
16
+ @default = {}
17
+ @definition = {}
18
+ end
19
+
20
+ def define(name, key)
21
+ return unless name || key
22
+ @definition[name]&.[](key)
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ module Babaloa
2
+ VERSION = "0.1.0"
3
+ end
data/qs ADDED
@@ -0,0 +1,416 @@
1
+ #!/bin/bash
2
+
3
+ dc=$(which docker-compose) # docker-compose command with full path
4
+
5
+ if [[ -x "$dc" ]]; then
6
+ :
7
+ else
8
+ echo "Please install Docker before run this command."
9
+ exit 2
10
+ fi
11
+
12
+ rm="--rm" # To destroy a container
13
+
14
+ app="app" # describe $application service name from docker-compose.yml
15
+
16
+ db="db" # describe database service name from docker-compose.yml
17
+
18
+ front="webpack" # describe webpacker service name from docker-compose.yml
19
+
20
+ app_name=`pwd | awk -F "/" '{ print $NF }'` # get project dir name
21
+
22
+ # define container name
23
+ app_container="${app_name}_${app}_1"
24
+ db_container="${app_name}_${db}_1"
25
+ front_container="${app_name}_${front}_1"
26
+
27
+ echoing() {
28
+ echo "========================================================"
29
+ echo "$1"
30
+ echo "========================================================"
31
+ }
32
+
33
+ rm_pids() {
34
+ if [ -f "tmp/pids/server.pid" ]; then
35
+ rm -f tmp/pids/server.pid
36
+ fi
37
+ }
38
+
39
+ create_project() {
40
+ echoing "Exec Bundle Install for executing rails new command"
41
+ # set options
42
+ test_option=" -T"
43
+ front_option=" --webpack"
44
+ db_option="postgresql"
45
+ for arg in $@
46
+ do
47
+ case $arg in
48
+ "test=true") test_option="" ;;
49
+ "webpack=false") front_option="" ;;
50
+ "db=mysql") db_option="mysql" ;;
51
+ *) ;;
52
+ esac
53
+ done
54
+
55
+ echo "front option setting by$front_option"
56
+ echo "test option setting by$test_option"
57
+ echo "db option setting by $db_option"
58
+
59
+ row_num="23,38d"
60
+ if [ "mysql" == "$db_option" ]; then
61
+ mv -f database.mysql.yml database.default.yml
62
+ mv -f docker-compose.mysql.yml docker-compose.yml
63
+ row_num="25,40d"
64
+ else
65
+ rm docker-compose.mysql.yml
66
+ rm database.mysql.yml
67
+ fi
68
+
69
+ if [ "" == "$front_option" ]; then
70
+ sed -i '' -e $row_num docker-compose.yml
71
+ fi
72
+
73
+ echoing "Exec Bundle Install for executing rails new command"
74
+ bundle_cmd install
75
+
76
+ echoing "Exec rails new with postgresql and webpack"
77
+ bundle_exec rails new . -f -d=$db_option$front_option$test_option
78
+
79
+ echoing "Update config/database.yml"
80
+ mv database.default.yml config/database.yml
81
+
82
+ echoing "Exec db create"
83
+ bundle_exec rails db:create
84
+
85
+ echoing "docker-compose up"
86
+ $dc up -d
87
+
88
+ echo "You can access to localhost:3000"
89
+ }
90
+
91
+ init_services() {
92
+ echoing "Building containers"
93
+ $dc build --no-cache
94
+
95
+ bundle_cmd install
96
+ run_yarn install
97
+ rails_cmd db:migrate:reset
98
+ rails_cmd db:seed
99
+
100
+ rm_pids
101
+
102
+ $dc up
103
+ }
104
+
105
+ compose_up() {
106
+ echoing "Create and start containers $*"
107
+ rm_pids
108
+ $dc up -d "$1"
109
+ }
110
+
111
+ compose_down() {
112
+ echoing "Stop and remove containers $*"
113
+ $dc down $*
114
+ }
115
+
116
+ compose_build() {
117
+ echoing "Build containers $*"
118
+ $dc build $*
119
+ }
120
+
121
+ compose_start() {
122
+ echoing "Start services $*"
123
+ rm_pids
124
+ $dc start $*
125
+ }
126
+
127
+ compose_stop() {
128
+ echoing "Stop services $*"
129
+ $dc stop $*
130
+ }
131
+
132
+ compose_restart() {
133
+ echoing "Restart services $*"
134
+ $dc restart $*
135
+ }
136
+
137
+ compose_ps() {
138
+ echoing "Showing running containers"
139
+ $dc ps
140
+ }
141
+
142
+ logs() {
143
+ echoing "Logs $*"
144
+ $dc logs -f $1
145
+ }
146
+
147
+ invoke_bash() {
148
+ $dc run $rm -u root $1 bash
149
+ }
150
+
151
+ invoke_run() {
152
+ renv=""
153
+ if [ -n "$RAILS_ENV" ]; then
154
+ renv="-e RAILS_ENV=$RAILS_ENV "
155
+ fi
156
+
157
+ if [ -n "$TRUNCATE_LOGS" ]; then
158
+ renv="$renv -e TRUNCATE_LOGS=$TRUNCATE_LOGS "
159
+ fi
160
+
161
+ dbenv=""
162
+ if [ -n "$DISABLE_DATABASE_ENVIRONMENT_CHECK" ]; then
163
+ dbenv="-e DISABLE_DATABASE_ENVIRONMENT_CHECK=$DISABLE_DATABASE_ENVIRONMENT_CHECK "
164
+ fi
165
+
166
+ $dc run $rm ${renv}${dbenv}$*
167
+ }
168
+
169
+ run_app() {
170
+ invoke_run $app $*
171
+ }
172
+
173
+ run_db() {
174
+ invoke_run $db $*
175
+ }
176
+
177
+ run_front() {
178
+ invoke_run $front $*
179
+ }
180
+
181
+ rails_server() {
182
+ compose_stop $app
183
+ rm_pids
184
+
185
+ renv=""
186
+ if [ -n "$RAILS_ENV" ]; then
187
+ renv="-e RAILS_ENV=$RAILS_ENV "
188
+ fi
189
+
190
+ $dc run $rm ${renv}--service-ports $app rails s -p 3000 -b 0.0.0.0
191
+ }
192
+
193
+ rails_db() {
194
+ case "$1" in
195
+ set)
196
+ rails_cmd db:migrate
197
+ ;;
198
+ up)
199
+ rails_cmd db:migrate:up VERSION="$2"
200
+ ;;
201
+ down)
202
+ rails_cmd db:migrate:down VERSION="$2"
203
+ ;;
204
+ reset)
205
+ rails_cmd db:reset
206
+ ;;
207
+ *)
208
+ rails_cmd db:migrate:status
209
+ ;;
210
+ esac
211
+ }
212
+
213
+ rails_cmd() {
214
+ bundle_exec rails $*
215
+ }
216
+
217
+ rake_cmd() {
218
+ bundle_exec rake $*
219
+ }
220
+
221
+ rspec_cmd() {
222
+ bundle_exec rspec $*
223
+ }
224
+
225
+ test_cmd() {
226
+ bundle_exec test $*
227
+ }
228
+
229
+ bundle_cmd() {
230
+ run_app bundle $*
231
+ }
232
+
233
+ bundle_exec() {
234
+ run_app bundle exec $*
235
+ }
236
+
237
+ rubocop_cmd() {
238
+ bundle_exec rubocop $*
239
+ }
240
+
241
+ rails_console() {
242
+ bundle_exec rails c $*
243
+ }
244
+
245
+ rake_reset_db() {
246
+ echoing "Running reset db"
247
+ compose_stop $app
248
+ DISABLE_DATABASE_ENVIRONMENT_CHECK=1 rake_cmd "db:reset"
249
+ rake_cmd "db:fdw:setup"
250
+ RAILS_ENV=test rake_cmd "db:fdw:setup"
251
+ compose_up $app
252
+ }
253
+
254
+ db_console() {
255
+ # from config/database.yml
256
+ database="development"
257
+ username="postgres"
258
+ port="5432"
259
+
260
+ run_db psql -h $db_container -p $port -U $username $database
261
+ }
262
+
263
+ db_dump() {
264
+ # from config/database.yml
265
+ database="development"
266
+ username="postgres"
267
+ port="5432"
268
+
269
+ tm=$(date +\%Y\%m\%d-\%H\%M)
270
+ dump_file=tmp/dbdump-${dbname}-${tm}.dump
271
+
272
+ echoing "Dump database $dbname data to $dump_file"
273
+
274
+ run_db pg_dump -h $db_container -p $port -U $username --disable-triggers $database > $dump_file
275
+ echo "done"
276
+ }
277
+
278
+ run_yarn() {
279
+ run_front bin/yarn $*
280
+ }
281
+
282
+ run_npm() {
283
+ run_front npm $*
284
+ }
285
+
286
+ run_webpack() {
287
+ run_front webpack $*
288
+ }
289
+
290
+ cmd=$1
291
+ shift
292
+ case "$cmd" in
293
+ setup)
294
+ create_project $* && exit 0
295
+ ;;
296
+ init)
297
+ init_services && exit 0
298
+ ;;
299
+ ps)
300
+ compose_ps && exit 0
301
+ ;;
302
+ up)
303
+ compose_up $* && compose_ps && exit 0
304
+ ;;
305
+ build)
306
+ compose_build $* && exit 0
307
+ ;;
308
+ start)
309
+ compose_start $* && exit 0
310
+ ;;
311
+ stop)
312
+ compose_stop $* && exit 0
313
+ ;;
314
+ restart)
315
+ compose_restart $* && exit 0
316
+ ;;
317
+ down)
318
+ compose_down $* && exit 0
319
+ ;;
320
+ logs)
321
+ logs $*
322
+ ;;
323
+ bash)
324
+ invoke_bash $*
325
+ ;;
326
+ run)
327
+ invoke_run $*
328
+ ;;
329
+ server)
330
+ rails_server $*
331
+ ;;
332
+ rails)
333
+ rails_cmd $*
334
+ ;;
335
+ db)
336
+ rails_db $*
337
+ ;;
338
+ cons)
339
+ rails_console $*
340
+ ;;
341
+ rake)
342
+ rake_cmd $*
343
+ ;;
344
+ rspec)
345
+ rspec_cmd $*
346
+ ;;
347
+ test)
348
+ test_cmd $*
349
+ ;;
350
+ bundle)
351
+ bundle_cmd $*
352
+ ;;
353
+ rubocop)
354
+ rubocop_cmd $*
355
+ ;;
356
+ reset-db)
357
+ rake_reset_db
358
+ ;;
359
+ psql)
360
+ db_console $*
361
+ ;;
362
+ db-dump)
363
+ db_dump $*
364
+ ;;
365
+ yarn)
366
+ run_yarn $*
367
+ ;;
368
+ npm)
369
+ run_npm $*
370
+ ;;
371
+ webpack)
372
+ run_webpack $*
373
+ ;;
374
+ *)
375
+ read -d '' help <<-EOF
376
+ Usage: $0 command
377
+
378
+ Service:
379
+ setup Create new rails application
380
+ init Initialize backend services then run
381
+ ps Show status of services
382
+ up Create service containers and start backend services
383
+ down Stop backend services and remove service containers
384
+ start Start services
385
+ stop Stop services
386
+ logs [options] default: none. View output from containers
387
+ bash [service] invoke bash
388
+ run [service] [command] run command in given container
389
+
390
+ App:
391
+ server Run rails server
392
+ rails [args] Run rails command in application container
393
+ rake [args] Run rake command in application container
394
+ db [args] Run rails db command you can use set(migrate), up, down, reset, other is status
395
+ ex: ./qs db set #running rails db:migrate
396
+ ./qs db up 2019010101 #running rails db:migrate:up VERSION=2019010101
397
+ rspec [args] Run rspec command in application container
398
+ test [args] Run Minitest command in application container
399
+ bundle [args] Run bundle command in application container
400
+ cons Run rails console
401
+ rubocop [args] Run rubocop
402
+
403
+ Frontend
404
+ yarn Run yarn command in Frontend container
405
+ npm Run npm command in Frontend container
406
+ webpack Run webpack command in Frontend container
407
+
408
+ DB:
409
+ reset-db reset database in DB container
410
+ psql launch psql console in DB container
411
+ pg-dump dump database data as sql file in DB container
412
+ EOF
413
+ echo "$help"
414
+ exit 2
415
+ ;;
416
+ esac
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: babaloa
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - belion-freee
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-05-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: CSV generator gem for ActiveRecord
56
+ email:
57
+ - belion.freee@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Dockerfile
66
+ - Gemfile
67
+ - Gemfile.lock
68
+ - LICENSE.txt
69
+ - README.md
70
+ - Rakefile
71
+ - babaloa.gemspec
72
+ - bin/console
73
+ - bin/setup
74
+ - docker-compose.yml
75
+ - lib/babaloa.rb
76
+ - lib/babaloa/config.rb
77
+ - lib/babaloa/version.rb
78
+ - qs
79
+ homepage: https://github.com/belion-freee/babaloa
80
+ licenses:
81
+ - MIT
82
+ metadata: {}
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.7.3
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: CSV generator gem for ActiveRecord
103
+ test_files: []