ore 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +0 -1
- data/ChangeLog.md +28 -18
- data/README.md +8 -6
- data/Rakefile +10 -0
- data/data/ore/templates/base/[name].gemspec.erb +1 -1
- data/data/ore/templates/base/_gemfile.erb +1 -1
- data/data/ore/templates/base/gemspec.yml.erb +2 -2
- data/data/ore/templates/base/template.yml +1 -1
- data/data/ore/templates/ore_tasks/template.yml +1 -1
- data/gemspec.yml +4 -2
- data/lib/ore/generator.rb +1 -1
- data/lib/ore/template/helpers.rb +24 -0
- data/ore.gemspec +9 -5
- data/spec/generator_spec.rb +9 -1
- data/spec/spec_helper.rb +2 -0
- metadata +43 -80
- data/GemspecYML.md +0 -272
- data/lib/ore.rb +0 -3
- data/lib/ore/checks.rb +0 -88
- data/lib/ore/defaults.rb +0 -141
- data/lib/ore/dependency.rb +0 -65
- data/lib/ore/document_file.rb +0 -118
- data/lib/ore/exceptions.rb +0 -3
- data/lib/ore/exceptions/exception.rb +0 -4
- data/lib/ore/exceptions/invalid_metadata.rb +0 -6
- data/lib/ore/exceptions/project_not_found.rb +0 -6
- data/lib/ore/naming.rb +0 -113
- data/lib/ore/paths.rb +0 -146
- data/lib/ore/project.rb +0 -591
- data/lib/ore/settings.rb +0 -262
- data/lib/ore/specification.rb +0 -29
- data/lib/ore/versions.rb +0 -3
- data/lib/ore/versions/exceptions.rb +0 -1
- data/lib/ore/versions/exceptions/invalid_version.rb +0 -8
- data/lib/ore/versions/version.rb +0 -75
- data/lib/ore/versions/version_constant.rb +0 -126
- data/lib/ore/versions/version_file.rb +0 -66
- data/lib/rubygems_plugin.rb +0 -40
- data/spec/dependency_spec.rb +0 -36
- data/spec/document_file_spec.rb +0 -29
- data/spec/helpers/files.rb +0 -7
- data/spec/helpers/files/.document +0 -5
- data/spec/helpers/files/VERSION +0 -1
- data/spec/helpers/files/VERSION.yml +0 -5
- data/spec/helpers/projects.rb +0 -13
- data/spec/helpers/projects/dm-is-plugin/Gemfile +0 -3
- data/spec/helpers/projects/dm-is-plugin/VERSION +0 -1
- data/spec/helpers/projects/dm-is-plugin/dm-is-plugin.gemspec +0 -10
- data/spec/helpers/projects/dm-is-plugin/gemspec.yml +0 -7
- data/spec/helpers/projects/dm-is-plugin/lib/dm-is-plugin.rb +0 -4
- data/spec/helpers/projects/dm-is-plugin/lib/dm-is-plugin/is/plugin.rb +0 -6
- data/spec/helpers/projects/explicit/gemspec.yml +0 -10
- data/spec/helpers/projects/explicit/lib/explicit/version.rb +0 -15
- data/spec/helpers/projects/ffi-binding/gemspec.yml +0 -9
- data/spec/helpers/projects/ffi-binding/lib/ffi/binding/version.rb +0 -5
- data/spec/helpers/projects/jewelery/VERSION +0 -1
- data/spec/helpers/projects/jewelery/bin/jewelery +0 -3
- data/spec/helpers/projects/jewelery/gemspec.yml +0 -4
- data/spec/helpers/projects/jewelery/jewelery.gemspec +0 -10
- data/spec/helpers/projects/jewelery/lib/jewelery.rb +0 -4
- data/spec/helpers/projects/jewelery/lib/jewelery/rubies.rb +0 -4
- data/spec/helpers/projects/minimal/gemspec.yml +0 -4
- data/spec/helpers/projects/minimal/lib/minimal.rb +0 -2
- data/spec/naming_spec.rb +0 -56
- data/spec/projects/dm_plugin_project_spec.rb +0 -29
- data/spec/projects/explicit_project_spec.rb +0 -33
- data/spec/projects/ffi_binding_project_spec.rb +0 -25
- data/spec/projects/jeweler_project_spec.rb +0 -17
- data/spec/projects/minimal_project_spec.rb +0 -17
- data/spec/projects/project_examples.rb +0 -34
- data/spec/versions/version_file_spec.rb +0 -28
- data/spec/versions/version_spec.rb +0 -53
data/lib/ore/dependency.rb
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
module Ore
|
2
|
-
#
|
3
|
-
# Represents a RubyGem dependency.
|
4
|
-
#
|
5
|
-
class Dependency
|
6
|
-
|
7
|
-
# The name of the dependency
|
8
|
-
attr_reader :name
|
9
|
-
|
10
|
-
# The required versions
|
11
|
-
attr_reader :versions
|
12
|
-
|
13
|
-
#
|
14
|
-
# Creates a new dependency.
|
15
|
-
#
|
16
|
-
# @param [String] name
|
17
|
-
# The name of the dependency.
|
18
|
-
#
|
19
|
-
# @param [Array<String>] versions
|
20
|
-
# The required versions.
|
21
|
-
#
|
22
|
-
def initialize(name,*versions)
|
23
|
-
@name = name
|
24
|
-
@versions = versions
|
25
|
-
end
|
26
|
-
|
27
|
-
#
|
28
|
-
# Parses a version string.
|
29
|
-
#
|
30
|
-
# @param [String] name
|
31
|
-
# The name of the dependency.
|
32
|
-
#
|
33
|
-
# @param [String, nil] versions
|
34
|
-
# The version string.
|
35
|
-
#
|
36
|
-
# @return [Dependency]
|
37
|
-
# The parsed dependency.
|
38
|
-
#
|
39
|
-
def self.parse_versions(name,versions)
|
40
|
-
versions = if versions.kind_of?(String)
|
41
|
-
versions.strip.split(/,\s*/)
|
42
|
-
else
|
43
|
-
[]
|
44
|
-
end
|
45
|
-
|
46
|
-
return new(name,*versions)
|
47
|
-
end
|
48
|
-
|
49
|
-
#
|
50
|
-
# Parses a dependencey string.
|
51
|
-
#
|
52
|
-
# @param [String] dependency
|
53
|
-
# The dependencey string.
|
54
|
-
#
|
55
|
-
# @return [Dependency]
|
56
|
-
# The parsed dependency.
|
57
|
-
#
|
58
|
-
def self.parse(dependency)
|
59
|
-
name, versions = dependency.strip.split(/\s+/,2)
|
60
|
-
|
61
|
-
return parse_versions(name,versions)
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
end
|
data/lib/ore/document_file.rb
DELETED
@@ -1,118 +0,0 @@
|
|
1
|
-
require 'set'
|
2
|
-
|
3
|
-
module Ore
|
4
|
-
#
|
5
|
-
# Parses the contents of a `.document`.
|
6
|
-
#
|
7
|
-
class DocumentFile
|
8
|
-
|
9
|
-
# The path to the `.document` file.
|
10
|
-
attr_reader :path
|
11
|
-
|
12
|
-
# The glob-patterns to find all code-files.
|
13
|
-
attr_reader :file_globs
|
14
|
-
|
15
|
-
# The glob-patterns to find all extra-files.
|
16
|
-
attr_reader :extra_file_globs
|
17
|
-
|
18
|
-
#
|
19
|
-
# Creates a new {DocumentFile}.
|
20
|
-
#
|
21
|
-
# @param [String] path
|
22
|
-
# The path of the `.document` file.
|
23
|
-
#
|
24
|
-
def initialize(path)
|
25
|
-
@path = File.expand_path(path)
|
26
|
-
|
27
|
-
@file_globs = Set[]
|
28
|
-
@extra_file_globs = Set[]
|
29
|
-
|
30
|
-
parse!
|
31
|
-
end
|
32
|
-
|
33
|
-
@@file = '.document'
|
34
|
-
|
35
|
-
#
|
36
|
-
# Finds the document file in a project.
|
37
|
-
#
|
38
|
-
# @param [Project] project
|
39
|
-
# The project to search within.
|
40
|
-
#
|
41
|
-
# @return [DocumentFile, nil]
|
42
|
-
# The found document file.
|
43
|
-
#
|
44
|
-
def self.find(project)
|
45
|
-
self.new(project.path(@@file)) if project.file?(@@file)
|
46
|
-
end
|
47
|
-
|
48
|
-
#
|
49
|
-
# All files described in the `.document` file.
|
50
|
-
#
|
51
|
-
# @yield [path]
|
52
|
-
# The given block will be passed every path that matches the file
|
53
|
-
# globs in the `.document` file.
|
54
|
-
#
|
55
|
-
# @yieldparam [String] path
|
56
|
-
# A match that matches the `.document` file patterns.
|
57
|
-
#
|
58
|
-
# @return [Enumerator]
|
59
|
-
# If no block was given, an enumerator object will be returned.
|
60
|
-
#
|
61
|
-
def each_file(&block)
|
62
|
-
return enum_for(:each_file) unless block
|
63
|
-
|
64
|
-
@file_globs.each do |pattern|
|
65
|
-
Dir.glob(pattern,&block)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
#
|
70
|
-
# All extra-files described in the `.document` file.
|
71
|
-
#
|
72
|
-
# @yield [path]
|
73
|
-
# The given block will be passed every path that matches the
|
74
|
-
# extra-file globs in the `.document` file.
|
75
|
-
#
|
76
|
-
# @yieldparam [String] path
|
77
|
-
# A match that matches the `.document` extra-file patterns.
|
78
|
-
#
|
79
|
-
# @return [Enumerator]
|
80
|
-
# If no block was given, an enumerator object will be returned.
|
81
|
-
#
|
82
|
-
def each_extra_file(&block)
|
83
|
-
return enum_for(:each_extra_file) unless block
|
84
|
-
|
85
|
-
@extra_file_globs.each do |pattern|
|
86
|
-
Dir.glob(pattern,&block)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
protected
|
91
|
-
|
92
|
-
#
|
93
|
-
# Parses the contents of a `.document` file.
|
94
|
-
#
|
95
|
-
def parse!
|
96
|
-
separator = false
|
97
|
-
|
98
|
-
File.open(@path) do |file|
|
99
|
-
file.each_line do |line|
|
100
|
-
line = line.chomp.strip
|
101
|
-
|
102
|
-
next if line.empty?
|
103
|
-
|
104
|
-
unless separator
|
105
|
-
if line == '-'
|
106
|
-
separator = true
|
107
|
-
else
|
108
|
-
@file_globs << line
|
109
|
-
end
|
110
|
-
else
|
111
|
-
@extra_file_globs << line
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
end
|
118
|
-
end
|
data/lib/ore/exceptions.rb
DELETED
data/lib/ore/naming.rb
DELETED
@@ -1,113 +0,0 @@
|
|
1
|
-
module Ore
|
2
|
-
#
|
3
|
-
# Provides methods for guessing the namespaces and directories
|
4
|
-
# of projects. {Naming} uses the naming conventions of project names
|
5
|
-
# defined by the
|
6
|
-
# [Ruby Packaging Standard (RPS)](http://chneukirchen.github.com/rps/).
|
7
|
-
#
|
8
|
-
module Naming
|
9
|
-
# The directory which contains executables for a project
|
10
|
-
@@bin_dir = 'bin'
|
11
|
-
|
12
|
-
# The directory which contains the code for a project
|
13
|
-
@@lib_dir = 'lib'
|
14
|
-
|
15
|
-
# The directory which contains C extension code for a project
|
16
|
-
@@ext_dir = 'ext'
|
17
|
-
|
18
|
-
# The directory which contains data files for a project
|
19
|
-
@@data_dir = 'data'
|
20
|
-
|
21
|
-
# The directory which contains unit-tests for a project
|
22
|
-
@@test_dir = 'test'
|
23
|
-
|
24
|
-
# The directory which contains spec-tests for a project
|
25
|
-
@@spec_dir = 'spec'
|
26
|
-
|
27
|
-
# The directory which contains built packages
|
28
|
-
@@pkg_dir = 'pkg'
|
29
|
-
|
30
|
-
# Words used in project names, but never in directory names
|
31
|
-
@@ignore_namespaces = %w[ruby java]
|
32
|
-
|
33
|
-
# Common project prefixes and namespaces
|
34
|
-
@@common_namespaces = {
|
35
|
-
'ffi' => 'FFI',
|
36
|
-
'dm' => 'DataMapper'
|
37
|
-
}
|
38
|
-
|
39
|
-
#
|
40
|
-
# Splits the project name into individual names.
|
41
|
-
#
|
42
|
-
# @param [String] name
|
43
|
-
# The name to split.
|
44
|
-
#
|
45
|
-
# @return [Array<String>]
|
46
|
-
# The individual names of the project name.
|
47
|
-
#
|
48
|
-
def names_in(name)
|
49
|
-
name.split('-').reject do |word|
|
50
|
-
@@ignore_namespaces.include?(word)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
#
|
55
|
-
# Guesses the module names from a project name.
|
56
|
-
#
|
57
|
-
# @return [Array<String>]
|
58
|
-
# The module names for a project.
|
59
|
-
#
|
60
|
-
def modules_of(name)
|
61
|
-
names_in(name).map do |words|
|
62
|
-
words.split('_').map { |word|
|
63
|
-
@@common_namespaces[word] || word.capitalize
|
64
|
-
}.join
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
#
|
69
|
-
# Guesses the full namespace for a project.
|
70
|
-
#
|
71
|
-
# @return [String]
|
72
|
-
# The full module namespace for a project.
|
73
|
-
#
|
74
|
-
def namespace_of(name)
|
75
|
-
modules_of(name).join('::')
|
76
|
-
end
|
77
|
-
|
78
|
-
#
|
79
|
-
# Converts a camel-case name to an underscored file name.
|
80
|
-
#
|
81
|
-
# @param [String] name
|
82
|
-
# The name to underscore.
|
83
|
-
#
|
84
|
-
# @return [String]
|
85
|
-
# The underscored version of the name.
|
86
|
-
#
|
87
|
-
def underscore(name)
|
88
|
-
name.gsub(/[^A-Z_][A-Z][^A-Z_]/) { |cap|
|
89
|
-
cap[0,1] + '_' + cap[1..-1]
|
90
|
-
}.downcase
|
91
|
-
end
|
92
|
-
|
93
|
-
#
|
94
|
-
# Guesses the namespace directories within `lib/` for a project.
|
95
|
-
#
|
96
|
-
# @return [Array<String>]
|
97
|
-
# The namespace directories for the project.
|
98
|
-
#
|
99
|
-
def namespace_dirs_of(name)
|
100
|
-
names_in(name).map { |word| underscore(word) }
|
101
|
-
end
|
102
|
-
|
103
|
-
#
|
104
|
-
# Guesses the namespace directory within `lib/` for a project.
|
105
|
-
#
|
106
|
-
# @return [String]
|
107
|
-
# The namespace directory for the project.
|
108
|
-
#
|
109
|
-
def namespace_path_of(name)
|
110
|
-
File.join(namespace_dirs_of(name))
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
data/lib/ore/paths.rb
DELETED
@@ -1,146 +0,0 @@
|
|
1
|
-
require 'ore/naming'
|
2
|
-
|
3
|
-
module Ore
|
4
|
-
#
|
5
|
-
# A mixin for {Project} which provides methods for working with paths.
|
6
|
-
#
|
7
|
-
module Paths
|
8
|
-
include Naming
|
9
|
-
|
10
|
-
#
|
11
|
-
# Builds a path relative to the project.
|
12
|
-
#
|
13
|
-
# @param [Array] names
|
14
|
-
# The directory names of the path.
|
15
|
-
#
|
16
|
-
# @return [Pathname]
|
17
|
-
# The new path.
|
18
|
-
#
|
19
|
-
def path(*names)
|
20
|
-
@root.join(*names)
|
21
|
-
end
|
22
|
-
|
23
|
-
#
|
24
|
-
# The `bin/` directory of the project.
|
25
|
-
#
|
26
|
-
# @return [Pathname]
|
27
|
-
# The path to the `bin/` directory.
|
28
|
-
#
|
29
|
-
def bin_dir
|
30
|
-
@root.join(@@lib_dir)
|
31
|
-
end
|
32
|
-
|
33
|
-
#
|
34
|
-
# The `lib/` directory of the project.
|
35
|
-
#
|
36
|
-
# @return [Pathname]
|
37
|
-
# The path to the `lib/` directory.
|
38
|
-
#
|
39
|
-
def lib_dir
|
40
|
-
@root.join(@@lib_dir)
|
41
|
-
end
|
42
|
-
|
43
|
-
#
|
44
|
-
# The `pkg/` directory of the project.
|
45
|
-
#
|
46
|
-
# @return [Pathname]
|
47
|
-
# The path to the `pkg/` directory.
|
48
|
-
#
|
49
|
-
def pkg_dir
|
50
|
-
@root.join(@@pkg_dir)
|
51
|
-
end
|
52
|
-
|
53
|
-
#
|
54
|
-
# Builds a path relative to the `lib/` directory.
|
55
|
-
#
|
56
|
-
# @param [Array] names
|
57
|
-
# The directory names of the path.
|
58
|
-
#
|
59
|
-
# @return [Pathname]
|
60
|
-
# The new path.
|
61
|
-
#
|
62
|
-
def lib_path(*names)
|
63
|
-
path(@@lib_dir,*names)
|
64
|
-
end
|
65
|
-
|
66
|
-
#
|
67
|
-
# Builds a relative path into the `pkg/` directory for the `.gem` file.
|
68
|
-
#
|
69
|
-
# @return [String]
|
70
|
-
# The path of a `.gem` file for the project.
|
71
|
-
#
|
72
|
-
def pkg_file
|
73
|
-
File.join(@@pkg_dir,"#{@name}-#{@version}.gem")
|
74
|
-
end
|
75
|
-
|
76
|
-
#
|
77
|
-
# Determines if a directory exists within the project.
|
78
|
-
#
|
79
|
-
# @param [String] path
|
80
|
-
# The path of the directory, relative to the project.
|
81
|
-
#
|
82
|
-
# @return [Boolean]
|
83
|
-
# Specifies whether the directory exists in the project.
|
84
|
-
#
|
85
|
-
def directory?(path)
|
86
|
-
@root.join(path).directory?
|
87
|
-
end
|
88
|
-
|
89
|
-
#
|
90
|
-
# Determines if a file exists within the project.
|
91
|
-
#
|
92
|
-
# @param [String] path
|
93
|
-
# The path of the file, relative to the project.
|
94
|
-
#
|
95
|
-
# @return [Boolean]
|
96
|
-
# Specifies whether the file exists in the project.
|
97
|
-
#
|
98
|
-
def file?(path)
|
99
|
-
@project_files.include?(path)
|
100
|
-
end
|
101
|
-
|
102
|
-
#
|
103
|
-
# Determines if a directory exists within the `lib/` directory of the
|
104
|
-
# project.
|
105
|
-
#
|
106
|
-
# @return [Boolean]
|
107
|
-
# Specifies that the directory exists within the `lib/` directory.
|
108
|
-
#
|
109
|
-
def lib_directory?(path)
|
110
|
-
directory?(File.join(@@lib_dir,path))
|
111
|
-
end
|
112
|
-
|
113
|
-
#
|
114
|
-
# Determines if a file exists within the `lib/` directory of the
|
115
|
-
# project.
|
116
|
-
#
|
117
|
-
# @return [Boolean]
|
118
|
-
# Specifies that the file exists within the `lib/` directory.
|
119
|
-
#
|
120
|
-
def lib_file?(path)
|
121
|
-
file?(File.join(@@lib_dir,path))
|
122
|
-
end
|
123
|
-
|
124
|
-
#
|
125
|
-
# Finds paths within the project that match a glob pattern.
|
126
|
-
#
|
127
|
-
# @param [String] pattern
|
128
|
-
# The glob pattern.
|
129
|
-
#
|
130
|
-
# @yield [path]
|
131
|
-
# The given block will be passed matching paths.
|
132
|
-
#
|
133
|
-
# @yieldparam [String] path
|
134
|
-
# A path relative to the root directory of the project.
|
135
|
-
#
|
136
|
-
def glob(pattern)
|
137
|
-
within do
|
138
|
-
Dir.glob(pattern) do |path|
|
139
|
-
if (@project_files.include?(path) || File.directory?(path))
|
140
|
-
yield path
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|