pario 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/pario.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'erb'
2
- require 'pario/inflector'
3
2
 
4
3
  module Pario
5
4
  autoload :Version, 'pario/version'
data/lib/pario/cli.rb CHANGED
@@ -54,6 +54,14 @@ module Pario
54
54
  def game_name
55
55
  @game_name ||= @arguments.delete_at(0)
56
56
  end
57
+
58
+ def game_name_camelcase
59
+ game_name.gsub(/(.)([A-Z])/,'\1_\2').downcase
60
+ end
61
+
62
+ def game_name_capitalize
63
+ game_name.to_s.gsub(/\b\w/){$&.upcase}
64
+ end
57
65
 
58
66
  def create_base_files
59
67
  build_main
@@ -63,7 +71,8 @@ module Pario
63
71
  end
64
72
 
65
73
  def build_game_class
66
- game_file = File.open("#{game_name.camelize}.rb", "w+")
74
+ Dir.chdir('game')
75
+ game_file = File.open("#{game_name_camelcase}.rb", "w+")
67
76
  game_file.puts game_class
68
77
  end
69
78
 
@@ -76,14 +85,14 @@ module Pario
76
85
  def build_extra_classes
77
86
  Dir.chdir("game") unless Dir.getwd.split("/").last == "game"
78
87
  @arguments.each do |new_class|
79
- class_file = File.open("#{new_class.camelize}.rb", "w+")
88
+ class_file = File.open("#{new_class.gsub(/(.)([A-Z])/,'\1_\2').downcase}.rb", "w+")
80
89
  class_file.puts class_template(new_class)
81
90
  end
82
91
  end
83
92
 
84
93
  def class_template(name)
85
94
  template = ERB.new <<-EOF
86
- class #{name.capitalize}
95
+ class #{name.to_s.gsub(/\b\w/){$&.upcase}}
87
96
  def initialize
88
97
  end
89
98
  end
@@ -99,7 +108,7 @@ require 'gosu'
99
108
  Dir.glob(File.join("game", "*.rb")).each {|file| require file }
100
109
 
101
110
 
102
- game = #{game_name.capitalize}.new(800, 600)
111
+ game = #{game_name_capitalize}.new(800, 600)
103
112
  game.show
104
113
  EOF
105
114
  main_template.result(binding)
@@ -107,7 +116,7 @@ main_template.result(binding)
107
116
 
108
117
  def game_class
109
118
  game_template = ERB.new <<-EOF
110
- class #{game_name.capitalize} < Gosu::Window
119
+ class #{game_name_capitalize} < Gosu::Window
111
120
  def initialize(window_width, window_height)
112
121
  super(window_width,window_height,0)
113
122
  end
@@ -127,8 +136,9 @@ game_template.result(binding)
127
136
  end
128
137
 
129
138
  def create_directories
130
- Dir.mkdir(game_name.downcase) unless File.directory?(game_name.downcase)
131
- Dir.chdir(game_name.downcase)
139
+ folder_name = game_name.gsub(/(.)([A-Z])/,'\1_\2').downcase!
140
+ Dir.mkdir(folder_name) unless File.directory?(folder_name)
141
+ Dir.chdir(folder_name)
132
142
  Directories.each do |sub_folder|
133
143
  Dir.mkdir sub_folder unless File.directory?(sub_folder)
134
144
  end
data/lib/pario/version.rb CHANGED
@@ -2,7 +2,7 @@ module Pario #:nodoc:
2
2
  module Version
3
3
  MAJOR = '0'
4
4
  MINOR = '4'
5
- MICRO = '0'
5
+ MICRO = '1'
6
6
 
7
7
  STRING = [MAJOR, MINOR, MICRO].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pario
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 0
10
- version: 0.4.0
9
+ - 1
10
+ version: 0.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bill Davenport
@@ -53,7 +53,6 @@ files:
53
53
  - lib/docs/README
54
54
  - lib/pario.rb
55
55
  - lib/pario/cli.rb
56
- - lib/pario/inflector.rb
57
56
  - lib/pario/media/pario_background.png
58
57
  - lib/pario/version.rb
59
58
  - lib/util.rb
@@ -1,16 +0,0 @@
1
- module Inflector
2
- module String
3
- def camelize
4
- gsub!(/(.)([A-Z])/,'\1_\2')
5
- self.downcase
6
- end
7
-
8
- def capitalize
9
- to_s.gsub(/\b\w/){$&.upcase}
10
- end
11
- end
12
- end
13
-
14
- class String
15
- include Inflector::String
16
- end