dm-gen 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/.gitignore +4 -0
  2. data/CHANGELOG.rdoc +6 -0
  3. data/LICENSE +1 -1
  4. data/README.rdoc +2 -3
  5. data/Rakefile +53 -0
  6. data/VERSION +1 -0
  7. data/dm-gen.gemspec +105 -0
  8. data/lib/dm-gen/generators/adapter.rb +3 -30
  9. data/lib/dm-gen/generators/is.rb +2 -26
  10. data/lib/dm-gen/generators/plugin_generator.rb +44 -0
  11. data/lib/dm-gen/templates/adapter/.gitignore +35 -0
  12. data/lib/dm-gen/templates/adapter/Gemfile +82 -0
  13. data/lib/dm-gen/templates/adapter/LICENSE +1 -1
  14. data/lib/dm-gen/templates/adapter/README.rdoc +3 -0
  15. data/lib/dm-gen/templates/adapter/Rakefile +17 -24
  16. data/lib/dm-gen/templates/adapter/lib/%gem_name%.rb +1 -0
  17. data/lib/dm-gen/templates/adapter/lib/{%adapter_file%.rb → %gem_name%/adapter.rb} +8 -17
  18. data/lib/dm-gen/templates/adapter/lib/%gem_name%/spec/setup.rb +21 -0
  19. data/lib/dm-gen/templates/adapter/spec/adapter_spec.rb +21 -0
  20. data/lib/dm-gen/templates/adapter/spec/rcov.opts +5 -0
  21. data/lib/dm-gen/templates/adapter/spec/spec.opts +2 -0
  22. data/lib/dm-gen/templates/adapter/spec/spec_helper.rb +4 -9
  23. data/lib/dm-gen/templates/adapter/tasks/local_gemfile.rake +18 -0
  24. data/lib/dm-gen/templates/adapter/tasks/spec.rake +38 -0
  25. data/lib/dm-gen/templates/adapter/tasks/yard.rake +9 -0
  26. data/lib/dm-gen/templates/adapter/tasks/yardstick.rake +19 -0
  27. data/lib/dm-gen/templates/is/.gitignore +36 -0
  28. data/lib/dm-gen/templates/is/Gemfile +143 -0
  29. data/lib/dm-gen/templates/is/LICENSE +1 -1
  30. data/lib/dm-gen/templates/is/README.rdoc +2 -0
  31. data/lib/dm-gen/templates/is/Rakefile +16 -24
  32. data/lib/dm-gen/templates/is/VERSION +1 -0
  33. data/lib/dm-gen/templates/is/lib/%gem_name%.rb +1 -8
  34. data/lib/dm-gen/templates/is/lib/%gem_name%/is/%name%.rb +30 -0
  35. data/lib/dm-gen/templates/is/spec/integration/%name%_spec.rb +16 -0
  36. data/lib/dm-gen/templates/is/spec/rcov.opts +6 -0
  37. data/lib/dm-gen/templates/is/spec/spec.opts +3 -0
  38. data/lib/dm-gen/templates/is/spec/spec_helper.rb +7 -21
  39. data/lib/dm-gen/templates/is/tasks/ci.rake +1 -0
  40. data/lib/dm-gen/templates/is/tasks/local_gemfile.rake +18 -0
  41. data/lib/dm-gen/templates/is/tasks/metrics.rake +36 -0
  42. data/lib/dm-gen/templates/is/tasks/spec.rake +38 -0
  43. data/lib/dm-gen/templates/is/tasks/yard.rake +9 -0
  44. data/lib/dm-gen/templates/is/tasks/yardstick.rake +19 -0
  45. data/lib/dm-gen/templates/one_file.rb +3 -2
  46. data/lib/dm_gen.rb +1 -1
  47. data/spec/adapter_spec.rb +34 -52
  48. data/spec/is_plugin_spec.rb +13 -28
  49. metadata +59 -30
  50. data/lib/dm-gen/templates/adapter/History.txt +0 -4
  51. data/lib/dm-gen/templates/adapter/Manifest.txt +0 -1
  52. data/lib/dm-gen/templates/adapter/README.txt +0 -3
  53. data/lib/dm-gen/templates/adapter/TODO +0 -0
  54. data/lib/dm-gen/templates/adapter/lib/%adapter_file%/version.rb +0 -5
  55. data/lib/dm-gen/templates/adapter/spec/integration/%adapter_file%_spec.rb +0 -36
  56. data/lib/dm-gen/templates/adapter/tasks/install.rb +0 -13
  57. data/lib/dm-gen/templates/adapter/tasks/spec.rb +0 -25
  58. data/lib/dm-gen/templates/is/History.txt +0 -4
  59. data/lib/dm-gen/templates/is/Manifest.txt +0 -1
  60. data/lib/dm-gen/templates/is/README.txt +0 -3
  61. data/lib/dm-gen/templates/is/TODO +0 -0
  62. data/lib/dm-gen/templates/is/lib/%gem_name%/is/%snake_name%.rb +0 -38
  63. data/lib/dm-gen/templates/is/lib/%gem_name%/is/version.rb +0 -7
  64. data/lib/dm-gen/templates/is/spec/integration/%snake_name%_spec.rb +0 -8
  65. data/lib/dm-gen/templates/is/tasks/install.rb +0 -13
  66. data/lib/dm-gen/templates/is/tasks/spec.rb +0 -25
