leaves 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2007 Jared Hanson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README ADDED
@@ -0,0 +1 @@
1
+ = Leaves
data/Rakefile ADDED
@@ -0,0 +1,47 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/clean'
4
+ require 'rake/gempackagetask'
5
+ require 'rake/rdoctask'
6
+ require 'rake/testtask'
7
+
8
+ PKG_NAME = 'leaves'
9
+ PKG_VERSION = '0.1.0'
10
+
11
+ PKG_FILES = FileList[
12
+ '[A-Z]*',
13
+ 'lib/**/*'
14
+ ]
15
+
16
+
17
+ spec = Gem::Specification.new do |s|
18
+ s.name = PKG_NAME
19
+ s.version = PKG_VERSION
20
+ s.files = PKG_FILES
21
+ s.add_dependency('rake', '>= 0.7.3')
22
+ s.add_dependency('vstudioide', '>= 0.1.0')
23
+ s.add_dependency('win32rc', '>= 0.1.0')
24
+ s.add_dependency('xcodeide', '>= 0.1.1')
25
+
26
+ s.author = "Jared Hanson"
27
+ s.email = "jaredhanson@gmail.com"
28
+ s.homepage = "http://leaves.rubyforge.org/"
29
+ s.rubyforge_project = "leaves"
30
+
31
+ s.summary = "A collection of useful Rake tasks."
32
+ end
33
+
34
+ Rake::GemPackageTask.new(spec) do |pkg|
35
+ pkg.gem_spec = spec
36
+ end
37
+
38
+ Rake::RDocTask.new do |rdoc|
39
+ rdoc.rdoc_dir = 'doc'
40
+ rdoc.rdoc_files.include('README')
41
+ rdoc.rdoc_files.include('lib/leaves/**/*.rb')
42
+ end
43
+
44
+ Rake::TestTask.new do |test|
45
+ test.libs << "test"
46
+ test.test_files = FileList['test/test_suite.rb']
47
+ end
@@ -0,0 +1,23 @@
1
+ class String
2
+
3
+ # Converts strings to UpperCamelCase.
4
+ #--
5
+ # Graciously borrowed from Rails & ActiveSupport
6
+ # http://svn.rubyonrails.org/rails/tags/rel_2-0-2/activesupport/lib/active_support/inflector.rb
7
+ def camelize
8
+ self.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
9
+ end
10
+
11
+ # The reverse of +camelize+. Makes an underscored form from the expression in the string.
12
+ #--
13
+ # Graciously borrowed from Rails & ActiveSupport
14
+ # http://svn.rubyonrails.org/rails/tags/rel_2-0-2/activesupport/lib/active_support/inflector.rb
15
+ def underscore
16
+ self.to_s.gsub(/::/, '/').
17
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
18
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
19
+ tr("-", "_").
20
+ downcase
21
+ end
22
+
23
+ end
@@ -0,0 +1,30 @@
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/tasklib'
4
+
5
+
6
+ module Rake
7
+ module Leaves
8
+
9
+ class DoxygenTask < TaskLib
10
+ attr_accessor :config
11
+
12
+ def initialize()
13
+ @config = 'Doxyfile'
14
+
15
+ yield self if block_given?
16
+ define
17
+ end
18
+
19
+ def define
20
+ desc "Generate documentation using Doxygen."
21
+ task :doc do
22
+ sh "doxygen #{@config}"
23
+ end
24
+
25
+ self
26
+ end
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,41 @@
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/tasklib'
4
+
5
+
6
+ module Rake
7
+ module Leaves
8
+
9
+ class HeaderDocTask < TaskLib
10
+ attr_accessor :files
11
+ attr_accessor :output
12
+
13
+ def initialize()
14
+ @files = Rake::FileList.new('./include')
15
+ @output = './doc'
16
+
17
+ yield self if block_given?
18
+ define
19
+ end
20
+
21
+ def define
22
+ desc "Generate documentation using HeaderDoc."
23
+ task :doc do
24
+ @files.each do |file|
25
+ sh "headerdoc2html -o #{@output} #{file}"
26
+ end
27
+ sh "gatherheaderdoc #{@output}"
28
+ end
29
+
30
+ task :clobber_doc do
31
+ rm_r @output rescue nil
32
+ end
33
+
34
+ task :clobber => [:clobber_doc]
35
+
36
+ self
37
+ end
38
+ end
39
+
40
+ end
41
+ end
data/lib/leaves/gnu.rb ADDED
@@ -0,0 +1,83 @@
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/tasklib'
4
+ require 'leaves/core_ext/string'
5
+ require 'leaves/rake_ext/tasklib'
6
+ require 'leaves/version'
7
+
8
+
9
+ module Rake
10
+ module Leaves
11
+
12
+ class MakeTask < TaskLib
13
+ attr_accessor :makefile
14
+ attr_accessor :version
15
+ attr_accessor :disable_shared
16
+ attr_accessor :c_flags
17
+ attr_accessor :do_not_configure
18
+
19
+ def initialize(name = nil)
20
+ @name = name
21
+
22
+ yield self if block_given?
23
+ define
24
+ end
25
+
26
+ def define
27
+ desc "Build using GNU toolchain."
28
+ task upaste("build", @name) => [upaste("compile", @name)]
29
+
30
+ task upaste("compile", @name) do
31
+ cmd = "make"
32
+ cmd << " -f #{@makefile}" if @makefile
33
+
34
+ sh cmd
35
+ end
36
+ task upaste("compile", @name) => [:dot_configure] unless @do_not_configure
37
+
38
+ # autoreconf is used to generate configuration files. As a result of its
39
+ # execution, a configure script will be generated. If the configure
40
+ # script already exists, there is no reason to execute the command.
41
+ unless @do_not_configure
42
+ file_create "configure" do
43
+ sh "autoreconf -i"
44
+ end
45
+ task :autoreconf => ["configure"]
46
+ end
47
+
48
+ # A configuration script is used during the system detection and makefile
49
+ # generation phases. As a result of its execution, a makefile will be
50
+ # generated, which can be used to build the program. If a makefile
51
+ # already exists, there is no reason to execute the configure script.
52
+ #
53
+ # NOTE: The task is named "dot_configure" to avoid a conflict with the
54
+ # file creation task that must be named "configure"
55
+ unless @do_not_configure
56
+ file_create "Makefile" do
57
+ cmd = ""
58
+ cmd << "CFLAGS=\"#{@c_flags}\" " if @c_flags
59
+
60
+ cmd << "./configure"
61
+ cmd << " --with-version=\"#{@version}\"" if @version
62
+ cmd << " --disable-shared" if @disable_shared
63
+
64
+ sh cmd
65
+ end
66
+ task :dot_configure => [:autoreconf, "Makefile"]
67
+ end
68
+
69
+ task :clean do
70
+ sh "make clean"
71
+ end
72
+
73
+ task :clobber do
74
+ sh "make distclean"
75
+ end
76
+
77
+ self
78
+ end
79
+
80
+ end
81
+
82
+ end
83
+ end
data/lib/leaves/qt.rb ADDED
@@ -0,0 +1,51 @@
1
+ require 'rake'
2
+ require 'rake/tasklib'
3
+ require 'rake/clean'
4
+ require 'leaves/version'
5
+
6
+
7
+ module Rake
8
+ module Leaves
9
+
10
+ class QmakeTask < TaskLib
11
+ attr_accessor :spec
12
+ attr_accessor :makefile
13
+
14
+ def initialize
15
+ @makefile = "Makefile"
16
+
17
+ yield self if block_given?
18
+ define
19
+ end
20
+
21
+ def define
22
+ define_build
23
+ task :compile => [:qmake]
24
+
25
+ file_create @makefile do
26
+ cmd = "qmake"
27
+ cmd << " -spec #{@spec}" if @spec
28
+ sh cmd
29
+ end
30
+ task :qmake => [@makefile]
31
+
32
+ self
33
+ end
34
+
35
+ private
36
+ def define_build
37
+ if (/darwin/.match(RUBY_PLATFORM) && (@spec.nil? || @spec == 'macx-xcode'))
38
+ require 'leaves/xcode'
39
+ Rake::Leaves::XcodeTask.new
40
+ else
41
+ require 'leaves/gnu'
42
+ Rake::Leaves::MakeTask.new do |make|
43
+ make.do_not_configure = true
44
+ end
45
+ end
46
+ end
47
+
48
+ end
49
+
50
+ end
51
+ end
@@ -0,0 +1,13 @@
1
+ require 'rake'
2
+ require 'rake/tasklib'
3
+
4
+
5
+ module Rake
6
+
7
+ class TaskLib
8
+ def upaste(a,b)
9
+ (b ? paste("#{a}_", b) : a.to_s.intern)
10
+ end
11
+ end
12
+
13
+ end
@@ -0,0 +1,40 @@
1
+ require 'rake'
2
+ require 'rake/tasklib'
3
+ require 'leaves/version'
4
+
5
+
6
+ module Rake
7
+ module Leaves
8
+
9
+ class SubversionTask < TaskLib
10
+
11
+ def initialize
12
+ yield self if block_given?
13
+ define
14
+ end
15
+
16
+ def define
17
+ namespace :svn do
18
+ desc "Bring changes from the repository into the working copy."
19
+ task :update do
20
+ sh "svn update"
21
+ end
22
+
23
+ desc "Print the status of working copy files and directories."
24
+ task :status do
25
+ sh "svn status"
26
+ end
27
+
28
+ desc "Display local modifications in the working copy."
29
+ task :diff do
30
+ sh "svn diff"
31
+ end
32
+ end
33
+
34
+ self
35
+ end
36
+
37
+ end
38
+
39
+ end
40
+ end
@@ -0,0 +1,7 @@
1
+ module Rake
2
+ module Leaves
3
+
4
+ VERSION = '0.1.0'.freeze
5
+
6
+ end
7
+ end
@@ -0,0 +1,126 @@
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/tasklib'
4
+ require 'vstudioide'
5
+ require 'win32rc'
6
+ require 'leaves/core_ext/string'
7
+ require 'leaves/rake_ext/tasklib'
8
+ require 'leaves/version'
9
+
10
+
11
+ module Rake
12
+ module Leaves
13
+
14
+ class VisualStudioTask < TaskLib
15
+ attr_accessor :solution
16
+ attr_accessor :config
17
+
18
+ def initialize(name = '')
19
+ @name = (name.to_s.empty? ? nil : name)
20
+
21
+ solution = FileList.new('*.sln').to_a.first
22
+ @solution = solution if solution
23
+ @config = name.to_s.camelize
24
+
25
+ yield self if block_given?
26
+ define
27
+ end
28
+
29
+ def define
30
+ if @name
31
+
32
+ desc "Build using Microsoft Visual Studio."
33
+ task paste("build_", @name) => [paste("compile_", @name)]
34
+
35
+ task paste("compile_", @name) do
36
+ sh "devenv \"#{@solution}\" /build \"#{@config}\" 2>&1"
37
+ end
38
+
39
+ task paste("clean_", @name) do
40
+ sh "devenv \"#{@solution}\" /clean \"#{@config}\" 2>&1"
41
+ end
42
+
43
+ else
44
+
45
+ sln = VStudioIDE::Solution.new(@solution)
46
+ sln.configurations.each do |cfg|
47
+ name = cfg.underscore
48
+ config = cfg.dup
49
+
50
+ desc "Build using Microsoft Visual Studio."
51
+ task paste("build_", name) => [paste("compile_", name)]
52
+
53
+ task paste("compile_", name) do
54
+ sh "devenv \"#{@solution}\" /build \"#{config}\" 2>&1"
55
+ end
56
+
57
+ task paste("clean_", name) do
58
+ sh "devenv \"#{@solution}\" /clean \"#{config}\" 2>&1"
59
+ end
60
+ end
61
+
62
+ end
63
+
64
+ self
65
+ end
66
+ end
67
+
68
+ class NmakeTask < TaskLib
69
+ attr_accessor :makefile
70
+ attr_accessor :macrodefs
71
+ attr_accessor :target
72
+
73
+ def initialize(name = nil)
74
+ @name = name
75
+ @makefile = "Makefile.msvc"
76
+
77
+ yield self if block_given?
78
+ define
79
+ end
80
+
81
+ def define
82
+ desc "Build using Microsoft Program Maintenance Utility (NMAKE.EXE)."
83
+ task upaste("build", @name) => [upaste("compile", @name)]
84
+
85
+ task upaste("compile", @name) do
86
+ cmd = "nmake /f \"#{@makefile}\""
87
+ cmd << " #{@macrodefs}" if @macrodefs
88
+ cmd << " #{@target}" if @target
89
+ cmd << " 2>&1"
90
+
91
+ sh cmd
92
+ end
93
+
94
+ task upaste("clean", @name) do
95
+ sh "nmake /f \"#{@makefile}\" clean 2>&1"
96
+ end
97
+
98
+ self
99
+ end
100
+ end
101
+
102
+ class RCVersionTask < TaskLib
103
+ attr_accessor :resource
104
+ attr_accessor :version
105
+
106
+ def initialize
107
+ resource = FileList.new('*.rc').to_a.first
108
+ @resource = resource if resource
109
+
110
+ yield self if block_given?
111
+ define
112
+ end
113
+
114
+ def define
115
+ task :version_rc do
116
+ rc = Win32RC::Resource.new(@resource)
117
+ rc.version = @version
118
+ rc.save
119
+ end
120
+
121
+ self
122
+ end
123
+ end
124
+
125
+ end
126
+ end
@@ -0,0 +1,104 @@
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/tasklib'
4
+ require 'xcodeide'
5
+ require 'leaves/core_ext/string'
6
+ require 'leaves/rake_ext/tasklib'
7
+ require 'leaves/version'
8
+
9
+
10
+ module Rake
11
+ module Leaves
12
+
13
+ class XcodeTask < TaskLib
14
+ attr_accessor :project
15
+ attr_accessor :config
16
+
17
+ def initialize(name = '')
18
+ @name = (name.to_s.empty? ? nil : name)
19
+
20
+ project = nil
21
+ if RUBY_PLATFORM.match(/darwin7/)
22
+ project = FileList.new('*.xcode').to_a.first
23
+ else
24
+ project = FileList.new('*.xcodeproj').to_a.first
25
+ end
26
+
27
+ @project = project if project
28
+ @config = name.to_s.camelize
29
+
30
+ yield self if block_given?
31
+ define
32
+ end
33
+
34
+ def define
35
+ if @name
36
+
37
+ desc "Build using Xcode."
38
+ task paste("build_", @name) => [paste("compile_", @name)]
39
+
40
+ task paste("compile_", @name) do
41
+ cmd = "xcodebuild"
42
+ cmd << " -project \"#{@project}\"" if @project
43
+ if RUBY_PLATFORM.match(/darwin7/)
44
+ cmd << " -buildstyle \"#{@config}\"" if @config
45
+ else
46
+ cmd << " -configuration \"#{@config}\"" if @config
47
+ end
48
+ sh cmd
49
+ end
50
+
51
+ task paste("clean_", @name) do
52
+ cmd = "xcodebuild"
53
+ cmd << " -project \"#{@project}\"" if @project
54
+ if RUBY_PLATFORM.match(/darwin7/)
55
+ cmd << " -buildstyle \"#{@config}\"" if @config
56
+ else
57
+ cmd << " -configuration \"#{@config}\"" if @config
58
+ end
59
+ cmd << " clean"
60
+ sh cmd
61
+ end
62
+
63
+ else
64
+
65
+ proj = XcodeIDE::Project.new(@project)
66
+ proj.configurations.each do |cfg|
67
+ name = cfg.underscore
68
+ config = cfg.dup
69
+
70
+ desc "Build using Xcode."
71
+ task paste("build_", name) => [paste("compile_", name)]
72
+
73
+ task paste("compile_", name) do
74
+ cmd = "xcodebuild"
75
+ cmd << " -project \"#{@project}\""
76
+ if RUBY_PLATFORM.match(/darwin7/)
77
+ cmd << " -buildstyle \"#{config}\""
78
+ else
79
+ cmd << " -configuration \"#{config}\""
80
+ end
81
+ sh cmd
82
+ end
83
+
84
+ task paste("clean_", name) do
85
+ cmd = "xcodebuild"
86
+ cmd << " -project \"#{@project}\""
87
+ if RUBY_PLATFORM.match(/darwin7/)
88
+ cmd << " -buildstyle \"#{config}\""
89
+ else
90
+ cmd << " -configuration \"#{config}\""
91
+ end
92
+ cmd << " clean"
93
+ sh cmd
94
+ end
95
+ end
96
+
97
+ end
98
+
99
+ self
100
+ end
101
+ end
102
+
103
+ end
104
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: leaves
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jared Hanson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-04-02 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rake
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.7.3
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: vstudioide
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: 0.1.0
32
+ version:
33
+ - !ruby/object:Gem::Dependency
34
+ name: win32rc
35
+ version_requirement:
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.1.0
41
+ version:
42
+ - !ruby/object:Gem::Dependency
43
+ name: xcodeide
44
+ version_requirement:
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 0.1.1
50
+ version:
51
+ description:
52
+ email: jaredhanson@gmail.com
53
+ executables: []
54
+
55
+ extensions: []
56
+
57
+ extra_rdoc_files: []
58
+
59
+ files:
60
+ - LICENSE
61
+ - Rakefile
62
+ - README
63
+ - lib/leaves
64
+ - lib/leaves/core_ext
65
+ - lib/leaves/core_ext/string.rb
66
+ - lib/leaves/doc
67
+ - lib/leaves/doc/doxygen.rb
68
+ - lib/leaves/doc/headerdoc.rb
69
+ - lib/leaves/gnu.rb
70
+ - lib/leaves/qt.rb
71
+ - lib/leaves/rake_ext
72
+ - lib/leaves/rake_ext/tasklib.rb
73
+ - lib/leaves/vcs
74
+ - lib/leaves/vcs/subversion.rb
75
+ - lib/leaves/version.rb
76
+ - lib/leaves/vstudio.rb
77
+ - lib/leaves/xcode.rb
78
+ has_rdoc: false
79
+ homepage: http://leaves.rubyforge.org/
80
+ post_install_message:
81
+ rdoc_options: []
82
+
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: "0"
90
+ version:
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: "0"
96
+ version:
97
+ requirements: []
98
+
99
+ rubyforge_project: leaves
100
+ rubygems_version: 1.0.1
101
+ signing_key:
102
+ specification_version: 2
103
+ summary: A collection of useful Rake tasks.
104
+ test_files: []
105
+