do_riak 0.10.1.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. data/CHANGELOG +2 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE +20 -0
  4. data/README.textile +23 -0
  5. data/TODO.txt +4 -0
  6. data/deps.rip +8 -0
  7. data/do_riak.gemspec +40 -0
  8. data/do_riak.pre.gemspec +8 -0
  9. data/gems/cache/bacon-1.1.0.gem +0 -0
  10. data/gems/cache/code-cleaner-0.8.1.gem +0 -0
  11. data/gems/cache/nake-0.0.8.gem +0 -0
  12. data/gems/cache/term-ansicolor-1.0.4.gem +0 -0
  13. data/gems/environment.rb +107 -0
  14. data/gems/gems/bacon-1.1.0/COPYING +18 -0
  15. data/gems/gems/bacon-1.1.0/ChangeLog +220 -0
  16. data/gems/gems/bacon-1.1.0/RDOX +69 -0
  17. data/gems/gems/bacon-1.1.0/README +290 -0
  18. data/gems/gems/bacon-1.1.0/Rakefile +138 -0
  19. data/gems/gems/bacon-1.1.0/bin/bacon +117 -0
  20. data/gems/gems/bacon-1.1.0/lib/autotest/bacon.rb +36 -0
  21. data/gems/gems/bacon-1.1.0/lib/autotest/bacon_rspec.rb +2 -0
  22. data/gems/gems/bacon-1.1.0/lib/autotest/discover.rb +9 -0
  23. data/gems/gems/bacon-1.1.0/lib/bacon.rb +354 -0
  24. data/gems/gems/bacon-1.1.0/test/spec_bacon.rb +374 -0
  25. data/gems/gems/bacon-1.1.0/test/spec_should.rb +32 -0
  26. data/gems/gems/code-cleaner-0.8.1/LICENSE +20 -0
  27. data/gems/gems/code-cleaner-0.8.1/README.textile +87 -0
  28. data/gems/gems/code-cleaner-0.8.1/TODO.txt +1 -0
  29. data/gems/gems/code-cleaner-0.8.1/bin/code-cleaner +143 -0
  30. data/gems/gems/code-cleaner-0.8.1/code-cleaner-0.8.gem +0 -0
  31. data/gems/gems/code-cleaner-0.8.1/code-cleaner.gemspec +25 -0
  32. data/gems/gems/code-cleaner-0.8.1/support/pre-commit.erb +70 -0
  33. data/gems/gems/code-cleaner-0.8.1/tasks.rb +13 -0
  34. data/gems/gems/code-cleaner-0.8.1/tasks/code-cleaner.nake +49 -0
  35. data/gems/gems/code-cleaner-0.8.1/tasks/code-cleaner.rake +22 -0
  36. data/gems/gems/code-cleaner-0.8.1/tasks/code-cleaner.thor +35 -0
  37. data/gems/gems/nake-0.0.8/CHANGELOG +48 -0
  38. data/gems/gems/nake-0.0.8/LICENSE +20 -0
  39. data/gems/gems/nake-0.0.8/README.textile +39 -0
  40. data/gems/gems/nake-0.0.8/TODO.txt +23 -0
  41. data/gems/gems/nake-0.0.8/bin/nake +66 -0
  42. data/gems/gems/nake-0.0.8/bin/nrake +4 -0
  43. data/gems/gems/nake-0.0.8/bin/rake2nake +1 -0
  44. data/gems/gems/nake-0.0.8/bin/snake +41 -0
  45. data/gems/gems/nake-0.0.8/bm/Rakefile +28 -0
  46. data/gems/gems/nake-0.0.8/bm/bms.rb +56 -0
  47. data/gems/gems/nake-0.0.8/bm/output.txt +5 -0
  48. data/gems/gems/nake-0.0.8/bm/tasks.rb +21 -0
  49. data/gems/gems/nake-0.0.8/bm/tmp/test.c +6 -0
  50. data/gems/gems/nake-0.0.8/bm/tmp/www/index.html +1 -0
  51. data/gems/gems/nake-0.0.8/deps.rb +5 -0
  52. data/gems/gems/nake-0.0.8/deps.rip +5 -0
  53. data/gems/gems/nake-0.0.8/examples/arguments.rb +38 -0
  54. data/gems/gems/nake-0.0.8/examples/basic.rb +5 -0
  55. data/gems/gems/nake-0.0.8/examples/boot.rb +18 -0
  56. data/gems/gems/nake-0.0.8/examples/complex.rb +9 -0
  57. data/gems/gems/nake-0.0.8/examples/configuration.rb +15 -0
  58. data/gems/gems/nake-0.0.8/examples/default.rb +10 -0
  59. data/gems/gems/nake-0.0.8/examples/default_proc.rb +11 -0
  60. data/gems/gems/nake-0.0.8/examples/dependencies.rb +10 -0
  61. data/gems/gems/nake-0.0.8/examples/description.rb +33 -0
  62. data/gems/gems/nake-0.0.8/examples/file.rb +22 -0
  63. data/gems/gems/nake-0.0.8/examples/helpers.rb +3 -0
  64. data/gems/gems/nake-0.0.8/examples/invoking.rb +14 -0
  65. data/gems/gems/nake-0.0.8/examples/rules.rb +0 -0
  66. data/gems/gems/nake-0.0.8/examples/script.rb +20 -0
  67. data/gems/gems/nake-0.0.8/examples/task_arguments.rb +27 -0
  68. data/gems/gems/nake-0.0.8/features/arguments.feature +22 -0
  69. data/gems/gems/nake-0.0.8/features/basic.feature +6 -0
  70. data/gems/gems/nake-0.0.8/features/boot.feature +5 -0
  71. data/gems/gems/nake-0.0.8/features/builtin_arguments.feature +14 -0
  72. data/gems/gems/nake-0.0.8/features/complex.feature +6 -0
  73. data/gems/gems/nake-0.0.8/features/configuration.feature +10 -0
  74. data/gems/gems/nake-0.0.8/features/default.feature +10 -0
  75. data/gems/gems/nake-0.0.8/features/default_proc.feature +6 -0
  76. data/gems/gems/nake-0.0.8/features/dependencies.feature +16 -0
  77. data/gems/gems/nake-0.0.8/features/description.feature +0 -0
  78. data/gems/gems/nake-0.0.8/features/env.rb +11 -0
  79. data/gems/gems/nake-0.0.8/features/executable.feature +29 -0
  80. data/gems/gems/nake-0.0.8/features/file.feature +23 -0
  81. data/gems/gems/nake-0.0.8/features/helpers.feature +6 -0
  82. data/gems/gems/nake-0.0.8/features/invoking.feature +14 -0
  83. data/gems/gems/nake-0.0.8/features/rules.feature +0 -0
  84. data/gems/gems/nake-0.0.8/features/script.feature +10 -0
  85. data/gems/gems/nake-0.0.8/features/steps.rb +39 -0
  86. data/gems/gems/nake-0.0.8/features/task_arguments.feature +10 -0
  87. data/gems/gems/nake-0.0.8/lib/nake.rb +103 -0
  88. data/gems/gems/nake-0.0.8/lib/nake/abstract_task.rb +175 -0
  89. data/gems/gems/nake-0.0.8/lib/nake/args.rb +65 -0
  90. data/gems/gems/nake-0.0.8/lib/nake/argv.rb +47 -0
  91. data/gems/gems/nake-0.0.8/lib/nake/colors.rb +22 -0
  92. data/gems/gems/nake-0.0.8/lib/nake/dsl.rb +70 -0
  93. data/gems/gems/nake-0.0.8/lib/nake/file_task.rb +62 -0
  94. data/gems/gems/nake-0.0.8/lib/nake/helpers.rb +65 -0
  95. data/gems/gems/nake-0.0.8/lib/nake/rake.rb +38 -0
  96. data/gems/gems/nake-0.0.8/lib/nake/rule.rb +35 -0
  97. data/gems/gems/nake-0.0.8/lib/nake/struct_hash.rb +22 -0
  98. data/gems/gems/nake-0.0.8/lib/nake/task.rb +6 -0
  99. data/gems/gems/nake-0.0.8/lib/nake/tasks/bundle.rb +30 -0
  100. data/gems/gems/nake-0.0.8/lib/nake/tasks/clean.rb +12 -0
  101. data/gems/gems/nake-0.0.8/lib/nake/tasks/gem.rb +29 -0
  102. data/gems/gems/nake-0.0.8/lib/nake/tasks/release.rb +43 -0
  103. data/gems/gems/nake-0.0.8/lib/nake/tasks/rip.rb +33 -0
  104. data/gems/gems/nake-0.0.8/lib/nake/tasks/spec.rb +20 -0
  105. data/gems/gems/nake-0.0.8/lib/nake/template.rb +51 -0
  106. data/gems/gems/nake-0.0.8/nake-0.0.8.pre.gem +0 -0
  107. data/gems/gems/nake-0.0.8/nake.gemspec +42 -0
  108. data/gems/gems/nake-0.0.8/nake.pre.gemspec +8 -0
  109. data/gems/gems/nake-0.0.8/spec/nake/abstract_task_spec.rb +0 -0
  110. data/gems/gems/nake-0.0.8/spec/nake/args_spec.rb +0 -0
  111. data/gems/gems/nake-0.0.8/spec/nake/argv_spec.rb +51 -0
  112. data/gems/gems/nake-0.0.8/spec/nake/colors_spec.rb +0 -0
  113. data/gems/gems/nake-0.0.8/spec/nake/dsl_spec.rb +35 -0
  114. data/gems/gems/nake-0.0.8/spec/nake/file_task_spec.rb +0 -0
  115. data/gems/gems/nake-0.0.8/spec/nake/helpers_spec.rb +14 -0
  116. data/gems/gems/nake-0.0.8/spec/nake/rake_spec.rb +0 -0
  117. data/gems/gems/nake-0.0.8/spec/nake/rule_spec.rb +72 -0
  118. data/gems/gems/nake-0.0.8/spec/nake/struct_hash_spec.rb +0 -0
  119. data/gems/gems/nake-0.0.8/spec/nake/task_spec.rb +72 -0
  120. data/gems/gems/nake-0.0.8/spec/nake/tasks/bundle_spec.rb +28 -0
  121. data/gems/gems/nake-0.0.8/spec/nake/tasks/clean_spec.rb +0 -0
  122. data/gems/gems/nake-0.0.8/spec/nake/tasks/gem_spec.rb +0 -0
  123. data/gems/gems/nake-0.0.8/spec/nake/tasks/release_spec.rb +0 -0
  124. data/gems/gems/nake-0.0.8/spec/nake/tasks/rip_spec.rb +0 -0
  125. data/gems/gems/nake-0.0.8/spec/nake/tasks/spec_spec.rb +0 -0
  126. data/gems/gems/nake-0.0.8/spec/nake/tasks_spec.rb +48 -0
  127. data/gems/gems/nake-0.0.8/spec/nake/template_spec.rb +84 -0
  128. data/gems/gems/nake-0.0.8/spec/nake_spec.rb +9 -0
  129. data/gems/gems/nake-0.0.8/spec/spec.opts +5 -0
  130. data/gems/gems/nake-0.0.8/spec/spec_helper.rb +29 -0
  131. data/gems/gems/nake-0.0.8/spec/stubs/database.yml.erb +9 -0
  132. data/gems/gems/nake-0.0.8/spec/stubs/database.yml.tt +9 -0
  133. data/gems/gems/nake-0.0.8/tasks.rb +42 -0
  134. data/gems/gems/term-ansicolor-1.0.4/CHANGES +22 -0
  135. data/gems/gems/term-ansicolor-1.0.4/COPYING +340 -0
  136. data/gems/gems/term-ansicolor-1.0.4/README +31 -0
  137. data/gems/gems/term-ansicolor-1.0.4/Rakefile +86 -0
  138. data/gems/gems/term-ansicolor-1.0.4/VERSION +1 -0
  139. data/gems/gems/term-ansicolor-1.0.4/doc-main.txt +119 -0
  140. data/gems/gems/term-ansicolor-1.0.4/examples/cdiff.rb +19 -0
  141. data/gems/gems/term-ansicolor-1.0.4/examples/example.rb +89 -0
  142. data/gems/gems/term-ansicolor-1.0.4/install.rb +15 -0
  143. data/gems/gems/term-ansicolor-1.0.4/lib/term/ansicolor.rb +102 -0
  144. data/gems/gems/term-ansicolor-1.0.4/lib/term/ansicolor/version.rb +10 -0
  145. data/gems/gems/term-ansicolor-1.0.4/term-ansicolor.gemspec +20 -0
  146. data/gems/specifications/bacon-1.1.0.gemspec +30 -0
  147. data/gems/specifications/code-cleaner-0.8.1.gemspec +31 -0
  148. data/gems/specifications/nake-0.0.8.gemspec +35 -0
  149. data/gems/specifications/term-ansicolor-1.0.4.gemspec +30 -0
  150. data/lib/do_riak.rb +10 -0
  151. data/lib/do_riak/errors.rb +11 -0
  152. data/lib/do_riak/transaction.rb +24 -0
  153. data/lib/do_riak/version.rb +7 -0
  154. data/script/bacon +3 -0
  155. data/script/code-cleaner +3 -0
  156. data/script/nake +3 -0
  157. data/spec/command_spec.rb +8 -0
  158. data/spec/connection_spec.rb +17 -0
  159. data/spec/reader_spec.rb +8 -0
  160. data/spec/result_spec.rb +12 -0
  161. data/spec/spec_helper.rb +19 -0
  162. data/spec/typecast/array_spec.rb +8 -0
  163. data/spec/typecast/bigdecimal_spec.rb +8 -0
  164. data/spec/typecast/boolean_spec.rb +8 -0
  165. data/spec/typecast/byte_array_spec.rb +8 -0
  166. data/spec/typecast/class_spec.rb +8 -0
  167. data/spec/typecast/date_spec.rb +8 -0
  168. data/spec/typecast/datetime_spec.rb +8 -0
  169. data/spec/typecast/float_spec.rb +12 -0
  170. data/spec/typecast/integer_spec.rb +8 -0
  171. data/spec/typecast/nil_spec.rb +16 -0
  172. data/spec/typecast/other_spec.rb +8 -0
  173. data/spec/typecast/range_spec.rb +8 -0
  174. data/spec/typecast/string_spec.rb +8 -0
  175. data/spec/typecast/time_spec.rb +8 -0
  176. data/tasks.rb +37 -0
  177. metadata +238 -0