@@ -5,13 +5,20 @@ describe "DMGen::Is" do
5
5
  @generator = DMGen::Is.new('/tmp', {}, 'awesome')
6
6
  end
7
7
 
8
+ describe "renders all templates without errors" do
9
+ DMGen::Is.new('/tmp', {}, 'awesome').templates.each do |template|
10
+ it "should render '#{template.name}' without raising" do
11
+ lambda { template.render }.should.not.raise(Exception)
12
+ end
13
+ end
14
+ end
15
+
8
16
  # basic file creation.
9
17
  it "creates a Rakefile" do
10
18
  @generator.should create('/tmp/dm-is-awesome/Rakefile')
11
19
  end
12
20
  it "creates the lib folder layout" do
13
21
  @generator.should create('/tmp/dm-is-awesome/lib/dm-is-awesome.rb')
14
- @generator.should create('/tmp/dm-is-awesome/lib/dm-is-awesome/is/version.rb')
15
22
  @generator.should create('/tmp/dm-is-awesome/lib/dm-is-awesome/is/awesome.rb')
16
23
  end
17
24
  it "creates the spec folder layout" do
@@ -20,37 +27,15 @@ describe "DMGen::Is" do
20
27
  @generator.should create('/tmp/dm-is-awesome/spec/spec_helper.rb')
21
28
  end
22
29
  it "creates a README" do
23
- @generator.should create('/tmp/dm-is-awesome/README.txt')
24
- end
25
- it "creates a History file" do
26
- @generator.should create('/tmp/dm-is-awesome/History.txt')
30
+ @generator.should create('/tmp/dm-is-awesome/README.rdoc')
27
31
  end
28
32
  it "creates a LICENSE" do
29
33
  @generator.should create('/tmp/dm-is-awesome/LICENSE')
30
34
  end
31
- it "creates a Manifest for Hoe" do
32
- @generator.should create('/tmp/dm-is-awesome/Manifest.txt')
33
- end
34
- it "creates a TODO list" do
35
- @generator.should create('/tmp/dm-is-awesome/TODO')
36
- end
37
35
  it "creates support tasks" do
38
- @generator.should create('/tmp/dm-is-awesome/tasks/spec.rb')
39
- @generator.should create('/tmp/dm-is-awesome/tasks/install.rb')
40
- end
41
-
42
- describe "Manifest.txt" do
43
- before do
44
- @template = @generator.template(:manifest_txt)
45
- @result = @template.render
46
- end
47
-
48
- it "contains itself" do
49
- @result.should.be.a.match(/^Manifest.txt$/)
50
- end
51
-
52
- it "is the sorted list of its contents" do
53
- @result.split("\n").sort.should == @result.split("\n")
54
- end
36
+ @generator.should create('/tmp/dm-is-awesome/tasks/local_gemfile.rake')
37
+ @generator.should create('/tmp/dm-is-awesome/tasks/spec.rake')
38
+ @generator.should create('/tmp/dm-is-awesome/tasks/yard.rake')
39
+ @generator.should create('/tmp/dm-is-awesome/tasks/yardstick.rake')
55
40
  end
56
41
  end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-gen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ hash: 11
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Jonathan Stott
@@ -9,19 +15,24 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2009-11-06 00:00:00 +00:00
18
+ date: 2010-06-09 00:00:00 +01:00
13
19
  default_executable: dm-gen
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: templater
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ~>
22
28
  - !ruby/object:Gem::Version
29
+ hash: 15
30
+ segments:
31
+ - 1
32
+ - 0
23
33
  version: "1.0"
