grapethor 0.2.2 → 0.2.3

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
  SHA256:
3
- metadata.gz: 34bea2dd1529d4854da3b0977935ff239c022fc159eaaf1316564ebcb78c54e8
4
- data.tar.gz: 20ddda30a361cdbc7e1e7299a748533233e77c8236ecb055da51cda74a8d108d
3
+ metadata.gz: e9187bde9ed9fb9f465935964e21b543d3a8d48cd026a1637f27db3c64c9a447
4
+ data.tar.gz: a559bbc74c883c306c2518ceeed6d507051f78dc21cf8110ed9e2266fa2a1de2
5
5
  SHA512:
6
- metadata.gz: 0bed46f98d9963e015120741eb68d8be17baa78162390b442b2c04c5a3aef22af1928ab7ea16ad319994643aa040c1edd5cda28e91bdf65ee5d3dcffa8bff0a0
7
- data.tar.gz: 6de3392a82a03732209e68261abee6140d9152a1ec2880dedf17c0bedac18b67d76eb928c4987f010ce1b5824d5043953ab18299ca5c0c2aaf6378011d678c29
6
+ metadata.gz: b3673e24a176dba4fe366f12e382b42fed8f1f02dd978876866e501e66c20112bff2915f4699c5c2bdf338df8a6f4a82fbc68b24f3cfac556496ac41ec148b0c
7
+ data.tar.gz: 1bf283d3d109bc4739ae5c677fbd062e2e20b039ee7fe494e9a41c61234b85a18aa61e1e822880e76e0f984f30ee960688d89f370bc949865421e58ff388d986
@@ -7,6 +7,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.3] - 2020-03-08
11
+ ### Added
12
+ + add 'puma' to server options
13
+
14
+ ### Fixed
15
+ + fix --path option for CLI
16
+ + fix class descriptions for tests
17
+
18
+
10
19
  ## [0.2.2] - 2020-02-29
11
20
  ### Fixed
12
21
  + update rake requirement from ~> 10.0 to ~> 13.0
@@ -23,5 +32,5 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
23
32
 
24
33
 
25
34
  ## [0.1.0] - 2019-04-10
26
- ###Added
35
+ ### Added
27
36
  + migrate source code from rawongithub/graperator gem
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grapethor (0.2.2)
4
+ grapethor (0.2.3)
5
5
  activesupport (~> 5.2)
6
6
  thor (~> 1.0.1)
7
7
 
data/README.md CHANGED
@@ -50,7 +50,7 @@ Options:
50
50
  # Possible values: activerecord
51
51
  -s, [--server=SERVER] # Preconfigure web server
52
52
  # Default: thin
53
- # Possible values: thin
53
+ # Possible values: thin, puma
54
54
  -t, [--test=TEST] # Use specific test framework
55
55
  # Default: minitest
56
56
  # Possible values: minitest, rspec
@@ -64,15 +64,20 @@ module Grapethor
64
64
  end
65
65
 
66
66
  def app_name
67
- @app_name ||= YAML.load(File.read(CONFIG_FILENAME))['app_name']
67
+ @app_name ||= config_filename(app_path)['app_name']
68
68
  end
69
69
 
70
70
  def app_prefix
71
- @app_prefix ||= YAML.load(File.read(CONFIG_FILENAME))['app_prefix']
71
+ @app_prefix ||= config_filename(app_path)['app_prefix']
72
72
  end
73
73
 
74
74
  def app_swagger?
75
- @app_swagger||= YAML.load(File.read(CONFIG_FILENAME))['app_swagger']
75
+ @app_swagger ||= config_filename(app_path)['app_swagger']
76
76
  end
77
+
78
+ def app_test_framework
79
+ @app_test_framework ||= config_filename(@app_path)['app_test_framework']
80
+ end
81
+
77
82
  end
78
83
  end
@@ -164,5 +164,28 @@ module Grapethor
164
164
  def end_resource_plural
165
165
  end_resource.pluralize
166
166
  end
