drumherum 0.1.17 → 0.1.18

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.
data/README.rdoc CHANGED
@@ -2,27 +2,28 @@
2
2
  = Drumherum
3
3
  http://bklippstein.github.com/drumherum/frames.html
4
4
 
5
+ "Drumherum" is a german word for "the stuff around it".
6
+
5
7
  == $LOAD_PATH management
6
- +smart_init+ finds the directory named 'lib' in your project and adds
7
- * the (main) directory above
8
- * the lib-directory itself
9
- to Rubys $LOAD_PATH. So your require statements load the actual version from your (local) project directory, not the (public) gem version.
10
-
11
- Usage (wherever you are in the directory hierarchy of your project):
12
- if $0 == __FILE__
13
- require 'drumherum'
14
- smart_init
15
- end
16
- require 'my-gem-project' # actual local version, not the gem version
17
-
18
- == Rake tasks for deployment
19
- rake publish # publish all on github and rubygems, reinstall gem
20
- rake git_publish # publish actual version to github
8
+ {include:SmartInit}
9
+
10
+ == Rake tasks for DRY release automation
11
+ Usage: Instead of +require 'rake'+ use
12
+ require 'drumherum/rake'
13
+ Tasks:
14
+ rake version # VERSION of the current project and the installed gem
15
+ rake publish # publish gem & docs on github and rubygems, reinstall gem
16
+
17
+ rake git_publish # publish current project to github
21
18
  rake git_publish_docs # publish docs to github
22
19
  rake rubygems_publish # release actual version to rubygems
20
+ See {file:lib/drumherum/rake.rb rake.rb}
23
21
 
24
22
  == Unit Tests
