gm 0.1.6 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/lib/gm/rubygems_plugin.rb +131 -0
  2. data/lib/rubygems_plugin.rb +1 -0
  3. metadata +17 -186
  4. data/LICENSE.txt +0 -22
  5. data/README.textile +0 -13
  6. data/bin/gem-make +0 -6
  7. data/bin/gm +0 -6
  8. data/gm_behaviors/author_behavior.rb +0 -29
  9. data/gm_behaviors/bin_files_behavior.rb +0 -10
  10. data/gm_behaviors/dependencies_behavior.rb +0 -22
  11. data/gm_behaviors/executables_behavior.rb +0 -13
  12. data/gm_behaviors/general_behavior.rb +0 -41
  13. data/gm_behaviors/github_behavior.rb +0 -14
  14. data/gm_behaviors/gm_files_behavior.rb +0 -13
  15. data/gm_behaviors/lib_files_behavior.rb +0 -10
  16. data/gm_behaviors/rails_behavior.rb +0 -11
  17. data/gm_behaviors/rdoc_behavior.rb +0 -34
  18. data/gm_behaviors/rspec_behavior.rb +0 -10
  19. data/gm_behaviors/rubigen_behavior.rb +0 -13
  20. data/gm_behaviors/rubyforge_behavior.rb +0 -12
  21. data/gm_behaviors/test_behavior.rb +0 -10
  22. data/gm_behaviors/text_files_behavior.rb +0 -10
  23. data/gm_commands/build_command.rb +0 -25
  24. data/gm_commands/build_gemspec_command.rb +0 -34
  25. data/gm_commands/clean_command.rb +0 -14
  26. data/gm_commands/config_command.rb +0 -42
  27. data/gm_commands/create_command.rb +0 -10
  28. data/gm_commands/gen_command.rb +0 -31
  29. data/gm_commands/help_command.rb +0 -246
  30. data/gm_commands/install_command.rb +0 -17
  31. data/gm_commands/publish_command.rb +0 -34
  32. data/gm_commands/spec_command.rb +0 -14
  33. data/gm_generators/bin/bin_generator.rb +0 -22
  34. data/gm_generators/bin/templates/bin/bin.rb +0 -3
  35. data/gm_generators/gem/gem_generator.rb +0 -38
  36. data/gm_generators/gem/templates/Gmfile +0 -4
  37. data/gm_generators/gem/templates/README.textile +0 -0
  38. data/gm_generators/gem/templates/lib/module.rb +0 -4
  39. data/gm_generators/mit_license/mit_license_generator.rb +0 -17
  40. data/gm_generators/mit_license/templates/LICENSE.txt +0 -22
  41. data/gm_generators/rails/rails_generator.rb +0 -18
  42. data/gm_generators/rails/templates/rails/init.rb +0 -1
  43. data/gm_generators/test/templates/test_case.rb.erb +0 -5
  44. data/gm_generators/test/templates/test_helper.rb.erb +0 -7
  45. data/gm_generators/test/test_generator.rb +0 -26
  46. data/gm_networks/github_network.rb +0 -72
  47. data/gm_networks/rubyforge_network.rb +0 -90
  48. data/lib/autotest/discover.rb +0 -3
  49. data/lib/autotest/gm.rb +0 -37
  50. data/lib/extentions/gem.rb +0 -27
  51. data/lib/gm.rb +0 -30
  52. data/lib/gm/app.rb +0 -111
  53. data/lib/gm/behavior.rb +0 -25
  54. data/lib/gm/command.rb +0 -66
  55. data/lib/gm/configuration.rb +0 -20
  56. data/lib/gm/documentation.rb +0 -38
  57. data/lib/gm/helpers.rb +0 -24
  58. data/lib/gm/loader.rb +0 -84
  59. data/lib/gm/network.rb +0 -29
  60. data/lib/gm/system.rb +0 -16
  61. data/test/command_test.rb +0 -106
  62. data/test/gem_extentions_test.rb +0 -31
  63. data/test/system_test.rb +0 -17
  64. data/test/test_helper.rb +0 -12
