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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99dcc3820e1f29f6cad9d6c513bb9bd621315223
4
- data.tar.gz: 829803d0f695ef5eff15fa0a9f6ecf5e158c4767
3
+ metadata.gz: a847dc89aa0849a69642fcaab9b67a917c0e1987
4
+ data.tar.gz: 8e145ed5b4bec31299933374870d5ba3dbc62403
5
5
  SHA512:
6
- metadata.gz: cc9d3497c9e4cb19b40cb87052483f7d0ba4cf04e1ca8fc9c63fa10847f4885d6e4c23e93f617aec9d0a1b868dea7458ae45586f76124025c407e85c892ef43f
7
- data.tar.gz: 7c87a941afd37e5d98418f22d8c083331a1123d64efa4f4c1f1be4d5a4ce7bb472e360a98aaf2ff312aee8486809c53b257db7b62bfee6d5296900bc657fbf1d
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' and not exist
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.2
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-28 00:00:00.000000000 Z
11
+ date: 2016-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler