File: Rakefile

package info (click to toggle)
ruby-maven-tools 1.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,360 kB
  • sloc: ruby: 4,834; xml: 4,402; makefile: 4
file content (70 lines) | stat: -rw-r--r-- 1,706 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#-*- mode: ruby -*-

task :default => [ :specs ]

desc 'generate licenses data from internet'
task :licenses do
  require 'open-uri'
  require 'ostruct'
  
  File.open( 'lib/maven/tools/licenses.rb', 'w' ) do |f|
    url = 'http://opensource.org'
    f.puts "require 'ostruct'"
    f.puts 'module Maven'
    f.puts '  module Tools'
    f.puts '    LICENSES = {}'
    
    open( url + '/licenses/alphabetical' ).each_line do |line|
      
      if line =~ /.*"\/licenses\// and line =~ /<li>/
        l = OpenStruct.new
        line.sub!( /.*"(\/licenses\/([^"]*))">/ ) do
          l.url = "http://opensource.org#{$1}"
          l.short = $1.sub( /\/licenses\//, '' )
          ''
        end
        line.sub!( /\ \(.*$/, '' )
        f.puts "    LICENSES[ #{l.short.downcase.inspect} ] = OpenStruct.new :short => #{l.short.inspect}, :name => #{line.strip.inspect}, :url => #{l.url.inspect}"
      end
    end
    f.puts '    LICENSES.freeze'
    f.puts '  end'
    f.puts 'end'
  end
  
end

desc 'run minispecs'
task :specs do
  begin
    require 'minitest'
  rescue LoadError
  end
  require 'minitest/autorun'

  $LOAD_PATH << "spec"
  $LOAD_PATH << "lib"

  Dir['spec/**/*_spec.rb'].each { |f| require f.sub(/spec\//, '') }
end

task :headers do
  require 'copyright_header'

  s = Gem::Specification.load( Dir["*gemspec"].first )

  args = {
    :license => s.license, 
    :copyright_software => s.name,
    :copyright_software_description => s.description,
    :copyright_holders => s.authors,
    :copyright_years => [Time.now.year],
    :add_path => "lib:src",
    :output_dir => './'
  }

  command_line = CopyrightHeader::CommandLine.new( args )
  command_line.execute
end

# vim: syntax=Ruby