duck_duck_duck 2.0.0 → 3.0.0

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: d97565d2e47ab5dc5fea5da0d0841dc8cdf4b4e1
4
- data.tar.gz: 653ad97e76ee7facecc8073b5ae562a5ae6ed4b2
3
+ metadata.gz: 20ab64a22819731148fd285dab0e88ffb6d55865
4
+ data.tar.gz: 772d54ecb03a4e998e38ca84ed1c0b556c8deabb
5
5
  SHA512:
6
- metadata.gz: eaeb8d1dc2caf225db7791e676083dcf27362243df85d2f0c56b8e405dc4832b1dd5e6c8aec9e49bb9e6fcbaaf2f360172a49ed3f6c857f028cb89d600442be9
7
- data.tar.gz: 3103362b255c6a292619f4418335fb2faf6b8cdeeee189a8a48926bb2f7dff9a1c15019a93574051c74976797a0c34d1d1de9660828d6a5106b36e34dd9aa4d8
6
+ metadata.gz: 0bc860a684065b65e9dfcf924c77d9f3b241525b73ff3e584ad9757d43a1e69c30e98f01a62581a9b0a485500b326eaf1f9223f6785b1d68f09d021e432ce7c3
7
+ data.tar.gz: 97d096b52826386a9590c9daade0bf40f48627d728fb7c20ea5546c23acf35c06c5de60522c910c20dfebc87367c8e748b94403c2ed23c84458f0e38c97a64e0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 3.0.0
@@ -139,12 +139,18 @@ class Duck_Duck_Duck
139
139
  def create
140
140
  `mkdir -p #{name}/migrates`
141
141
 
142
- files = Dir.glob("#{name}/migrates/*.sql").grep(/\/\d{4}\-/).sort
142
+ files = Dir.glob("#{name}/migrates/*.sql").grep(/\/\d+\-/).sort
143
143
 
144
+ size = 3
144
145
  next_ver = begin
145
- (files.last || '')[/\/(\d{4})[^\/]+\z/]
146
- v = ($1 ? $1 : '0')
147
- '%04d' % (v.to_i + (10 - v[/\d\z/].to_i))
146
+ (files.last || '')[/\/(\d+)[^\/]+\z/]
147
+ v = if $1
148
+ size = $1.size
149
+ $1
150
+ else
151
+ '0'
152
+ end
153
+ "%0#{size}d" % (v.to_i + 1)
148
154
  end
149
155
 
150
156
  new_file = "#{name}/migrates/#{next_ver}-#{[action, sub_action].compact.join('-')}.sql"
@@ -54,21 +54,21 @@ describe "create" do
54
54
  @dir = tmp_dir
55
55
  }
56
56
 
57
- it "names the file in successive file versions: 0000-....sql" do
57
+ it "names the file in successive file versions: 000-....sql" do
58
58
  Dir.chdir(@dir) {
59
59
  Exit_0("duck_duck_duck create MOD table_1")
60
60
  Exit_0("duck_duck_duck create MOD table_2")
61
61
 
62
- Exit_0("touch MOD/migrates/0022-skip_zero.sql")
62
+ Exit_0("touch MOD/migrates/005-skip_zero.sql")
63
63
  Exit_0("duck_duck_duck create MOD table_3")
64
64
 
65
- Exit_0("touch MOD/migrates/0091-skip_zero.sql")
65
+ Exit_0("touch MOD/migrates/009-skip_zero.sql")
66
66
  Exit_0("duck_duck_duck create MOD table_100")
67
67
 
68
- File.should.exists('MOD/migrates/0010-table_1.sql')
69
- File.should.exists('MOD/migrates/0020-table_2.sql')
70
- File.should.exists('MOD/migrates/0030-table_3.sql')
71
- File.should.exists('MOD/migrates/0100-table_100.sql')
68
+ File.should.exists('MOD/migrates/001-table_1.sql')
69
+ File.should.exists('MOD/migrates/002-table_2.sql')
70
+ File.should.exists('MOD/migrates/006-table_3.sql')
71
+ File.should.exists('MOD/migrates/010-table_100.sql')
72
72
  }
73
73
  end
74
74
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duck_duck_duck
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - da99
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-23 00:00:00.000000000 Z
11
+ date: 2015-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  version: '0'
168
168
  requirements: []
169
169
  rubyforge_project:
170
- rubygems_version: 2.4.5
170
+ rubygems_version: 2.4.6
171
171
  signing_key:
172
172
  specification_version: 4
173
173
  summary: Migrations for apps composed of mini-apps.