scaffoldhub 0.1.1 → 0.1.2
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.
data/Gemfile.lock
CHANGED
@@ -16,14 +16,16 @@ module ActiveRecord
|
|
16
16
|
class_option :parent, :type => :string, :desc => "The parent class for the generated model"
|
17
17
|
|
18
18
|
def create_model_file
|
19
|
-
|
20
|
-
|
19
|
+
find_template_file(:model) do |model_template|
|
20
|
+
template model_template.src, File.join('app/models', class_path, "#{file_name}.rb")
|
21
|
+
end
|
21
22
|
end
|
22
23
|
|
23
24
|
def create_migration_file
|
24
25
|
return unless options[:migration] && options[:parent].nil?
|
25
|
-
|
26
|
-
|
26
|
+
find_template_file(:migration) do |migration_template|
|
27
|
+
migration_template migration_template.src, "db/migrate/create_#{table_name}.rb"
|
28
|
+
end
|
27
29
|
end
|
28
30
|
|
29
31
|
end
|
@@ -18,8 +18,9 @@ module ScaffoldController
|
|
18
18
|
class_option :local, :default => false, :banner => "LOCAL SCAFFOLD", :type => :boolean, :desc => "Use a local scaffold, not scaffoldhub.org"
|
19
19
|
|
20
20
|
def create_controller_files
|
21
|
-
|
22
|
-
|
21
|
+
find_template_file(:controller) do |controller_template_file|
|
22
|
+
template controller_template_file.src, File.join('app/controllers', class_path, "#{controller_file_name}_controller.rb")
|
23
|
+
end
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
data/lib/scaffoldhub.rb
CHANGED
data/lib/scaffoldhub/helper.rb
CHANGED
@@ -18,6 +18,7 @@ module Scaffoldhub
|
|
18
18
|
begin
|
19
19
|
scaffold_spec.select_files(type).each do |template_file|
|
20
20
|
yield template_file.download!
|
21
|
+
template_file.close
|
21
22
|
end
|
22
23
|
rescue Errno::ENOENT => e
|
23
24
|
say_status :error, e.message, :red
|
@@ -34,7 +35,10 @@ module Scaffoldhub
|
|
34
35
|
def find_template_file(type)
|
35
36
|
begin
|
36
37
|
template_file = scaffold_spec.find_file(type)
|
37
|
-
|
38
|
+
if template_file
|
39
|
+
yield template_file.download!
|
40
|
+
template_file.close
|
41
|
+
end
|
38
42
|
rescue Errno::ENOENT => e
|
39
43
|
say_status :error, e.message, :red
|
40
44
|
raise e
|
@@ -14,10 +14,14 @@ module Scaffoldhub
|
|
14
14
|
if @local
|
15
15
|
File.join(@base_url, @src)
|
16
16
|
else
|
17
|
-
@
|
17
|
+
@temp_file.path
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
def close
|
22
|
+
@temp_file.close if @temp_file
|
23
|
+
end
|
24
|
+
|
21
25
|
def dest
|
22
26
|
if @rename
|
23
27
|
File.join(@dest, @rename)
|
@@ -30,8 +34,8 @@ module Scaffoldhub
|
|
30
34
|
if @local
|
31
35
|
raise Errno::ENOENT.new(src) unless File.exists?(src)
|
32
36
|
else
|
33
|
-
@
|
34
|
-
open(@
|
37
|
+
@temp_file = Tempfile.new(File.basename(@src))
|
38
|
+
File.open(@temp_file.path, "wb") do |file|
|
35
39
|
file.write(remote_file_contents!)
|
36
40
|
end
|
37
41
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scaffoldhub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Pat Shaughnessy
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-11 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|