@@ -0,0 +1,131 @@
1
+ require 'rubygems/command_manager'
2
+
3
+ class Gem::Commands::SpecifyCommand < Gem::Command
4
+
5
+ def initialize
6
+ super 'specify', 'Generate a spec file'
7
+ end
8
+
9
+ def execute
10
+ code = IO.read('Gmfile')
11
+ eval(code, binding, 'Gmfile')
12
+ complete_configuration
13
+ if spec.validate
14
+ File.open("#{spec.name}.gemspec", 'w+') { |f| f.write spec.to_ruby }
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def specify(&block)
21
+ @spec ||= begin
22
+ spec = Gem::Specification.new
23
+ @proxy = Proxy.new(spec)
24
+ block.call(@proxy)
25
+ spec
26
+ end
27
+ end
28
+
29
+ def spec
30
+ @spec
31
+ end
32
+
33
+ def clean_files
34
+ @spec.test_files = clean_files_in(@spec.test_files)
35
+ @spec.files = clean_files_in(@spec.files)
36
+ end
37
+
38
+ def clean_files_in(array)
39
+ array = array.dup
40
+ @proxy.ignored_files.each do |pattern|
41
+ rejector = case pattern
42
+ when Proc then lambda { |path| !!pattern.call(path) }
43
+ when Regexp then lambda { |path| !!(path =~ pattern) }
44
+ when String then lambda { |path| !!(path == pattern) }
45
+ end
46
+ array = array.reject(&rejector)
47
+ end
48
+ array = array.reject { |path| File.symlink?(path) }
49
+ array
50
+ end
51
+
52
+ def complete_configuration
53
+ find_files
54
+ if spec.summary and !spec.description
55
+ spec.description = spec.summary
56
+ end
57
+ if spec.description and !spec.summary
58
+ spec.summary = spec.description
59
+ end
60
+ clean_files
61
+ end
62
+
63
+ def find_files
64
+ if spec.files.empty?
65
+ spec.files = Dir.glob('{app,config,db,lib,rails,spec,tasks,test,vendor}/**/*.{rb,erb,rake,meta,builder}')
66
+ spec.files += Dir.glob('public/**/*.*')
67
+ end
68
+ if spec.test_files.empty?
69
+ spec.test_files = Dir.glob('{test,spec}/**/*.{rb}')
70
+ end
71
+ spec.files += @proxy.files
72
+ spec.test_files += @proxy.test_files
73
+ end
74
+
75
+ class Proxy
76
+ attr_reader :ignored_files, :files, :test_files
77
+ def initialize(target)
78
+ @target = target
79
+ @ignored_files = []
80
+ @files = []
81
+ @test_files = []
82
+ end
83
+ def ignore_files(pattern=nil, &proc)
84
+ @ignored_files.push(pattern || proc)
85
+ end
86
+ def include_files(*pattern, &proc)
87
+ pattern.push(proc)
88
+ pattern = pattern.flatten.compact.uniq
89
+ pattern = pattern.first if pattern.size == 1
90
+ include_pattern(pattern) { |files| @files.concat(files) }
91
+ end
92
+ def include_test_files(*pattern, &proc)
93
+ pattern.push(proc)
94
+ pattern = pattern.flatten.compact.uniq
95
+ pattern = pattern.first if pattern.size == 1
96
+ include_pattern(pattern) { |files| @test_files.concat(files) }
97
+ end
98
+ def include_pattern(pattern, &inject)
99
+ case pattern
100
+ when Proc then include_pattern(pattern.call, &inject)
101
+ when Array then pattern.each { |p| include_pattern(p, &inject) }
102
+ when String then inject.call(Dir.glob(pattern).compact.uniq)
103
+ when NilClass then # nothing
104
+ end
105
+ end
106
+ def method_missing(m,*args,&block)
107
+ m = m.to_s
108
+ if args.size == 1 && m[-1,1] != '=' && @target.respond_to?("#{m}=")
109
+ m = "#{m}="
110
+ end
111
+ @target.send(m,*args,&block)
112
+ end
113
+ end
114
+ end
115
+
116
+ class Gem::Commands::MakeCommand < Gem::Command
117
+
118
+ def initialize
119
+ super 'make', 'Generate a spec file and build the gem'
120
+ end
121
+
122
+
123
+ def execute
124
+ Gem::CommandManager.instance.run('specify')
125
+ Gem::CommandManager.instance.run("build #{Dir.glob("*.gemspec")}")
126
+ end
127
+
128
+ end
129
+
130
+ Gem::CommandManager.instance.register_command :specify
131
+ Gem::CommandManager.instance.register_command :make
@@ -0,0 +1 @@
1
+ require 'gm/rubygems_plugin'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Menke
@@ -9,185 +9,27 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-25 00:00:00 +01:00
12
+ date: 2009-09-02 00:00:00 +02:00
13
13
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: simonmenke-ec
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 0.0.4
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: clip
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.0.0
34
- version:
35
- - !ruby/object:Gem::Dependency
36
- name: rubigen
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: 1.5.1
44
- version:
45
- - !ruby/object:Gem::Dependency
46
- name: simonmenke-ec
47
- type: :runtime
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: 0.0.4
54
- version:
55
- - !ruby/object:Gem::Dependency
56
- name: clip
57
- type: :runtime
58
- version_requirement:
59
- version_requirements: !ruby/object:Gem::Requirement
60
- requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- version: 1.0.0
64
- version:
65
- - !ruby/object:Gem::Dependency
66
- name: rubigen
67
- type: :runtime
68
- version_requirement:
69
- version_requirements: !ruby/object:Gem::Requirement
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- version: 1.5.1
74
- version:
75
- - !ruby/object:Gem::Dependency
76
- name: simonmenke-ec
77
- type: :runtime
78
- version_requirement:
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: 0.0.4
84
- version:
85
- - !ruby/object:Gem::Dependency
86
- name: clip
87
- type: :runtime
88
- version_requirement:
89
- version_requirements: !ruby/object:Gem::Requirement
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- version: 1.0.0
94
- version:
95
- - !ruby/object:Gem::Dependency
96
- name: rubigen
97
- type: :runtime
98
- version_requirement:
99
- version_requirements: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: 1.5.1
104
- version:
105
- description:
14
+ dependencies: []
15
+
16
+ description: " "
106
17
  email: simon.menke@gmail.com
