gravitext-devtools 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc CHANGED
@@ -1,3 +1,12 @@
1
+ === 1.2.0 (2012-1-13)
2
+ * Use rjack-tarpit ~> 2.0.0 (build)
3
+ * Convert to use of hooker ~> 1.0.0 for config support.
4
+ * Added config support to ManifestWriter, for file
5
+ inclusion/exclusion like for headers.
6
+ * Add Rakefile, Gemfile, and gemspec and Ruby lines to count.
7
+ * Add assembly, gemspec, and Gemfile* as default header exclusions.
8
+ * Add gemspec and Gemfile* as default manifest exclusions.
9
+
1
10
  === 1.1.0 (2011-2-13)
2
11
  * Add support for header inclusion files.
3
12
  * Add new gt-count utility.
data/README.rdoc CHANGED
@@ -13,7 +13,7 @@ gt-count:: Count lines of code by type.
13
13
 
14
14
  == License
15
15
 
16
- Copyright (c) 2008-2011 David Kellum
16
+ Copyright (c) 2008-2012 David Kellum
17
17
 
18
18
  Licensed under the Apache License, Version 2.0 (the "License"); you
19
19
  may not use this file except in compliance with the License. You
data/Rakefile CHANGED
@@ -1,30 +1,7 @@
1
1
  # -*- ruby -*-
2
2
 
3
- $LOAD_PATH << './lib'
4
- require 'gravitext-devtools/base'
5
-
6
3
  require 'rubygems'
7
- gem 'rjack-tarpit', '~> 1.3.0'
4
+ require 'bundler/setup'
8
5
  require 'rjack-tarpit'
9
6
 
10
- t = RJack::TarPit.new( 'gravitext-devtools', Gravitext::DevTools::VERSION )
11
-
12
- t.specify do |h|
13
- h.developer( 'David Kellum', 'dek-oss@gravitext.com' )
14
- h.extra_deps << [ 'rainbow', '~> 1.1' ]
15
- end
16
-
17
- task :check_history_version do
18
- t.test_line_match( 'History.rdoc', /^==/, / #{ t.version } / )
19
- end
20
- task :check_history_date do
21
- t.test_line_match( 'History.rdoc', /^==/, /\([0-9\-]+\)$/ )
22
- end
23
-
24
- task :gem => [ :check_history_version, ]
25
- task :tag => [ :check_history_version, :check_history_date ]
26
- task :push => [ :check_history_version, :check_history_date ]
27
-
28
- task :test #noop
29
-
30
- t.define_tasks
7
+ RJack::TarPit.new( 'gravitext-devtools' ).define_tasks
data/bin/gt-cleanws CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/ruby
2
2
  #--
3
- # Copyright (c) 2008-2011 David Kellum
3
+ # Copyright (c) 2008-2012 David Kellum
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License"); you
6
6
  # may not use this file except in compliance with the License. You may
data/bin/gt-count CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/ruby
2
2
  #--
3
- # Copyright (c) 2008-2011 David Kellum
3
+ # Copyright (c) 2008-2012 David Kellum
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License"); you
6
6
  # may not use this file except in compliance with the License. You may
data/bin/gt-header CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/ruby
2
2
  #--
3
- # Copyright (c) 2008-2011 David Kellum
3
+ # Copyright (c) 2008-2012 David Kellum
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License"); you
6
6
  # may not use this file except in compliance with the License. You may
@@ -19,4 +19,10 @@ $LOAD_PATH.unshift File.join( File.dirname( __FILE__ ), "..", "lib" )
19
19
 
20
20
  require 'gravitext-devtools/header_writer'
21
21
 
22
- Gravitext::DevTools::HeaderWriter.new.run
22
+ module Gravitext::DevTools
23
+
24
+ load_config_from_pwd
25
+
26
+ HeaderWriter.new.run
27
+
28
+ end
data/bin/gt-manifest CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/ruby
2
2
  #--
3
- # Copyright (c) 2008-2011 David Kellum
3
+ # Copyright (c) 2008-2012 David Kellum
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License"); you
6
6
  # may not use this file except in compliance with the License. You may
@@ -19,4 +19,10 @@ $LOAD_PATH.unshift File.join( File.dirname( __FILE__ ), "..", "lib" )
19
19
 
20
20
  require 'gravitext-devtools/manifest_writer'
21
21
 
22
- Gravitext::DevTools::ManifestWriter.new.run
22
+ module Gravitext::DevTools
23
+
24
+ load_config_from_pwd
25
+
26
+ ManifestWriter.new.run
27
+
28
+ end
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2008-2011 David Kellum
2
+ # Copyright (c) 2008-2012 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You may
@@ -17,11 +17,25 @@
17
17
  require 'gravitext-devtools/base.rb'
18
18
  require 'optparse'
19
19
 
20
+ require 'rubygems'
21
+ require 'hooker'
22
+
23
+ module Hooker
24
+ class << self
25
+ # Deprecated, use setup_header instead.
26
+ def header( &block )
27
+ add( [ :gt, :header ], caller.first, &block )
28
+ end
29
+ end
30
+
31
+ log_with { |m| puts m }
32
+ end
33
+
20
34
  module Gravitext
21
35
  module DevTools
22
36
 
23
- def self.configure
24
- yield Gravitext::DevTools::Config
37
+ def self.configure( &block )
38
+ Hooker.with( :gt, &block )
25
39
  end
26
40
 
27
41
  def self.load_config_from_pwd
@@ -30,7 +44,7 @@ module Gravitext
30
44
  while( File.directory?( pwd ) )
31
45
  cfile = File.join( pwd, '.gt-config' )
32
46
  if File.exist?( cfile )
33
- Config::load_config( cfile )
47
+ Hooker.load_file( cfile )
34
48
  break
35
49
  end
36
50
  break if File.exist?( File.join( pwd, '.git' ) )
@@ -40,19 +54,6 @@ module Gravitext
40
54
  end
41
55
  end
42
56
 
43
- module Config
44
-
45
- def self.load_config( file )
46
- puts "Loading config #{file}."
47
- load file
48
- end
49
-
50
- def self.method_missing( method, *arguments, &block )
51
- ccall = caller[0]
52
- puts "Method %s from %s not defined, ignored" % [ method, ccall ]
53
- end
54
- end
55
-
56
57
  class GitFileLister
57
58
 
58
59
  # Inclusions to the list expressed in various ways
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2008-2011 David Kellum
2
+ # Copyright (c) 2008-2012 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You may
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Gravitext
18
18
  module DevTools
19
- VERSION = "1.1.0"
19
+ VERSION = "1.2.0"
20
20
  end
21
21
  end
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2008-2011 David Kellum
2
+ # Copyright (c) 2008-2012 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You may
@@ -17,20 +17,11 @@
17
17
  require 'gravitext-devtools'
18
18
  require 'fileutils'
19
19
  require 'erb'
20
- require 'rubygems'
21
20
  require 'rainbow'
22
21
 
23
22
  module Gravitext
24
23
  module DevTools
25
24
 
26
- module Config
27
- def self.header
28
- hw = HeaderWriter.instance
29
- raise "HeaderWriter not initialized" unless hw
30
- yield hw
31
- end
32
- end
33
-
34
25
  class HeaderWriter
35
26
  include FileUtils
36
27
 
@@ -41,10 +32,6 @@ module Gravitext
41
32
  attr_accessor :exclusions
42
33
  attr_accessor :inclusions
43
34
 
44
- class << self
45
- attr_accessor :instance
46
- end
47
-
48
35
  def initialize
49
36
  @verbose = false
50
37
  @do_write = false
@@ -63,11 +50,13 @@ module Gravitext
63
50
  '**/*.jar',
64
51
  '**/Rakefile',
65
52
  '**/pom.xml',
66
- '**/assembly.xml']
53
+ '**/assembly.xml',
54
+ '*.gemspec',
55
+ 'Gemfile*' ]
67
56
 
