schema_to_scaffold 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/bin/scaffold CHANGED
@@ -12,7 +12,7 @@ if opts[:help]
12
12
  exit 0
13
13
  end
14
14
 
15
- ## looking for schema.rb in user directory
15
+ ## looking for /schema\S*.rb$/ in user directory
16
16
 
17
17
  unless opts[:path].to_s.match(/\.rb$/)
18
18
  paths = SchemaToScaffold::Path.new(opts[:path])
@@ -9,7 +9,8 @@ module SchemaToScaffold
9
9
  class Path
10
10
 
11
11
  def initialize(path)
12
- @search_path = ENV[PATH_NAMES.detect {|home| ENV[home] != nil}]
12
+ #@search_path = ENV[PATH_NAMES.detect {|home| ENV[home] != nil}]
13
+ @search_path = Dir.pwd
13
14
  @path = path
14
15
  end
15
16
 
@@ -28,13 +29,17 @@ module SchemaToScaffold
28
29
  check_directory
29
30
  @schema_paths = Array.new
30
31
  Find.find(@search_path) do |s_p|
31
- @schema_paths<<s_p if s_p[/schema\.rb$/]
32
+ @schema_paths<<s_p if s_p[/schema[^\/]*.rb$/]
32
33
  end
33
34
  end
34
35
 
35
36
  ##
36
37
  # Return the chosen path
37
38
  def choose
39
+ if @schema_paths.empty?
40
+ puts "\nSorry there is none /schema\S*\.rb$/ in the directory #{@search_path}"
41
+ exit
42
+ end
38
43
  @schema_paths.each_with_index {|path,indx| puts "#{indx}. #{path}" }
39
44
  begin
40
45
  print "\nSelect a path to the target schema: "
@@ -1,6 +1,6 @@
1
1
  module SchemaToScaffold
2
- REVISION = 2
3
- MINOR = 2
2
+ REVISION = 0
3
+ MINOR = 3
4
4
  MAJOR = 0
5
5
  VERSION = [MAJOR, MINOR, REVISION].join('.')
6
6
  end
@@ -18,5 +18,5 @@ EOD
18
18
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
19
19
  gem.require_paths = ["lib"]
20
20
  gem.post_install_message = "Thanks for installing!"
21
- gem.licenses = ['MIT']
21
+ gem.licenses = ['MIT']
22
22
  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.2.2
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-01-17 00:00:00.000000000 Z
13
+ date: 2013-02-11 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: ! ' Command line app which parses a schema.rb file obtained from your
16
16
  rails repo or by running rake:schema:dump
@@ -63,3 +63,4 @@ signing_key:
63
63
  specification_version: 3
64
64
  summary: Generate rails scaffold script from a schema.rb file.
65
65
  test_files: []
66
+ has_rdoc: