falsework 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/bin/falsework CHANGED
@@ -207,8 +207,12 @@ def addFiles mode, files
207
207
  CliUtils.errx EX_USAGE, 'missing argument(s)' if files.size == 0
208
208
 
209
209
  r = true
210
- m = Mould.new(File.basename(Dir.pwd), $conf[:template],
211
- $conf[:user], $conf[:email], $conf[:gecos])
210
+ begin
211
+ m = Mould.new(File.basename(Dir.pwd), $conf[:template],
212
+ $conf[:user], $conf[:email], $conf[:gecos])
213
+ rescue
214
+ CliUtils.errx EX_SOFTWARE, $!
215
+ end
212
216
 
213
217
  files.each {|i|
214
218
  created = m.add(mode, i) rescue CliUtils.errx(1, $!)
@@ -283,6 +287,9 @@ $conf[:upgrader] = {}
283
287
  $conf[:upgrader][:batch] = false
284
288
  $conf[:upgrader][:save] = false
285
289
 
290
+ # try to load a note file to set current template
291
+ $conf[:template] = Upgrader.noteLoad['template']['name'] rescue nil
292
+
286
293
  $conf.load {|o|
287
294
  o.on('--user STR', 'Github user.') {|i| $conf[:user] = i }
288
295
  o.on('--gecos STR', 'A gecos-like string.') {|i| $conf[:gecos] = i }
data/doc/NEWS.rdoc CHANGED
@@ -1,3 +1,15 @@
1
+ === 3.1.0
2
+
3
+ Thu May 24 23:20:04 EEST 2012
4
+
5
+ * Fix a long standing issue with redundant '-t' CLO after a project was
6
+ generated.
7
+
8
+ * Fix empty value of template version in .falsework file.
9
+
10
+ * Tell user if she doesn't have '#config.yaml' file in her template if
11
+ she is trying to add files to a project afterwards.
12
+
1
13
  === 3.0.0
2
14
 
3
15
  Sun Apr 29 12:22:27 EEST 2012
@@ -2,7 +2,7 @@
2
2
  module Falsework
3
3
  module Meta # :nodoc:
4
4
  NAME = 'falsework'
5
- VERSION = '3.0.0'
5
+ VERSION = '3.1.0'
6
6
  AUTHOR = 'Alexander Gromnitsky'
7
7
  EMAIL = 'alexander.gromnitsky@gmail.com'
8
8
  HOMEPAGE = 'http://github.com/gromnitsky/' + NAME
@@ -101,7 +101,8 @@ module Falsework
101
101
  'src' => nil,
102
102
  'dir' => 'test/test_%s.rb',
103
103
  'mode_int' => nil
104
- }]
104
+ }],
105
+ 'version' => '1.0.0'
105
106
  }
106
107
  configParse
107
108
 
@@ -251,7 +252,6 @@ module Falsework
251
252
  begin
252
253
  myconf = YAML.load_file file
253
254
  myconf[:file] = file
254
- myconf['version'] = '1.0.0' unless myconf['version']
255
255
  r = true
256
256
  rescue
257
257
  CliUtils.warnx "cannot parse #{file}: #{$!}"
@@ -292,7 +292,11 @@ module Falsework
292
292
  created = []
293
293
 
294
294
  unless @conf[mode] && @conf[mode][0]['src']
295
- CliUtils.warnx "hash '#{mode}' is empty in #{@conf[:file]}"
295
+ if @conf[:file]
296
+ CliUtils.warnx "hash '#{mode}' is empty in #{@conf[:file]}"
297
+ else
298
+ CliUtils.warnx "template '#{@template}' doesn't have '#{TEMPLATE_CONFIG}' file"
299
+ end
296
300
  return []
297
301
  end
298
302
 
data/test/test_cli.rb CHANGED
@@ -113,7 +113,7 @@ class TestCommandLine < MiniTest::Unit::TestCase
113
113
  assert_equal(0, r[0])
114
114
 
115
115
  Dir.chdir('templates/c_glib') {
116
- r = CliUtils.exec "#{@cmd} -t c-glib exe q-q-q"
116
+ r = CliUtils.exec "#{@cmd} exe q-q-q"
117
117
  assert_equal(0, r[0])
118
118
  assert_equal(true, File.exist?('src/q_q_q.h'))
119
119
  assert_equal(true, File.exist?('src/q_q_q.c'))
data/test/test_mould.rb CHANGED
@@ -17,7 +17,15 @@ class TestMould < MiniTest::Unit::TestCase
17
17
  # no template config file
18
18
  m = Mould.new 'foo', nil
19
19
  refute m.conf[:upgrade]
20
+ assert_equal '1.0.0', m.conf['version']
20
21
 
22
+ # config with just a version
23
+ File.open('t/ruby-cli/'+Mould::TEMPLATE_CONFIG, 'w+') {|fp|
24
+ fp.puts Hash['version' => '3.2.1'].to_yaml
25
+ }
26
+ m = Mould.new 'foo', nil
27
+ assert_equal '3.2.1', m.conf['version']
28
+
21
29
  # invalid template config file
22
30
  File.open('t/ruby-cli/'+Mould::TEMPLATE_CONFIG, 'w+') {|fp|
23
31
  fp.puts 'garbage'
@@ -32,6 +40,19 @@ class TestMould < MiniTest::Unit::TestCase
32
40
  assert_equal 'lib/%%@project%%/cliconfig.rb', m.conf['upgrade']['files'].first
33
41
  end
34
42
 
43
+ def test_invalidAdd
44
+ ClearFakeFS do
45
+ FileUtils.mkdir_p 't/ruby-cli'
46
+ Mould.template_dirs.unshift Pathname.new('t')
47
+
48
+ m = Mould.new 'foo', nil
49
+ out, err = capture_io { m.add 'doc', 'breaking-news' }
50
+ assert_match /template .+ doesn\'t have .+ file/, err
51
+
52
+ Mould.template_dirs.shift
53
+ end
54
+ end
55
+
35
56
  def test_name_project
36
57
  assert_equal '', Mould.name_project('')
37
58
  assert_equal '', Mould.name_project(nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: falsework
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-29 00:00:00.000000000 Z
12
+ date: 2012-05-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: open4
@@ -204,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
204
204
  version: '0'
205
205
  requirements: []
206
206
  rubyforge_project:
207
- rubygems_version: 1.8.21
207
+ rubygems_version: 1.8.24
208
208
  signing_key:
209
209
  specification_version: 3
210
210
  summary: A primitive scaffold generator for writing CLI programs in Ruby.