newgem 0.28.0 → 0.29.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Manifest.txt +10 -2
- data/config/hoe.rb +1 -1
- data/cucumber_generators/feature/feature_generator.rb +3 -3
- data/features/cli.feature +28 -0
- data/features/executable_generator.feature +33 -0
- data/features/expected_outputs/newgem.out +50 -0
- data/features/steps/cli.rb +104 -0
- data/features/steps/env.rb +34 -0
- data/features/steps/executable_generator.rb +0 -0
- data/lib/newgem/version.rb +1 -1
- data/rubygems_generators/executable/executable_generator.rb +9 -3
- data/rubygems_generators/executable/templates/bin/app.rb.erb +10 -0
- data/rubygems_generators/executable/templates/lib/app/cli.rb.erb +42 -0
- data/rubygems_generators/executable/templates/test/test_cli.rb.erb +8 -0
- data/rubygems_generators/install_cucumber/install_cucumber_generator.rb +1 -4
- data/tasks/cucumber.rake +6 -0
- data/test/test_executable_generator.rb +4 -3
- data/test/test_install_cucumber_generator.rb +0 -2
- data/website/index.html +1 -1
- data/website/rubyforge.html +1 -1
- data/website/version-raw.js +1 -1
- data/website/version.js +1 -1
- metadata +12 -4
- data/rubygems_generators/executable/templates/app.rb +0 -44
- data/rubygems_generators/install_cucumber/templates/cucumber +0 -2
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 0.29.0 2008-10-18 NOT RELEASED
|
2
|
+
|
3
|
+
* execute generator uses a lib/appname/cli.rb file
|
4
|
+
* basic feature descriptions for newgem and executable generators
|
5
|
+
|
1
6
|
== 0.28.0 2008-10-17
|
2
7
|
|
3
8
|
* Cucumber support: install_cucumber generator, and features generator for cucumber scope
|
data/Manifest.txt
CHANGED
@@ -39,6 +39,12 @@ cucumber_generators/feature/USAGE
|
|
39
39
|
cucumber_generators/feature/feature_generator.rb
|
40
40
|
cucumber_generators/feature/templates/feature.erb
|
41
41
|
cucumber_generators/feature/templates/steps.erb
|
42
|
+
features/cli.feature
|
43
|
+
features/executable_generator.feature
|
44
|
+
features/expected_outputs/newgem.out
|
45
|
+
features/steps/cli.rb
|
46
|
+
features/steps/env.rb
|
47
|
+
features/steps/executable_generator.rb
|
42
48
|
lib/newgem.rb
|
43
49
|
lib/newgem/quick_template.rb
|
44
50
|
lib/newgem/rubyforge.rb
|
@@ -64,7 +70,9 @@ newgem_theme_generators/plain_theme/templates/website/stylesheets/screen.css
|
|
64
70
|
newgem_theme_generators/plain_theme/templates/website/template.html.erb
|
65
71
|
rubygems_generators/executable/USAGE
|
66
72
|
rubygems_generators/executable/executable_generator.rb
|
67
|
-
rubygems_generators/executable/templates/app.rb
|
73
|
+
rubygems_generators/executable/templates/bin/app.rb.erb
|
74
|
+
rubygems_generators/executable/templates/lib/app/cli.rb.erb
|
75
|
+
rubygems_generators/executable/templates/test/test_cli.rb.erb
|
68
76
|
rubygems_generators/extconf/USAGE
|
69
77
|
rubygems_generators/extconf/extconf_generator.rb
|
70
78
|
rubygems_generators/extconf/templates/README.txt
|
@@ -75,7 +83,6 @@ rubygems_generators/extconf/templates/tasks/extconf.rake
|
|
75
83
|
rubygems_generators/extconf/templates/tasks/extconf_name.rake
|
76
84
|
rubygems_generators/extconf/templates/test/test.rb.erb
|
77
85
|
rubygems_generators/install_cucumber/install_cucumber_generator.rb
|
78
|
-
rubygems_generators/install_cucumber/templates/cucumber
|
79
86
|
rubygems_generators/install_cucumber/templates/cucumber.rake
|
80
87
|
rubygems_generators/install_cucumber/templates/env.rb
|
81
88
|
rubygems_generators/install_jruby/USAGE
|
@@ -103,6 +110,7 @@ script/txt2html.rb
|
|
103
110
|
script/txt2js
|
104
111
|
setup.rb
|
105
112
|
tasks/bundles.rake
|
113
|
+
tasks/cucumber.rake
|
106
114
|
tasks/deployment.rake
|
107
115
|
tasks/environment.rake
|
108
116
|
tasks/generator_report.rake
|
data/config/hoe.rb
CHANGED
@@ -31,7 +31,7 @@ end
|
|
31
31
|
REV = nil #File.read(".svn/entries")[/committed-rev="(\d+)"/, 1] rescue nil
|
32
32
|
# REV = YAML.load(`svn info`)['Revision']
|
33
33
|
VERS = Newgem::VERSION::STRING + (REV ? ".#{REV}" : "")
|
34
|
-
CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store']
|
34
|
+
CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store', 'tmp']
|
35
35
|
|
36
36
|
# Generate all the Rake tasks
|
37
37
|
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
@@ -5,9 +5,9 @@ class FeatureGenerator < RubiGen::Base
|
|
5
5
|
super
|
6
6
|
usage if args.empty?
|
7
7
|
@name = args.shift
|
8
|
-
@plural_name = @name.pluralize
|
9
|
-
@singular_name = @name.singularize
|
10
|
-
@class_name = @name.classify
|
8
|
+
@plural_name = @name.pluralize.underscore
|
9
|
+
@singular_name = @name.singularize.underscore
|
10
|
+
@class_name = @name.singularize.classify
|
11
11
|
end
|
12
12
|
|
13
13
|
def manifest
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Feature: Can run create RubyGem scaffolds
|
2
|
+
|
3
|
+
As a developer of RubyGems
|
4
|
+
I want to create RubyGem scaffolds
|
5
|
+
So that I can rapidly produce specs and code for encapsulated applications and libraries
|
6
|
+
|
7
|
+
Scenario: Run newgem without any arguments
|
8
|
+
Given a safe folder
|
9
|
+
When newgem is executed for project 'my_project' with no options
|
10
|
+
Then folder 'my_project' is created
|
11
|
+
And file 'my_project/Rakefile' is created
|
12
|
+
And output matches 'newgem.out'
|
13
|
+
And invokes generator 'install_test_unit'
|
14
|
+
And invokes generator 'install_website'
|
15
|
+
And invokes generator 'install_rubigen_scripts'
|
16
|
+
|
17
|
+
Scenario: Run newgem to include rspec
|
18
|
+
Given a safe folder
|
19
|
+
When newgem is executed for project 'my_rspec_project' with options '-T rspec'
|
20
|
+
Then folder 'my_rspec_project' is created
|
21
|
+
And invokes generator 'install_rspec'
|
22
|
+
|
23
|
+
Scenario: Run newgem to disable website
|
24
|
+
Given a safe folder
|
25
|
+
When newgem is executed for project 'my_project' with options '-W'
|
26
|
+
Then folder 'my_project' is created
|
27
|
+
And does not invoke generator 'install_website'
|
28
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
Feature: Generate an executable/CLI scaffold
|
2
|
+
|
3
|
+
As a RubyGem developer
|
4
|
+
I want a scaffold for executable/CLI scripts
|
5
|
+
So that I know the structure for constructing CLIs and can create them quickly
|
6
|
+
|
7
|
+
Scenario: Run executable generator with name of executable
|
8
|
+
Given an existing newgem scaffold [called 'my_project']
|
9
|
+
When 'executable' generator is invoked with arguments 'my_app'
|
10
|
+
Then folder 'my_project/bin/my_app' is created
|
11
|
+
And file 'my_project/bin/my_app' is created
|
12
|
+
And file 'my_project/lib/my_app/cli.rb' is created
|
13
|
+
And file 'my_project/test/test_my_app_cli.rb' is created
|
14
|
+
|
15
|
+
Scenario: Run CLI app from executable generator to show help
|
16
|
+
Given an existing newgem scaffold [called 'my_project']
|
17
|
+
Given 'executable' generator is invoked with arguments 'my_app'
|
18
|
+
When run executable 'my_project/bin/my_app' with arguments '-h'
|
19
|
+
Then help options '-h' and '--help' are displayed
|
20
|
+
Then help options '-p' and '--path' are displayed
|
21
|
+
|
22
|
+
Scenario: Run CLI app from executable generator should not fail
|
23
|
+
Given an existing newgem scaffold [called 'my_project']
|
24
|
+
Given 'executable' generator is invoked with arguments 'my_app'
|
25
|
+
When run executable 'my_project/bin/my_app' with arguments ''
|
26
|
+
Then output matches /lib\/my_app\/cli.rb/
|
27
|
+
|
28
|
+
Scenario: Run unit tests after executable generator should all pass
|
29
|
+
Given an existing newgem scaffold [called 'my_project']
|
30
|
+
Given 'executable' generator is invoked with arguments 'my_app'
|
31
|
+
When run unit tests for test file 'test/test_my_app_cli.rb'
|
32
|
+
Then all 1 tests pass
|
33
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
create
|
2
|
+
create config
|
3
|
+
create doc
|
4
|
+
create lib
|
5
|
+
create script
|
6
|
+
create tasks
|
7
|
+
create lib/my_project
|
8
|
+
create History.txt
|
9
|
+
create Rakefile
|
10
|
+
create README.rdoc
|
11
|
+
create PostInstall.txt
|
12
|
+
create setup.rb
|
13
|
+
create lib/my_project.rb
|
14
|
+
create lib/my_project/version.rb
|
15
|
+
create config/hoe.rb
|
16
|
+
create config/requirements.rb
|
17
|
+
create tasks/deployment.rake
|
18
|
+
create tasks/environment.rake
|
19
|
+
create tasks/website.rake
|
20
|
+
dependency install_test_unit
|
21
|
+
create test
|
22
|
+
create test/test_helper.rb
|
23
|
+
create test/test_my_project.rb
|
24
|
+
dependency install_website
|
25
|
+
create website/javascripts
|
26
|
+
create website/stylesheets
|
27
|
+
exists script
|
28
|
+
exists tasks
|
29
|
+
create website/index.txt
|
30
|
+
create website/index.html
|
31
|
+
create script/txt2html
|
32
|
+
force tasks/website.rake
|
33
|
+
dependency plain_theme
|
34
|
+
exists website/javascripts
|
35
|
+
exists website/stylesheets
|
36
|
+
create website/template.html.erb
|
37
|
+
create website/stylesheets/screen.css
|
38
|
+
create website/javascripts/rounded_corners_lite.inc.js
|
39
|
+
dependency install_rubigen_scripts
|
40
|
+
exists script
|
41
|
+
create script/generate
|
42
|
+
create script/destroy
|
43
|
+
create script/console
|
44
|
+
create Manifest.txt
|
45
|
+
readme readme
|
46
|
+
Important
|
47
|
+
=========
|
48
|
+
|
49
|
+
* Open config/hoe.rb
|
50
|
+
* Update missing details (gem description, dependent gems, etc.)
|
@@ -0,0 +1,104 @@
|
|
1
|
+
Given %r{^a safe folder$} do
|
2
|
+
$tmp_root = File.dirname(__FILE__) + "/../../tmp"
|
3
|
+
FileUtils.rm_rf $tmp_root
|
4
|
+
FileUtils.mkdir_p $tmp_root
|
5
|
+
end
|
6
|
+
|
7
|
+
Given %r{^an existing newgem scaffold \[called '(.*)'\]$} do |project_name|
|
8
|
+
# TODO this is a combo of "a safe folder" and "newgem is executed ..." steps; refactor
|
9
|
+
$tmp_root = File.dirname(__FILE__) + "/../../tmp"
|
10
|
+
FileUtils.rm_rf $tmp_root
|
11
|
+
FileUtils.mkdir_p $tmp_root
|
12
|
+
newgem = File.expand_path(File.dirname(__FILE__) + "/../../bin/newgem")
|
13
|
+
FileUtils.chdir $tmp_root do
|
14
|
+
newgem_stdout = "newgem.out"
|
15
|
+
system "ruby #{newgem} #{project_name} > #{newgem_stdout}"
|
16
|
+
end
|
17
|
+
@project_name = project_name
|
18
|
+
end
|
19
|
+
|
20
|
+
When %r{^newgem is executed for project '(.*)' with no options$} do |project_name|
|
21
|
+
newgem = File.expand_path(File.dirname(__FILE__) + "/../../bin/newgem")
|
22
|
+
FileUtils.chdir $tmp_root do
|
23
|
+
@newgem_stdout = "newgem.out"
|
24
|
+
system "ruby #{newgem} #{project_name} > #{@newgem_stdout}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
When %r{^newgem is executed for project '(.*)' with options '(.*)'$} do |project_name, arguments|
|
29
|
+
newgem = File.expand_path(File.dirname(__FILE__) + "/../../bin/newgem")
|
30
|
+
FileUtils.chdir $tmp_root do
|
31
|
+
@newgem_stdout = "newgem.out"
|
32
|
+
system "ruby #{newgem} #{arguments} #{project_name} > #{@newgem_stdout}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
When %r{^'(.*)' generator is invoked with arguments '(.*)'$} do |generator, arguments|
|
37
|
+
FileUtils.chdir(File.join($tmp_root, @project_name)) do
|
38
|
+
if Object.const_defined?("APP_ROOT")
|
39
|
+
APP_ROOT.replace(FileUtils.pwd)
|
40
|
+
else
|
41
|
+
APP_ROOT = FileUtils.pwd
|
42
|
+
end
|
43
|
+
run_generator(generator, arguments.split(' '), SOURCES)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
When /^run executable '(.*)' with arguments '(.*)'$/ do |executable, arguments|
|
48
|
+
FileUtils.chdir($tmp_root) do
|
49
|
+
@stdout = "#{File.basename(executable)}.out"
|
50
|
+
system "ruby #{executable} #{arguments} > #{@stdout}"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
When /^run unit tests for test file '(.*)'$/ do |test_file|
|
55
|
+
@test_stdout = File.expand_path(File.join($tmp_root, "tests.out"))
|
56
|
+
FileUtils.chdir(File.join($tmp_root, @project_name)) do
|
57
|
+
system "ruby #{test_file} > #{@test_stdout}"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
Then %r{^folder '(.*)' is created$} do |folder|
|
62
|
+
FileUtils.chdir $tmp_root do
|
63
|
+
File.exists?(folder).should be_true
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
Then %r{^file '(.*)' is created$} do |file|
|
68
|
+
FileUtils.chdir $tmp_root do
|
69
|
+
File.exists?(file).should be_true
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
Then %r{^output matches '(.*)'$} do |file|
|
74
|
+
expected_output = File.read(File.join(File.dirname(__FILE__) + "/../expected_outputs", file))
|
75
|
+
actual_output = File.read(File.dirname(__FILE__) + "/../../tmp/#{@newgem_stdout}")
|
76
|
+
actual_output.should == expected_output
|
77
|
+
end
|
78
|
+
|
79
|
+
Then %r{^invokes generator '(.*)'$} do |generator|
|
80
|
+
actual_output = File.read(File.dirname(__FILE__) + "/../../tmp/#{@newgem_stdout}")
|
81
|
+
actual_output.should match(/dependency\s+#{generator}/)
|
82
|
+
end
|
83
|
+
|
84
|
+
Then %r{^does not invoke generator '(.*)'$} do |generator|
|
85
|
+
actual_output = File.read(File.dirname(__FILE__) + "/../../tmp/#{@newgem_stdout}")
|
86
|
+
actual_output.should_not match(/dependency\s+#{generator}/)
|
87
|
+
end
|
88
|
+
|
89
|
+
Then /^help options '(.*)' and '(.*)' are displayed$/ do |opt1, opt2|
|
90
|
+
actual_output = File.read(File.dirname(__FILE__) + "/../../tmp/#{@stdout}")
|
91
|
+
actual_output.should match(/#{opt1}/)
|
92
|
+
actual_output.should match(/#{opt2}/)
|
93
|
+
end
|
94
|
+
|
95
|
+
Then /^output matches \/(.*)\/$/ do |regex|
|
96
|
+
actual_output = File.read(File.dirname(__FILE__) + "/../../tmp/#{@stdout}")
|
97
|
+
actual_output.should match(/#{regex}/)
|
98
|
+
end
|
99
|
+
|
100
|
+
Then /^all (\d+) tests pass$/ do |expected_test_count|
|
101
|
+
expected = %r{^#{expected_test_count} tests, \d+ assertions, 0 failures, 0 errors}
|
102
|
+
actual_output = File.read(@test_stdout)
|
103
|
+
actual_output.should match(expected)
|
104
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../../lib/newgem"
|
2
|
+
|
3
|
+
require 'cucumber'
|
4
|
+
|
5
|
+
require "fileutils"
|
6
|
+
require "spec"
|
7
|
+
|
8
|
+
# Following lines from original Rails cucumber generator.
|
9
|
+
# Not sure how to translate/reuse etc yet.
|
10
|
+
#
|
11
|
+
# # Sets up the Rails environment for Cucumber
|
12
|
+
# ENV["RAILS_ENV"] = "test"
|
13
|
+
# require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
14
|
+
# require 'cucumber/rails/world'
|
15
|
+
# Cucumber::Rails.use_transactional_fixtures
|
16
|
+
#
|
17
|
+
# # Comment out the next line if you're not using RSpec's matchers (should / should_not) in your steps.
|
18
|
+
# require 'cucumber/rails/rspec'
|
19
|
+
|
20
|
+
# code from test/test_generator_helper.rb
|
21
|
+
TMP_ROOT = File.dirname(__FILE__) + "/tmp" unless defined?(TMP_ROOT)
|
22
|
+
|
23
|
+
begin
|
24
|
+
require 'rubigen'
|
25
|
+
rescue LoadError
|
26
|
+
require 'rubygems'
|
27
|
+
require 'rubigen'
|
28
|
+
end
|
29
|
+
require 'rubigen/helpers/generator_test_helper'
|
30
|
+
include RubiGen::GeneratorTestHelper
|
31
|
+
|
32
|
+
SOURCES = Dir[File.dirname(__FILE__) + "/../../*_generators"].map do |f|
|
33
|
+
RubiGen::PathSource.new(:test, File.expand_path(f))
|
34
|
+
end
|
File without changes
|
data/lib/newgem/version.rb
CHANGED
@@ -5,12 +5,14 @@ class ExecutableGenerator < RubiGen::Base
|
|
5
5
|
default_options :shebang => DEFAULT_SHEBANG,
|
6
6
|
:author => nil
|
7
7
|
|
8
|
-
attr_reader :bin_name, :author
|
8
|
+
attr_reader :bin_name, :module_name, :project_name, :author
|
9
9
|
|
10
10
|
def initialize(runtime_args, runtime_options = {})
|
11
11
|
super
|
12
12
|
usage if args.empty?
|
13
13
|
@bin_name = args.shift
|
14
|
+
@module_name = @bin_name.classify
|
15
|
+
@project_name = File.basename(File.expand_path(destination_root))
|
14
16
|
extract_options
|
15
17
|
end
|
16
18
|
|
@@ -23,9 +25,13 @@ class ExecutableGenerator < RubiGen::Base
|
|
23
25
|
record do |m|
|
24
26
|
# Ensure bin folder exists
|
25
27
|
m.directory "bin"
|
28
|
+
m.directory "lib/#{bin_name}"
|
29
|
+
m.directory "test"
|
26
30
|
|
27
31
|
# App stub
|
28
|
-
m.template "app.rb",
|
32
|
+
m.template "bin/app.rb.erb", "bin/#{bin_name}"
|
33
|
+
m.template "lib/app/cli.rb.erb", "lib/#{bin_name}/cli.rb"
|
34
|
+
m.template "test/test_cli.rb.erb", "test/test_#{bin_name}_cli.rb"
|
29
35
|
end
|
30
36
|
end
|
31
37
|
|
@@ -50,4 +56,4 @@ EOS
|
|
50
56
|
def extract_options
|
51
57
|
@author = options[:author]
|
52
58
|
end
|
53
|
-
end
|
59
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created <%= "by #{author} " if author %>on <%= (now = Time.now).year %>-<%= now.month %>-<%= now.day %>.
|
4
|
+
# Copyright (c) <%= now.year %>. All rights reserved.
|
5
|
+
|
6
|
+
require File.expand_path(File.dirname(__FILE__) + "/../lib/<%= project_name %>")
|
7
|
+
|
8
|
+
require "<%= bin_name %>/cli"
|
9
|
+
|
10
|
+
<%= module_name %>::CLI.execute
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module <%= module_name %>
|
4
|
+
class CLI
|
5
|
+
def self.execute
|
6
|
+
|
7
|
+
# NOTE: the option -p/--path= is given as an example, and should be replaced in your application.
|
8
|
+
|
9
|
+
options = {
|
10
|
+
:path => '~'
|
11
|
+
}
|
12
|
+
mandatory_options = %w( )
|
13
|
+
|
14
|
+
parser = OptionParser.new do |opts|
|
15
|
+
opts.banner = <<-BANNER.gsub(/^ /,'')
|
16
|
+
This application is wonderful because...
|
17
|
+
|
18
|
+
Usage: #{File.basename($0)} [options]
|
19
|
+
|
20
|
+
Options are:
|
21
|
+
BANNER
|
22
|
+
opts.separator ""
|
23
|
+
opts.on("-p", "--path=PATH", String,
|
24
|
+
"This is a sample message.",
|
25
|
+
"For multiple lines, add more strings.",
|
26
|
+
"Default: ~") { |arg| OPTIONS[:path] = arg }
|
27
|
+
opts.on("-h", "--help",
|
28
|
+
"Show this help message.") { puts opts; exit }
|
29
|
+
opts.parse!(ARGV)
|
30
|
+
|
31
|
+
if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }
|
32
|
+
puts opts; exit
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
path = options[:path]
|
37
|
+
|
38
|
+
# do stuff
|
39
|
+
puts "To update this executable, look in lib/<%= bin_name %>/cli.rb"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -9,7 +9,7 @@ class InstallCucumberGenerator < RubiGen::Base
|
|
9
9
|
|
10
10
|
def initialize(runtime_args, runtime_options = {})
|
11
11
|
super
|
12
|
-
@project_name = File.basename(destination_root)
|
12
|
+
@project_name = File.basename(File.expand_path(destination_root))
|
13
13
|
end
|
14
14
|
|
15
15
|
def manifest
|
@@ -21,9 +21,6 @@ class InstallCucumberGenerator < RubiGen::Base
|
|
21
21
|
|
22
22
|
m.directory 'tasks'
|
23
23
|
m.file 'cucumber.rake', 'tasks/cucumber.rake'
|
24
|
-
|
25
|
-
m.directory 'script'
|
26
|
-
m.file 'cucumber', 'script/cucumber', script_options
|
27
24
|
end
|
28
25
|
end
|
29
26
|
|
data/tasks/cucumber.rake
ADDED
@@ -12,14 +12,15 @@ class TestExecutableGenerator < Test::Unit::TestCase
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_generator_without_options
|
15
|
-
name = "
|
15
|
+
name = "binname"
|
16
16
|
run_generator('executable', [name], sources)
|
17
17
|
assert_generated_file("bin/#{name}")
|
18
|
+
assert_generated_file("lib/#{name}/cli.rb")
|
19
|
+
assert_generated_file("test/test_#{name}_cli.rb")
|
18
20
|
end
|
19
21
|
|
20
22
|
def sources
|
21
|
-
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
|
22
|
-
]
|
23
|
+
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__), "..", generator_path))]
|
23
24
|
end
|
24
25
|
|
25
26
|
def generator_path
|
data/website/index.html
CHANGED
@@ -39,7 +39,7 @@
|
|
39
39
|
|
40
40
|
<div id="version"> <!-- class="clickable" onclick='document.location = "http://rubyforge.org/projects/newgem"; return true' -->
|
41
41
|
<p>Get Version</p>
|
42
|
-
<a href="http://rubyforge.org/projects/newgem" class="numbers">0.
|
42
|
+
<a href="http://rubyforge.org/projects/newgem" class="numbers">0.29.0</a>
|
43
43
|
<p>Featured in</p>
|
44
44
|
<a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FBeginning-Ruby-Novice-Professional-Experts%2Fdp%2F1590597664%2F&tag=drnic-20&linkCode=ur2&camp=1789&creative=9325" class="book"><img src="images/beginning-ruby.jpg" /></a>
|
45
45
|
</div>
|
data/website/rubyforge.html
CHANGED
@@ -39,7 +39,7 @@
|
|
39
39
|
|
40
40
|
<div id="version"> <!-- class="clickable" onclick='document.location = "http://rubyforge.org/projects/newgem"; return true' -->
|
41
41
|
<p>Get Version</p>
|
42
|
-
<a href="http://rubyforge.org/projects/newgem" class="numbers">0.
|
42
|
+
<a href="http://rubyforge.org/projects/newgem" class="numbers">0.29.0</a>
|
43
43
|
<p>Featured in</p>
|
44
44
|
<a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FBeginning-Ruby-Novice-Professional-Experts%2Fdp%2F1590597664%2F&tag=drnic-20&linkCode=ur2&camp=1789&creative=9325" class="book"><img src="images/beginning-ruby.jpg" /></a>
|
45
45
|
</div>
|
data/website/version-raw.js
CHANGED
data/website/version.js
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newgem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.29.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dr Nic Williams
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-10-
|
12
|
+
date: 2008-10-19 00:00:00 -02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -125,6 +125,12 @@ files:
|
|
125
125
|
- cucumber_generators/feature/feature_generator.rb
|
126
126
|
- cucumber_generators/feature/templates/feature.erb
|
127
127
|
- cucumber_generators/feature/templates/steps.erb
|
128
|
+
- features/cli.feature
|
129
|
+
- features/executable_generator.feature
|
130
|
+
- features/expected_outputs/newgem.out
|
131
|
+
- features/steps/cli.rb
|
132
|
+
- features/steps/env.rb
|
133
|
+
- features/steps/executable_generator.rb
|
128
134
|
- lib/newgem.rb
|
129
135
|
- lib/newgem/quick_template.rb
|
130
136
|
- lib/newgem/rubyforge.rb
|
@@ -150,7 +156,9 @@ files:
|
|
150
156
|
- newgem_theme_generators/plain_theme/templates/website/template.html.erb
|
151
157
|
- rubygems_generators/executable/USAGE
|
152
158
|
- rubygems_generators/executable/executable_generator.rb
|
153
|
-
- rubygems_generators/executable/templates/app.rb
|
159
|
+
- rubygems_generators/executable/templates/bin/app.rb.erb
|
160
|
+
- rubygems_generators/executable/templates/lib/app/cli.rb.erb
|
161
|
+
- rubygems_generators/executable/templates/test/test_cli.rb.erb
|
154
162
|
- rubygems_generators/extconf/USAGE
|
155
163
|
- rubygems_generators/extconf/extconf_generator.rb
|
156
164
|
- rubygems_generators/extconf/templates/README.txt
|
@@ -161,7 +169,6 @@ files:
|
|
161
169
|
- rubygems_generators/extconf/templates/tasks/extconf_name.rake
|
162
170
|
- rubygems_generators/extconf/templates/test/test.rb.erb
|
163
171
|
- rubygems_generators/install_cucumber/install_cucumber_generator.rb
|
164
|
-
- rubygems_generators/install_cucumber/templates/cucumber
|
165
172
|
- rubygems_generators/install_cucumber/templates/cucumber.rake
|
166
173
|
- rubygems_generators/install_cucumber/templates/env.rb
|
167
174
|
- rubygems_generators/install_jruby/USAGE
|
@@ -189,6 +196,7 @@ files:
|
|
189
196
|
- script/txt2js
|
190
197
|
- setup.rb
|
191
198
|
- tasks/bundles.rake
|
199
|
+
- tasks/cucumber.rake
|
192
200
|
- tasks/deployment.rake
|
193
201
|
- tasks/environment.rake
|
194
202
|
- tasks/generator_report.rake
|
@@ -1,44 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# Created <%= "by #{author} " if author %>on <%= (now = Time.now).year %>-<%= now.month %>-<%= now.day %>.
|
4
|
-
# Copyright (c) <%= now.year %>. All rights reserved.
|
5
|
-
|
6
|
-
begin
|
7
|
-
require 'rubygems'
|
8
|
-
rescue LoadError
|
9
|
-
# no rubygems to load, so we fail silently
|
10
|
-
end
|
11
|
-
|
12
|
-
require 'optparse'
|
13
|
-
|
14
|
-
# NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
|
15
|
-
|
16
|
-
OPTIONS = {
|
17
|
-
:path => '~'
|
18
|
-
}
|
19
|
-
MANDATORY_OPTIONS = %w( )
|
20
|
-
|
21
|
-
parser = OptionParser.new do |opts|
|
22
|
-
opts.banner = <<BANNER
|
23
|
-
This application is wonderful because...
|
24
|
-
|
25
|
-
Usage: #{File.basename($0)} [options]
|
26
|
-
|
27
|
-
Options are:
|
28
|
-
BANNER
|
29
|
-
opts.separator ""
|
30
|
-
opts.on("-p", "--path=PATH", String,
|
31
|
-
"The root path for selecting files",
|
32
|
-
"Default: ~") { |OPTIONS[:path]| }
|
33
|
-
opts.on("-h", "--help",
|
34
|
-
"Show this help message.") { puts opts; exit }
|
35
|
-
opts.parse!(ARGV)
|
36
|
-
|
37
|
-
if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
|
38
|
-
puts opts; exit
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
path = OPTIONS[:path]
|
43
|
-
|
44
|
-
# do stuff
|