ore 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/.document +0 -1
  2. data/ChangeLog.md +28 -18
  3. data/README.md +8 -6
  4. data/Rakefile +10 -0
  5. data/data/ore/templates/base/[name].gemspec.erb +1 -1
  6. data/data/ore/templates/base/_gemfile.erb +1 -1
  7. data/data/ore/templates/base/gemspec.yml.erb +2 -2
  8. data/data/ore/templates/base/template.yml +1 -1
  9. data/data/ore/templates/ore_tasks/template.yml +1 -1
  10. data/gemspec.yml +4 -2
  11. data/lib/ore/generator.rb +1 -1
  12. data/lib/ore/template/helpers.rb +24 -0
  13. data/ore.gemspec +9 -5
  14. data/spec/generator_spec.rb +9 -1
  15. data/spec/spec_helper.rb +2 -0
  16. metadata +43 -80
  17. data/GemspecYML.md +0 -272
  18. data/lib/ore.rb +0 -3
  19. data/lib/ore/checks.rb +0 -88
  20. data/lib/ore/defaults.rb +0 -141
  21. data/lib/ore/dependency.rb +0 -65
  22. data/lib/ore/document_file.rb +0 -118
  23. data/lib/ore/exceptions.rb +0 -3
  24. data/lib/ore/exceptions/exception.rb +0 -4
  25. data/lib/ore/exceptions/invalid_metadata.rb +0 -6
  26. data/lib/ore/exceptions/project_not_found.rb +0 -6
  27. data/lib/ore/naming.rb +0 -113
  28. data/lib/ore/paths.rb +0 -146
  29. data/lib/ore/project.rb +0 -591
  30. data/lib/ore/settings.rb +0 -262
  31. data/lib/ore/specification.rb +0 -29
  32. data/lib/ore/versions.rb +0 -3
  33. data/lib/ore/versions/exceptions.rb +0 -1
  34. data/lib/ore/versions/exceptions/invalid_version.rb +0 -8
  35. data/lib/ore/versions/version.rb +0 -75
  36. data/lib/ore/versions/version_constant.rb +0 -126
  37. data/lib/ore/versions/version_file.rb +0 -66
  38. data/lib/rubygems_plugin.rb +0 -40
  39. data/spec/dependency_spec.rb +0 -36
  40. data/spec/document_file_spec.rb +0 -29
  41. data/spec/helpers/files.rb +0 -7
  42. data/spec/helpers/files/.document +0 -5
  43. data/spec/helpers/files/VERSION +0 -1
  44. data/spec/helpers/files/VERSION.yml +0 -5
  45. data/spec/helpers/projects.rb +0 -13
  46. data/spec/helpers/projects/dm-is-plugin/Gemfile +0 -3
  47. data/spec/helpers/projects/dm-is-plugin/VERSION +0 -1
  48. data/spec/helpers/projects/dm-is-plugin/dm-is-plugin.gemspec +0 -10
  49. data/spec/helpers/projects/dm-is-plugin/gemspec.yml +0 -7
  50. data/spec/helpers/projects/dm-is-plugin/lib/dm-is-plugin.rb +0 -4
  51. data/spec/helpers/projects/dm-is-plugin/lib/dm-is-plugin/is/plugin.rb +0 -6
  52. data/spec/helpers/projects/explicit/gemspec.yml +0 -10
  53. data/spec/helpers/projects/explicit/lib/explicit/version.rb +0 -15
  54. data/spec/helpers/projects/ffi-binding/gemspec.yml +0 -9
  55. data/spec/helpers/projects/ffi-binding/lib/ffi/binding/version.rb +0 -5
  56. data/spec/helpers/projects/jewelery/VERSION +0 -1
  57. data/spec/helpers/projects/jewelery/bin/jewelery +0 -3
  58. data/spec/helpers/projects/jewelery/gemspec.yml +0 -4
  59. data/spec/helpers/projects/jewelery/jewelery.gemspec +0 -10
  60. data/spec/helpers/projects/jewelery/lib/jewelery.rb +0 -4
  61. data/spec/helpers/projects/jewelery/lib/jewelery/rubies.rb +0 -4
  62. data/spec/helpers/projects/minimal/gemspec.yml +0 -4
  63. data/spec/helpers/projects/minimal/lib/minimal.rb +0 -2
  64. data/spec/naming_spec.rb +0 -56
  65. data/spec/projects/dm_plugin_project_spec.rb +0 -29
  66. data/spec/projects/explicit_project_spec.rb +0 -33
  67. data/spec/projects/ffi_binding_project_spec.rb +0 -25
  68. data/spec/projects/jeweler_project_spec.rb +0 -17
  69. data/spec/projects/minimal_project_spec.rb +0 -17
  70. data/spec/projects/project_examples.rb +0 -34
  71. data/spec/versions/version_file_spec.rb +0 -28
  72. data/spec/versions/version_spec.rb +0 -53