68
57
  @cached_header = {}
69
58
 
70
- HeaderWriter.instance = self # The last created
59
+ Hooker.apply( [ :gt, :header ], self )
71
60
  end
72
61
 
73
62
  def parse_options( args = ARGV )
@@ -90,15 +79,13 @@ module Gravitext
90
79
 
91
80
  parse_options( args )
92
81
 
93
- Gravitext::DevTools.load_config_from_pwd
94
-
95
82
  @git_lister.inclusions = @inclusions
96
83
  @git_lister.exclusions = @exclusions
97
84
 
98
85
  files = @git_lister.files
99
86
 
100
87
  files.each do |fname|
101
- HeaderProcessor.new( fname, @do_write ).process
88
+ HeaderProcessor.new( fname, @do_write, self ).process
102
89
  end
103
90
  end
104
91
 
@@ -153,9 +140,10 @@ module Gravitext
153
140
  EMPTY = mk_tag( "EMPTY", :yellow )
154
141
  WROTE = mk_tag( "WROTE", :yellow )
155
142
 
156
- def initialize( fname, do_write = false )
143
+ def initialize( fname, do_write, writer )
157
144
  @cpos = 0
158
145
  @do_write = do_write
146
+ @writer = writer
159
147
  @fname = fname
160
148
  @format = case fname
161
149
  when /\.(java|c|h)$/
@@ -168,7 +156,6 @@ module Gravitext
168
156
  :txt
169
157
  end
170
158
  @state = :first
171
- @writer = HeaderWriter.instance
172
159
  end
173
160
 
174
161
  def process
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2008-2011 David Kellum
2
+ # Copyright (c) 2008-2012 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You may
@@ -51,7 +51,8 @@ module Gravitext
51
51
  total_lines = total_code = 0
52
52
 
53
53
  map = [ [ 'JAVA', [ '**/*.java' ] ],
54
- [ 'RUBY', [ '**/*.rb', '**/bin/*', '**/init/*'] ] ]
54
+ [ 'RUBY', [ '**/*.rb', '**/bin/*', '**/init/*',
55
+ '**/Rakefile', '**/Gemfile', '**.gemspec' ] ] ]
55
56
 
