moneypools-rake_helpers 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg
data/Rakefile CHANGED
@@ -1,24 +1,33 @@
1
1
  require 'rubygems'
2
- gem 'hoe', '>= 2.1.0'
3
- require 'hoe'
4
- require 'fileutils'
5
- require './lib/rake_helpers'
2
+ require 'rake'
6
3
 
7
- Hoe.plugin :newgem
8
- # Hoe.plugin :website
9
- # Hoe.plugin :cucumberfeatures
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "#{ENV['github'] ? 'moneypools-' : ''}rake_helpers"
8
+ gem.summary = %Q{Some extensions to sprout}
9
+ gem.email = "support@mymoneypools.com"
10
+ gem.homepage = "http://github.com/moneypools/rake_helpers"
11
+ gem.authors = ["moneypools"]
12
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
13
+ end
10
14
 
11
- # Generate all the Rake tasks
12
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
- $hoe = Hoe.spec 'rake_helpers' do
14
- self.developer 'moneypools', 'support@mymoneypools.com'
15
- self.rubyforge_name = self.name # TODO this is default value
16
- # self.extra_deps = [['activesupport','>= 2.2.2']]
15
+ rescue LoadError
16
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
17
17
  end
18
18
 
19
- require 'newgem/tasks'
20
- Dir['tasks/**/*.rake'].each { |t| load t }
19
+ require 'rake/rdoctask'
20
+ Rake::RDocTask.new do |rdoc|
21
+ if File.exist?('VERSION.yml')
22
+ config = YAML.load(File.read('VERSION.yml'))
23
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
24
+ else
25
+ version = ""
26
+ end
27
+
28
+ rdoc.rdoc_dir = 'rdoc'
29
+ rdoc.title = "sprout-extensions #{version}"
30
+ rdoc.rdoc_files.include('README*')
31
+ rdoc.rdoc_files.include('lib/**/*.rb')
32
+ end
21
33
 
22
- # TODO - want other tests/tasks run by default? Add them to the list
23
- # remove_task :default
24
- # task :default => [:spec, :features]
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.5
@@ -1,3 +1,4 @@
1
+ require 'yaml'
1
2
  require 'singleton'
2
3
 
3
4
  module MP
@@ -9,10 +10,10 @@ module MP
9
10
  class Option
10
11
  attr_reader :attribute, :name, :message, :default
11
12
 
12
- def initialize(attribute, options, &block)
13
+ def initialize(attribute, overrides, options, &block)
13
14
  @attribute = attribute
14
15
 
15
- @overrides = ENV
16
+ @overrides = overrides
16
17
  @default = options[:default]
17
18
  @name = options.fetch(:name, attribute).to_s
18
19
  @message = options.fetch(:message, "Must specify #{attribute} with #{name}=")
@@ -32,7 +33,7 @@ module MP
32
33
  end
33
34
 
34
35
  def fetch(local_default)
35
- value = fetch_from(@overrides) || @value || local_default || default
36
+ value = fetch_from_overrides || @value || local_default || default
36
37
  @parser ? @parser.call(value) : value
37
38
  end
38
39
 
@@ -46,6 +47,11 @@ module MP
46
47
  end
47
48
 
48
49
  private
50
+ def fetch_from_overrides
51
+ # grab the first hit
52
+ @overrides.map { |overrides| fetch_from(overrides) }.compact[0]
53
+ end
54
+
49
55
  def name_variants
50
56
  key = name.to_s
51
57
 
@@ -65,12 +71,21 @@ module MP
65
71
  yield instance
66
72
  end
67
73
 
74
+ def self.global_settings_file=(file)
75
+ @global_settings = YAML.load(File.read(file))
76
+ @global_settings
77
+ end
78
+
79
+ def self.global_settings
80
+ @global_settings ||= {}
81
+ end
82
+
68
83
  def initialize
69
84
  @attributes = {}
70
85
  end
71
86
 
72
87
  def add(attribute, options={}, &block)
73
- option = Option.new(attribute, options, &block)
88
+ option = Option.new(attribute, [ENV, configuration_settings], options, &block)
74
89
 
75
90
  @attributes[option.name] = option
76
91
 
@@ -111,6 +126,14 @@ module MP
111
126
  end
112
127
  end
113
128
 
129
+ def configuration_settings
130
+ MP::Config.global_settings[settings_key] ||= {}
131
+ end
132
+
133
+ def settings_key
134
+ @settings_key ||= underscore(self.class.name).split('_')[0]
135
+ end
136
+
114
137
  # The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string.
115
138
  #
116
139
  # Changes '::' to '/' to convert namespaces to paths.
@@ -0,0 +1,47 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{rake_helpers}
5
+ s.version = "0.0.5"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["moneypools"]
9
+ s.date = %q{2009-07-15}
10
+ s.email = %q{support@mymoneypools.com}
11
+ s.files = [
12
+ ".gitignore",
13
+ "History.txt",
14
+ "Rakefile",
15
+ "VERSION",
16
+ "lib/rake_helpers.rb",
17
+ "lib/rake_helpers/config.rb",
18
+ "lib/rake_helpers/erb_helper.rb",
19
+ "rake_helpers.gemspec",
20
+ "script/console",
21
+ "script/destroy",
22
+ "script/generate",
23
+ "spec/rake_helpers_spec.rb",
24
+ "spec/spec.opts",
25
+ "spec/spec_helper.rb",
26
+ "tasks/rspec.rake"
27
+ ]
28
+ s.homepage = %q{http://github.com/moneypools/rake_helpers}
29
+ s.rdoc_options = ["--charset=UTF-8"]
30
+ s.require_paths = ["lib"]
31
+ s.rubygems_version = %q{1.3.4}
32
+ s.summary = %q{Some extensions to sprout}
33
+ s.test_files = [
34
+ "spec/rake_helpers_spec.rb",
35
+ "spec/spec_helper.rb"
36
+ ]
37
+
38
+ if s.respond_to? :specification_version then
39
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
40
+ s.specification_version = 3
41
+
42
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
43
+ else
44
+ end
45
+ else
46
+ end
47
+ end
data/script/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/rake_helpers.rb'}"
9
+ puts "Loading rake_helpers gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
data/script/destroy ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
data/tasks/rspec.rake ADDED
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moneypools-rake_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - moneypools
@@ -9,46 +9,39 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-10 00:00:00 -07:00
12
+ date: 2009-07-15 00:00:00 -07:00
13
13
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: hoe
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 2.3.2
24
- version:
25
- description: FIX (describe your package)
26
- email:
27
- - support@mymoneypools.com
14
+ dependencies: []
15
+
16
+ description:
17
+ email: support@mymoneypools.com
28
18
  executables: []
29
19
 
30
20
  extensions: []
31
21
 
32
- extra_rdoc_files:
33
- - History.txt
34
- - Manifest.txt
22
+ extra_rdoc_files: []
23
+
35
24
  files:
25
+ - .gitignore
36
26
  - History.txt
37
- - Manifest.txt
38
- - README.rdoc
39
27
  - Rakefile
28
+ - VERSION
40
29
  - lib/rake_helpers.rb
41
- - lib/rake_helpers/erb_helper.rb
42
30
  - lib/rake_helpers/config.rb
31
+ - lib/rake_helpers/erb_helper.rb
32
+ - rake_helpers.gemspec
33
+ - script/console
34
+ - script/destroy
35
+ - script/generate
43
36
  - spec/rake_helpers_spec.rb
44
37
  - spec/spec.opts
45
38
  - spec/spec_helper.rb
39
+ - tasks/rspec.rake
46
40
  has_rdoc: false
47
- homepage: http://github.com/#{github_username}/#{project_name}
41
+ homepage: http://github.com/moneypools/rake_helpers
48
42
  post_install_message:
49
43
  rdoc_options:
50
- - --main
51
- - README.rdoc
44
+ - --charset=UTF-8
52
45
  require_paths:
53
46
  - lib
54
47
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -65,10 +58,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
58
  version:
66
59
  requirements: []
67
60
 
68
- rubyforge_project: rake_helpers
61
+ rubyforge_project:
69
62
  rubygems_version: 1.2.0
70
63
  signing_key:
71
64
  specification_version: 3
72
- summary: FIX (describe your package)
73
- test_files: []
74
-
65
+ summary: Some extensions to sprout
66
+ test_files:
67
+ - spec/rake_helpers_spec.rb
68
+ - spec/spec_helper.rb
data/Manifest.txt DELETED
@@ -1,10 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- README.rdoc
4
- Rakefile
5
- lib/rake_helpers.rb
6
- lib/rake_helpers/erb_helper.rb
7
- lib/rake_helpers/config.rb
8
- spec/rake_helpers_spec.rb
9
- spec/spec.opts
10
- spec/spec_helper.rb
data/README.rdoc DELETED
@@ -1,48 +0,0 @@
1
- = rake_helpers
2
-
3
- * http://github.com/#{github_username}/#{project_name}
4
-
5
- == DESCRIPTION:
6
-
7
- FIX (describe your package)
8
-
9
- == FEATURES/PROBLEMS:
10
-
11
- * FIX (list of features or problems)
12
-
13
- == SYNOPSIS:
14
-
15
- FIX (code sample of usage)
16
-
17
- == REQUIREMENTS:
18
-
19
- * FIX (list of requirements)
20
-
21
- == INSTALL:
22
-
23
- * FIX (sudo gem install, anything else)
24
-
25
- == LICENSE:
26
-
27
- (The MIT License)
28
-
29
- Copyright (c) 2009 FIXME full name
30
-
31
- Permission is hereby granted, free of charge, to any person obtaining
32
- a copy of this software and associated documentation files (the
33
- 'Software'), to deal in the Software without restriction, including
34
- without limitation the rights to use, copy, modify, merge, publish,
35
- distribute, sublicense, and/or sell copies of the Software, and to
36
- permit persons to whom the Software is furnished to do so, subject to
37
- the following conditions:
38
-
39
- The above copyright notice and this permission notice shall be
40
- included in all copies or substantial portions of the Software.
41
-
42
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.