@@ -0,0 +1,65 @@
1
+ # encoding: utf-8
2
+
3
+ require "fileutils"
4
+ require "nake/colors"
5
+
6
+ module Nake
7
+ module TaskHelpers
8
+ include FileUtils
9
+ def run(*parts)
10
+ puts parts.join(" ").cyan
11
+ system(*parts)
12
+ end
13
+
14
+ # return true if process suceeded, false otherwise
15
+ # sh "ls -a"
16
+ # sh "ls", "-a"
17
+ def sh(*parts)
18
+ puts "#{"$".magenta} #{parts.join(" ").cyan}"
19
+ system("sh", "-c", *parts)
20
+ end
21
+
22
+ # zsh "ls .*(.)"
23
+ def zsh(*parts)
24
+ puts "#{"%".magenta} #{parts.join(" ").cyan}"
25
+ system("zsh", "-c", *parts)
26
+ end
27
+ end
28
+
29
+ module PrintHelpers
30
+ def info(message)
31
+ puts "~ #{message}".cyan if Nake.verbose
32
+ end
33
+
34
+ def note(message)
35
+ puts "~ #{message}".green if Nake.verbose
36
+ end
37
+
38
+ def warn(message)
39
+ Kernel.warn("~ #{message.yellow}") if Nake.debug
40
+ end
41
+
42
+ def debug(message)
43
+ STDERR.puts("~ #{message.yellow}") if Nake.debug
44
+ end
45
+
46
+ def error(message)
47
+ STDERR.puts "~ #{message}".red
48
+ end
49
+
50
+ def abort(message)
51
+ Kernel.abort "[#{"ERROR".red}] #{message}"
52
+ end
53
+
54
+ def print_exception_and_abort(exception)
55
+ abort exception.message
56
+ end
57
+
58
+ def print_exception_with_backtrace_and_abort(exception)
59
+ abort [exception.message, exception.backtrace.join("\n- ")].join("\n")
60
+ end
61
+ end
62
+ end
63
+
64
+ Object.send(:include, Nake::TaskHelpers)
65
+ Object.send(:include, Nake::PrintHelpers)
@@ -0,0 +1,38 @@
1
+ module Rake
2
+ def self.method_missing
3
+ raise NotImplementedError
4
+ end
5
+
6
+ def self.const_missing(constant)
7
+ raise NotImplementedError, "Nake doesn't support Rake::#{constant}, please use normal Rake"
8
+ end
9
+ end
10
+
11
+ # lazy-loading FTW!
12
+ def Object.const_missing(constant)
13
+ if constant.eql?(:FileList)
14
+ begin
15
+ require "filelist"
16
+ FileList
17
+ rescue LoadError
18
+ raise LoadError, "You have to install filelist gem!"
19
+ end
20
+ end
21
+ end
22
+
23
+ module Nake
24
+ module RakeDSL
25
+ def task
26
+ end
27
+
28
+ def file
29
+ end
30
+
31
+ def rule
32
+ end
33
+
34
+ def multitask
35
+ raise NotImplementedError, "Multitask method won't be supported"
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+
3
+ require "nake/abstract_task"
4
+
5
+ module Nake
6
+ class Rule < AbstractTask
7
+ undef_method :hidden, :hidden=
8
+ class << self
9
+ undef_method :tasks
10
+ end
11
+
12
+ def self.rules
13
+ @@rules ||= Hash.new
14
+ end
15
+
16
+ # Rule["test.o"]
17
+ # # => rule with pattern ".o"
18
+ def self.[](file)
19
+ self.rules.find { |rule| rule.match?(file.to_s) }
20
+ end
21
+
22
+ def self.[]=(pattern, rule)
23
+ self.rules[pattern.to_s] = rule
24
+ end
25
+
26
+ alias_method :pattern, :name
27
+ def match?(file)
28
+ #
29
+ end
30
+ end
31
+
32
+ # Somewhat like method_missing:
33
+ # If you can't find a task, try to look for a rule
34
+ AbstractTask.tasks.default_proc = lambda { |hash, name| Rule[name] }
35
+ end
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+
3
+ # options.extend(HashStructMixin)
4
+ # options.name
5
+ # options.force?
6
+ module Nake
7
+ module HashStructMixin
8
+ def method_missing(name, *args, &block)
9
+ if args.empty? && block.nil?
10
+ # options.name
11
+ if value = self[name]
12
+ return value
13
+ # options.force?
14
+ elsif name.to_s.match(/^(.*)\?$/) && value = self[$1.to_sym]
15
+ return value
16
+ end
17
+ end
18
+
19
+ super(name, *args, &block)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,6 @@
1
+ require "nake/abstract_task"
2
+
3
+ module Nake
4
+ class Task < AbstractTask
5
+ end
6
+ end
@@ -0,0 +1,30 @@
1
+ # encoding: utf-8
2
+
3
+ require "nake/task"
4
+
5
+ # NOTE: if you have bundler bundled locally, just
6
+ # add bundler/lib into $: and this task will work
7
+ Nake::Task.new(:bundle) do |task|
8
+ task.description = "Install your gems locally from gems/cache via bundler"
9
+
10
+ # define bundler method, so we can test it
11
+ task.define_singleton_method(:bundler) do
12
+ @bundler ||= Gem::Commands::BundleCommand.new
13
+ end
14
+
15
+ # task definition
16
+ task.define do |*args, options|
17
+ require 'rubygems'
18
+ require 'rubygems/command'
19
+
20
+ begin
21
+ require 'bundler'
22
+ require 'bundler/commands/bundle_command'
23
+ rescue LoadError
24
+ abort "You have to have bundler installed!"
25
+ end
26
+
27
+ args.push("--cached") unless options.delete[:cached]
28
+ self.bundler.invoke(*task.original_args)
29
+ end
30
+ end
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+
3
+ require "nake/dsl"
4
+
5
+ # require "nake/tasks/clean"
6
+ # Task[:clean].config[:files] = Dir["*.gem"]
7
+ Task.new(:clean) do |task|
8
+ task.config[:files] = Array.new
9
+ task.define do
10
+ task.config[:files].each { |file| rm_f file }
11
+ end
12
+ end
@@ -0,0 +1,29 @@
1
+ # encoding: utf-8
2
+
3
+ require "nake/dsl"
4
+ require "nake/tasks/clean"
5
+
6
+ # register gem files for cleaning
7
+ Task[:clean].config[:files].push(*Dir["*.gem"])
8
+
9
+ module Nake::PackageMixin
10
+ def gem_name
11
+ "#{Task[:release].config[:name]}-#{Task[:release].config[:version]}.gem"
12
+ end
13
+ end
14
+
15
+ # require "nake/tasks/gem"
16
+ # Task[:build].config[:gemspec] = Dir["*.gemspec"]
17
+ Task.new(:build) do |task|
18
+ task.define do
19
+ sh "gem build #{task.config[:gemspec]}"
20
+ end
21
+ end
22
+
23
+ Task.new(:install, :build) do |task|
24
+ task.extend(PackageMixin)
25
+ task.description = "Install"
26
+ task.define do
27
+ sh "gem install #{self.gem_name}"
28
+ end
29
+ end
@@ -0,0 +1,43 @@
1
+ # encoding: utf-8
2
+
3
+ require "nake/tasks/gem"
4
+
5
+ # require "nake/tasks/release"
6
+ # Task[:release].config[:version] = Nake::VERSION
7
+ task(:release, "release:tag", "release:gemcutter").tap do |task|
8
+ task.description = "Release current version version"
9
+ task.define do
10
+ puts "Version #{task.config[:version]} was successfuly published. Don't forget to increase VERSION constant!"
11
+ end
12
+ end
13
+
14
+ task(:prerelease).tap do |task|
15
+ task.description = "Update prerelease version"
16
+ task.define do
17
+ Task[:release].config[:version] = "#{Task[:release].config[:version]}.pre"
18
+ Task[:build].config[:gemspec] = Task[:build].config[:gemspec].sub(/\.gemspec/, ".pre.gemspec")
19
+ Task["release:gemcutter"].call
20
+ end
21
+ end
22
+
23
+ Task.new("release:tag") do |task|
24
+ task.description = "Create Git tag"
25
+ task.define do
26
+ version = Task[:release].config[:version]
27
+ raise ConfigurationError, "You have to provide Task[:release].config[:version]!" if version.nil?
28
+ puts "Creating new git tag #{version} and pushing it online ..."
29
+ sh "git tag -a -m 'Version #{version}' #{version}"
30
+ sh "git push --tags"
31
+ puts "Tag #{version} was created and pushed to GitHub."
32
+ end
33
+ end
34
+
35
+ Task.new("release:gemcutter") do |task|
36
+ task.description = "Push gem to Gemcutter"
37
+ task.dependencies = [:clean, :build]
38
+ task.extend(PackageMixin)
39
+ task.define do
40
+ puts "Pushing to Gemcutter ..."
41
+ sh "gem push #{self.gem_name}"
42
+ end
43
+ end
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+
3
+ begin
4
+ require "recho"
5
+ rescue LoadError
6
+ raise LoadError, "This task require recho gem!"
7
+ end
8
+
9
+ require "nake/file_task"
10
+
11
+ # FileTask["deps.rip"].config[:versions] = {rack: "1.0.1", media_path: "SHA1"}
12
+
13
+ # register task
14
+ #Task[:release].dependencies.unshift("deps.rip")
15
+
16
+ # deps.rip.str:
17
+ ##!/usr/bin/env rip install
18
+ #
19
+ ## Syntax:
20
+ ## repository [tag or commit to install]
21
+ #git://github.com/botanicus/media-path.git %{media_path}
22
+ #git://github.com/rack/rack.git %{rack}
23
+
24
+ FileTask.new("deps.rip", "deps.rip.str") do |task|
25
+ task.config[:versions] = Hash.new
26
+ task.description = "Regenerate deps.rip"
27
+ task.define do
28
+ data = File.read("deps.rip.str")
29
+ dependencies = "%Q{#{data}}" % task.config[:versions]
30
+ FileUtils.echo("deps.str") > dependencies
31
+ sh "chmod +x deps.rip"
32
+ end
33
+ end
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+
3
+ # ./tasks.rb spec/nake/argv_spec.rb spec/nake/task_spec.rb
4
+ task(:spec) do |*paths, options|
5
+ paths.push("spec") if paths.empty?
6
+ sh "spec", *paths
7
+ end
8
+
9
+ Task.new("spec:stubs") do |task|
10
+ task.description = "Create stubs of all library files."
11
+ task.define do
12
+ Dir.glob("lib/**/*.rb").each do |file|
13
+ specfile = file.sub(/^lib/, "spec").sub(/\.rb$/, '_spec.rb')
14
+ unless File.exist?(specfile)
15
+ sh "mkdir -p #{File.dirname(specfile)}"
16
+ sh "touch #{specfile}"
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+
3
+ module Nake
4
+ module TaskHelpers
5
+ def template(source, target, context = Hash.new)
6
+ template = Template.new(source)
7
+ File.open(target, "w") do |file|
8
+ file.puts(template.render(context))
9
+ end
10
+ end
11
+
12
+ def erb(source, target, context = Hash.new)
13
+ template = ErbTemplate.new(source)
14
+ File.open(target, "w") do |file|
15
+ file.puts(template.render(context))
16
+ end
17
+ end
18
+ end
19
+
20
+ class Template
21
+ def initialize(path)
22
+ @path = path
23
+ end
24
+
25
+ def render(context = Hash.new)
26
+ File.read(@path) % context
27
+ end
28
+ end
29
+
30
+ class ErbTemplate
31
+ def initialize(path)
32
+ require "erb"
33
+ @path = path
34
+ end
35
+
36
+ def set_locals(context)
37
+ context.inject("") do |source, pair|
38
+ source += "#{pair.first} = context[:#{pair.first}]\n"
39
+ end
40
+ end
41
+
42
+ def source(context)
43
+ ["<% #{self.set_locals(context)} %>", File.read(@path)].join("")
44
+ end
45
+
46
+ def render(context = Hash.new)
47
+ template = ERB.new(self.source(context))
48
+ template.result(binding)
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env gem build
2
+ # encoding: utf-8
3
+
4
+ # NOTE: we can't use require_relative because when we run gem build, it use eval for executing this file
5
+ #$:.unshift(File.join(File.dirname(__FILE__), "lib"))
6
+ #require "nake"
7
+
8
+ Gem::Specification.new do |s|
9
+ s.name = "nake"
10
+ s.version = "0.0.8"
11
+ s.authors = ["Jakub Šťastný aka Botanicus"]
12
+ s.homepage = "http://github.com/botanicus/nake"
13
+ s.summary = "Nake is light-weight and highly flexible Rake replacement with much better arguments parsing"
14
+ s.description = "" # TODO: long description
15
+ s.cert_chain = nil
16
+ s.email = ["knava.bestvinensis", "gmail.com"].join("@")
17
+ s.has_rdoc = true
18
+
19
+ # files
20
+ s.files = Dir.glob("**/*")
21
+ s.executables = ["nake"]
22
+ s.default_executable = "nake"
23
+ s.require_paths = ["lib"]
24
+
25
+ # Ruby version
26
+ s.required_ruby_version = ::Gem::Requirement.new("~> 1.9")
27
+
28
+ # dependencies
29
+ s.add_dependency "term-ansicolor"
30
+
31
+ begin
32
+ require "changelog"
33
+ rescue LoadError
34
+ warn "You have to have changelog gem installed for post install message"
35
+ else
36
+ changelog = CHANGELOG.new(File.join(File.dirname(__FILE__), "CHANGELOG"))
37
+ s.post_install_message = "=== Changes in the last Nake ===\n- #{changelog.last_version_changes.join("\n- ")}"
38
+ end
39
+
40
+ # RubyForge
41
+ s.rubyforge_project = "nake"
42
+ end