railsbuilder 0.1.14 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46013794018786b045c4f8a0084306f2075908e1
4
- data.tar.gz: 0b1c00b7627636c9e9718741c692a2c3a65b191f
3
+ metadata.gz: f9994a3ff9f6e6de413c233e14c04fbc53e53533
4
+ data.tar.gz: 2874fe55180335cf9fcf54d58295242cb23bf1c7
5
5
  SHA512:
6
- metadata.gz: abc348bffdfcf05de2b23b7c2ffe55a8baa3cad191ba1c2d01ddc66a49355dfcbdc2460f52543964dd2b4c55101349a8ae03be2bd83487f5178047b3e1409c16
7
- data.tar.gz: 679bc2a232164c64978584510736b69d33f04f7a97ae9f4b3820fad1c7cabbdcd71e0172712b339df476cd3e86918f8a926d9ebe76ed6cd8b51066b1789a9919
6
+ metadata.gz: 7bcbbc4b40286bd54bd38d1c4946e3394df983f8c2b8807a49af511206f18c0a13832b75ed858b43b1cac384f4bd033c06001713afb60bf79c4f8eb48587e969
7
+ data.tar.gz: b8196fc24190011b77d710668f129358e5679ada6793f7d74c30f0841a1146956244e130ccaa230db34e7f87aa857d0d95cd0469584f7939fa16e528561a197e
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/railsbuilder.rb CHANGED
@@ -17,7 +17,7 @@ class RailsBuilder
17
17
 
18
18
  def initialize(filepath=nil, journal: false)
19
19
 
20
- buffer, _ = RXFHelper.read(filepath) if filepath
20
+ @config, _ = RXFHelper.read(filepath) if filepath
21
21
  @tmp_path = @journal = journal == true ? Dir.tmpdir : journal if journal
22
22
 
23
23
  patterns = [
@@ -36,7 +36,7 @@ class RailsBuilder
36
36
  [:all, /^\s*;/, :comment]
37
37
  ]
38
38
 
39
- xml = parse(patterns, buffer.gsub(/^(\s{,5})#/,'\1;'))
39
+ xml = parse(patterns, @config.gsub(/^(\s{,5})#/,'\1;'))
40
40
  @doc = Rexle.new xml
41
41
 
42
42
  @parent_path = Dir.pwd
@@ -64,10 +64,14 @@ class RailsBuilder
64
64
  + "exist as a file directory"
65
65
  activity = "new Rails app created"
66
66
  @notifications << [trigger,activity]
67
+
68
+ else
69
+
67
70
  end
68
71
 
69
72
  @app_path = app_path = doc.element('app_path/@app_path') ||
70
- File.join(@parent_path, app)
73
+ File.join(@parent_path, app)
74
+
71
75
  Dir.chdir app_path
72
76
 
73
77
  # select the :resource records
@@ -327,14 +331,34 @@ class RailsBuilder
327
331
  @notifications.to_yaml
328
332
  end
329
333
 
330
- def save()
331
- File.write "#{@app}.cfg", @config
334
+ def restore(level=-2)
335
+
336
+ base = File.join(@tmp_path, 'railsbuilder', @app)
337
+ dx = Dynarex.new File.join(base, 'dynarexdaily.xml')
338
+ a = dx.all
339
+ return 'no restore points available' if a.length < 1
340
+
341
+ level = 0 if a.length < 2
342
+ record = a[level]
343
+ path = record.desc
344
+
345
+ FileUtils.rm_rf @app_path
346
+ FileUtils.copy_entry File.join(base, path), @app_path, preserve=true
347
+ record.delete
348
+ dx.save
349
+
350
+ path + ' app restored'
351
+ end
352
+
353
+ def save(filepath=@parent_path)
354
+ File.write File.join(filepath, "#{@app}.cfg"), @config
332
355
  end
333
356
 
334
357
  def to_doc()
335
358
  @doc
336
359
  end
337
360
 
361
+
338
362
  private
339
363
 
340
364
  def parse(patterns, s=nil)
@@ -386,6 +410,8 @@ EOF
386
410
  FileUtils.copy_entry @app_path, snapshot_path, preserve=true
387
411
  al = ActivityLogger.new File.join(@tmp_path, 'railsbuilder', @app)
388
412
  al.create File.join(d,t)
413
+
414
+ self.save snapshot_path
389
415
  end
390
416
 
391
417
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railsbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file