24
- version:
34
+ type: :runtime
35
+ version_requirements: *id001
25
36
  description: |
26
37
  dm-gen is a simple commandline tool for generating DataMapper related files.
27
38
  It includes generators for standalone or one file examples, is plugins, adapters
@@ -36,39 +47,52 @@ extra_rdoc_files:
36
47
  - LICENSE
37
48
  - README.rdoc
38
49
  files:
50
+ - .gitignore
39
51
  - CHANGELOG.rdoc
52
+ - LICENSE
40
53
  - README.rdoc
54
+ - Rakefile
55
+ - VERSION
41
56
  - bin/dm-gen
57
+ - dm-gen.gemspec
42
58
  - lib/dm-gen/generators/adapter.rb
43
59
  - lib/dm-gen/generators/is.rb
44
60
  - lib/dm-gen/generators/one_file.rb
45
- - lib/dm-gen/templates/adapter/History.txt
61
+ - lib/dm-gen/generators/plugin_generator.rb
62
+ - lib/dm-gen/templates/adapter/.gitignore
63
+ - lib/dm-gen/templates/adapter/Gemfile
46
64
  - lib/dm-gen/templates/adapter/LICENSE
47
- - lib/dm-gen/templates/adapter/Manifest.txt
48
- - lib/dm-gen/templates/adapter/README.txt
65
+ - lib/dm-gen/templates/adapter/README.rdoc
49
66
  - lib/dm-gen/templates/adapter/Rakefile
50
- - lib/dm-gen/templates/adapter/TODO
51
- - lib/dm-gen/templates/adapter/lib/%adapter_file%.rb
52
- - lib/dm-gen/templates/adapter/lib/%adapter_file%/version.rb
53
- - lib/dm-gen/templates/adapter/spec/integration/%adapter_file%_spec.rb
67
+ - lib/dm-gen/templates/adapter/lib/%gem_name%.rb
68
+ - lib/dm-gen/templates/adapter/lib/%gem_name%/adapter.rb
69
+ - lib/dm-gen/templates/adapter/lib/%gem_name%/spec/setup.rb
70
+ - lib/dm-gen/templates/adapter/spec/adapter_spec.rb
71
+ - lib/dm-gen/templates/adapter/spec/rcov.opts
54
72
  - lib/dm-gen/templates/adapter/spec/spec.opts
55
73
  - lib/dm-gen/templates/adapter/spec/spec_helper.rb
56
- - lib/dm-gen/templates/adapter/tasks/install.rb
57
- - lib/dm-gen/templates/adapter/tasks/spec.rb
58
- - lib/dm-gen/templates/is/History.txt
74
+ - lib/dm-gen/templates/adapter/tasks/local_gemfile.rake
75
+ - lib/dm-gen/templates/adapter/tasks/spec.rake
76
+ - lib/dm-gen/templates/adapter/tasks/yard.rake
77
+ - lib/dm-gen/templates/adapter/tasks/yardstick.rake
78
+ - lib/dm-gen/templates/is/.gitignore
79
+ - lib/dm-gen/templates/is/Gemfile
59
80
  - lib/dm-gen/templates/is/LICENSE
60
- - lib/dm-gen/templates/is/Manifest.txt
61
- - lib/dm-gen/templates/is/README.txt
81
+ - lib/dm-gen/templates/is/README.rdoc
62
82
  - lib/dm-gen/templates/is/Rakefile
63
- - lib/dm-gen/templates/is/TODO
83
+ - lib/dm-gen/templates/is/VERSION
64
84
  - lib/dm-gen/templates/is/lib/%gem_name%.rb
65
- - lib/dm-gen/templates/is/lib/%gem_name%/is/%snake_name%.rb
66
- - lib/dm-gen/templates/is/lib/%gem_name%/is/version.rb
67
- - lib/dm-gen/templates/is/spec/integration/%snake_name%_spec.rb
85
+ - lib/dm-gen/templates/is/lib/%gem_name%/is/%name%.rb
86
+ - lib/dm-gen/templates/is/spec/integration/%name%_spec.rb
87
+ - lib/dm-gen/templates/is/spec/rcov.opts
68
88
  - lib/dm-gen/templates/is/spec/spec.opts
69
89
  - lib/dm-gen/templates/is/spec/spec_helper.rb
