gm 0.1.6 → 1.0.4

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.
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
@@ -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
@@ -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
@@ -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
@@ -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