newgem 0.29.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/History.txt +15 -1
  2. data/Manifest.txt +7 -22
  3. data/README.rdoc +55 -33
  4. data/Rakefile +22 -7
  5. data/app_generators/newgem/newgem_generator.rb +23 -23
  6. data/app_generators/newgem/templates/Rakefile +27 -3
  7. data/app_generators/newgem/templates/lib/module.rb +1 -1
  8. data/bin/newgem +12 -2
  9. data/config/website.yml +2 -0
  10. data/features/development.feature +22 -0
  11. data/features/executable_generator.feature +6 -6
  12. data/features/expected_outputs/newgem.out +2 -9
  13. data/features/install_cucumber.feature +11 -0
  14. data/features/install_website.feature +13 -0
  15. data/features/newgem_cli.feature +60 -0
  16. data/features/steps/cli.rb +125 -36
  17. data/features/steps/env.rb +4 -2
  18. data/lib/newgem/support/tasks.rb +10 -0
  19. data/lib/newgem/tasks.rb +1 -0
  20. data/lib/newgem.rb +5 -5
  21. data/newgem_generators/install_website/install_website_generator.rb +12 -9
  22. data/newgem_generators/install_website/templates/config/website.yml.sample.erb +2 -0
  23. data/newgem_generators/install_website/templates/script/txt2html +5 -16
  24. data/newgem_generators/install_website/templates/tasks/website.rake +34 -4
  25. data/rubygems_generators/executable/templates/test/test_cli.rb.erb +1 -1
  26. data/script/txt2html +5 -16
  27. data/tasks/deployment.rake +5 -6
  28. data/tasks/website.rake +34 -6
  29. data/test/test_install_website_generator.rb +1 -0
  30. data/test/test_newgem_generator.rb +0 -10
  31. data/website/index.html +27 -22
  32. data/website/index.txt +30 -19
  33. data/website/rubyforge.html +2 -2
  34. data/website/version.js +0 -4
  35. metadata +35 -67
  36. data/Todo.txt +0 -4
  37. data/app_generators/newgem/templates/config/hoe.rb +0 -82
  38. data/app_generators/newgem/templates/config/requirements.rb +0 -15
  39. data/app_generators/newgem/templates/lib/version.rb +0 -10
  40. data/app_generators/newgem/templates/setup.rb +0 -1585
  41. data/app_generators/newgem/templates/tasks/deployment.rake +0 -34
  42. data/app_generators/newgem/templates/tasks/environment.rake +0 -7
  43. data/app_generators/newgem/templates/tasks/website.rake +0 -9
  44. data/config/hoe.rb +0 -62
  45. data/features/cli.feature +0 -28
  46. data/features/steps/executable_generator.rb +0 -0
  47. data/lib/newgem/version.rb +0 -9
  48. data/rubygems_generators/install_rspec_stories/USAGE +0 -5
  49. data/rubygems_generators/install_rspec_stories/install_rspec_stories_generator.rb +0 -54
  50. data/rubygems_generators/install_rspec_stories/templates/all.rb +0 -8
  51. data/rubygems_generators/install_rspec_stories/templates/steps.rb +0 -13
  52. data/rubygems_generators/install_rspec_stories/templates/story.story +0 -9
  53. data/script/txt2html.rb +0 -70
  54. data/script/txt2js +0 -59
  55. data/setup.rb +0 -1585
  56. data/tasks/generator_report.rake +0 -19
  57. data/test/test_install_rspec_stories_generator.rb +0 -45
