schema_to_scaffold 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/bin/scaffold +2 -2
- data/lib/schema_to_scaffold/table.rb +6 -2
- data/lib/schema_to_scaffold/version.rb +1 -1
- data/lib/schema_to_scaffold.rb +2 -2
- data/schema_to_scaffold.gemspec +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07a5fd72e0c73d1ffb171bc0bfacb4702fc95954
|
4
|
+
data.tar.gz: f0347470eb6a7fa6f5c1d8c390ed1c1e15fe7d55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f31129826e687075cc094741a0478fb36dd719a6acf2fa54c5b6804e501244a7cc835c0c8b5bd207ea1faf384ce7821d951980de3699361f72303164ec602792
|
7
|
+
data.tar.gz: 54e9b54a1a9198051829666ee31f8a17341e35b7ed0db69887f81305ad839511dfa86c6c4a15a9f5ac26945ae392830be8e435e789577573e180ddcc53676d48
|
data/README.md
CHANGED
@@ -16,7 +16,7 @@ Schema to Scaffold output looks like this:
|
|
16
16
|
|
17
17
|
rails generate scaffold users fname:string lname:string bdate:date email:string encrypted_password:string
|
18
18
|
|
19
|
-
It's possible to generate scripts for all your tables at once. Just
|
19
|
+
It's possible to generate scripts for all your tables at once. Just enter `*` when selecting the table.
|
20
20
|
|
21
21
|
## Installation
|
22
22
|
|
@@ -43,7 +43,7 @@ scaffold -c -p ~/work/rails/my_app/db/schema.rb
|
|
43
43
|
```
|
44
44
|
## Generators
|
45
45
|
|
46
|
-
Since this gem
|
46
|
+
Since this gem assists you in invoking Rails generators for your scaffolding, make sure you've configured your generators with your preferred settings before you start. There's a good [Rails Guide](http://guides.rubyonrails.org/generators.html) and you can invoke `rails g scaffold -h` to see options.
|
47
47
|
|
48
48
|
Generator options are configured in `config/application.rb`. Here is an example setting:
|
49
49
|
|
@@ -89,4 +89,4 @@ Schema to Scaffold is set up by default to support creating scaffolds for your e
|
|
89
89
|
|
90
90
|
## Collaborate
|
91
91
|
|
92
|
-
If you want to collaborate send me an email
|
92
|
+
If you want to collaborate, please send me an email, or just create an issue or pull request.
|
data/bin/scaffold
CHANGED
@@ -53,8 +53,8 @@ end
|
|
53
53
|
|
54
54
|
script = []
|
55
55
|
target = opts[:factory_girl] ? "factory_girl:model" : "scaffold"
|
56
|
-
|
57
|
-
script <<
|
56
|
+
migragion_flag = opts[:migration] || opts[:factory_girl]
|
57
|
+
tables.each { |table_id| script << SchemaToScaffold.generate_script(schema, table_id, target, migragion_flag) }
|
58
58
|
output = script.join("")
|
59
59
|
puts "\nScript for #{target}:\n\n"
|
60
60
|
puts output
|
@@ -11,9 +11,13 @@ module SchemaToScaffold
|
|
11
11
|
@name, @attributes = name, attributes
|
12
12
|
end
|
13
13
|
|
14
|
-
def to_script(target)
|
14
|
+
def to_script(target,migragion_flag)
|
15
15
|
attributes_list = attributes.map(&:to_script).reject{|x| x.nil? || x.empty?}.join(' ')
|
16
|
-
|
16
|
+
script = []
|
17
|
+
script << "rails generate #{target} #{modelize name} #{attributes_list}"
|
18
|
+
script << " --no-migration" unless migragion_flag
|
19
|
+
script << "\n\n"
|
20
|
+
return script
|
17
21
|
end
|
18
22
|
|
19
23
|
def self.parse(table_data)
|
data/lib/schema_to_scaffold.rb
CHANGED
@@ -78,9 +78,9 @@ LINUX_SAMPLE
|
|
78
78
|
##
|
79
79
|
# Generates the rails scaffold script
|
80
80
|
|
81
|
-
def self.generate_script(schema, table=nil,target)
|
81
|
+
def self.generate_script(schema, table=nil,target,migragion_flag)
|
82
82
|
schema = Schema.new(schema) unless schema.is_a? Schema
|
83
83
|
return schema.to_script if table.nil?
|
84
|
-
schema.table(table).to_script target
|
84
|
+
schema.table(table).to_script target, migragion_flag
|
85
85
|
end
|
86
86
|
end
|
data/schema_to_scaffold.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schema_to_scaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- João Soares
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-09-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name: activesupport
|
15
|
+
name: activesupport-inflector
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 0.1.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: 0.1.0
|
28
28
|
description: |2
|
29
29
|
Command line app which parses a schema.rb file obtained from your rails repo or by running rake:schema:dump
|
30
30
|
email:
|
@@ -35,7 +35,7 @@ executables:
|
|
35
35
|
extensions: []
|
36
36
|
extra_rdoc_files: []
|
37
37
|
files:
|
38
|
-
- .gitignore
|
38
|
+
- ".gitignore"
|
39
39
|
- Gemfile
|
40
40
|
- LICENSE.txt
|
41
41
|
- README.md
|
@@ -58,17 +58,17 @@ require_paths:
|
|
58
58
|
- lib
|
59
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '0'
|
64
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
70
|
rubyforge_project:
|
71
|
-
rubygems_version: 2.
|
71
|
+
rubygems_version: 2.2.2
|
72
72
|
signing_key:
|
73
73
|
specification_version: 4
|
74
74
|
summary: Generate rails scaffold script from a schema.rb file.
|