gosu_android 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,9 +5,9 @@ module Gosu
5
5
  module Base
6
6
 
7
7
  def self.show_help
8
- puts "Usage: gosu_android [OPTION]"
8
+ puts "Usage: gosu_android OPTION"
9
9
  puts "Adds or deletes dependencies for Gosu in a Ruboto project."
10
- puts "If no argument is specified it adds the dependencies."
10
+ puts "If no argument is specified it displays this help."
11
11
  puts ""
12
12
  puts " -a, --add adds the files to the project"
13
13
  puts " -d, --delete deletes the files from the project"
@@ -25,14 +25,16 @@ module Gosu
25
25
  root = Dir.pwd
26
26
  #gem root -> where the gem is located
27
27
  gem_root = File.expand_path(File.dirname(__FILE__))
28
- gem_root.slice! "/commands"
28
+ #Delete last occurence of /commands
29
+ gem_root = gem_root.reverse.sub( "/commands".reverse, '' ).reverse
29
30
 
30
- #Get all the files needed for gosu android
31
+ #Add * to read all files in folder
31
32
  gem_root_s = gem_root + "/*"
32
33
  gem_root_ss = gem_root + "/*/*"
33
-
34
- #List of not usefull files
34
+
35
+ #Get all the files needed for gosu android
35
36
  lib_files = FileList[ gem_root_s, gem_root_ss ].to_a
37
+ #List of not usefull files
36
38
  not_copy_files = ["commands", "description", "version"]
37
39
 
38
40
  #Do not copy the ones that are not needed
@@ -53,13 +55,10 @@ module Gosu
53
55
  end
54
56
  end
55
57
 
56
- #FIXME This is a dirty way to delete de last
57
- #gosu_android from the gem_root variable
58
-
59
58
  #Main file and jar dependencies go in different folders
60
59
  #than normal files
61
- gem_root = gem_root + "/"
62
- gem_root.slice! "/gosu_android/"
60
+ #Delete last occurence of /gosu_android
61
+ gem_root = gem_root.reverse.sub( "/gosu_android".reverse, '' ).reverse
63
62
 
64
63
  src = gem_root + "/gosu_android.rb"
65
64
  dst = root + "/src/gosu_android.rb"
@@ -69,8 +68,8 @@ module Gosu
69
68
  FileUtils.cp(src, dst)
70
69
 
71
70
  #Resources files
72
- gem_root = gem_root + "_"
73
- gem_root.slice! "/lib_"
71
+ #Delete last occurence of /lib
72
+ gem_root = gem_root.reverse.sub( "/lib".reverse, '' ).reverse
74
73
  gem_root_s = gem_root + "/res/*"
75
74
  gem_root_ss = gem_root + "/res/*/**"
76
75
 
@@ -87,7 +86,7 @@ module Gosu
87
86
  FileUtils.cp(src, dst)
88
87
  end
89
88
  end
90
-
89
+
91
90
  end
92
91
 
93
92
  def self.delete_files
@@ -119,14 +118,11 @@ module Gosu
119
118
 
120
119
  #gem root -> where the gem is located
121
120
  gem_root = File.expand_path(File.dirname(__FILE__))
122
- gem_root.slice! "/commands"
123
-
124
- gem_root = gem_root + "/"
125
- gem_root.slice! "/gosu_android/"
121
+ gem_root = gem_root.reverse.sub( "/gosu_android/commands".reverse, '' ).reverse
126
122
 
127
123
  #Resources files
128
- gem_root = gem_root + "_"
129
- gem_root.slice! "/lib_"
124
+ #Delete last occurence of /lib
125
+ gem_root = gem_root.reverse.sub( "/lib".reverse, '' ).reverse
130
126
  gem_root_s = gem_root + "/res/*"
131
127
  gem_root_ss = gem_root + "/res/*/**"
132
128
 
@@ -169,7 +165,7 @@ module Gosu
169
165
  end
170
166
  end
171
167
 
172
- if help
168
+ if help or not add and not delete
173
169
  show_help
174
170
  exit 0
175
171
  end
@@ -178,11 +174,7 @@ module Gosu
178
174
  $stderr.puts "Add and delete can not be perform at the same time\n"
179
175
  exit 1
180
176
  end
181
-
182
- if not add and not delete
183
- add = true
184
- end
185
-
177
+
186
178
  if add
187
179
  add_files
188
180
  exit 0
@@ -1,3 +1,3 @@
1
1
  module Gosu
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gosu_android
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Garoe Dorta
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-03-26 00:00:00 Z
18
+ date: 2013-03-27 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: ruboto