@@ -1,34 +0,0 @@
1
- desc 'Release the website and new gem version'
2
- task :deploy => [:check_version, :website, :release] do
3
- puts "Remember to create SVN tag:"
4
- puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
5
- "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
6
- puts "Suggested comment:"
7
- puts "Tagging release #{CHANGES}"
8
- end
9
-
10
- desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
11
- task :local_deploy => [:website_generate, :install_gem]
12
-
13
- task :check_version do
14
- unless ENV['VERSION']
15
- puts 'Must pass a VERSION=x.y.z release version'
16
- exit
17
- end
18
- unless ENV['VERSION'] == VERS
19
- puts "Please update your version.rb to match the release version, currently #{VERS}"
20
- exit
21
- end
22
- end
23
-
24
- desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
25
- task :install_gem_no_doc => [:clean, :package] do
26
- sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
27
- end
28
-
29
- namespace :manifest do
30
- desc 'Recreate Manifest.txt to include ALL files'
31
- task :refresh do
32
- `rake check_manifest | patch -p0 > Manifest.txt`
33
- end
34
- end
@@ -1,7 +0,0 @@
1
- task :ruby_env do
2
- RUBY_APP = if RUBY_PLATFORM =~ /java/
3
- "jruby"
4
- else
5
- "ruby"
6
- end unless defined? RUBY_APP
7
- end
@@ -1,9 +0,0 @@
1
- # stubs for the website generation
2
- # To install the website framework:
3
- # script/generate website
4
-
5
- task :website_generate
6
-
7
- task :website_upload
8
-
9
- task :website => :publish_docs
data/config/hoe.rb DELETED
@@ -1,62 +0,0 @@
1
- require 'hoe'
2
- require 'newgem/version'
3
-
4
- AUTHOR = "Dr Nic Williams"
5
- EMAIL = "drnicwilliams@gmail.com"
6
- DESCRIPTION = "Make your own gems at home"
7
- GEM_NAME = "newgem" # what ppl will type to install your gem
8
- RUBYFORGE_PROJECT = "newgem"
9
- HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
10
- DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
11
-
12
- @config_file = "~/.rubyforge/user-config.yml"
13
- @config = nil
14
- RUBYFORGE_USERNAME = "unknown"
15
- def rubyforge_username
16
- unless @config
17
- begin
18
- @config = YAML.load(File.read(File.expand_path(@config_file)))
19
- rescue
20
- puts <<-EOS
21
- ERROR: No rubyforge config file found: #{@config_file}
22
- Run 'rubyforge setup' to prepare your env for access to Rubyforge
23
- - See http://newgem.rubyforge.org/rubyforge.html for more details
24
- EOS
25
- exit
26
- end
27
- end
28
- RUBYFORGE_USERNAME.replace @config["username"]
29
- end
30
-
31
- REV = nil #File.read(".svn/entries")[/committed-rev="(\d+)"/, 1] rescue nil
32
- # REV = YAML.load(`svn info`)['Revision']
33
- VERS = Newgem::VERSION::STRING + (REV ? ".#{REV}" : "")
34
- CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store', 'tmp']
35
-
36
- # Generate all the Rake tasks
37
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
38
- hoe = Hoe.new(GEM_NAME, VERS) do |p|
39
- p.developer(AUTHOR, EMAIL)
40
- p.description = DESCRIPTION
41
- p.summary = DESCRIPTION
42
- p.url = HOMEPATH
43
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
44
- p.test_globs = ["test/**/test*.rb"]
45
- p.clean_globs |= CLEAN #An array of file patterns to delete on clean.
46
-
47
- # == Optional
48
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
49
- p.extra_deps = [
50
- ['RedCloth','>=4.0.0'],
51
- ['syntax','>=1.0.0'],
52
- ['activesupport','>=2.0.2'],
53
- ['rubigen','>=1.3.0']
54
- ]
55
- #p.spec_extras - A hash of extra values to set in the gemspec.
56
- end
57
-
58
- CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\n\n")
59
- PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "\#{RUBYFORGE_PROJECT}/\#{GEM_NAME}"
60
- hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
61
- hoe.rsync_args = '-av --delete --ignore-errors'
62
- hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
data/features/cli.feature DELETED
@@ -1,28 +0,0 @@
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
-
File without changes
@@ -1,9 +0,0 @@
1
- module Newgem
2
- module VERSION #:nodoc:
3
- MAJOR = 0
4
- MINOR = 29
5
- TINY = 0
6
-
7
- STRING = [MAJOR, MINOR, TINY].join('.')
8
- end
9
- end
@@ -1,5 +0,0 @@
1
- Description:
2
- Creates an RSpec story scaffold for this RubyGem.
3
-
4
- Usage:
5
- script/generate install_rspec_stories
@@ -1,54 +0,0 @@
1
- class InstallRspecStoriesGenerator < RubiGen::Base
2
-
3
- default_options :author => nil
4
-
5
- attr_reader :gem_name, :module_name, :name
6
-
7
- def initialize(runtime_args, runtime_options = {})
8
- super
9
- @gem_name = base_name
10
- @module_name = gem_name.camelize
11
- extract_options
12
- end
13
-
14
- def manifest
15
- record do |m|
16
- # Ensure appropriate folder(s) exists
17
- m.directory 'stories/steps'
18
-
19
- m.template 'steps.rb', "stories/steps/#{gem_name}_steps.rb"
20
- m.template 'story.story', "stories/sell_#{gem_name}.story"
21
- m.template 'all.rb', "stories/all.rb"
22
- # Create stubs
23
- # m.template "template.rb", "some_file_after_erb.rb"
24
- # m.file "file", "some_file_copied"
25
- end
26
- end
27
-
28
- protected
29
- def banner
30
- <<-EOS
31
- Creates an RSpec story scaffold for this RubyGem.
32
-
33
- USAGE: #{$0} #{spec.name}
34
- EOS
35
- end
36
-
37
- def add_options!(opts)
38
- # opts.separator ''
39
- # opts.separator 'Options:'
40
- # For each option below, place the default
41
- # at the top of the file next to "default_options"
42
- # opts.on("-a", "--author=\"Your Name\"", String,
43
- # "Some comment about this option",
44
- # "Default: none") { |options[:author]| }
45
- # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
46
- end
47
-
48
- def extract_options
49
- # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
50
- # Templates can access these value via the attr_reader-generated methods, but not the
51
- # raw instance variable value.
52
- # @author = options[:author]
53
- end
54
- end
@@ -1,8 +0,0 @@
1
- require 'rubygems'
2
- require 'spec/story'
3
- require File.dirname(__FILE__) + '/../spec/spec_helper'
4
- require 'stories/steps/<%= gem_name %>_steps'
5
-
6
- with_steps_for :<%= gem_name %> do
7
- run 'stories/sell_<%= gem_name %>.story'
8
- end
@@ -1,13 +0,0 @@
1
- steps_for :<%= gem_name %> do
2
- Given 'there are $n <%= gem_name %>' do |n|
3
- <%= module_name %>.initial = n.to_i
4
- end
5
-
6
- When 'I sell $n <%= gem_name %>' do |n|
7
- <%= module_name %>.sold = n.to_i
8
- end
9
-
10
- Then 'there should be $n <%= gem_name %> left' do |n|
11
- <%= module_name %>.left.should == n.to_i
12
- end
13
- end
@@ -1,9 +0,0 @@
1
- Story: Sell <%= gem_name %>
2
- As a <%= gem_name %> artist
3
- I want to sell <%= gem_name %>
4
- So that I can make the world a better place
5
-
6
- Scenario: Sell a couple
7
- Given there are 5 <%= gem_name %>
8
- When I sell 2 <%= gem_name %>
9
- Then there should be 3 <%= gem_name %> left
data/script/txt2html.rb DELETED
@@ -1,70 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'redcloth'
5
- require 'syntax/convertors/html'
6
- require 'erb'
7
-
8
- class Fixnum
9
- def ordinal
10
- # teens
11
- return 'th' if (10..19).include?(self % 100)
12
- # others
13
- case self % 10
14
- when 1: return 'st'
15
- when 2: return 'nd'
16
- when 3: return 'rd'
17
- else return 'th'
18
- end
19
- end
20
- end
21
-
22
- class Time
23
- def pretty
24
- return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
25
- end
26
- end
27
-
28
- module Txt2Html
29
- def convert_syntax(syntax, source)
30
- return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
31
- end
32
-
33
- require File.dirname(__FILE__) + '/../lib/newgem/version.rb'
34
-
35
- version = Newgem::VERSION::STRING
36
- download = ENV['HOMEPAGE']
37
-
38
- if ARGV.length >= 1
39
- src, template = ARGV
40
- template ||= File.dirname(__FILE__) + '/../website/template.html.erb'
41
-
42
- else
43
- puts("Usage: #{File.split($0).last} source.txt [template.html.erb] > output.html")
44
- exit!
45
- end
46
-
47
- template = ERB.new(File.open(template).read)
48
-
49
- title = nil
50
- body = nil
51
- File.open(src) do |fsrc|
52
- title_text = fsrc.readline
53
- body_text = fsrc.read
54
- syntax_items = []
55
- body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</\1>!m){
56
- ident = syntax_items.length
57
- element, syntax, source = $1, $2, $3
58
- syntax_items << "<#{element} class=\"syntax\">#{convert_syntax(syntax, source)}</#{element}>"
59
- "syntax-temp-#{ident}"
60
- }
61
- title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
62
- body = RedCloth.new(body_text).to_html
63
- body.gsub!(%r!(?:<pre><code>)?syntax-temp-(\d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
64
- end
65
- stat = File.stat(src)
66
- created = stat.ctime
67
- modified = stat.mtime
68
-
69
- $stdout << template.result(binding)
70
- end
data/script/txt2js DELETED
@@ -1,59 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'redcloth'
5
- require 'syntax/convertors/html'
6
- require 'erb'
7
- require 'active_support'
8
- require File.dirname(__FILE__) + '/../lib/newgem/version.rb'
9
-
10
- version = Newgem::VERSION::STRING
11
- download = 'http://rubyforge.org/projects/newgem'
12
-
13
- class Fixnum
14
- def ordinal
15
- # teens
16
- return 'th' if (10..19).include?(self % 100)
17
- # others
18
- case self % 10
19
- when 1: return 'st'
20
- when 2: return 'nd'
21
- when 3: return 'rd'
22
- else return 'th'
23
- end
24
- end
25
- end
26
-
27
- class Time
28
- def pretty
29
- return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
30
- end
31
- end
32
-
33
- def convert_syntax(syntax, source)
34
- return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
35
- end
36
-
37
- if ARGV.length >= 1
38
- src, template = ARGV
39
- template ||= File.dirname(__FILE__) + '/../website/template.js'
40
- else
41
- puts("Usage: #{File.split($0).last} source.txt [template.js] > output.html")
42
- exit!
43
- end
44
-
45
- template = ERB.new(File.open(template).read)
46
-
47
- title = nil
48
- body = nil
49
- File.open(src) do |fsrc|
50
- title_text = fsrc.readline
51
- body_text = fsrc.read
52
- title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
53
- body = RedCloth.new(body_text)
54
- end
55
- stat = File.stat(src)
56
- created = stat.ctime
57
- modified = stat.mtime
58
-
59
- $stdout << template.result(binding)