simonmenke-gm 0.1.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/rubygems_plugin.rb +81 -0
  2. metadata +11 -145
  3. data/LICENSE.txt +0 -22
  4. data/README.textile +0 -13
  5. data/bin/gem-make +0 -6
  6. data/bin/gm +0 -6
  7. data/gm_behaviors/author_behavior.rb +0 -29
  8. data/gm_behaviors/bin_files_behavior.rb +0 -10
  9. data/gm_behaviors/dependencies_behavior.rb +0 -22
  10. data/gm_behaviors/executables_behavior.rb +0 -13
  11. data/gm_behaviors/general_behavior.rb +0 -41
  12. data/gm_behaviors/github_behavior.rb +0 -14
  13. data/gm_behaviors/gm_files_behavior.rb +0 -13
  14. data/gm_behaviors/lib_files_behavior.rb +0 -10
  15. data/gm_behaviors/rails_behavior.rb +0 -11
  16. data/gm_behaviors/rdoc_behavior.rb +0 -34
  17. data/gm_behaviors/rspec_behavior.rb +0 -10
  18. data/gm_behaviors/rubigen_behavior.rb +0 -13
  19. data/gm_behaviors/rubyforge_behavior.rb +0 -12
  20. data/gm_behaviors/test_behavior.rb +0 -10
  21. data/gm_behaviors/text_files_behavior.rb +0 -10
  22. data/gm_commands/build_command.rb +0 -25
  23. data/gm_commands/build_gemspec_command.rb +0 -34
  24. data/gm_commands/clean_command.rb +0 -14
  25. data/gm_commands/config_command.rb +0 -42
  26. data/gm_commands/create_command.rb +0 -10
  27. data/gm_commands/gen_command.rb +0 -31
  28. data/gm_commands/help_command.rb +0 -246
  29. data/gm_commands/install_command.rb +0 -17
  30. data/gm_commands/publish_command.rb +0 -34
  31. data/gm_commands/spec_command.rb +0 -14
  32. data/gm_generators/bin/bin_generator.rb +0 -22
  33. data/gm_generators/bin/templates/bin/bin.rb +0 -3
  34. data/gm_generators/gem/gem_generator.rb +0 -38
  35. data/gm_generators/gem/templates/Gmfile +0 -4
  36. data/gm_generators/gem/templates/README.textile +0 -0
  37. data/gm_generators/gem/templates/lib/module.rb +0 -4
  38. data/gm_generators/mit_license/mit_license_generator.rb +0 -17
  39. data/gm_generators/mit_license/templates/LICENSE.txt +0 -22
  40. data/gm_generators/rails/rails_generator.rb +0 -18
  41. data/gm_generators/rails/templates/rails/init.rb +0 -1
  42. data/gm_generators/test/templates/test_case.rb.erb +0 -5
  43. data/gm_generators/test/templates/test_helper.rb.erb +0 -7
  44. data/gm_generators/test/test_generator.rb +0 -26
  45. data/gm_networks/github_network.rb +0 -72
  46. data/gm_networks/rubyforge_network.rb +0 -90
  47. data/lib/autotest/discover.rb +0 -3
  48. data/lib/autotest/gm.rb +0 -37
  49. data/lib/extentions/gem.rb +0 -27
  50. data/lib/gm.rb +0 -30
  51. data/lib/gm/app.rb +0 -111
  52. data/lib/gm/behavior.rb +0 -25
  53. data/lib/gm/command.rb +0 -66
  54. data/lib/gm/configuration.rb +0 -20
  55. data/lib/gm/documentation.rb +0 -38
  56. data/lib/gm/helpers.rb +0 -24
  57. data/lib/gm/loader.rb +0 -84
  58. data/lib/gm/network.rb +0 -29
  59. data/lib/gm/system.rb +0 -16
  60. data/test/command_test.rb +0 -106
  61. data/test/gem_extentions_test.rb +0 -31
  62. data/test/system_test.rb +0 -17
  63. data/test/test_helper.rb +0 -12