70
- - lib/dm-gen/templates/is/tasks/install.rb
71
- - lib/dm-gen/templates/is/tasks/spec.rb
90
+ - lib/dm-gen/templates/is/tasks/ci.rake
91
+ - lib/dm-gen/templates/is/tasks/local_gemfile.rake
92
+ - lib/dm-gen/templates/is/tasks/metrics.rake
93
+ - lib/dm-gen/templates/is/tasks/spec.rake
94
+ - lib/dm-gen/templates/is/tasks/yard.rake
95
+ - lib/dm-gen/templates/is/tasks/yardstick.rake
72
96
  - lib/dm-gen/templates/one_file.rb
73
97
  - lib/dm_gen.rb
74
98
  - spec/adapter_spec.rb
@@ -76,7 +100,6 @@ files:
76
100
  - spec/is_plugin_spec.rb
77
101
  - spec/one_file_spec.rb
78
102
  - spec/spec_helper.rb
79
- - LICENSE
80
103
  has_rdoc: true
81
104
  homepage: http://github.com/namelessjon/dm-gen
82
105
  licenses: []
@@ -94,27 +117,33 @@ rdoc_options:
94
117
  require_paths:
95
118
  - lib
96
119
  required_ruby_version: !ruby/object:Gem::Requirement
120
+ none: false
97
121
  requirements:
98
122
  - - ">="
99
123
  - !ruby/object:Gem::Version
124
+ hash: 3
125
+ segments:
126
+ - 0
100
127
  version: "0"
101
- version:
102
128
  required_rubygems_version: !ruby/object:Gem::Requirement
129
+ none: false
103
130
  requirements:
104
131
  - - ">="
105
132
  - !ruby/object:Gem::Version
133
+ hash: 3
134
+ segments:
135
+ - 0
106
136
  version: "0"
107
- version:
108
137
  requirements: []
109
138
 
110
139
  rubyforge_project:
111
- rubygems_version: 1.3.5
140
+ rubygems_version: 1.3.7
112
141
  signing_key:
113
142
  specification_version: 3
114
143
  summary: Simple commandline tool for generating DataMapper related files
115
144
  test_files:
145
+ - spec/spec_helper.rb
116
146
  - spec/adapter_spec.rb
117
- - spec/is_plugin_spec.rb
118
147
  - spec/dm_gen_spec.rb
119
148
  - spec/one_file_spec.rb
