newgem 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.22.0 2008-04-03
2
+
3
+ * script/console - irb/console for your gem under development [Orion]
4
+
1
5
  == 0.21.0 2008-04-03
2
6
 
3
7
  * New Generator: install_rspec_stories for rubygems
data/Manifest.txt CHANGED
@@ -15,6 +15,8 @@ app_generators/newgem/templates/config/requirements.rb
15
15
  app_generators/newgem/templates/empty_log
16
16
  app_generators/newgem/templates/module.rb
17
17
  app_generators/newgem/templates/readme
18
+ app_generators/newgem/templates/script/console.erb
19
+ app_generators/newgem/templates/script/win_script.cmd
18
20
  app_generators/newgem/templates/setup.rb
19
21
  app_generators/newgem/templates/spec.opts
20
22
  app_generators/newgem/templates/spec.rb
@@ -1,7 +1,7 @@
1
1
  require 'rbconfig'
2
2
 
3
3
  class NewgemGenerator < RubiGen::Base
4
-
4
+
5
5
  DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
6
6
  Config::CONFIG['ruby_install_name'])
7
7
 
@@ -14,18 +14,18 @@ class NewgemGenerator < RubiGen::Base
14
14
  :disable_website => nil,
15
15
  :test_framework => 'test::unit',
16
16
  :version => '0.0.1'
17
-
18
-
17
+
18
+
19
19
  attr_reader :gem_name, :module_name
20
20
  attr_reader :version, :version_str, :author, :email
21
-
21
+
22
22
  # extensions/option
23
23
  attr_reader :test_framework
24
24
  attr_reader :bin_names_list
25
25
  attr_reader :disable_website
26
26
  attr_reader :manifest
27
27
  attr_reader :is_jruby
28
-
28
+
29
29
  def initialize(runtime_args, runtime_options = {})
30
30
  super
31
31
  usage if args.empty?
@@ -44,27 +44,27 @@ class NewgemGenerator < RubiGen::Base
44
44
  # Root directory and all subdirectories.
45
45
  m.directory ''
46
46
  BASEDIRS.each { |path| m.directory path }
47
-
47
+
48
48
  m.directory "lib/#{gem_name}"
49
49
 
50
50
  # Root
51
51
  m.template_copy_each %w( History.txt License.txt Rakefile README.txt )
52
- m.file_copy_each %w( setup.rb )
52
+ m.file_copy_each %w( setup.rb )
53
53
 
54
54
  # Default module for app
55
55
  m.template "module.rb", "lib/#{gem_name}.rb"
56
56
  m.template "version.rb", "lib/#{gem_name}/version.rb"
57
-
57
+
58
58
  # Config
59
59
  m.template_copy_each %w( hoe.rb requirements.rb ), "config"
60
60
 
61
61
  %w(debug).each { |file|
62
62
  m.file "empty_log", "log/#{file}.log", :chmod => 0666
63
63
  }
64
-
64
+
65
65
  # Tasks
66
66
  m.file_copy_each %w( deployment.rake environment.rake website.rake ), "tasks"
67
-
67
+
68
68
  # Selecting a test framework
69
69
  case test_framework
70
70
  when "test::unit"
@@ -72,24 +72,30 @@ class NewgemGenerator < RubiGen::Base
72
72
  m.template "test.rb", "test/test_#{gem_name}.rb"
73
73
  when "rspec"
74
74
  m.dependency "install_rspec", [gem_name], :destination => destination_root, :collision => :force
75
- end
76
-
75
+ end
76
+
77
77
  # Website
78
- m.dependency "install_website", [gem_name],
78
+ m.dependency "install_website", [gem_name],
79
79
  :author => author, :email => email, :destination => destination_root, :collision => :force unless disable_website
80
-
80
+
81
81
  # JRuby
82
82
  m.dependency "install_jruby", [gem_name], :destination => destination_root, :collision => :force if is_jruby
83
83
 
84
84
  # Executables
85
85
  for bin_name in bin_names_list
86
- m.dependency "executable", [bin_name], :destination => destination_root, :collision => :force
86
+ m.dependency "executable", [bin_name], :destination => destination_root, :collision => :force
87
87
  end
88
-
88
+
89
89
  m.dependency "install_rubigen_scripts", [destination_root, "rubygems", "newgem", "newgem_theme"], :shebang => options[:shebang], :collision => :force
90
-
90
+
91
+ %w( console ).each do |file|
92
+ m.template "script/#{file}.erb", "script/#{file}", script_options
93
+ m.template "script/win_script.cmd", "script/#{file}.cmd",
94
+ :assigns => { :filename => file } if windows
95
+ end
96
+
91
97
  m.write_manifest "Manifest.txt"
92
-
98
+
93
99
  m.readme "readme"
94
100
  end
95
101
  end
@@ -127,17 +133,17 @@ EOS
127
133
  "Default: #{DEFAULT_SHEBANG}") { |x| options[:shebang] = x }
128
134
  opts.on("-T", "--test-with=TEST_FRAMEWORK", String,
129
135
  "Select your preferred testing framework.",
130
- "Options: test::unit (default), rspec.") { |x| options[:test_framework] = x }
136
+ "Options: test::unit (default), rspec.") { |x| options[:test_framework] = x }
131
137
  opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