107
- executables:
108
- - gem-make
109
- - gm
18
+ engine_dependencies: {}
19
+
20
+ executables: []
21
+
110
22
  extensions: []
111
23
 
112
24
  extra_rdoc_files: []
113
25
 
114
26
  files:
115
- - test/command_test.rb
116
- - test/gem_extentions_test.rb
117
- - test/system_test.rb
118
- - test/test_helper.rb
119
- - bin/gem-make
120
- - bin/gm
121
- - LICENSE.txt
122
- - README.textile
123
- - gm_generators/bin/bin_generator.rb
124
- - gm_generators/bin/templates/bin/bin.rb
125
- - gm_generators/gem/gem_generator.rb
126
- - gm_generators/gem/templates/Gmfile
127
- - gm_generators/gem/templates/README.textile
128
- - gm_generators/gem/templates/lib/module.rb
129
- - gm_generators/mit_license/mit_license_generator.rb
130
- - gm_generators/mit_license/templates/LICENSE.txt
131
- - gm_generators/rails/rails_generator.rb
132
- - gm_generators/rails/templates/rails/init.rb
133
- - gm_generators/test/templates/test_case.rb.erb
134
- - gm_generators/test/templates/test_helper.rb.erb
135
- - gm_generators/test/test_generator.rb
136
- - gm_commands/build_command.rb
137
- - gm_commands/build_gemspec_command.rb
138
- - gm_commands/clean_command.rb
139
- - gm_commands/config_command.rb
140
- - gm_commands/create_command.rb
141
- - gm_commands/gen_command.rb
142
- - gm_commands/help_command.rb
143
- - gm_commands/install_command.rb
144
- - gm_commands/publish_command.rb
145
- - gm_commands/spec_command.rb
146
- - gm_behaviors/author_behavior.rb
147
- - gm_behaviors/bin_files_behavior.rb
148
- - gm_behaviors/dependencies_behavior.rb
149
- - gm_behaviors/executables_behavior.rb
150
- - gm_behaviors/general_behavior.rb
151
- - gm_behaviors/github_behavior.rb
152
- - gm_behaviors/gm_files_behavior.rb
153
- - gm_behaviors/lib_files_behavior.rb
154
- - gm_behaviors/rails_behavior.rb
155
- - gm_behaviors/rdoc_behavior.rb
156
- - gm_behaviors/rspec_behavior.rb
157
- - gm_behaviors/rubigen_behavior.rb
158
- - gm_behaviors/rubyforge_behavior.rb
159
- - gm_behaviors/test_behavior.rb
160
- - gm_behaviors/text_files_behavior.rb
161
- - gm_networks/github_network.rb
162
- - gm_networks/rubyforge_network.rb
163
- - gm_generators/bin
164
- - gm_generators/bin/templates
165
- - gm_generators/bin/templates/bin
166
- - gm_generators/gem
167
- - gm_generators/gem/templates
168
- - gm_generators/gem/templates/lib
169
- - gm_generators/mit_license
170
- - gm_generators/mit_license/templates
171
- - gm_generators/rails
172
- - gm_generators/rails/templates
173
- - gm_generators/rails/templates/rails
174
- - gm_generators/test
175
- - gm_generators/test/templates
176
- - lib/autotest/discover.rb
177
- - lib/autotest/gm.rb
178
- - lib/extentions/gem.rb
179
- - lib/gm/app.rb
180
- - lib/gm/behavior.rb
181
- - lib/gm/command.rb
182
- - lib/gm/configuration.rb
183
- - lib/gm/documentation.rb
184
- - lib/gm/helpers.rb
185
- - lib/gm/loader.rb
186
- - lib/gm/network.rb
187
- - lib/gm/system.rb
188
- - lib/gm.rb
27
+ - lib/gm/rubygems_plugin.rb
28
+ - lib/rubygems_plugin.rb
189
29
  has_rdoc: true