167
+
168
+
169
+ def app_test_framework
170
+ @app_test_framework ||= config_filename(@app_path)['app_test_framework']
171
+ end
172
+
173
+ def app_orm
174
+ @app_orm ||= config_filename(@app_path)['app_orm']
175
+ end
176
+
177
+
178
+ def param_to_type(param)
179
+ ATTRS_MAP.dig(app_orm.to_sym, param.to_sym, :type) || 'Unknown'
180
+ end
181
+
182
+ def sample_value(param, path=false)
183
+ val = ATTRS_MAP.dig(app_orm.to_sym, param.to_sym, :sample)
184
+ if path && val.respond_to?(:tr!)
185
+ val.tr!("'", "")
186
+ end
187
+ val || 'unknown'
188
+ end
189
+
167
190
  end
168
191
  end
@@ -58,7 +58,7 @@ module Grapethor
58
58
  class_option :server, aliases: '-s',
59
59
  type: :string,
60
60
  default: 'thin',
61
- enum: %w[thin],
61
+ enum: %w[thin puma],
62
62
  desc: 'Preconfigure web server'
63
63
 
64
64
  class_option :test, aliases: '-t',
@@ -78,16 +78,43 @@ module Grapethor
78
78
  Dir.exist?("#{app_path}/api/#{api_version}")
79
79
  end
80
80
 
81
+
81
82
  def res_migration
82
83
  "#{Time.now.strftime("%Y%m%d%H%M%S")}_create_#{res_name.pluralize}"
83
84
  end
84
85
 
86
+
85
87
  def res_name_plural
86
88
  res_name.pluralize
87
89
  end
88
90
 
91
+
89
92
  def app_prefix
90
- @app_prefix ||= YAML.load(File.read(CONFIG_FILENAME))['app_prefix']
93
+ @app_prefix ||= config_filename(@app_path)['app_prefix']
94
+ end
95
+
96
+
97
+ def app_test_framework
98
+ @app_test_framework ||= config_filename(@app_path)['app_test_framework']
99
+ end
100
+
101
+
102
+ def app_orm
103
+ @app_orm ||= config_filename(@app_path)['app_orm']
104
+ end
105
+
106
+
107
+ def param_to_type(param)
108
+ ATTRS_MAP.dig(app_orm.to_sym, param.to_sym, :type) || 'Unknown'
109
+ end
110
+
111
+
112
+ def sample_value(param, path=false)
113
+ val = ATTRS_MAP.dig(app_orm.to_sym, param.to_sym, :sample)
114
+ if path && val.respond_to?(:tr!)
115
+ val.tr!("'", "")
116
+ end
117
+ val || 'unknown'
91
118
  end
92
119
 
93
120
  end
@@ -87,22 +87,12 @@ module Grapethor
87
87
  end
88
88
 
89
89
 
90
- def param_to_type(param)
91
- ATTRS_MAP.dig(app_orm.to_sym, param.to_sym, :type) || 'Unknown'
92
- end
93
-
94
-
95
- def sample_value(param, path=false)
96
- val = ATTRS_MAP.dig(app_orm.to_sym, param.to_sym, :sample)
97
- if path && val.respond_to?(:tr!)
98
- val.tr!("'", "")
90
+ def config_filename(app_path)
91
+ begin
92
+ YAML.load(File.read(File.join(app_path, CONFIG_FILENAME)))
93
+ rescue Errno::ENOENT, Errno::EACCES
94
+ say "\n ERROR: Config file not found. Try grapethor command with -p, [--path=PATH] option."
99
95
  end
100
- val || 'unknown'
101
- end
102
-
103
-
104
- def app_test_framework
105
- YAML.load(File.read(CONFIG_FILENAME))['app_test_framework']
106
96
  end
107
97
 
108
98
 
@@ -110,9 +100,5 @@ module Grapethor
110
100
  TEST_FRAMEWORK_DIRNAME[app_test_framework.to_sym]
111
101
  end
112
102
 
113
-
114
- def app_orm
115
- YAML.load(File.read(CONFIG_FILENAME))['app_orm']
116
- end
117
103
  end
118
104
  end
@@ -1,3 +1,3 @@
1
1
  module Grapethor
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grapethor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafal Wrzochol
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-01 00:00:00.000000000 Z
11
+ date: 2020-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor