Module: Drumherum
- Defined in
- lib/drumherum/smart_init.rb
You set up your release info once in your Rakefile. Like this:
require 'drumherum'
smart_init
require 'version'
require 'yard'
require 'drumherum/rake'
YARD::Rake::YardocTask.new
Drumherum.github_username = 'your_user_name'
smart_init detects your root directory and sets up the projectname and all other stuff.
Set this up in your Rakefile (collapse)
-
+ github_username=(your_user_name)
Set your github username.
Release infos for DRY release automation (collapse)
-
+ (Array) directory_main
The root directory of your project (as array).
-
+ (String) github_username
(see #github_username=).
-
+ (Symbol) host_os
Host OS: :windows, :linux or :other.
-
+ loaded!
Indicates setup complete.
-
+ (true, false) loaded?
Setup complete? All require-statements done?.
-
+ (Class) project_class
Class of the actual project.
-
+ (String) project_name
Name of the actual project.
-
+ (String) project_version
Version of the actual project.
-
+ (String) ruby_dir
Path of Ruby installation.
-
+ (String) url_docs
URI to github (documentation).
-
+ (String) url_source
URI to github (source).
Class Method Details
+ (Array) directory_main
The root directory of your project (as array). It's available whenever you called smart_init before. You can call smart_init from any location in your project directory.
-
main_dir = File.join(Drumherum.directory_main)
-
lib_dir = File.join(Drumherum.directory_main, 'lib')
-
test_dir = File.join(Drumherum.directory_main, 'test')
78 79 80 81 82 83 84 |
# File 'lib/drumherum/smart_init.rb', line 78 def directory_main if defined? @directory_main @directory_main else [] end end |
+ (String) github_username
(see #github_username=)
60 61 62 |
# File 'lib/drumherum/smart_init.rb', line 60 def github_username @github_username || 'gleer' end |
+ github_username=(your_user_name)
This method returns an undefined value.
Set your github username
23 24 25 |
# File 'lib/drumherum/smart_init.rb', line 23 def github_username=(your_user_name) @github_username = your_user_name end |
+ (Symbol) host_os
Host OS: :windows, :linux or :other.
116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/drumherum/smart_init.rb', line 116 def host_os return $host_os if defined? $host_os case RbConfig::CONFIG['host_os'] when /mswin|windows|mingw32|cygwin32/i $host_os = :windows when /linux/i $host_os = :linux else $host_os = :other end # case #puts "RbConfig::CONFIG['host_os']=#{RbConfig::CONFIG['host_os']}" #puts "$host_os=#{$host_os.inspect}" end |
+ loaded!
This method returns an undefined value.
Indicates setup complete. All require-statements are done.
88 89 90 |
# File 'lib/drumherum/smart_init.rb', line 88 def loaded! @loaded = true end |
+ (true, false) loaded?
Setup complete? All require-statements done?
94 95 96 |
# File 'lib/drumherum/smart_init.rb', line 94 def loaded? @loaded end |
+ (Class) project_class
Class of the actual project
41 42 43 44 45 46 47 |
# File 'lib/drumherum/smart_init.rb', line 41 def project_class classname = project_name.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ classname raise NameError, "#{classname.inspect} is not a valid constant name!" end Object.module_eval("::#{$1}", __FILE__, __LINE__) end |
+ (String) project_name
Name of the actual project
31 32 33 34 35 36 37 |
# File 'lib/drumherum/smart_init.rb', line 31 def project_name if @directory_main @directory_main[-1].strip else raise "start smart_init first" end end |
+ (String) project_version
Version of the actual project
50 51 52 |
# File 'lib/drumherum/smart_init.rb', line 50 def project_version project_class.const_get('VERSION') end |
+ (String) ruby_dir
Path of Ruby installation
110 111 112 |
# File 'lib/drumherum/smart_init.rb', line 110 def ruby_dir RbConfig::CONFIG['prefix'] end |
+ (String) url_docs
URI to github (documentation)
104 105 106 |
# File 'lib/drumherum/smart_init.rb', line 104 def url_docs "http://#{Drumherum.github_username}.github.com/#{Drumherum.project_name}/frames.html" end |
+ (String) url_source
URI to github (source)
99 100 101 |
# File 'lib/drumherum/smart_init.rb', line 99 def url_source "https://github.com/#{Drumherum.github_username}/#{Drumherum.project_name}" end |