190
30
  homepage: http://github.com/simonmenke/gm
31
+ licenses: []
32
+
191
33
  post_install_message:
192
34
  rdoc_options: []
193
35
 
@@ -208,20 +50,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
50
  requirements: []
209
51
 
210
52
  rubyforge_project: gem-make
211
- rubygems_version: 1.3.1
53
+ rubygems_version: 1.3.5
212
54
  signing_key:
213
- specification_version: 2
55
+ specification_version: 3
214
56
  summary: Building gems the clean way.
215
- test_files:
216
- - test/command_test.rb
217
- - test/gem_extentions_test.rb
218
- - test/system_test.rb
219
- - test/test_helper.rb
220
- - test/command_test.rb
221
- - test/gem_extentions_test.rb
222
- - test/system_test.rb
223
- - test/test_helper.rb
224
- - test/command_test.rb
225
- - test/gem_extentions_test.rb
226
- - test/system_test.rb
227
- - test/test_helper.rb
57
+ test_files: []
58
+
@@ -1,22 +0,0 @@
1
- Copyright (c) 2009 Simon Menke
2
-
3
- Permission is hereby granted, free of charge, to any person
4
- obtaining a copy of this software and associated documentation
5
- files (the "Software"), to deal in the Software without
6
- restriction, including without limitation the rights to use,
7
- copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the
9
- Software is furnished to do so, subject to the following
10
- conditions:
11
-
12
- The above copyright notice and this permission notice shall be
13
- included in all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
- OTHER DEALINGS IN THE SOFTWARE.
@@ -1,13 +0,0 @@
1
- h1. GM (GemMake)
2
-
3
- GM is a gem and gemspec builder for use with github.
4
-
5
- For the documentation go to "http://simonmenke.github.com/gm":http://simonmenke.github.com/gm
6
-
7
- For bug reports and feature requests go to "http://menke.lighthouseapp.com/projects/23688-gm":http://menke.lighthouseapp.com/projects/23688-gm
8
-
9
- h2. Todo
10
-
11
- * Document extendability
12
- * Document architecture
13
- * Implement CDN interfaces (rubyforge, github, your site, ...)
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require File.dirname(__FILE__)+'/../lib/gm'
4
-
5
- APP_ROOT = File.expand_path('.')
6
- GM::App.instance.run
data/bin/gm DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require File.dirname(__FILE__)+'/../lib/gm'
4
-
5
- APP_ROOT = File.expand_path('.')
6
- GM::App.instance.run
@@ -1,29 +0,0 @@
1
-
2
- class AuthorBehavior < GM::Behavior
3
-
4
- specify_conf do |root|
5
-
6
- root.map :author do |author|
7
- author.should_be_present
8
-
9
- author.conf(:name) do |name|
10
- name.should_be_present
11
- name.should_be_a String
12
- name.should_not_be_empty
13
- end
14
-
15
- author.conf(:email) do |email|
16
- email.should_be_present
17
- email.should_be_a String
18
- email.should_not_be_empty
19
- end
20
- end
21
-
22
- end
23
-
24
- def run
25
- spec.author = config[:author][:name]
26
- spec.email = config[:author][:email]
27
- end
28
-
29
- end