25
- You will see a status display for your tests if you use UnitTest instead of Test::Unit::TestCase:
23
+ {include:UnitTest}
24
+
25
+ == Easy development of regular expressions
26
+ See {String#show_regexp}
26
27
 
27
28
 
28
29
 
data/Rakefile.rb CHANGED
@@ -9,7 +9,6 @@ YARD::Rake::YardocTask.new
9
9
  Drumherum.github_username = 'bklippstein'
10
10
 
11
11
 
12
-
13
12
  # ----------------------------------------------------------------------------------------------
14
13
  # Hoe
15
14
  #
@@ -34,25 +33,16 @@ end
34
33
 
35
34
 
36
35
 
37
-
38
36
  # ----------------------------------------------------------------------------------------------
39
- # Local Tasks
37
+ # Hide Tasks
40
38
  #
41
39
 
42
- remove_task 'audit'
43
- remove_task 'dcov'
44
- remove_task 'debug_email'
45
- remove_task 'debug_gem'
46
- remove_task 'deploy'
47
- remove_task 'deps:email'
48
- remove_task 'install_gem'
49
- remove_task 'multi'
50
- remove_task 'newb'
51
- remove_task 'publish_docs'
52
- remove_task 'rdoc'
53
- remove_task 'ridocs'
54
-
55
- #Dir['tasks/**/*.rake'].each { |t| load t }
40
+ hide_tasks [ :announce, :audit, :check_extra_deps, :clobber_docs, :clobber_package, :default ]
41
+ hide_tasks [ :dcov, :debug_email, :docs, :gem, :git_add, :git_commit, :git_push, :install_gem ]
42
+ hide_tasks [ :newb, :package, :post_blog, :publish_docs, :release, :release_sanity, :release_to_gemcutter ]
43
+ hide_tasks [ :repackage, :ridocs, :sleep_15, :sleep_5, :utf8, :yard, :yard_post ]
44
+
45
+
56
46
 
57
47
 
58
48
 
@@ -1,14 +1,7 @@
1
1
  # ruby encoding: utf-8
2
2
 
3
- #== Rake
4
-
5
- # ----------------------------------------------------------------------------------------------
6
- # Rake initialisieren
7
- #
8
-
9
3
  require 'rake'
10
4
 
11
-
12
5
 
13
6
  # ----------------------------------------------------------------------------------------------
14
7
  # Ergänzung: Alte Tasks entfernen
@@ -16,6 +9,16 @@ require 'rake'
16
9
  # Beispiel: remove_task 'test:plugins'
17
10
  # Quelle: http://matthewbass.com/2007/03/07/overriding-existing-rake-tasks/
18
11
  # dies hier stimmt nicht: http://www.dcmanges.com/blog/modifying-rake-tasks
12
+
13
+
14
+ # @private
15
+ module Rake
16
+ class Task
17
+ def hide!
18
+ @comment = nil
19
+ end
20
+ end
21
+ end
19
22
 
20
23
  Rake::TaskManager.class_eval do
21
24
  def remove_task(task_name)
@@ -23,13 +26,44 @@ Rake::TaskManager.class_eval do
23
26
  end
24
27
  end
25
28
 
26
- def remove_task(task_name)
27
- Rake.application.remove_task(task_name)
29
+
30
+ module RakeTaskCleanup
31
+
32
+ # If you want to override a task, you first have to delete it. Usage:
33
+ # remove_task 'test:plugins'
34
+ #
35
+ def remove_task(task_name)
36
+ Rake.application.remove_task(task_name)
37
+ end
38
+
39
+ # You can just hide tasks by clearing their descriptions.
40
+ # After this they still exist, but they are not listed anymore.
41
+ # Usage:
42
+ # hide_tasks [ :announce, :audit, :check_extra_deps, :clobber_docs, :clobber_package, :default ]
43
+ #
44
+ def hide_tasks(task_list)
45
+ task_list.each do | task_name |
46
+ t = Rake.application.lookup(task_name)
47
+ t.hide!
48
+ end
49
+ end
50
+ end
51
+
52
+ class Object
53
+ include RakeTaskCleanup
28
54
  end
29
55
 
30
56
 
31
57
 
32
58
 
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
33
67
  # -------------------------------------------------------------------------------------------------------
34
68
  # publish
35
69
  #
@@ -268,11 +302,17 @@ end
268
302
 
269
303
  # Task :version
270
304
  #
271
- desc 'VERSION of the current project'
305
+ desc 'VERSION of the current project and the installed gem'
272
306
  task :version do
273
307
 
274
- puts "\n#{Drumherum.project_name} (#{Drumherum.project_version})\n\n"
275
-
308
+ puts "\n*** THIS PROJECT ***\n"
309
+ puts "\n#{Drumherum.project_name} (#{Drumherum.project_version})\n"
310
+ verbose(false) do
311
+ sh "gem list #{Drumherum.project_name}"
312
+ end
313
+ puts
314
+ puts
315
+
276
316
  end
277
317
 
278
318
 
@@ -3,11 +3,12 @@
3
3
 
4
4
  class String
5
5
 
6
-
7
- # Zeigt das Ergebnis eines Matches mit einer Regular Expression. Erleichtert das Entwickeln regulärer Ausdrücke.
6
+ # Easy development of regular expressions.
7
+ # @return [String] result of the match
8
+ # @param [Regexp] regular_expression to match with +self+
8
9
  #
9
- def show_regexp(re)
10
- if self =~ re
10
+ def show_regexp(regular_expression)
11
+ if self =~ regular_expression
11
12
  "#{$`}<<#{$&}>>#{$'}"
12
13
  else
13
14
  "no match"
@@ -17,6 +18,7 @@ class String
17
18
  end
18
19
 
19
20
  if defined? TransparentNil
21
+ # @private
20
22
  class NilClass
21
23
  def show_regexp(*a); nil; end
22
24
  end
@@ -1,12 +1,33 @@
1
1
  # ruby encoding: utf-8
2
- # ü
3
-
2
+ #
3
+ #
4
+ # You set up your release info once in your Rakefile. Like this:
5
+ # require 'drumherum'
6
+ # smart_init
7
+ # require 'version'
8
+ # require 'yard'
9
+ # require 'drumherum/rake'
10
+ # YARD::Rake::YardocTask.new
11
+ # Drumherum.github_username = 'your_user_name'
12
+ #
13
+ # {SmartInit#smart_init smart_init} detects your root directory and sets up the projectname and all other stuff.
14
+ #
4
15
  module Drumherum
5
16
 
6
17
 
7
18
  class << self
19
+
20
+ # @!group Set this up in your Rakefile
21
+
22
+ # @return [void] Set your github username
23
+ def github_username=(your_user_name)
24
+ @github_username = your_user_name
25
+ end
26
+
27
+
28
+ # @!group Release infos for DRY release automation
8
29
 
9
- # Name of the actual project
30
+ # @return [String] Name of the actual project
10
31
  def project_name
11
32
  if @directory_main
12
33
  @directory_main[-1].strip
@@ -16,7 +37,7 @@ module Drumherum
16
37
  end
17
38
 
18
39
 
19
- # Class of the actual project
40
+ # @return [Class] Class of the actual project
20
41
  def project_class
21
42
  classname = project_name.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
22
43
  unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ classname
@@ -25,70 +46,85 @@ module Drumherum
25
46
  Object.module_eval("::#{$1}", __FILE__, __LINE__)
26
47
  end
27
48
 
28
- # Version of the actual project
49
+ # @return [String] Version of the actual project
29
50
  def project_version
30
51
  project_class.const_get('VERSION')
31
52
  end
32
53
 
33
54
 
34
55
 
35
- # Set your github username
36
- def github_username=(gn)
37
- @github_username = gn
38
- end
56
+
39
57
 
40
- # Your github username
58
+ # @return [String] Your github username
59
+ # (see #github_username=)
41
60
  def github_username
42
61
  @github_username || 'gleer'
43
62
  end
44
63
 
45
- # Set the main directory (as array)
64
+ # @return [void] Set the main directory (as array)
65
+ # @private
46
66
  def directory_main=(mn)
47
67
  @directory_main = mn
48
68
  end
49
69
 
50
- # The main directory (as array).
51
- # main_dir = File.join(Drumherum::directory_main)
52
- # lib_dir = File.join(Drumherum::directory_main, 'lib')
53
- # test_dir = File.join(Drumherum::directory_main, 'test')
70
+ # The root directory of your project (as array).
71
+ # It's available whenever you called {SmartInit#smart_init smart_init} before.
72
+ # You can call {SmartInit#smart_init smart_init} from any location in your project directory.
73
+ # * main_dir = File.join(Drumherum.directory_main)
74
+ # * lib_dir = File.join(Drumherum.directory_main, 'lib')
75
+ # * test_dir = File.join(Drumherum.directory_main, 'test')
76
+ # @return [Array]
54
77
  #
55
78
  def directory_main
56
79
  @directory_main || []
57
80
  end
58
81
 
59
82
 
83
+ # @return [void] indicates setup complete. All require-statements are done.
60
84
  def loaded!
61
85
  @loaded = true
62
86
  end
63
87
 
88
+
89
+ # @return [true, false] setup complete? All require-statements done?
64
90
  def loaded?
65
91
  @loaded
66
92
  end
67
93
 
94
+ # @return [String] URI to github (source)
68
95
  def url_source
69
96
  "https://github.com/#{Drumherum.github_username}/#{Drumherum.project_name}"
70
97
  end
71
98
 
99
+ # @return [String] URI to github (documentation)
72
100
  def url_docs
73
101
  "http://#{Drumherum.github_username}.github.com/#{Drumherum.project_name}/frames.html"
74
102
  end
75
-
103
+
104
+
76
105
  end # moduldefinitionen
77
106
 
78
107
  end
79
108
 
80
109
 
110
+ # {SmartInit#smart_init smart_init} finds the directory named 'lib' in your project and adds
111
+ # * the (main) directory above
112
+ # * the lib-directory itself
113
+ # to Rubys $LOAD_PATH. So your require statements load the actual version from your (local) project directory, not the (public) gem version.
114
+ #
115
+ # Also, {SmartInit#smart_init smart_init} sets some {Drumherum release infos} for Hoe.
116
+ #
117
+ # Usage (wherever you are in the directory hierarchy of your project):
118
+ # if $0 == __FILE__
119
+ # require 'drumherum'
120
+ # smart_init
121
+ # end
122
+ # require 'my-gem-project' # actual local version, not the gem version
123
+ #
81
124
  module SmartInit
82
-
83
- # Vereinfacht die require-Statements in den Tests bei der Entwicklung von Libraries.
84
- # Beim lokalen Aufruf eines einzelnen Tests wird die lokale Version der Library verwendet, nicht die installierte gem.
85
- # Verwendung:
86
- # if $0 == __FILE__
87
- # require 'drumherum'
88
- # smart_init
89
- # end
90
- # require 'mygemproject'
91
- #
125
+
126
+ # @!group Included in Object
127
+
92
128
  def smart_init(__file__ = nil)
93
129
  __file__ = caller[0] unless __file__
94
130
  dir_caller =File.dirname(__file__)
@@ -124,7 +160,7 @@ module SmartInit
124
160
 
125
161
  end # module
126
162
 
127
-
163
+ # @private
128
164
  class Object
129
165
  include SmartInit
130
166
  end
@@ -1,11 +1,12 @@
1
1
  # ruby encoding: utf-8
2
2
  require 'test/unit'
3
3
 
4
+ # You will see a status display for your tests if you use {UnitTest} instead of Test::Unit::TestCase:
5
+ #
6
+ class UnitTest < Test::Unit::TestCase
4
7
 
5
- class UnitTest < Test::Unit::TestCase # :nodoc:
6
-
7
- # Meldet den aktuell durchlaufenden Test
8
- def test0 #:nodoc:
8
+ # looks like a test, but just prints status information
9
+ def test0
9
10
  name = self.class.to_s.gsub(/^.*::/, '')
10
11
  name.gsub!(/^Test/, '')
11
12
  name.gsub!(/^[0-9]+/, '')
@@ -28,6 +29,7 @@ end
28
29
  #
29
30
  if $0 == __FILE__
30
31
 
32
+ # @private
31
33
  class Test030Blatest < UnitTest # :nodoc:
32
34
 
33
35
  def test_bla
data/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Drumherum
3
3
 
4
- VERSION = '0.1.17'
4
+ VERSION = '0.1.18'
5
5
 
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drumherum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.1.18
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: