has_bootstrap 0.0.1 → 0.0.2

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.
Files changed (5) hide show
  1. data/README +2 -2
  2. data/Rakefile +39 -15
  3. data/init.rb +4 -0
  4. data/lib/has_bootstrap.rb +11 -0
  5. metadata +5 -3
data/README CHANGED
@@ -1,6 +1,6 @@
1
1
  # has_bootstrap
2
2
 
3
- Add bootstrap functionality to your ActiveRecord models. I'm using it to load country or language data into my database.
3
+ Add bootstrap functionality to your ActiveRecord models.
4
4
 
5
5
  ## Install
6
6
 
@@ -9,7 +9,7 @@ Add bootstrap functionality to your ActiveRecord models. I'm using it to load co
9
9
  ## Usage
10
10
 
11
11
  class Color < ActiveRecord::Base
12
- bootstrap(
12
+ has_bootstrap(
13
13
  {:id => 1, :name => 'red'},
14
14
  {:id => 2, :name => 'blue'},
15
15
  {:id => 3, :name => 'green'}
data/Rakefile CHANGED
@@ -1,44 +1,68 @@
1
1
  # Created by Thomas Boerger on 2011-07-01.
2
2
  # Copyright (c) 2011. All rights reserved.
3
3
 
4
- require "rubygems"
5
- require "date"
6
- require "rubygems/package_task"
7
- require "rubygems/specification"
4
+ require 'rubygems'
5
+ require 'rubygems/package_task'
6
+ require 'rubygems/specification'
7
+ require 'rake'
8
+ require 'rake/testtask'
9
+ require 'rdoc/task'
10
+ require 'rcov/rcovtask'
11
+ require 'date'
8
12
 
9
- GEM_TITLE = "has_bootstrap"
10
- GEM_VERSION = "0.0.1"
13
+ GEM_TITLE = 'has_bootstrap'
14
+ GEM_VERSION = '0.0.2'
11
15
 
12
16
  spec = Gem::Specification.new do |s|
13
17
  s.name = GEM_TITLE
14
18
  s.version = GEM_VERSION
19
+ s.platform = Gem::Platform::RUBY
15
20
  s.extra_rdoc_files = ['README', 'LICENSE']
16
- s.rdoc_options << '--line-numbers'
21
+ s.rdoc_options << '--line-numbers' << '--main=README'
17
22
  s.summary = 'Has bootstrap'
18
23
  s.description = 'Bootstrap for ActiveRecord models'
19
24
  s.author = 'Thomas Boerger'
20
25
  s.email = 'tboerger@tbpro.de'
21
26
  s.homepage = 'http://github.com/tbpro/has_bootstrap'
22
- s.files = %w(LICENSE README Rakefile) + Dir.glob('{lib}/**/*')
27
+ s.files = %w(LICENSE README Rakefile init.rb) + Dir.glob('{app,generators,lib,test}/**/*')
28
+ s.test_files = Dir["test/**/*_test.rb"]
23
29
  end
24
30
 
25
31
  Gem::PackageTask.new(spec) do |pkg|
26
32
  pkg.gem_spec = spec
27
33
  end
28
34
 
29
- desc "Install the gem"
30
- task :install => [:package] do
31
- sh %{sudo gem install pkg/#{GEM_TITLE}-#{GEM_VERSION}}
32
- end
33
-
34
- desc "Create a gemspec"
35
+ desc 'Create a gemspec'
35
36
  task :writespec do
36
37
  File.open("#{GEM_TITLE}.gemspec", "w") do |file|
37
38
  file.puts spec.to_ruby
38
39
  end
39
40
  end
40
41
 
41
- desc "List all tasks"
42
+ desc 'Docs for gem'
43
+ Rake::RDocTask.new(:rdoc) do |rdoc|
44
+ rdoc.rdoc_dir = 'doc'
45
+ rdoc.title = spec.name
46
+ rdoc.options << '--line-numbers' << '--main=README'
47
+ rdoc.rdoc_files.include('README', 'LICENSE', 'lib/**/*.rb', 'app/**/*.rb')
48
+ end
49
+
50
+ #desc 'Tests for gem'
51
+ #Rake::TestTask.new(:test) do |t|
52
+ # t.libs << 'lib'
53
+ # t.test_files = spec.test_files
54
+ # t.verbose = true
55
+ #end
56
+
57
+ #desc 'Rcov for gem'
58
+ #Rcov::RcovTask.new(:rcov) do |t|
59
+ # t.libs << 'lib'
60
+ # t.test_files = spec.test_files
61
+ # t.rcov_opts << '--exclude="^(?!lib/|app/)"'
62
+ # t.verbose = true
63
+ #end
64
+
65
+ desc 'List all tasks'
42
66
  task :default do
43
67
  puts `rake -T`.grep(/^[^(].*$/)
44
68
  end
data/init.rb ADDED
@@ -0,0 +1,4 @@
1
+ # Created by Thomas Boerger on 2011-07-01.
2
+ # Copyright (c) 2011. All rights reserved.
3
+
4
+ require 'has_bootstrap'
data/lib/has_bootstrap.rb CHANGED
@@ -4,6 +4,11 @@
4
4
  module HasBootstrap
5
5
  module MacroMethods
6
6
  def has_bootstrap(*records)
7
+ unless included_modules.include?(InstanceMethods)
8
+ extend HasBootstrap::ClassMethods
9
+ include HasBootstrap::InstanceMethods
10
+ end
11
+
7
12
  primary_key = self.primary_key.to_sym
8
13
  records.flatten!
9
14
 
@@ -35,6 +40,12 @@ module HasBootstrap
35
40
  records
36
41
  end
37
42
  end
43
+
44
+ module ClassMethods
45
+ end
46
+
47
+ module InstanceMethods
48
+ end
38
49
  end
39
50
 
40
51
  ActiveRecord::Base.class_eval do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Thomas Boerger
@@ -31,6 +31,7 @@ files:
31
31
  - LICENSE
32
32
  - README
33
33
  - Rakefile
34
+ - init.rb
34
35
  - lib/has_bootstrap.rb
35
36
  homepage: http://github.com/tbpro/has_bootstrap
36
37
  licenses: []
@@ -38,6 +39,7 @@ licenses: []
38
39
  post_install_message:
39
40
  rdoc_options:
40
41
  - --line-numbers
42
+ - --main=README
41
43
  require_paths:
42
44
  - lib
43
45
  required_ruby_version: !ruby/object:Gem::Requirement