schema_to_scaffold 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d673c2a71ab1f619041dc8044c8be792aa9c616
4
- data.tar.gz: f409f89344e0108f61a374383e8a61259409eea8
3
+ metadata.gz: 07a5fd72e0c73d1ffb171bc0bfacb4702fc95954
4
+ data.tar.gz: f0347470eb6a7fa6f5c1d8c390ed1c1e15fe7d55
5
5
  SHA512:
6
- metadata.gz: 78af7d0a89aec5adfdf5f7c51cb0fb33153d55a86c8487b122c515db7d94e8967045e87c569c9100fe3b1d27a7b8ace46e4d3ae01835bf9aebf268327a22dfac
7
- data.tar.gz: f118752b73266eae93a6455d20fb0cf735c85dce954887db98b4f47af04e741d087ac1b86165a181c9419ab3a7f56f5f67d7b5a0b5852e93e4f8d97f891b919c
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 choose `*` when choosing the table.
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 will let you invoke 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.
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 please.
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
- tables.each { |table_id| script << SchemaToScaffold.generate_script(schema, table_id, target) }
57
- script << " --no-migration" unless opts[:migration] || opts[:factory_girl]
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
- return "rails generate #{target} #{modelize name} #{attributes_list}"
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)
@@ -1,6 +1,6 @@
1
1
  module SchemaToScaffold
2
2
  MAJOR = 0
3
3
  MINOR = 5
4
- REVISION = 2
4
+ REVISION = 3
5
5
  VERSION = [MAJOR, MINOR, REVISION].join('.')
6
6
  end
@@ -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
@@ -20,5 +20,5 @@ EOD
20
20
  gem.post_install_message = "Thanks for installing!"
21
21
  gem.licenses = ['MIT']
22
22
 
23
- gem.add_dependency('activesupport', '>= 3.2.1')
23
+ gem.add_dependency('activesupport-inflector', '~> 0.1.0')
24
24
  end
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.2
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-07-10 00:00:00.000000000 Z
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: 3.2.1
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: 3.2.1
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.0.3
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.