railsbuilder 0.1.13 → 0.1.14

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: 3af5373f5b183a7a8ed9ead6d41a0c29cdf5c6e6
4
- data.tar.gz: 79d6d6832af12dc50a2556b7fac07004dd616cdd
3
+ metadata.gz: 46013794018786b045c4f8a0084306f2075908e1
4
+ data.tar.gz: 0b1c00b7627636c9e9718741c692a2c3a65b191f
5
5
  SHA512:
6
- metadata.gz: 1921b509434c749373b793fcaebecf81dbb9a6969518f3675a4d436888c441d88837ccc90fcb797d2d15ceee51f853d943955297240039de91c9f760054fbcf3
7
- data.tar.gz: 1190f8b00a7d6f17292eed699d0bfe3c2bb3ac0ebd204a72703670050a654e3a1c363e8f57394fae5c8dc1a2782bfd599aed85901490edf27e513c9d29a6e5f3
6
+ metadata.gz: abc348bffdfcf05de2b23b7c2ffe55a8baa3cad191ba1c2d01ddc66a49355dfcbdc2460f52543964dd2b4c55101349a8ae03be2bd83487f5178047b3e1409c16
7
+ data.tar.gz: 679bc2a232164c64978584510736b69d33f04f7a97ae9f4b3820fad1c7cabbdcd71e0172712b339df476cd3e86918f8a926d9ebe76ed6cd8b51066b1789a9919
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/railsbuilder.rb CHANGED
@@ -8,15 +8,17 @@ require 'lineparser'
8
8
  require 'rdiscount'
9
9
  require 'yaml'
10
10
  require 'rxfhelper'
11
+ require 'tmpdir'
12
+ require 'activity-logger'
11
13
 
12
14
 
13
15
  class RailsBuilder
14
16
 
15
- attr_accessor :notifications
16
17
 
17
- def initialize(filepath=nil)
18
+ def initialize(filepath=nil, journal: false)
18
19
 
19
20
  buffer, _ = RXFHelper.read(filepath) if filepath
21
+ @tmp_path = @journal = journal == true ? Dir.tmpdir : journal if journal
20
22
 
21
23
  patterns = [
22
24
  [:root, 'app_path: :app_path', :app_path],
@@ -50,9 +52,6 @@ class RailsBuilder
50
52
  @app = app = doc.element('app/@app')
51
53
  return unless app
52
54
 
53
- app_path = doc.element('app_path/@app_path')
54
- Dir.chdir app_path if app_path
55
-
56
55
  unless File.exists? app then
57
56
 
58
57
  command = 'rails new ' + app
@@ -67,7 +66,9 @@ class RailsBuilder
67
66
  @notifications << [trigger,activity]
68
67
  end
69
68
 
70
- Dir.chdir app
69
+ @app_path = app_path = doc.element('app_path/@app_path') ||
70
+ File.join(@parent_path, app)
71
+ Dir.chdir app_path
71
72
 
72
73
  # select the :resource records
73
74
  root = doc.element('root/@root')
@@ -317,10 +318,15 @@ class RailsBuilder
317
318
  end # / child iterator
318
319
  end
319
320
 
321
+ snapshot() if @journal and @notifications.any?
320
322
  Dir.chdir @parent_path
321
323
  @notifications.to_yaml
322
324
  end
323
325
 
326
+ def notifications
327
+ @notifications.to_yaml
328
+ end
329
+
324
330
  def save()
325
331
  File.write "#{@app}.cfg", @config
326
332
  end
@@ -370,6 +376,18 @@ EOF
370
376
  :abort
371
377
  end
372
378
  end
379
+
380
+ def snapshot()
381
+
382
+ d, t = Time.now.strftime("%d-%b").downcase, Time.now.strftime("%H%M_%S")
383
+ snapshot_path = File.join(@tmp_path, 'railsbuilder', @app, d,t)
384
+ FileUtils.mkdir_p snapshot_path
385
+
386
+ FileUtils.copy_entry @app_path, snapshot_path, preserve=true
387
+ al = ActivityLogger.new File.join(@tmp_path, 'railsbuilder', @app)
388
+ al.create File.join(d,t)
389
+ end
390
+
373
391
  end
374
392
 
375
393
  =begin
data.tar.gz.sig CHANGED
Binary file
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.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  bNcCWso1cJhifoTCytPAyf9YVuyU4HjqC3eqx3p00NCg0VoELwMEkyhkpvYOGz2l
32
32
  NSkTRB6yCN+xzQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2014-03-14 00:00:00.000000000 Z
34
+ date: 2014-03-15 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rails
@@ -89,6 +89,20 @@ dependencies:
89
89
  - - ">="
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
+ - !ruby/object:Gem::Dependency
93
+ name: activity-logger
94
+ requirement: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :runtime
100
+ prerelease: false
101
+ version_requirements: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
92
106
  description:
93
107
  email: james@r0bertson.co.uk
94
108
  executables: []
metadata.gz.sig CHANGED
Binary file