autorake 2.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.
@@ -0,0 +1,23 @@
1
+ #
2
+ # autorake/version.rb -- Name and version number
3
+ #
4
+
5
+ module Autorake
6
+
7
+ NAME = "autorake"
8
+ VERSION = "2.0"
9
+ SUMMARY = "Configure project before Rake build or install."
10
+
11
+ DESCRIPTION = <<EOT
12
+ This script allows you to write pretty mkrf_conf scripts
13
+ with autocmd-like functionality.
14
+ EOT
15
+
16
+ COPYRIGHT = "(C) 2013 Bertram Scharpf"
17
+ LICENSE = "BSD"
18
+ AUTHOR = "Bertram Scharpf <software@bertram-scharpf.de>"
19
+ TEAM = [ "Bertram Scharpf"]
20
+ HOMEPAGE = "http://www.bertram-scharpf.de"
21
+
22
+ end
23
+
@@ -0,0 +1,30 @@
1
+ #
2
+ # Rakefile -- build some libraries
3
+ #
4
+
5
+ require "autorake"
6
+
7
+ task :default
8
+
9
+ task :clean
10
+
11
+
12
+ # Installers
13
+
14
+ vims = %w(
15
+ plugin/ruby.vim
16
+ plugin/yesno.vim
17
+ )
18
+
19
+ if has? :dial then
20
+ vims.concat %w(
21
+ plugin/dial.vim
22
+ )
23
+ end
24
+
25
+ ug = { :user => parm[ :user], :group => parm[ :group] }
26
+
27
+ installer "vimfiles", "VIM"
28
+
29
+ installer vims, "VIMFILES", ug
30
+
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #
4
+ # mkrf_conf -- configure installer
5
+ #
6
+
7
+ require "autorake/mkconfig"
8
+
9
+ Autorake.configure {
10
+
11
+ directory :vim, "DATA/vim"
12
+ directory :vimfiles, "VIM/vimfiles"
13
+
14
+ disable :dial
15
+
16
+ with :user, "games"
17
+ with :group, "games"
18
+
19
+ }
20
+
@@ -0,0 +1,17 @@
1
+ "
2
+ " phone.vim -- Handle phone numbers
3
+ "
4
+
5
+ " call external program `waehl'
6
+ func Dial( ...)
7
+ let s="[-+./()0-9 ]*"
8
+ let nr=matchstr( getline("."), "\\<".s."\\%".col(".")."c".s."\\>")
9
+ if nr == ""
10
+ throw "No phone number under cursor."
11
+ endif
12
+ call system( "dial '".nr."'")
13
+ " possible implemetation of `dial':
14
+ " echo "atdt,,$1;h0" >/dev/ttyS0
15
+ endf
16
+ command -nargs=0 Dial call Dial()
17
+
@@ -0,0 +1,97 @@
1
+ "
2
+ " ruby.vim -- Shortcuts for Ruby evaluation
3
+ "
4
+
5
+ function s:Ruby() range
6
+ exec a:lastline
7
+ ruby <<
8
+ begin
9
+ _ = eval(VIM.evaluate("getline(a:firstline,a:lastline)").join $/)
10
+ _.nil? or append "#=> " + _.inspect
11
+ rescue Exception
12
+ append "#!! #$! (#{$!.class})"
13
+ end
14
+ .
15
+ endfunc
16
+
17
+ function s:RubySum() range
18
+ " Build sum of expressions.
19
+ " Everything before :(colon) and after #(hash) is treated as a comment.
20
+ exec a:lastline
21
+ ruby <<
22
+ begin
23
+ $kfm = true
24
+ _ = eval VIM.evaluate("getline(a:firstline,a:lastline)").map { |l|
25
+ VIM.numbers_of l
26
+ }.join( " + ")
27
+ append "-"*32, ($kfm ? "%.2f" % _ : _.to_s)
28
+ rescue Exception
29
+ append "-"*32, "#!! #$! (#{$!.class})"
30
+ end
31
+ .
32
+ endfunc
33
+
34
+ function s:RubySums() range
35
+ ruby <<
36
+ f, l = VIM.evaluate("a:firstline").to_i, VIM.evaluate("a:lastline").to_i
37
+ c = VIM::Buffer.current
38
+ _ = 0
39
+ $kfm = true
40
+ f.upto l do |i|
41
+ begin
42
+ _ += eval VIM.numbers_of( c[i])
43
+ c[i] += " #=> " + ($kfm ? "%.2f" % _ : _.to_s)
44
+ rescue Exception
45
+ c[i] += " #!! #$! (#{$!.class})"
46
+ break
47
+ end
48
+ end
49
+ .
50
+ endfunc
51
+
52
+
53
+ ruby <<
54
+ require "rubygems"
55
+
56
+ module VIM
57
+ class <<self
58
+ def numbers_of line
59
+ line.chomp!
60
+ line.gsub! /^.*?[:=]/, ""
61
+ line.gsub! /#.*?$/, ""
62
+ line.gsub! /\d(\.\d{3})+,\d/ do |x|
63
+ x.delete "."
64
+ end
65
+ line.gsub! /(\d+,)-/, "\\100"
66
+ line.gsub! /(\d+),(\d+)(-)?/, "\\3\\1.\\2"
67
+ $kfm &&= line !~ /(^|[^0-9.])\d+(\.(\d|\d{3,}))?([^0-9.]|$)/
68
+ line =~ /\S/ ? line : "0"
69
+ end
70
+ end
71
+ end
72
+ def append *s
73
+ s.any? or s.push nil
74
+ c = VIM::Buffer.current
75
+ s.each { |e|
76
+ e.to_s.each_line { |l|
77
+ l.chomp!
78
+ n = c.line_number
79
+ c.append n, l
80
+ n += 1
81
+ Vim.command n.to_s
82
+ }
83
+ }
84
+ nil
85
+ end
86
+ def pp s
87
+ append s.pretty_inspect
88
+ rescue NoMethodError
89
+ require "pp" and retry
90
+ raise
91
+ end
92
+ .
93
+
94
+ command -bar -nargs=0 -range=% Ruby <line1>,<line2>call s:Ruby()
95
+ command -bar -nargs=0 -range=% RubySum <line1>,<line2>call s:RubySum()
96
+ command -bar -nargs=0 -range=% RubySums <line1>,<line2>call s:RubySums()
97
+
@@ -0,0 +1,40 @@
1
+ "
2
+ " yesno.vim -- Toggle yes/no
3
+ "
4
+
5
+ function s:ToggleYesNo()
6
+ let w=expand("<cword>")
7
+ if w == "yes" | let w="no"
8
+ elseif w == "no" | let w="yes"
9
+ elseif w == "YES" | let w="NO"
10
+ elseif w == "NO" | let w="YES"
11
+ elseif w == "Yes" | let w="No"
12
+ elseif w == "No" | let w="Yes"
13
+ elseif w == "on" | let w="off"
14
+ elseif w == "off" | let w="on"
15
+ elseif w == "ON" | let w="OFF"
16
+ elseif w == "OFF" | let w="ON"
17
+ elseif w == "auto" | let w="manual"
18
+ elseif w == "manual" | let w="auto"
19
+ elseif w == "ja" | let w="nein"
20
+ elseif w == "nein" | let w="ja"
21
+ elseif w == "true" | let w="false"
22
+ elseif w == "false" | let w="true"
23
+ elseif w == "TRUE" | let w="FALSE"
24
+ elseif w == "FALSE" | let w="TRUE"
25
+ elseif w == "True" | let w="False"
26
+ elseif w == "False" | let w="True"
27
+ elseif w == "up" | let w="down"
28
+ elseif w == "down" | let w="up"
29
+ elseif w == "enable" | let w="disable"
30
+ elseif w == "disable" | let w="enable"
31
+ elseif w == "left" | let w="right"
32
+ elseif w == "right" | let w="left"
33
+ else | let w=""
34
+ endif
35
+ if w!=""
36
+ exec "normal! \"_ciw\<C-R>=w\<cr>\<Esc>b"
37
+ endif
38
+ endfunc
39
+ nnoremap gy :call <SID>ToggleYesNo()<cr>
40
+
@@ -0,0 +1,27 @@
1
+ #
2
+ # Rakefile -- build executable
3
+ #
4
+
5
+ require "autorake"
6
+
7
+ c = compiler "-O2"
8
+ l = linker
9
+
10
+ rule ".o" => ".c" do |t|
11
+ c.cc t.name, t.source
12
+ end
13
+
14
+ task "hello" => "hello.o" do |t|
15
+ l.cc t.name, t.prerequisites
16
+ end
17
+
18
+ task :default => "hello"
19
+
20
+ task :clean do
21
+ FileList[ "*.o", "hello"].each { |f| rm_f f }
22
+ end
23
+
24
+ task :foo do
25
+ puts "Parameter foo is: %s." % parm[ :foo]
26
+ end
27
+
@@ -0,0 +1,20 @@
1
+ /*
2
+ * hello.c -- Say hello to the world.
3
+ */
4
+
5
+ #ifdef HAVE_HEADER_STDIO_H
6
+ #include <stdio.h>
7
+ #define SAY_IT
8
+ #endif
9
+
10
+ int main( int argc, char ** argv)
11
+ {
12
+ #ifdef SAY_IT
13
+ printf( "Hello, world!\n");
14
+ #endif
15
+ #ifdef FEATURE_NOW
16
+ printf( "Now is the time.\n");
17
+ #endif
18
+ return 0;
19
+ }
20
+
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #
4
+ # mkrf_conf -- configure Hello
5
+ #
6
+
7
+ require "autorake/mkconfig"
8
+
9
+ Autorake.configure {
10
+
11
+ have_header "stdio.h"
12
+
13
+ disable :now do
14
+ with :foo, "dummy"
15
+ # incdir :bar, "/path/to/bar"
16
+ # libdir :baz, "/path/to/baz"
17
+ end
18
+
19
+ }
20
+
@@ -0,0 +1,23 @@
1
+ #
2
+ # Rakefile -- build some libraries
3
+ #
4
+
5
+ require "autorake"
6
+
7
+ c = compiler "-O2", "-fPIC"
8
+ l = linker "-shared"
9
+
10
+ rule ".o" => ".c" do |t|
11
+ c.cc t.name, t.source
12
+ end
13
+
14
+ task "hello.so" => "hello.o" do |t|
15
+ l.cc t.name, t.prerequisites
16
+ end
17
+
18
+ task :default => "hello.so"
19
+
20
+ task :clean do
21
+ FileList[ "*.o", "*.so"].each { |f| rm_f f }
22
+ end
23
+
@@ -0,0 +1,43 @@
1
+ /*
2
+ * hello.c -- Say "Hello, world!"
3
+ */
4
+
5
+
6
+ #include "hello.h"
7
+
8
+ #if defined( HAVE_HEADER_RUBY_H)
9
+ #include <ruby.h>
10
+ #elif defined( HAVE_HEADER_RUBY_RUBY_H)
11
+ #include <ruby/ruby.h>
12
+ #else
13
+ #error "Ruby doesn't seem to be installed."
14
+ #endif
15
+
16
+
17
+ static ID id_puts;
18
+
19
+ static VALUE rb_obj_hello_bang( VALUE obj);
20
+
21
+
22
+ /*
23
+ * call-seq:
24
+ * obj.hello! => nil
25
+ *
26
+ * Prints "Hello, world!".
27
+ *
28
+ */
29
+
30
+ VALUE rb_obj_hello_bang( VALUE obj)
31
+ {
32
+ return rb_funcall( obj, id_puts, 1, rb_str_new2( "Hello, world!"));
33
+ }
34
+
35
+
36
+
37
+ void Init_hello( void)
38
+ {
39
+ rb_define_method( rb_cObject, "hello!", &rb_obj_hello_bang, 0);
40
+
41
+ id_puts = rb_intern( "puts");
42
+ }
43
+
@@ -0,0 +1,11 @@
1
+ /*
2
+ * hello.h -- Say "Hello, world!"
3
+ */
4
+
5
+ #ifndef __HELLO_H__
6
+ #define __HELLO_H__
7
+
8
+ extern void Init_hello( void);
9
+
10
+ #endif
11
+
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #
4
+ # mkrf_conf -- configure RbHello
5
+ #
6
+
7
+ require "autorake/mkconfig"
8
+
9
+ Autorake.configure {
10
+
11
+ extending_ruby
12
+
13
+ if RUBY_VERSION < "1.9" then
14
+ have_header "ruby.h"
15
+ else
16
+ have_header "ruby/ruby.h"
17
+ end
18
+
19
+ }
20
+
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #
4
+ # rbhello -- Say "Hello, world"
5
+ #
6
+
7
+ require "./hello"
8
+
9
+ hello!
10
+
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: autorake
3
+ version: !ruby/object:Gem::Version
4
+ version: '2.0'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Bertram Scharpf
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-08-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.8.7
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.8.7
30
+ description: ! 'This script allows you to write pretty mkrf_conf scripts
31
+
32
+ with autocmd-like functionality.
33
+
34
+ '
35
+ email: Bertram Scharpf <software@bertram-scharpf.de>
36
+ executables: []
37
+ extensions: []
38
+ extra_rdoc_files:
39
+ - README
40
+ - LICENSE
41
+ files:
42
+ - lib/autorake.rb
43
+ - lib/autorake/application.rb
44
+ - lib/autorake/configure.rb
45
+ - lib/autorake/compile.rb
46
+ - lib/autorake/definition.rb
47
+ - lib/autorake/directories.rb
48
+ - lib/autorake/mkconfig.rb
49
+ - lib/autorake/version.rb
50
+ - samples/plainc/Rakefile
51
+ - samples/plainc/mkrf_conf
52
+ - samples/plainc/hello.c
53
+ - samples/rbextend/Rakefile
54
+ - samples/rbextend/mkrf_conf
55
+ - samples/rbextend/hello.c
56
+ - samples/rbextend/hello.h
57
+ - samples/rbextend/rbhello
58
+ - samples/justinst/Rakefile
59
+ - samples/justinst/mkrf_conf
60
+ - samples/justinst/plugin/dial.vim
61
+ - samples/justinst/plugin/ruby.vim
62
+ - samples/justinst/plugin/yesno.vim
63
+ - README
64
+ - LICENSE
65
+ homepage: http://www.bertram-scharpf.de
66
+ licenses:
67
+ - BSD
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements:
85
+ - Rake
86
+ rubyforge_project: NONE
87
+ rubygems_version: 1.8.25
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: Configure project before Rake build or install.
91
+ test_files: []