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.
- data/rubygems_plugin.rb +81 -0
- metadata +11 -145
- data/LICENSE.txt +0 -22
- data/README.textile +0 -13
- data/bin/gem-make +0 -6
- data/bin/gm +0 -6
- data/gm_behaviors/author_behavior.rb +0 -29
- data/gm_behaviors/bin_files_behavior.rb +0 -10
- data/gm_behaviors/dependencies_behavior.rb +0 -22
- data/gm_behaviors/executables_behavior.rb +0 -13
- data/gm_behaviors/general_behavior.rb +0 -41
- data/gm_behaviors/github_behavior.rb +0 -14
- data/gm_behaviors/gm_files_behavior.rb +0 -13
- data/gm_behaviors/lib_files_behavior.rb +0 -10
- data/gm_behaviors/rails_behavior.rb +0 -11
- data/gm_behaviors/rdoc_behavior.rb +0 -34
- data/gm_behaviors/rspec_behavior.rb +0 -10
- data/gm_behaviors/rubigen_behavior.rb +0 -13
- data/gm_behaviors/rubyforge_behavior.rb +0 -12
- data/gm_behaviors/test_behavior.rb +0 -10
- data/gm_behaviors/text_files_behavior.rb +0 -10
- data/gm_commands/build_command.rb +0 -25
- data/gm_commands/build_gemspec_command.rb +0 -34
- data/gm_commands/clean_command.rb +0 -14
- data/gm_commands/config_command.rb +0 -42
- data/gm_commands/create_command.rb +0 -10
- data/gm_commands/gen_command.rb +0 -31
- data/gm_commands/help_command.rb +0 -246
- data/gm_commands/install_command.rb +0 -17
- data/gm_commands/publish_command.rb +0 -34
- data/gm_commands/spec_command.rb +0 -14
- data/gm_generators/bin/bin_generator.rb +0 -22
- data/gm_generators/bin/templates/bin/bin.rb +0 -3
- data/gm_generators/gem/gem_generator.rb +0 -38
- data/gm_generators/gem/templates/Gmfile +0 -4
- data/gm_generators/gem/templates/README.textile +0 -0
- data/gm_generators/gem/templates/lib/module.rb +0 -4
- data/gm_generators/mit_license/mit_license_generator.rb +0 -17
- data/gm_generators/mit_license/templates/LICENSE.txt +0 -22
- data/gm_generators/rails/rails_generator.rb +0 -18
- data/gm_generators/rails/templates/rails/init.rb +0 -1
- data/gm_generators/test/templates/test_case.rb.erb +0 -5
- data/gm_generators/test/templates/test_helper.rb.erb +0 -7
- data/gm_generators/test/test_generator.rb +0 -26
- data/gm_networks/github_network.rb +0 -72
- data/gm_networks/rubyforge_network.rb +0 -90
- data/lib/autotest/discover.rb +0 -3
- data/lib/autotest/gm.rb +0 -37
- data/lib/extentions/gem.rb +0 -27
- data/lib/gm.rb +0 -30
- data/lib/gm/app.rb +0 -111
- data/lib/gm/behavior.rb +0 -25
- data/lib/gm/command.rb +0 -66
- data/lib/gm/configuration.rb +0 -20
- data/lib/gm/documentation.rb +0 -38
- data/lib/gm/helpers.rb +0 -24
- data/lib/gm/loader.rb +0 -84
- data/lib/gm/network.rb +0 -29
- data/lib/gm/system.rb +0 -16
- data/test/command_test.rb +0 -106
- data/test/gem_extentions_test.rb +0 -31
- data/test/system_test.rb +0 -17
- data/test/test_helper.rb +0 -12
data/lib/gm/system.rb
DELETED
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
|
data/test/gem_extentions_test.rb
DELETED
@@ -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
|