120
- - spec/spec_helper.rb
149
+ - spec/is_plugin_spec.rb
@@ -1,4 +0,0 @@
1
- === 0.0.1 / <%= Time.now.strftime('%Y-%m-%d') %>
2
-
3
- * Release!
4
-
@@ -1 +0,0 @@
1
- <%= manifest_files.join("\n") %>
@@ -1,3 +0,0 @@
1
- = <%= gem_name %>
2
-
3
- Description of the adapter. What data-store is it for, what is that good for?
File without changes
@@ -1,5 +0,0 @@
1
- module DataMapper
2
- module <%= class_name %>
3
- VERSION = '0.0.1'
4
- end
5
- end
@@ -1,36 +0,0 @@
1
- require 'pathname'
2
- require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
3
-
4
-
5
- # load up the shared specs.
6
- require 'dm-core/spec/adapter_shared_spec'
7
-
8
- describe 'DataMapper::Adapters::<%= class_name %>' do
9
- before :all do
10
- class ::Heffalump
11
- include DataMapper::Resource
12
-
13
- property :id, Serial
14
- property :name, String
15
- property :num_spots, Integer
16
- property :striped, Boolean
17
- end
18
-
19
- @model = Heffalump
20
- end
21
-
22
- supported_by :<%= snake_name %> do
23
- before :all do
24
- @model.all.destroy!
25
-
26
- @heff1 = @model.create(:color => 'Black', :num_spots => 0, :striped => true)
27
- @heff2 = @model.create(:color => 'Brown', :num_spots => 25, :striped => false)
28
- @heff3 = @model.create(:color => 'Dark Blue', :num_spots => nil, :striped => false)
29
-
30
- @string_property = @model.color
31
- @integer_property = @model.num_spots
32
- end
33
-
34
- it_should_behave_like 'An Adapter'
35
- end
36
- end
@@ -1,13 +0,0 @@
1
- def sudo_gem(cmd)
2
- sh "#{SUDO} #{RUBY} -S gem #{cmd}", :verbose => false
3
- end
4
-
5
- desc "Install #{GEM_NAME} #{GEM_VERSION}"
6
- task :install => [ :package ] do
7
- sudo_gem "install --local pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources"
8
- end
9
-
10
- desc "Uninstall #{GEM_NAME} #{GEM_VERSION}"
11
- task :uninstall => [ :clobber ] do
12
- sudo_gem "uninstall #{GEM_NAME} -v#{GEM_VERSION} -Ix"
13
- end
@@ -1,25 +0,0 @@
1
- begin
2
- gem 'rspec', '~>1.1.11'
3
- require 'spec'
4
- require 'spec/rake/spectask'
5
-
6
- task :default => [ :spec ]
7
-
8
- desc 'Run specifications'
9
- Spec::Rake::SpecTask.new(:spec) do |t|
10
- t.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts')
11
- t.spec_files = Pathname.glob((ROOT + 'spec/**/*_spec.rb').to_s)
12
-
13
- begin
14
- gem 'rcov', '~>0.8'
15
- t.rcov = JRUBY ? false : (ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true)
16
- t.rcov_opts << '--exclude' << 'spec'
17
- t.rcov_opts << '--text-summary'
18
- t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
19
- rescue LoadError
20
- # rcov not installed
21
- end
22
- end
23
- rescue LoadError
24
- # rspec not installed
25
- end
@@ -1,4 +0,0 @@
1
- === 0.0.1 / <%= Time.now.strftime('%Y-%m-%d') %>
2
-
3
- * Release!
4
-
@@ -1 +0,0 @@
1
- <%= manifest_files.join("\n") %>
@@ -1,3 +0,0 @@
1
- = <%= gem_name %>
2
-
3
- Description of plugin. What it does, and how.
File without changes
@@ -1,38 +0,0 @@
1
- module DataMapper
2
- module Is
3
- module <%= class_name %>
4
-
5
- ##
6
- # fired when your plugin gets included into Resource
7
- #
8
- def self.included(base)
9
-
10
- end
11
-
12
- ##
13
- # Methods that should be included in DataMapper::Model.
14
- # Normally this should just be your generator, so that the namespace
15
- # does not get cluttered. ClassMethods and InstanceMethods gets added
16
- # in the specific resources when you fire is :<%= snake_name %>
17
- ##
18
-
19
- def is_<%= snake_name %>(options)
20
-
21
- # Add class-methods
22
- extend DataMapper::Is::<%= class_name %>::ClassMethods
23
- # Add instance-methods
24
- include DataMapper::Is::<%= class_name %>::InstanceMethods
25
-
26
- end
27
-
28
- module ClassMethods
29
-
30
- end # ClassMethods
31
-
32
- module InstanceMethods
33
-
34
- end # InstanceMethods
35
-
36
- end # <%= class_name %>
37
- end # Is
38
- end # DataMapper
@@ -1,7 +0,0 @@
1
- module DataMapper
2
- module Is
3
- module <%= class_name %>
4
- VERSION = '0.0.1'
5
- end
6
- end
7
- end
@@ -1,8 +0,0 @@
1
- require 'pathname'
2
- require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
3
-
4
- if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
5
- describe 'DataMapper::Is::<%= class_name %>' do
6
-
7
- end
8
- end
@@ -1,13 +0,0 @@
1
- def sudo_gem(cmd)
2
- sh "#{SUDO} #{RUBY} -S gem #{cmd}", :verbose => false
3
- end
4
-
5
- desc "Install #{GEM_NAME} #{GEM_VERSION}"
6
- task :install => [ :package ] do
7
- sudo_gem "install --local pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources"
8
- end
9
-
10
- desc "Uninstall #{GEM_NAME} #{GEM_VERSION}"
11
- task :uninstall => [ :clobber ] do
12
- sudo_gem "uninstall #{GEM_NAME} -v#{GEM_VERSION} -Ix"
13
- end
@@ -1,25 +0,0 @@
1
- begin
2
- gem 'rspec', '~>1.1.11'
3
- require 'spec'
4
- require 'spec/rake/spectask'
5
-
6
- task :default => [ :spec ]
7
-
8
- desc 'Run specifications'
9
- Spec::Rake::SpecTask.new(:spec) do |t|
10
- t.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts')
11
- t.spec_files = Pathname.glob((ROOT + 'spec/**/*_spec.rb').to_s)
12
-
13
- begin
14
- gem 'rcov', '~>0.8'
15
- t.rcov = JRUBY ? false : (ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true)
16
- t.rcov_opts << '--exclude' << 'spec'
17
- t.rcov_opts << '--text-summary'
18
- t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
19
- rescue LoadError
20
- # rcov not installed
21
- end
22
- end
23
- rescue LoadError
24
- # rspec not installed
25
- end