fanforce-app-factory 2.0.0.rc34 → 2.0.0.rc35

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -29,7 +29,9 @@ namespace :scaffolding do
29
29
  scaffolding_dir = File.expand_path('../lib/fanforce/app_factory/scaffolding', __FILE__)
30
30
 
31
31
  Dir.glob("#{scaffolding_dir}/**/*", File::FNM_DOTMATCH).each do |scaffold_filepath|
32
- next if scaffold_filepath =~ /\.registry/ or File.directory?(scaffold_filepath)
32
+ next if scaffold_filepath =~ /\.registry$/
33
+ next if scaffold_filepath =~ /\/readme$/
34
+ next if File.directory?(scaffold_filepath)
33
35
 
34
36
  file_parts = scaffold_filepath.split('/')
35
37
  registry_filepath = "#{file_parts[0...-1].join('/')}/._#{file_parts[-1]}.registry"
@@ -30,9 +30,14 @@ class Fanforce::AppFactory::CLI::Scaffolding
30
30
  # status = :exists, :current, :missing, :previous, :diverged, :forked
31
31
  change_data = {}
32
32
  files.each do |file|
33
- next change_data[file.filepath] = {
34
- status: File.directory?(file.filepath) ? :exists : :missing,
35
- } if File.directory?(file.scaffold_filepath)
33
+ if File.directory?(file.scaffold_filepath)
34
+ directory_exists = File.directory?(file.filepath)
35
+ change_data[file.filepath] = {status: directory_exists ? :exists : :missing}
36
+ if directory_exists and File.exists?("#{file.scaffold_filepath}readme") and Dir.glob("#{file.filepath}*").size == 0
37
+ change_data["#{file.filepath}readme"] = {status: :missing}
38
+ end
39
+ next
40
+ end
36
41
 
37
42
  status = file.status
38
43
  diff = file.diff_changes if [:previous,:diverged].include?(status)
@@ -58,6 +63,7 @@ class Fanforce::AppFactory::CLI::Scaffolding
58
63
  def files
59
64
  Dir.glob("#{self.class.dir}/**/*", File::FNM_DOTMATCH).inject([]) do |files, scaffold_filepath|
60
65
  next files if scaffold_filepath =~ /\.registry$/
66
+ next files if scaffold_filepath =~ /\/readme$/
61
67
  next files if scaffold_filepath =~ /\/\.\.?$/
62
68
  scaffold_filepath = "#{scaffold_filepath}/" if File.directory?(scaffold_filepath) and scaffold_filepath !~ /\/$/
63
69
  files << Fanforce::AppFactory::CLI::ScaffoldingFile.new(scaffold_filepath, app)
@@ -18,8 +18,13 @@ class Fanforce::AppFactory::CLI::ScaffoldingFile
18
18
 
19
19
  def create
20
20
  if File.directory?(scaffold_filepath)
21
- mkdir
22
- return nil
21
+ Dir.mkdir(filepath)
22
+ if File.exists?("#{scaffold_filepath}#{readme}")
23
+ File.open("#{filepath}#{readme}", 'w') {|f| f.write(File.open("#{scaffold_filepath}#{readme}").read) }
24
+ end
25
+
26
+ log "#{'Created'.format(:green,:bold)} #{relativepath}"
27
+ return true
23
28
  end
24
29
 
25
30
  return update if File.exists?(filepath)
@@ -32,8 +37,21 @@ class Fanforce::AppFactory::CLI::ScaffoldingFile
32
37
 
33
38
  def update
34
39
  if File.directory?(scaffold_filepath)
35
- mkdir
36
- return nil
40
+ created_dir = false
41
+ added_readme = false
42
+ if !File.directory?(filepath)
43
+ Dir.mkdir(filepath)
44
+ log "#{'Created'.format(:green,:bold)} #{relativepath}"
45
+ created_dir = true
46
+ end
47
+
48
+ if File.exists?("#{scaffold_filepath}readme") and Dir.glob("#{filepath}*").size == 0
49
+ File.open("#{filepath}readme", 'w') {|f| f.write(File.open("#{scaffold_filepath}readme").read) }
50
+ log "#{'Added'.format(:green,:bold)} #{relativepath}readme" if !created_dir
51
+ added_readme = true
52
+ end
53
+
54
+ return (created_dir || added_readme) ? true : false
37
55
  end
38
56
 
39
57
  is_missing = is_missing?
@@ -80,10 +98,6 @@ class Fanforce::AppFactory::CLI::ScaffoldingFile
80
98
 
81
99
  ######################################################################################################################
82
100
 
83
- def mkdir
84
- Dir.mkdir(filepath) if !File.directory?(filepath)
85
- end
86
-
87
101
  def extension
88
102
  @extension ||= scaffold_filepath.match(/([^\/\.]+)$/)[1].to_s.downcase
89
103
  end
@@ -0,0 +1,2 @@
1
+ This file exists to ensure the folder is added to git (since the directory is empty). You should remove this file
2
+ once you add some files.
@@ -0,0 +1,2 @@
1
+ This file exists to ensure the folder is added to git (since the directory is empty). You should remove this file
2
+ once you add some files.
@@ -1,5 +1,5 @@
1
1
  class Fanforce
2
2
  class AppFactory
3
- VERSION = '2.0.0.rc34'
3
+ VERSION = '2.0.0.rc35'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fanforce-app-factory
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc34
4
+ version: 2.0.0.rc35
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -463,7 +463,7 @@ files:
463
463
  - lib/fanforce/app_factory/scaffolding/assets/js/._fembedded-app.coffee.registry
464
464
  - lib/fanforce/app_factory/scaffolding/assets/js/._fembedded.js.registry
465
465
  - lib/fanforce/app_factory/scaffolding/assets/js/._promotional.js.registry
466
- - lib/fanforce/app_factory/scaffolding/assets/js/controllers/.registry
466
+ - lib/fanforce/app_factory/scaffolding/assets/js/controllers/readme
467
467
  - lib/fanforce/app_factory/scaffolding/assets/js/fembedded-app.coffee
468
468
  - lib/fanforce/app_factory/scaffolding/assets/js/fembedded.js
469
469
  - lib/fanforce/app_factory/scaffolding/assets/js/lib/._cookie.coffee.registry
@@ -473,7 +473,7 @@ files:
473
473
  - lib/fanforce/app_factory/scaffolding/assets/js/lib/filters.coffee
474
474
  - lib/fanforce/app_factory/scaffolding/assets/js/lib/utils.coffee
475
475
  - lib/fanforce/app_factory/scaffolding/assets/js/promotional.js
476
- - lib/fanforce/app_factory/scaffolding/assets/js/scripts/.registry
476
+ - lib/fanforce/app_factory/scaffolding/assets/js/scripts/readme
477
477
  - lib/fanforce/app_factory/scaffolding/config.json
478
478
  - lib/fanforce/app_factory/scaffolding/config.ru
479
479
  - lib/fanforce/app_factory/scaffolding/favicon.ico
@@ -1 +0,0 @@
1
- # This file exists to ensure the folder is added to git (since the directory is empty)
@@ -1 +0,0 @@
1
- # This file exists to ensure the folder is added to git (since the directory is empty)