132
138
  opts.on("-V", "--set-version=YOUR_VERSION", String,
133
139
  "Version of the gem you are creating.",
134
140
  "Default: 0.0.1") { |x| options[:version] = x }
135
- opts.on("-W", "--website-disable",
141
+ opts.on("-W", "--website-disable",
136
142
  "Disables the generation of the website for your RubyGem.") { |x| options[:disable_website] = x }
137
- opts.on("--simple",
143
+ opts.on("--simple",
138
144
  "Creates a simple RubyGems scaffold.") { |x| }
139
145
  end
140
-
146
+
141
147
  def extract_options
142
148
  @version = options[:version].to_s.split(/\./)
143
149
  @version_str = @version.join('.')
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/<%= gem_name %>.rb'}"
9
+ puts "Loading <%= gem_name %> gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
@@ -0,0 +1 @@
1
+ @ruby <%= File.join("script", filename) %> %*
@@ -1,7 +1,7 @@
1
1
  module Newgem #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 21
4
+ MINOR = 22
5
5
  TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
@@ -4,20 +4,20 @@ class InstallWebsiteGenerator < RubiGen::Base
4
4
 
5
5
  DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
6
6
  Config::CONFIG['ruby_install_name'])
7
-
7
+
8
8
  default_options :shebang => DEFAULT_SHEBANG,
9
9
  :author => "TODO",
10
10
  :email => "TODO",
11
11
  :theme => 'plain_theme'
12
-
12
+
13
13
  attr_reader :gem_name, :module_name
14
14
  attr_reader :author, :email, :theme
15
-
15
+
16
16
  def initialize(runtime_args, runtime_options = {})
17
17
  super
18
18
  @destination_root = File.expand_path(destination_root)
19
19
  @gem_name = base_name
20
-
20
+
21
21
  @module_name = @gem_name.camelcase
22
22
  extract_options
23
23
  end
@@ -35,15 +35,15 @@ class InstallWebsiteGenerator < RubiGen::Base
35
35
 
36
36
  # Website
37
37
  m.template_copy_each %w( index.txt index.html ), "website"
38
-
38
+
39
39
  %w( txt2html ).each do |file|
40
40
  m.template "script/#{file}", "script/#{file}", script_options
41
- m.template "script/win_script.cmd", "script/#{file}.cmd",
41
+ m.template "script/win_script.cmd", "script/#{file}.cmd",
42
42
  :assigns => { :filename => file } if windows
43
43
  end
44
-
44
+
45
45
  m.file_copy_each %w[ website.rake ], "tasks"
46
-
46
+
47
47
  m.dependency theme, [], :destination => destination_root
48
48
  end
49
49
  end
@@ -72,7 +72,7 @@ EOS
72
72
  "Theme generator to use",
73
73
  "Default: plain_theme") { |x| options[:theme] = x }
74
74
  end
75
-
75
+
76
76
  def extract_options
77
77
  # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
78
78
  # Templates can access these value via the attr_reader-generated methods, but not the
@@ -37,7 +37,7 @@ class TestNewgemGenerator < Test::Unit::TestCase
37
37
  assert_generated_file("test/#{file}")
38
38
  end
39
39
 
40
- %w[generate destroy].each do |file|
40
+ %w[generate destroy console].each do |file|
41
41
  assert_generated_file("script/#{file}")
42
42
  end
43
43
 
data/website/index.html CHANGED
@@ -33,7 +33,7 @@
33
33
  <h1>New Gem Generator</h1>
34
34
  <div id="version"> <!-- class="clickable" onclick='document.location = ""; return true' -->
35
35
  <p>Get Version</p>
36
- <a href="" class="numbers">0.21.0</a>
36
+ <a href="" class="numbers">0.22.0</a>
37
37
  <p>Featured in</p>
38
38
  <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>
39
39
  </div>
@@ -33,7 +33,7 @@
33
33
  <h1>New Gem Generator</h1>
34
34
  <div id="version"> <!-- class="clickable" onclick='document.location = ""; return true' -->
35
35
  <p>Get Version</p>
36
- <a href="" class="numbers">0.21.0</a>
36
+ <a href="" class="numbers">0.22.0</a>
37
37
  <p>Featured in</p>
38
38
  <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>
39
39
  </div>
@@ -1,3 +1,3 @@
1
1
  // Announcement JS file
2
- var version = "0.21.0";
2
+ var version = "0.22.0";
3
3
  MagicAnnouncement.show('compositekeys', version);
data/website/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // Version JS file
2
- var version = "0.21.0";
2
+ var version = "0.22.0";
3
3
 
4
4
  document.write(" - " + version);
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.21.0
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dr Nic Williams
@@ -107,6 +107,8 @@ files:
107
107
  - app_generators/newgem/templates/empty_log
108
108
  - app_generators/newgem/templates/module.rb
109
109
  - app_generators/newgem/templates/readme
110
+ - app_generators/newgem/templates/script/console.erb
111
+ - app_generators/newgem/templates/script/win_script.cmd
110
112
  - app_generators/newgem/templates/setup.rb
111
113
  - app_generators/newgem/templates/spec.opts
112
114
  - app_generators/newgem/templates/spec.rb