56
57
  map.each do | lang, fpats |
57
58
  files = git_files.select { |f| @git_lister.match?( fpats, f ) }
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2008-2011 David Kellum
2
+ # Copyright (c) 2008-2012 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You may
@@ -29,17 +29,25 @@ module Gravitext
29
29
  # Boolean
30
30
  attr_accessor :static
31
31
 
32
+ attr_accessor :exclusions
33
+ attr_accessor :inclusions
34
+
32
35
  def initialize
33
36
  @verbose = false
34
37
  @static = File.exist?( 'Manifest.static' )
35
38
 
36
39
  @git_lister = GitFileLister.new
37
40
 
38
- @git_lister.exclusions = [ %r{(^|/).gitignore$},
39
- %r{(^|/).gt-config$},
40
- %r{(^|/)src(/|$)},
41
- 'lib/**/*.jar',
42
- 'Manifest.static' ]
41
+ @inclusions = []
42
+ @exclusions = [ %r{(^|/).gitignore$},
43
+ %r{(^|/).gt-config$},
44
+ %r{(^|/)src(/|$)},
45
+ 'lib/**/*.jar',
46
+ 'Manifest.static',
47
+ '*.gemspec',
48
+ 'Gemfile*' ]
49
+
50
+ Hooker.apply( [ :gt, :manifest ], self )
43
51
  end
44
52
 
45
53
  def parse_options( args = ARGV )
@@ -61,6 +69,9 @@ module Gravitext
61
69
 
62
70
  parse_options( args )
63
71
 
72
+ @git_lister.inclusions = @inclusions
73
+ @git_lister.exclusions = @exclusions
74
+
64
75
  @git_lister.extra_files << 'Manifest.txt' unless @static
65
76
  @git_lister.git_flags << '-c' # Include cached by default
66
77
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gravitext-devtools
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease: false
4
+ hash: 31
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 1.1.0
10
+ version: 1.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Kellum
@@ -15,12 +15,9 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-13 00:00:00 -08:00
19
- default_executable:
18
+ date: 2012-01-13 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- name: rainbow
23
- prerelease: false
24
21
  requirement: &id001 !ruby/object:Gem::Requirement
25
22
  none: false
26
23
  requirements:
@@ -31,31 +28,42 @@ dependencies:
31
28
  - 1
32
29
  - 1
33
30
  version: "1.1"
34
- type: :runtime
35
31
  version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: rjack-tarpit
32
+ name: rainbow
38
33
  prerelease: false
34
+ type: :runtime
35
+ - !ruby/object:Gem::Dependency
39
36
  requirement: &id002 !ruby/object:Gem::Requirement
40
37
  none: false
41
38
  requirements:
42
39
  - - ~>
43
40
  - !ruby/object:Gem::Version
44
- hash: 27
41
+ hash: 23
45
42
  segments:
46
43
  - 1
47
- - 3
48
44
  - 0
49
- version: 1.3.0
50
- type: :development
45
+ - 0
46
+ version: 1.0.0
51
47
  version_requirements: *id002
52
- description: |-
53
- A collection of development support tools.
54
-
55
- gt-manifest:: Maintain manifest from git ls-files minus exclusions.
56
- gt-cleanws:: Cleanup whitespace in files.
57
- gt-header:: Add and maintain file license headers.
58
- gt-count:: Count lines of code by type.
48
+ name: hooker
49
+ prerelease: false
50
+ type: :runtime
51
+ - !ruby/object:Gem::Dependency
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 2
60
+ - 0
61
+ version: "2.0"
62
+ version_requirements: *id003
63
+ name: rjack-tarpit
64
+ prerelease: false
65
+ type: :development
66
+ description:
59
67
  email:
60
68
  - dek-oss@gravitext.com
61
69
  executables:
@@ -66,8 +74,6 @@ executables:
66
74
  extensions: []
67
75
 
68
76
  extra_rdoc_files:
69
- - Manifest.txt
70
- - templates/format/format.txt
71
77
  - History.rdoc
72
78
  - README.rdoc
73
79
  files:
@@ -91,7 +97,6 @@ files:
91
97
  - templates/license/apache
92
98
  - templates/license/bsd
93
99
  - templates/license/mit
94
- has_rdoc: true
95
100
  homepage: http://github.com/dekellum/gravitext-devtools
96
101
  licenses: []
97
102
 
@@ -121,10 +126,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
126
  version: "0"
122
127
  requirements: []
123
128
 
124
- rubyforge_project: gravitext-devtools
125
- rubygems_version: 1.3.7
129
+ rubyforge_project:
130
+ rubygems_version: 1.8.11
126
131
  signing_key:
127
132
  specification_version: 3
128
- summary: A collection of development support tools
133
+ summary: A collection of development support tools.
129
134
  test_files: []
130
135