data/lib/gm/system.rb DELETED
@@ -1,16 +0,0 @@
1
-
2
- module GM
3
-
4
- module System
5
-
6
- def sh(*cmds)
7
- cmds.each do |cmd|
8
- cmd = cmd.strip
9
- GM.app.log "> #{cmd}"
10
- system(cmd)
11
- end
12
- end
13
-
14
- end
15
-
16
- end
data/test/command_test.rb DELETED
@@ -1,106 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper'
2
-
3
- class CommandTest < Test::Unit::TestCase
4
-
5
- before do
6
- GM.app.reset!
7
- end
8
-
9
- context "load_command" do
10
-
11
- should "return klass" do
12
- File.expects(:exist?).with('path/to/my_command.rb').returns(true)
13
- IO.expects(:read).with('path/to/my_command.rb').returns(%{
14
- class MyCommand ; end
15
- })
16
- klass = GM::Command.load_command('path/to/my_command.rb')
17
- assert_equal "MyCommand", klass.to_s.split('::', 2).last
18
- end
19
-
20
- should "return false when file doen't exist" do
21
- File.expects(:exist?).with('path/to/my_command.rb').returns(false)
22
- assert_raise(LoadError) { GM::Command.load_command('path/to/my_command.rb') }
23
- end
24
-
25
- should "return false when file doen't contain command" do
26
- File.expects(:exist?).with('path/to/my_command.rb').returns(true)
27
- IO.expects(:read).with('path/to/my_command.rb').returns(%{})
28
- assert_raise(LoadError) { GM::Command.load_command('path/to/my_command.rb') }
29
- end
30
-
31
- end
32
-
33
- context "build" do
34
-
35
- should "return instance of HelpCommand not found" do
36
- help_cmd = mock
37
- help_cmd_class = mock
38
- help_cmd_class.expects(:new).returns(help_cmd)
39
- GM::Command.commands[:hello] = help_cmd_class
40
- cmd = GM::Command.build(:hello)
41
- assert_equal help_cmd, cmd
42
- end
43
-
44
- should "return new command" do
45
- hello_cmd = mock
46
- hello_cmd_class = mock
47
- hello_cmd_class.expects(:new).returns(hello_cmd)
48
- GM::Command.commands[:hello] = hello_cmd_class
49
- cmd = GM::Command.build(:hello)
50
- assert_equal hello_cmd, cmd
51
- end
52
-
53
- should "find command name in argv if name is nil" do
54
- argv = %w( -v hello world )
55
- hello_cmd = mock
56
- hello_cmd_class = mock
57
- hello_cmd_class.expects(:new).returns(hello_cmd)
58
- GM::Command.commands[:hello] = hello_cmd_class
59
- cmd = GM::Command.build(argv)
60
- assert_equal hello_cmd, cmd
61
- end
62
-
63
- end
64
-
65
- context "run" do
66
-
67
- should "run command and return remaining argv" do
68
- argv = %w( -v p )
69
- hello_cmd = mock('hello_command') do
70
- expects(:run)
71
- expects(:banner_text).returns("")
72
- expects(:add_options).with() { |value| Clip::Parser === value }
73
- expects(:options=).with() { |value| Clip::Parser === value }
74
- expects(:argv=).with %w( p )
75
- end
76
- hello_cmd_class = mock('hello_command_class') do
77
- expects(:new).returns(hello_cmd)
78
- end
79
- GM::Command.commands[:hello] = hello_cmd_class
80
- assert_equal %w( p ), GM::Command.run(:hello, argv)
81
- end
82
-
83
- should "find command name in argv if name is nil" do
84
- argv = %w( -v hello p )
85
- hello_cmd = mock('hello_command') do
86
- expects(:run)
87
- expects(:banner_text).returns("")
88
- expects(:add_options).with() { |value| Clip::Parser === value }
89
- expects(:options=).with() { |value| Clip::Parser === value }
90
- expects(:argv=).with %w( p )
91
- end
92
- hello_cmd_class = mock('hello_command_class') do
93
- expects(:new).returns(hello_cmd)
94
- end
95
- GM::Command.commands[:hello] = hello_cmd_class
96
- assert_equal %w( p ), GM::Command.run(argv)
97
- end
98
-
99
- end
100
-
101
-
102
- should "retrun GM.app for #app" do
103
- assert_equal GM.app, GM::Command.new.send(:app)
104
- end
105
-
106
- end
@@ -1,31 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper'
2
-
3
- class GemExtentionsTest < Test::Unit::TestCase
4
-
5
- should "find recent files" do
6
- gems = Gem.searcher.find_all('autotest/discover.rb')
7
- gems = gems.inject({}) do |specs, spec|
8
- specs[spec.name] = spec if specs[spec.name].nil? or (spec <=> specs[spec.name]) == 1
9
- specs
10
- end.values
11
- paths = gems.collect do |gem|
12
- Gem.searcher.matching_files gem, 'autotest/discover.rb'
13
- end.flatten.compact
14
-
15
- assert_equal paths, Gem.find_recent_files('autotest/discover.rb')
16
- end
17
-
18
- should "find_recent_resources" do
19
- gems = Gem.searcher.find_all('autotest/discover.rb')
20
- gems = gems.inject({}) do |specs, spec|
21
- specs[spec.name] = spec if specs[spec.name].nil? or (spec <=> specs[spec.name]) == 1
22
- specs
23
- end.values
24
- paths = gems.collect do |gem|
25
- Gem.searcher.matching_files gem, 'autotest/discover.rb'
26
- end.flatten.compact
27
-
28
- assert_equal paths, Gem.find_recent_resources('lib/autotest/discover.rb')
29
- end
30
-
31
- end
data/test/system_test.rb DELETED
@@ -1,17 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper'
2
-
3
- class SystemTest < Test::Unit::TestCase
4
-
5
- include GM::System
6
-
7
- should "call Kernel#system" do
8
- GM.app.expects(:log).with('> ls -l')
9
- GM.app.expects(:log).with('> ls -a')
10
-
11
- expects(:system).with('ls -l')
12
- expects(:system).with('ls -a')
13
-
14
- sh %{ ls -l }, %{ ls -a }
15
- end
16
-
17
- end
data/test/test_helper.rb DELETED
@@ -1,12 +0,0 @@
1
- require 'test/unit'
2
- require 'rubygems'
3
- require 'mocha' rescue puts('please install mocha') and exit(1)
4
- require 'context' rescue puts('please install context') and exit(1)
5
-
6
- require File.dirname(__FILE__)+'/../lib/gm'
7
-
8
- class Test::Unit::TestCase
9
-
10
- # put your helpers here
11
-
12
- end