juwelier 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +2 -0
- data/.document +8 -0
- data/.semver +5 -0
- data/.travis.yml +7 -0
- data/.yardopts +2 -0
- data/ChangeLog.markdown +230 -0
- data/Gemfile +40 -0
- data/LICENSE.txt +20 -0
- data/README.markdown +252 -0
- data/Rakefile +78 -0
- data/bin/juwelier +9 -0
- data/features/generator/cucumber.feature +103 -0
- data/features/generator/directory_layout.feature +86 -0
- data/features/generator/dotdocument.feature +13 -0
- data/features/generator/env_options.feature +9 -0
- data/features/generator/gemfile.feature +81 -0
- data/features/generator/git.feature +102 -0
- data/features/generator/license.feature +20 -0
- data/features/generator/rakefile.feature +158 -0
- data/features/generator/readme.feature +12 -0
- data/features/generator/test.feature +54 -0
- data/features/generator/test_helper.feature +149 -0
- data/features/placeholder.feature +5 -0
- data/features/step_definitions/debug_steps.rb +6 -0
- data/features/step_definitions/filesystem_steps.rb +70 -0
- data/features/step_definitions/generator_steps.rb +387 -0
- data/features/step_definitions/task_steps.rb +6 -0
- data/features/support/env.rb +41 -0
- data/features/tasks/build_gem.feature +9 -0
- data/features/tasks/version.feature +31 -0
- data/features/tasks/version_bumping.feature +49 -0
- data/juwelier.gemspec +241 -0
- data/lib/juwelier.rb +178 -0
- data/lib/juwelier/commands.rb +20 -0
- data/lib/juwelier/commands/build_gem.rb +40 -0
- data/lib/juwelier/commands/check_dependencies.rb +66 -0
- data/lib/juwelier/commands/install_gem.rb +31 -0
- data/lib/juwelier/commands/release_gemspec.rb +87 -0
- data/lib/juwelier/commands/release_to_git.rb +64 -0
- data/lib/juwelier/commands/release_to_rubygems.rb +28 -0
- data/lib/juwelier/commands/validate_gemspec.rb +30 -0
- data/lib/juwelier/commands/version/base.rb +55 -0
- data/lib/juwelier/commands/version/bump_major.rb +13 -0
- data/lib/juwelier/commands/version/bump_minor.rb +12 -0
- data/lib/juwelier/commands/version/bump_patch.rb +14 -0
- data/lib/juwelier/commands/version/write.rb +12 -0
- data/lib/juwelier/commands/write_gemspec.rb +39 -0
- data/lib/juwelier/errors.rb +8 -0
- data/lib/juwelier/gemcutter_tasks.rb +8 -0
- data/lib/juwelier/gemspec_helper.rb +87 -0
- data/lib/juwelier/generator.rb +304 -0
- data/lib/juwelier/generator/application.rb +63 -0
- data/lib/juwelier/generator/bacon_mixin.rb +43 -0
- data/lib/juwelier/generator/github_mixin.rb +22 -0
- data/lib/juwelier/generator/micronaut_mixin.rb +41 -0
- data/lib/juwelier/generator/minitest_mixin.rb +42 -0
- data/lib/juwelier/generator/options.rb +172 -0
- data/lib/juwelier/generator/rdoc_mixin.rb +13 -0
- data/lib/juwelier/generator/riot_mixin.rb +42 -0
- data/lib/juwelier/generator/rspec_mixin.rb +42 -0
- data/lib/juwelier/generator/shindo_mixin.rb +44 -0
- data/lib/juwelier/generator/shoulda_mixin.rb +42 -0
- data/lib/juwelier/generator/testspec_mixin.rb +42 -0
- data/lib/juwelier/generator/testunit_mixin.rb +39 -0
- data/lib/juwelier/generator/yard_mixin.rb +15 -0
- data/lib/juwelier/rubyforge_tasks.rb +95 -0
- data/lib/juwelier/rubygems_dot_org_tasks.rb +38 -0
- data/lib/juwelier/rubygems_tasks.rb +38 -0
- data/lib/juwelier/specification.rb +110 -0
- data/lib/juwelier/tasks.rb +239 -0
- data/lib/juwelier/templates/.document +5 -0
- data/lib/juwelier/templates/.gitignore +49 -0
- data/lib/juwelier/templates/Gemfile +12 -0
- data/lib/juwelier/templates/LICENSE.txt +20 -0
- data/lib/juwelier/templates/README.rdoc +19 -0
- data/lib/juwelier/templates/Rakefile +9 -0
- data/lib/juwelier/templates/bacon/flunking.rb +7 -0
- data/lib/juwelier/templates/bacon/helper.rb +10 -0
- data/lib/juwelier/templates/bundler_setup.erb +10 -0
- data/lib/juwelier/templates/features/default.feature +9 -0
- data/lib/juwelier/templates/features/support/env.rb +11 -0
- data/lib/juwelier/templates/juwelier_tasks.erb +31 -0
- data/lib/juwelier/templates/micronaut/flunking.rb +7 -0
- data/lib/juwelier/templates/micronaut/helper.rb +19 -0
- data/lib/juwelier/templates/minitest/flunking.rb +7 -0
- data/lib/juwelier/templates/minitest/helper.rb +13 -0
- data/lib/juwelier/templates/other_tasks.erb +70 -0
- data/lib/juwelier/templates/riot/flunking.rb +11 -0
- data/lib/juwelier/templates/riot/helper.rb +5 -0
- data/lib/juwelier/templates/rspec/.rspec +1 -0
- data/lib/juwelier/templates/rspec/flunking.rb +7 -0
- data/lib/juwelier/templates/rspec/helper.rb +14 -0
- data/lib/juwelier/templates/shindo/flunking.rb +8 -0
- data/lib/juwelier/templates/shindo/helper.rb +7 -0
- data/lib/juwelier/templates/shoulda/flunking.rb +7 -0
- data/lib/juwelier/templates/shoulda/helper.rb +12 -0
- data/lib/juwelier/templates/simplecov.erb +16 -0
- data/lib/juwelier/templates/testspec/flunking.rb +7 -0
- data/lib/juwelier/templates/testspec/helper.rb +7 -0
- data/lib/juwelier/templates/testunit/flunking.rb +7 -0
- data/lib/juwelier/templates/testunit/helper.rb +11 -0
- data/lib/juwelier/version.rb +10 -0
- data/lib/juwelier/version_helper.rb +141 -0
- data/test/fixtures/bar/VERSION.yml +4 -0
- data/test/fixtures/bar/bin/foo_the_ultimate_bin +1 -0
- data/test/fixtures/bar/hey_include_me_in_gemspec +0 -0
- data/test/fixtures/bar/lib/foo_the_ultimate_lib.rb +1 -0
- data/test/fixtures/existing-project-with-version-constant/.document +5 -0
- data/test/fixtures/existing-project-with-version-constant/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-constant/LICENSE.txt +20 -0
- data/test/fixtures/existing-project-with-version-constant/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-constant/Rakefile +85 -0
- data/test/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-constant/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-constant/test/test_helper.rb +10 -0
- data/test/fixtures/existing-project-with-version-plaintext/.document +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/LICENSE.txt +20 -0
- data/test/fixtures/existing-project-with-version-plaintext/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-plaintext/Rakefile +84 -0
- data/test/fixtures/existing-project-with-version-plaintext/VERSION +1 -0
- data/test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-plaintext/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-plaintext/test/test_helper.rb +10 -0
- data/test/fixtures/existing-project-with-version-yaml/.document +5 -0
- data/test/fixtures/existing-project-with-version-yaml/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-yaml/LICENSE.txt +20 -0
- data/test/fixtures/existing-project-with-version-yaml/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-yaml/Rakefile +84 -0
- data/test/fixtures/existing-project-with-version-yaml/VERSION.yml +4 -0
- data/test/fixtures/existing-project-with-version-yaml/bin/foo_the_ultimate_bin +0 -0
- data/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-yaml/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-yaml/test/test_helper.rb +10 -0
- data/test/geminstaller.yml +12 -0
- data/test/juwelier/commands/test_build_gem.rb +112 -0
- data/test/juwelier/commands/test_install_gem.rb +35 -0
- data/test/juwelier/commands/test_release_to_gemcutter.rb +39 -0
- data/test/juwelier/commands/test_release_to_git.rb +271 -0
- data/test/juwelier/commands/test_release_to_github.rb +477 -0
- data/test/juwelier/commands/test_validate_gemspec.rb +27 -0
- data/test/juwelier/commands/test_write_gemspec.rb +103 -0
- data/test/juwelier/commands/version/test_base.rb +53 -0
- data/test/juwelier/commands/version/test_bump_major.rb +22 -0
- data/test/juwelier/commands/version/test_bump_minor.rb +19 -0
- data/test/juwelier/commands/version/test_bump_patch.rb +20 -0
- data/test/juwelier/commands/version/test_write.rb +22 -0
- data/test/juwelier/generator/test_application.rb +142 -0
- data/test/juwelier/generator/test_options.rb +227 -0
- data/test/juwelier/test_gemspec_helper.rb +44 -0
- data/test/juwelier/test_generator.rb +140 -0
- data/test/juwelier/test_generator_initialization.rb +150 -0
- data/test/juwelier/test_generator_mixins.rb +23 -0
- data/test/juwelier/test_specification.rb +245 -0
- data/test/juwelier/test_tasks.rb +50 -0
- data/test/juwelier/test_version_helper.rb +214 -0
- data/test/shoulda_macros/juwelier_macros.rb +35 -0
- data/test/test_helper.rb +174 -0
- data/test/test_juwelier.rb +177 -0
- metadata +396 -0
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'shellwords'
|
2
|
+
|
3
|
+
class Juwelier
|
4
|
+
class Generator
|
5
|
+
class Application
|
6
|
+
class << self
|
7
|
+
include Shellwords
|
8
|
+
|
9
|
+
def run!(*arguments)
|
10
|
+
options = build_options(arguments)
|
11
|
+
|
12
|
+
if options[:invalid_argument]
|
13
|
+
$stderr.puts options[:invalid_argument]
|
14
|
+
options[:show_help] = true
|
15
|
+
end
|
16
|
+
|
17
|
+
if options[:show_version]
|
18
|
+
$stderr.puts "Version: #{Juwelier::Version::STRING}"
|
19
|
+
return 1
|
20
|
+
end
|
21
|
+
|
22
|
+
if options[:show_help]
|
23
|
+
$stderr.puts options.opts
|
24
|
+
return 1
|
25
|
+
end
|
26
|
+
|
27
|
+
if options[:project_name].nil? || options[:project_name].squeeze.strip == ""
|
28
|
+
$stderr.puts options.opts
|
29
|
+
return 1
|
30
|
+
end
|
31
|
+
|
32
|
+
begin
|
33
|
+
generator = Juwelier::Generator.new(options)
|
34
|
+
generator.run
|
35
|
+
return 0
|
36
|
+
rescue Juwelier::NoGitUserName
|
37
|
+
$stderr.puts %Q{No user.name found in ~/.gitconfig. Please tell git about yourself (see http://help.github.com/git-email-settings/ for details). For example: git config --global user.name "mad voo"}
|
38
|
+
return 1
|
39
|
+
rescue Juwelier::NoGitUserEmail
|
40
|
+
$stderr.puts %Q{No user.email found in ~/.gitconfig. Please tell git about yourself (see http://help.github.com/git-email-settings/ for details). For example: git config --global user.email mad.vooo@gmail.com}
|
41
|
+
return 1
|
42
|
+
rescue Juwelier::NoGitHubUser
|
43
|
+
$stderr.puts %Q{Please specify --github-username or set github.user in ~/.gitconfig (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.user defunkt}
|
44
|
+
return 1
|
45
|
+
rescue Juwelier::FileInTheWay
|
46
|
+
$stderr.puts "The directory #{options[:project_name]} already exists. Maybe move it out of the way before continuing?"
|
47
|
+
return 1
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def build_options(arguments)
|
52
|
+
env_opts_string = ENV['JUWELIER_OPTS'] || ""
|
53
|
+
env_opts = Juwelier::Generator::Options.new(shellwords(env_opts_string))
|
54
|
+
argument_opts = Juwelier::Generator::Options.new(arguments)
|
55
|
+
|
56
|
+
env_opts.merge(argument_opts)
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
class Juwelier
|
2
|
+
class Generator
|
3
|
+
module BaconMixin
|
4
|
+
|
5
|
+
def self.extended(generator)
|
6
|
+
generator.development_dependencies << ["bacon", ">= 0"]
|
7
|
+
end
|
8
|
+
|
9
|
+
def default_task
|
10
|
+
'spec'
|
11
|
+
end
|
12
|
+
|
13
|
+
def feature_support_require
|
14
|
+
'test/unit/assertions'
|
15
|
+
end
|
16
|
+
|
17
|
+
def feature_support_extend
|
18
|
+
'Test::Unit::Assertions' # NOTE can't use bacon inside of cucumber actually
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_dir
|
22
|
+
'spec'
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_task
|
26
|
+
'spec'
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_pattern
|
30
|
+
'spec/**/*_spec.rb'
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_filename
|
34
|
+
"#{require_name}_spec.rb"
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_helper_filename
|
38
|
+
"spec_helper.rb"
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class Juwelier
|
2
|
+
class Generator
|
3
|
+
module GithubMixin
|
4
|
+
def self.extended(generator)
|
5
|
+
generator.github_username = generator.options[:github_username]
|
6
|
+
generator.should_create_remote_repo = generator.options[:create_repo]
|
7
|
+
|
8
|
+
unless generator.github_username
|
9
|
+
raise NoGitHubUser
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def git_remote
|
14
|
+
@git_remote ||= "git@github.com:#{github_username}/#{project_name}.git"
|
15
|
+
end
|
16
|
+
|
17
|
+
def homepage
|
18
|
+
@homepage ||= "http://github.com/#{github_username}/#{project_name}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class Juwelier
|
2
|
+
class Generator
|
3
|
+
module MicronautMixin
|
4
|
+
def self.extended(generator)
|
5
|
+
generator.development_dependencies << ["spicycode-micronaut", ">= 0"]
|
6
|
+
end
|
7
|
+
|
8
|
+
def default_task
|
9
|
+
'examples'
|
10
|
+
end
|
11
|
+
|
12
|
+
def feature_support_require
|
13
|
+
'micronaut/expectations'
|
14
|
+
end
|
15
|
+
|
16
|
+
def feature_support_extend
|
17
|
+
'Micronaut::Matchers'
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_dir
|
21
|
+
'examples'
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_task
|
25
|
+
'examples'
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_pattern
|
29
|
+
'examples/**/*_example.rb'
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_filename
|
33
|
+
"#{require_name}_example.rb"
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_helper_filename
|
37
|
+
"example_helper.rb"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class Juwelier
|
2
|
+
class Generator
|
3
|
+
module MinitestMixin
|
4
|
+
def self.extended(generator)
|
5
|
+
generator.development_dependencies << ["minitest", ">= 0"]
|
6
|
+
end
|
7
|
+
|
8
|
+
def default_task
|
9
|
+
'test'
|
10
|
+
end
|
11
|
+
|
12
|
+
def feature_support_require
|
13
|
+
'minitest/unit'
|
14
|
+
end
|
15
|
+
|
16
|
+
def feature_support_extend
|
17
|
+
'MiniTest::Assertions'
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_dir
|
21
|
+
'test'
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_task
|
25
|
+
'test'
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_pattern
|
29
|
+
'test/**/test_*.rb'
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_filename
|
33
|
+
"test_#{require_name}.rb"
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_helper_filename
|
37
|
+
"helper.rb"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
class Juwelier
|
2
|
+
class Generator
|
3
|
+
class Options < Hash
|
4
|
+
attr_reader :opts, :orig_args
|
5
|
+
|
6
|
+
def initialize(args)
|
7
|
+
super()
|
8
|
+
|
9
|
+
@orig_args = args.clone
|
10
|
+
self[:testing_framework] = :shoulda
|
11
|
+
self[:documentation_framework] = :rdoc
|
12
|
+
self[:use_bundler] = true
|
13
|
+
|
14
|
+
self[:user_name] = ENV['GIT_AUTHOR_NAME'] || ENV['GIT_COMMITTER_NAME'] || git_config['user.name']
|
15
|
+
self[:user_email] = ENV['GIT_AUTHOR_EMAIL'] || ENV['GIT_COMMITTER_EMAIL'] || git_config['user.email']
|
16
|
+
self[:github_username] = git_config['github.user']
|
17
|
+
|
18
|
+
require 'optparse'
|
19
|
+
@opts = OptionParser.new do |o|
|
20
|
+
o.banner = "Usage: #{File.basename($0)} [options] reponame\ne.g. #{File.basename($0)} the-perfect-gem"
|
21
|
+
|
22
|
+
o.on('--directory [DIRECTORY]', 'specify the directory to generate into (deprecated)') do |directory|
|
23
|
+
warn "--directory is deprecated and will be removed in 2.0.0. Please specify an absolute path to a directory as the last argument instead" # DEPRECATE
|
24
|
+
self[:directory] = directory
|
25
|
+
end
|
26
|
+
|
27
|
+
o.separator ""
|
28
|
+
|
29
|
+
o.on('--rspec', 'generate rspec code examples') do
|
30
|
+
self[:testing_framework] = :rspec
|
31
|
+
end
|
32
|
+
|
33
|
+
o.on('--shoulda', 'generate shoulda tests') do
|
34
|
+
self[:testing_framework] = :shoulda
|
35
|
+
end
|
36
|
+
|
37
|
+
o.on('--testunit', 'generate test/unit tests') do
|
38
|
+
self[:testing_framework] = :testunit
|
39
|
+
end
|
40
|
+
|
41
|
+
o.on('--bacon', 'generate bacon specifications') do
|
42
|
+
self[:testing_framework] = :bacon
|
43
|
+
end
|
44
|
+
|
45
|
+
o.on('--testspec', 'generate test/spec tests') do
|
46
|
+
self[:testing_framework] = :testspec
|
47
|
+
end
|
48
|
+
|
49
|
+
o.on('--minitest', 'generate minitest tests') do
|
50
|
+
self[:testing_framework] = :minitest
|
51
|
+
end
|
52
|
+
|
53
|
+
o.on('--micronaut', 'generate micronaut examples') do
|
54
|
+
self[:testing_framework] = :micronaut
|
55
|
+
end
|
56
|
+
|
57
|
+
o.on('--riot', 'generate riot tests') do
|
58
|
+
self[:testing_framework] = :riot
|
59
|
+
end
|
60
|
+
|
61
|
+
o.on('--shindo', 'generate shindo tests') do
|
62
|
+
self[:testing_framework] = :shindo
|
63
|
+
end
|
64
|
+
|
65
|
+
o.separator ""
|
66
|
+
|
67
|
+
o.on('--[no-]bundler', 'use bundler for managing dependencies') do |v|
|
68
|
+
self[:use_bundler] = v
|
69
|
+
end
|
70
|
+
|
71
|
+
o.on('--cucumber', 'generate cucumber stories in addition to the other tests') do
|
72
|
+
self[:use_cucumber] = true
|
73
|
+
end
|
74
|
+
|
75
|
+
o.separator ""
|
76
|
+
|
77
|
+
o.on('--reek', 'generate rake task for reek') do
|
78
|
+
self[:use_reek] = true
|
79
|
+
end
|
80
|
+
|
81
|
+
o.on('--roodi', 'generate rake task for roodi') do
|
82
|
+
self[:use_roodi] = true
|
83
|
+
end
|
84
|
+
|
85
|
+
o.separator ""
|
86
|
+
|
87
|
+
o.on('--summary [SUMMARY]', 'specify the summary of the project') do |summary|
|
88
|
+
self[:summary] = summary
|
89
|
+
end
|
90
|
+
|
91
|
+
o.on('--description [DESCRIPTION]', 'specify a description of the project') do |description|
|
92
|
+
self[:description] = description
|
93
|
+
end
|
94
|
+
|
95
|
+
o.separator ""
|
96
|
+
|
97
|
+
o.on('--user-name [USER_NAME]', "the user's name, ie that is credited in the LICENSE") do |user_name|
|
98
|
+
self[:user_name] = user_name
|
99
|
+
end
|
100
|
+
|
101
|
+
o.on('--user-email [USER_EMAIL]', "the user's email, ie that is credited in the Gem specification") do |user_email|
|
102
|
+
self[:user_email] = user_email
|
103
|
+
end
|
104
|
+
|
105
|
+
o.separator ""
|
106
|
+
|
107
|
+
o.on('--github-username [GITHUB_USERNAME]', "name of the user on GitHub to set the project up under") do |github_username|
|
108
|
+
self[:github_username] = github_username
|
109
|
+
end
|
110
|
+
|
111
|
+
o.on('--git-remote [GIT_REMOTE]', 'URI to set the git origin remote to') do |git_remote|
|
112
|
+
self[:git_remote] = git_remote
|
113
|
+
end
|
114
|
+
|
115
|
+
o.on('--homepage [HOMEPAGE]', "the homepage for your project (defaults to the GitHub repo)") do |homepage|
|
116
|
+
self[:homepage] = homepage
|
117
|
+
end
|
118
|
+
|
119
|
+
o.on('--create-repo', 'create the repository on GitHub') do
|
120
|
+
self[:create_repo] = true
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
o.separator ""
|
125
|
+
|
126
|
+
o.on('--yard', 'use yard for documentation') do
|
127
|
+
self[:documentation_framework] = :yard
|
128
|
+
end
|
129
|
+
|
130
|
+
o.on('--rdoc', 'use rdoc for documentation') do
|
131
|
+
self[:documentation_framework] = :rdoc
|
132
|
+
end
|
133
|
+
|
134
|
+
o.on('-v', '--version', 'show version') do
|
135
|
+
self[:show_version] = true
|
136
|
+
end
|
137
|
+
|
138
|
+
o.on_tail('-h', '--help', 'display this help and exit') do
|
139
|
+
self[:show_help] = true
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
begin
|
144
|
+
@opts.parse!(args)
|
145
|
+
self[:project_name] = args.shift
|
146
|
+
rescue OptionParser::InvalidOption => e
|
147
|
+
self[:invalid_argument] = e.message
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
def merge(other)
|
152
|
+
self.class.new(@orig_args + other.orig_args)
|
153
|
+
end
|
154
|
+
|
155
|
+
|
156
|
+
# Expose git config here, so we can stub it out for test environments
|
157
|
+
def self.git_config
|
158
|
+
@git_config ||= if Pathname.new("~/.gitconfig").expand_path.exist?
|
159
|
+
Git.global_config
|
160
|
+
else
|
161
|
+
{}
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
165
|
+
|
166
|
+
def git_config
|
167
|
+
self.class.git_config
|
168
|
+
end
|
169
|
+
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class Juwelier
|
2
|
+
class Generator
|
3
|
+
module RiotMixin
|
4
|
+
def self.extended(generator)
|
5
|
+
generator.development_dependencies << ["riot", ">= 0"]
|
6
|
+
end
|
7
|
+
|
8
|
+
def default_task
|
9
|
+
'test'
|
10
|
+
end
|
11
|
+
|
12
|
+
def feature_support_require
|
13
|
+
'riot/context'
|
14
|
+
end
|
15
|
+
|
16
|
+
def feature_support_extend
|
17
|
+
'Riot::Context'
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_dir
|
21
|
+
'test'
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_task
|
25
|
+
'test'
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_pattern
|
29
|
+
'test/**/*_test.rb'
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_filename
|
33
|
+
"#{require_name}_test.rb"
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_helper_filename
|
37
|
+
"teststrap.rb"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|