ActiveRecorder 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_recorder/filewriter.rb +6 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a847dc89aa0849a69642fcaab9b67a917c0e1987
|
4
|
+
data.tar.gz: 8e145ed5b4bec31299933374870d5ba3dbc62403
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2fc326bd65e2c7ed4ffbb2f2aceeff3706b9172cc9c1f5bc3484de2d69ec51aeea73c403b021d788a81df148fa225f2baad5f7fa51fc1296a17fec362edfd46
|
7
|
+
data.tar.gz: d24ee5d586b06e2eb574fd989d968caab5c0dfbfdcd4fbca36ee1a05a1ad7ffe8f5a69b320bd46f3a280441ccfc2cebf7484686f8c1a21066aee88ecb10e3d5d
|
@@ -75,16 +75,16 @@ module Filewriter
|
|
75
75
|
# Get input and output directory of files
|
76
76
|
input = "#{File.join(path, 'config')}/routes.rb"
|
77
77
|
output = "#{File.join(path, 'config')}/tmp.rb"
|
78
|
+
# Check whether line already exists
|
79
|
+
exist = false
|
78
80
|
# Open the file to read from
|
79
81
|
open(input, 'r') do |input_file|
|
80
82
|
open(output, 'w') do |output_file|
|
81
|
-
# Check whether line already exists
|
82
|
-
exist = false
|
83
83
|
# Read each line of input
|
84
84
|
input_file.each_line do |line|
|
85
|
-
if line.start_with? "get 'tables' => 'tables#index'"
|
85
|
+
if line.start_with? " get 'tables' => 'tables#index'"
|
86
86
|
exist = true
|
87
|
-
elsif line.start_with? 'end'
|
87
|
+
elsif line.start_with? 'end'
|
88
88
|
output_file.puts(" get 'tables' => 'tables#index'")
|
89
89
|
output_file.puts('end')
|
90
90
|
else
|
@@ -94,7 +94,7 @@ module Filewriter
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
# Overwrite input with output
|
97
|
-
FileUtils.mv(output, input)
|
97
|
+
FileUtils.mv(output, input) unless exist
|
98
98
|
end
|
99
99
|
|
100
100
|
# Prepends '@' and appends 's' to a lower case variable name
|
@@ -119,6 +119,7 @@ module Filewriter
|
|
119
119
|
# Creates a directory with the given path
|
120
120
|
def self.create_tables_dir(path)
|
121
121
|
dir = File.join(path, 'app/views/tables')
|
122
|
+
FileUtils.remove_dir(dir)
|
122
123
|
Dir.mkdir dir
|
123
124
|
end
|
124
125
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ActiveRecorder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Goh Chin Loong
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|