@@ -1,66 +0,0 @@
1
- require 'ore/versions/exceptions/invalid_version'
2
- require 'ore/versions/version'
3
-
4
- require 'yaml'
5
-
6
- module Ore
7
- module Versions
8
- #
9
- # Represents a version loaded from a `VERSION` file.
10
- #
11
- class VersionFile < Version
12
-
13
- # Common `VERSION` file-names.
14
- @@files = %w[VERSION VERSION.yml]
15
-
16
- #
17
- # Finds the `VERSION` file.
18
- #
19
- # @param [Project] project
20
- # The Ore project.
21
- #
22
- # @return [VersionFile, nil]
23
- # The version file of the project.
24
- #
25
- def self.find(project)
26
- @@files.each do |name|
27
- return load(project.path(name)) if project.file?(name)
28
- end
29
-
30
- return nil
31
- end
32
-
33
- #
34
- # Loads the version file of the project.
35
- #
36
- # @param [String] path
37
- # The path to the version file.
38
- #
39
- # @return [VersionFile]
40
- # The loaded version file.
41
- #
42
- # @raise [InvalidVersion]
43
- # The `VERSION` file must contain either a `Hash` or a `String`.
44
- #
45
- def self.load(path)
46
- data = YAML.load_file(path)
47
-
48
- case data
49
- when Hash
50
- self.new(
51
- (data[:major] || data['major']),
52
- (data[:minor] || data['minor']),
53
- (data[:patch] || data['patch']),
54
- (data[:build] || data['build'])
55
- )
56
- when String
57
- self.parse(data)
58
- else
59
- file = File.basename(@path)
60
- raise(InvalidVersion,"invalid version data in #{file.dump}")
61
- end
62
- end
63
-
64
- end
65
- end
66
- end
@@ -1,40 +0,0 @@
1
- module Ore
2
- #
3
- # Provides transparent access to {Ore::Specification}.
4
- #
5
- # @param [Symbol] name
6
- # The constant name.
7
- #
8
- # @return [Object]
9
- # The constant.
10
- #
11
- # @raise [NameError]
12
- # The constant could not be found.
13
- #
14
- def self.const_missing(name)
15
- if name == :Specification
16
- begin
17
- # attempt to load 'ore/specification' from the $LOAD_PATH
18
- require 'ore/specification'
19
- rescue ::LoadError
20
- # find our `lib/` directory
21
- lib_dir = File.expand_path(File.dirname(__FILE__))
22
-
23
- # modify the $LOAD_PATH is 'ore/specification' is not available
24
- $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
25
-
26
- begin
27
- # attempt loading 'ore/specification' again
28
- require 'ore/specification'
29
- rescue ::LoadError
30
- # ore is probably not installed, so raise a NameError
31
- return super(name)
32
- end
33
- end
34
-
35
- return Ore.const_get(name)
36
- end
37
-
38
- super(name)
39
- end
40
- end
@@ -1,36 +0,0 @@
1
- require 'spec_helper'
2
- require 'ore/dependency'
3
-
4
- describe Dependency do
5
- subject { Dependency }
6
-
7
- describe "parse" do
8
- it "should parse a dependency string with only a name" do
9
- dep = subject.parse('foo')
10
-
11
- dep.name.should == 'foo'
12
- dep.versions.should be_empty
13
- end
14
-
15
- it "should parse a dependency with a version" do
16
- dep = subject.parse('foo ~> 1.2.3')
17
-
18
- dep.name.should == 'foo'
19
- dep.versions.should == ['~> 1.2.3']
20
- end
21
- end
22
-
23
- describe "parse_versions" do
24
- it "should parse a single version" do
25
- dep = subject.parse_versions('foo', '~> 1.2.3')
26
-
27
- dep.versions.should == ['~> 1.2.3']
28
- end
29
-
30
- it "should parse multiple versions" do
31
- dep = subject.parse_versions('foo', '~> 1.2.3, >= 1.4.0')
32
-
33
- dep.versions.should == ['~> 1.2.3', '>= 1.4.0']
34
- end
35
- end
36
- end
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
- require 'helpers/files'
3
-
4
- require 'ore/document_file'
5
-
6
- describe DocumentFile do
7
- include Helpers::Files
8
-
9
- subject { DocumentFile.new(file('.document')) }
10
-
11
- it "should parse the file globs from a .document file" do
12
- subject.file_globs.to_a.should =~ %w[
13
- lib/**/*.rb
14
- bin/*
15
- ]
16
- end
17
-
18
- it "should parse the extra-file globs from a .document file" do
19
- subject.extra_file_globs.to_a.should =~ %w[
20
- ChangeLog.md
21
- COPYING.txt
22
- ]
23
- end
24
-
25
- it "should not consume the - separator" do
26
- subject.file_globs.should_not include('-')
27
- subject.extra_file_globs.should_not include('-')
28
- end
29
- end
@@ -1,7 +0,0 @@
1
- module Helpers
2
- module Files
3
- def file(name)
4
- File.join(File.dirname(__FILE__),'files',name)
5
- end
6
- end
7
- end
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- ChangeLog.md
5
- COPYING.txt
@@ -1 +0,0 @@
1
- 1.2.3
@@ -1,5 +0,0 @@
1
- ---
2
- :major: 1
3
- :minor: 2
4
- :patch: 3
5
- :build:
@@ -1,13 +0,0 @@
1
- require 'ore/project'
2
-
3
- module Helpers
4
- module Projects
5
- def project_dir(name)
6
- File.join(File.dirname(__FILE__),'projects',name)
7
- end
8
-
9
- def project(name)
10
- Ore::Project.find(project_dir(name))
11
- end
12
- end
13
- end
@@ -1,3 +0,0 @@
1
- source :rubygems
2
-
3
- gemspec
@@ -1 +0,0 @@
1
- 1.2.3
@@ -1,10 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- begin
4
- Ore::Specification.new do |gemspec|
5
- # custom logic here
6
- end
7
- rescue NameError
8
- STDERR.puts "The 'dm-is-plugin.gemspec' file requires Ore."
9
- STDERR.puts "Run `gem install ore` to install Ore."
10
- end
@@ -1,7 +0,0 @@
1
- name: dm-is-plugin
2
- summary: DataMapper Plugin
3
- description: A plugin for DataMapper
4
- authors: Dan Kubb
5
-
6
- dependencies:
7
- dm-core: ~> 1.0.0
@@ -1,4 +0,0 @@
1
- require 'dm-core'
2
- require 'dm-is-plugin/is/plugin'
3
-
4
- DataMapper::Model.append_extensions DataMapper::Is::Plugin
@@ -1,6 +0,0 @@
1
- module DataMapper
2
- module Is
3
- module Plugin
4
- end
5
- end
6
- end
@@ -1,10 +0,0 @@
1
- name: Explicit
2
- summary: An explicit library
3
- description: This is a library written by strict developers.
4
- license: MIT
5
- authors:
6
- - Senior Software Engineer
7
- - Junior Software Engineer
8
-
9
- required_ruby_version: >= 1.8.7
10
- required_rubygems_version: >= 1.3.7
@@ -1,15 +0,0 @@
1
- module Explicit
2
- module Version
3
- MAJOR = 1
4
-
5
- MINOR = 2
6
-
7
- PATCH = 3
8
-
9
- VERSION = [MAJOR, MINOR, PATCH].join('.')
10
-
11
- def self.to_s
12
- VERSION
13
- end
14
- end
15
- end
@@ -1,9 +0,0 @@
1
- name: ffi-binding
2
- summary: FFI Binding
3
- description: FFI Binding for some C library
4
- authors: Wayne Meissner
5
-
6
- requirements: libstuff >= 1.0
7
-
8
- dependencies:
9
- ffi: ~> 0.6.0
@@ -1,5 +0,0 @@
1
- module FFI
2
- module Binding
3
- VERSION = '1.2.3'
4
- end
5
- end
@@ -1 +0,0 @@
1
- 1.2.3
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts 'Built with Jeweler!'
@@ -1,4 +0,0 @@
1
- name: Jewelery
2
- summary: A library created with Jeweler
3
- description: This is how projects have been layed out in the past.
4
- authors: technicalpickles
@@ -1,10 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- begin
4
- Ore::Specification.new do |gemspec|
5
- # custom logic here
6
- end
7
- rescue NameError
8
- STDERR.puts "The 'my-project.gemspec' file requires Ore."
9
- STDERR.puts "Run `gem install ore` to install Ore."
10
- end
@@ -1,4 +0,0 @@
1
- require 'jewelery/rubies'
2
-
3
- module Jewelery
4
- end
@@ -1,4 +0,0 @@
1
- module Jewelery
2
- class Rubies
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- version: 1.2.3
2
- summary: Minimal
3
- description: Least amount of effort
4
- authors: me
@@ -1,2 +0,0 @@
1
- module Minimal
2
- end
data/spec/naming_spec.rb DELETED
@@ -1,56 +0,0 @@
1
- require 'spec_helper'
2
- require 'ore/naming'
3
-
4
- describe Naming do
5
- subject do
6
- obj = Object.new
7
- obj.extend Ore::Naming
8
- obj
9
- end
10
-
11
- describe "underscore" do
12
- it "should underscore CamelCase names" do
13
- subject.underscore('FooBar').should == 'foo_bar'
14
- end
15
-
16
- it "should not add leading underscores to Capitalized names" do
17
- subject.underscore('Foo').should == 'foo'
18
- end
19
-
20
- it "should not add tailing underscores to CamelCase names" do
21
- subject.underscore('FooX').should == 'foox'
22
- end
23
-
24
- it "should not add underscores when they already exist" do
25
- subject.underscore('Foo_Bar').should == 'foo_bar'
26
- end
27
- end
28
-
29
- it "should guess the module names from a project name" do
30
- subject.modules_of('foo-bar').should == ['Foo', 'Bar']
31
- end
32
-
33
- it "should filter out obvious names from the module names" do
34
- subject.modules_of('ruby-foo').should == ['Foo']
35
- end
36
-
37
- it "should recognize common acronyms in project names" do
38
- subject.modules_of('ffi-bar').should == ['FFI', 'Bar']
39
- end
40
-
41
- it "should guess the namespace from a project name" do
42
- subject.namespace_of('foo-bar').should == 'Foo::Bar'
43
- end
44
-
45
- it "should guess the namespace directories from a project name" do
46
- subject.namespace_dirs_of('foo-bar').should == ['foo', 'bar']
47
- end
48
-
49
- it "should filter out namespaces that are rarely used in directory names" do
50
- subject.namespace_dirs_of('ruby-foo').should == ['foo']
51
- end
52
-
53
- it "should guess the namespace directory from a project name" do
54
- subject.namespace_path_of('foo-bar').should == 'foo/bar'
55
- end
56
- end
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
- require 'helpers/projects'
3
- require 'projects/project_examples'
4
-
5
- describe "DataMapper Plugin project" do
6
- include Helpers::Projects
7
-
8
- before(:all) do
9
- @project = project('dm-is-plugin')
10
- end
11
-
12
- it_should_behave_like 'an Ore Project'
13
-
14
- it "should correctly guess the namespace" do
15
- @project.namespace.should == 'DataMapper::Is::Plugin'
16
- end
17
-
18
- it "should have a namespace directory" do
19
- @project.namespace_dir.should == 'dm-is-plugin'
20
- end
21
-
22
- it "should use Bundler" do
23
- @project.should be_bundler
24
- end
25
-
26
- it "should default the required RubyGems version to >= 1.3.6" do
27
- @project.required_rubygems_version.should == '>= 1.3.6'
28
- end
29
- end