main 5.0.1 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README CHANGED
@@ -499,6 +499,10 @@ DOCS
499
499
  API section below
500
500
 
501
501
  HISTORY
502
+ 5.1.0
503
+ - support for STATE_DIRNAME and STATE_BASENAME environment variables
504
+ 5.0.0
505
+ ?
502
506
  4.4.0
503
507
  - support for automatic sequel/sqlite/amalgalite dbs for persistent state
504
508
  across invocations
data/README.erb CHANGED
@@ -188,6 +188,9 @@ DOCS
188
188
  API section below
189
189
 
190
190
  HISTORY
191
+ 4.5.1
192
+ - moved dotdir to state_path
193
+
191
194
  4.5.0
192
195
  - use map.rb for config objects
193
196
 
@@ -1,7 +1,7 @@
1
1
  module Main
2
2
  # top level constants
3
3
  #
4
- Main::VERSION = '5.0.1' unless
4
+ Main::VERSION = '5.1.0' unless
5
5
  defined? Main::VERSION
6
6
  def self.version() Main::VERSION end
7
7
 
@@ -268,17 +268,31 @@ module Main
268
268
  define_method(:run, &block) if block
269
269
  end
270
270
 
271
- def dotdir(*dotdir, &block)
272
- @dotdir = File.join(Util.home, ".#{ name }") unless defined?(@dotdir)
271
+ def state_dirname(*args)
272
+ @state_dirname = File.join(*args) unless args.empty?
273
+ @state_dirname ||= ENV['STATE_DIRNAME']
274
+ @state_dirname ||= Util.home
275
+ @state_dirname
276
+ end
277
+
278
+ def state_basename(*args)
279
+ @state_basename = File.join(*args) unless args.empty?
280
+ @state_basename ||= ENV['STATE_BASENAME']
281
+ @state_basename ||= ".#{ name }"
282
+ @state_basename
283
+ end
284
+
285
+ def state_path(*state_path, &block)
286
+ @state_path = File.join(state_dirname, state_basename) unless defined?(@state_path)
273
287
 
274
- @dotdir = dotdir.join('/') unless dotdir.empty?
288
+ @state_path = state_path.join('/') unless state_path.empty?
275
289
 
276
290
  if block
277
291
  require 'fileutils' unless defined?(FileUtils)
278
- FileUtils.mkdir_p(@dotdir) unless test(?d, @dotdir)
292
+ FileUtils.mkdir_p(@state_path) unless test(?d, @state_path)
279
293
  Dir.chdir(&block)
280
294
  else
281
- @dotdir
295
+ @state_path
282
296
  end
283
297
  end
284
298
 
@@ -286,14 +300,14 @@ module Main
286
300
  unless defined?(@db)
287
301
  require 'sequel' unless defined?(Sequel)
288
302
  require 'amalgalite' unless defined?(Amalgalite)
289
- @db = dotdir{ Sequel.amalgalite(db_path) }
303
+ @db = state_path{ Sequel.amalgalite(db_path) }
290
304
  @db.instance_eval(&block) if block
291
305
  end
292
306
  @db
293
307
  end
294
308
 
295
309
  def db_path(*db_path)
296
- @db_path = File.join(dotdir, 'db.sqlite') unless defined?(@db_path)
310
+ @db_path = File.join(state_path, 'db.sqlite') unless defined?(@db_path)
297
311
  @db_path = File.join(*db_path) unless db_path.empty?
298
312
  @db_path
299
313
  end
@@ -315,6 +329,7 @@ module Main
315
329
  []
316
330
  end
317
331
  dash = lines.shift if lines.first.to_s =~ /^---/
332
+ require 'fileutils' unless defined?(FileUtils)
318
333
  FileUtils.mkdir_p(File.dirname(config_path))
319
334
  open(config_path, 'w') do |fd|
320
335
  fd.puts "## file: #{ config_path }"
@@ -332,7 +347,7 @@ module Main
332
347
  alias_method('edit_config_file!', 'config')
333
348
 
334
349
  def config_path(*config_path)
335
- @config_path = File.join(dotdir, 'config.yml') unless defined?(@config_path)
350
+ @config_path = File.join(state_path, 'config.yml') unless defined?(@config_path)
336
351
  @config_path = File.join(*config_path) unless config_path.empty?
337
352
  @config_path
338
353
  end
@@ -269,8 +269,8 @@ module Main
269
269
  fcall(self, '__instance_eval_block', *argv, &block)
270
270
  end
271
271
 
272
- def dotdir(&block)
273
- self.class.dotdir(&block)
272
+ def state_path(&block)
273
+ self.class.state_path(&block)
274
274
  end
275
275
 
276
276
  def db(&block)
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "main"
6
- spec.version = "5.0.1"
6
+ spec.version = "5.1.0"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "main"
9
9
  spec.description = "description: main kicks the ass"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: main
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-04 00:00:00.000000000 Z
12
+ date: 2012-09-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chronic
16
- requirement: &70346687627120 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 0.6.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70346687627120
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.6.2
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: fattr
27
- requirement: &70346687626200 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: 2.2.0
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70346687626200
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 2.2.0
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: arrayfields
38
- requirement: &70346687625160 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: 4.7.4
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70346687625160
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 4.7.4
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: map
49
- requirement: &70346687623000 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,7 +69,12 @@ dependencies:
54
69
  version: 5.1.0
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *70346687623000
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 5.1.0
58
78
  description: ! 'description: main kicks the ass'
59
79
  email: ara.t.howard@gmail.com
60
80
  executables: []
@@ -113,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
133
  version: '0'
114
134
  requirements: []
115
135
  rubyforge_project: codeforpeople
116
- rubygems_version: 1.8.11
136
+ rubygems_version: 1.8.24
117
137
  signing_key:
118
138
  specification_version: 3
119
139
  summary: main