simonmenke-gm 0.1.0 → 0.1.1
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.
- data/gm_commands/build_command.rb +12 -15
- data/gm_commands/clean_command.rb +5 -9
- data/gm_commands/config_command.rb +10 -14
- data/gm_commands/create_command.rb +5 -9
- data/gm_commands/gen_command.rb +9 -13
- data/gm_commands/help_command.rb +42 -46
- data/gm_commands/install_command.rb +7 -11
- data/gm_commands/publish_command.rb +29 -0
- data/gm_commands/spec_command.rb +8 -12
- data/gm_networks/github_network.rb +42 -0
- data/gm_passes/configatron.rb +5 -1
- data/gm_passes/gm.rb +1 -0
- data/lib/gm/app.rb +14 -2
- data/lib/gm/command.rb +7 -26
- data/lib/gm/documentation.rb +22 -0
- data/lib/gm/dsl.rb +6 -6
- data/lib/gm/loader.rb +80 -0
- data/lib/gm/network.rb +25 -0
- data/lib/gm/system.rb +16 -0
- data/lib/gm.rb +4 -0
- data/test/command_test.rb +9 -10
- metadata +32 -26
@@ -1,21 +1,18 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
class BuildCommand < Command
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
app.emulate = true
|
10
|
-
app.build_gemspec
|
11
|
-
|
12
|
-
app.info "Building your gem..."
|
13
|
-
builder = Gem::Builder.new app.gemspec
|
14
|
-
app.gem_file_name = builder.build
|
15
|
-
system("rm -f pkg/#{app.gem_file_name}")
|
16
|
-
system("mkdir -p pkg && mv #{app.gem_file_name} pkg/")
|
17
|
-
end
|
4
|
+
desc "Build the gem (gem will be in ./pkg)"
|
5
|
+
|
6
|
+
def run
|
7
|
+
app.emulate = true
|
8
|
+
app.build_gemspec
|
18
9
|
|
10
|
+
app.info "Building your gem..."
|
11
|
+
builder = Gem::Builder.new app.gemspec
|
12
|
+
app.gem_file_name = builder.build
|
13
|
+
sh("rm -f pkg/#{app.gem_file_name}",
|
14
|
+
"mkdir -p pkg",
|
15
|
+
"mv #{app.gem_file_name} pkg/")
|
19
16
|
end
|
20
17
|
|
21
18
|
end
|
@@ -1,26 +1,22 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
class ConfigCommand < Command
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
EMPTY_CONFIG = <<-EOC
|
4
|
+
desc "Edit your global configuration."
|
5
|
+
|
6
|
+
EMPTY_CONFIG = <<-EOC
|
9
7
|
author:
|
10
8
|
name:
|
11
9
|
email:
|
12
10
|
github:
|
13
11
|
username:
|
14
12
|
EOC
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
21
|
-
system("$EDITOR '#{path}'")
|
13
|
+
|
14
|
+
def run
|
15
|
+
path = File.expand_path('~/.gmrc')
|
16
|
+
unless File.exist? path
|
17
|
+
File.open(path, 'w+') { |f| f.write EMPTY_CONFIG }
|
22
18
|
end
|
23
|
-
|
19
|
+
sh("$EDITOR '#{path}'")
|
24
20
|
end
|
25
21
|
|
26
22
|
end
|
@@ -1,14 +1,10 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
class CreateCommand < Command
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
def run
|
9
|
-
Command.run(:gen, ['gem', *ARGV])
|
10
|
-
end
|
11
|
-
|
4
|
+
desc "Generate the basic directory tree for a new gem"
|
5
|
+
|
6
|
+
def run
|
7
|
+
Command.run(:gen, ['gem', *ARGV])
|
12
8
|
end
|
13
9
|
|
14
10
|
end
|
data/gm_commands/gen_command.rb
CHANGED
@@ -1,19 +1,15 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
class GenCommand < Command
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
@gen_name = self.argv.shift
|
11
|
-
@gen_options = self.argv
|
12
|
-
|
13
|
-
RubiGen::Base.use_component_sources!(:gm)
|
14
|
-
RubiGen::Scripts::Generate.new.run(@gen_options, :generator => @gen_name)
|
15
|
-
end
|
4
|
+
desc "Use a generator"
|
5
|
+
|
6
|
+
def run
|
7
|
+
app.build_gemspec if File.exist?('./gmfile.yml')
|
8
|
+
@gen_name = self.argv.shift
|
9
|
+
@gen_options = self.argv
|
16
10
|
|
11
|
+
RubiGen::Base.use_component_sources!(:gm)
|
12
|
+
RubiGen::Scripts::Generate.new.run(@gen_options, :generator => @gen_name)
|
17
13
|
end
|
18
14
|
|
19
15
|
end
|
data/gm_commands/help_command.rb
CHANGED
@@ -1,55 +1,51 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
class HelpCommand < Command
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
desc "Display this help message"
|
5
|
+
|
6
|
+
def run
|
7
|
+
puts "#{File.basename($0)} <command> <options>"
|
8
|
+
puts options.to_s
|
9
|
+
puts ""
|
10
|
+
puts "Commands:"
|
11
|
+
command_descriptions
|
12
|
+
puts ""
|
13
|
+
puts "Passes:"
|
14
|
+
passes_in_running_order
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def passes_in_running_order
|
20
|
+
format = "% 3d %- 20s %s"
|
7
21
|
|
8
|
-
|
9
|
-
|
10
|
-
puts
|
11
|
-
puts ""
|
12
|
-
puts "Commands:"
|
13
|
-
command_descriptions
|
14
|
-
puts ""
|
15
|
-
puts "Passes:"
|
16
|
-
passes_in_running_order
|
22
|
+
puts "- initialization"
|
23
|
+
ConfigurationPassQueue.new(:initialization).each_with_index do |pass, idx|
|
24
|
+
puts format % [idx+1, pass.name, pass.description]
|
17
25
|
end
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
def passes_in_running_order
|
22
|
-
format = "% 3d %- 20s %s"
|
23
|
-
|
24
|
-
puts "- initialization"
|
25
|
-
ConfigurationPassQueue.new(:initialization).each_with_index do |pass, idx|
|
26
|
-
puts format % [idx, pass.name, pass.description]
|
27
|
-
end
|
28
|
-
puts "- configuration"
|
29
|
-
ConfigurationPassQueue.new(:configuration).each_with_index do |pass, idx|
|
30
|
-
puts format % [idx, pass.name, pass.description]
|
31
|
-
end
|
32
|
-
puts "- normal"
|
33
|
-
ConfigurationPassQueue.new(:normal).each_with_index do |pass, idx|
|
34
|
-
puts format % [idx, pass.name, pass.description]
|
35
|
-
end
|
36
|
-
puts "- finalization"
|
37
|
-
ConfigurationPassQueue.new(:finalization).each_with_index do |pass, idx|
|
38
|
-
puts format % [idx, pass.name, pass.description]
|
39
|
-
end
|
26
|
+
puts "- configuration"
|
27
|
+
ConfigurationPassQueue.new(:configuration).each_with_index do |pass, idx|
|
28
|
+
puts format % [idx+1, pass.name, pass.description]
|
40
29
|
end
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
30
|
+
puts "- normal"
|
31
|
+
ConfigurationPassQueue.new(:normal).each_with_index do |pass, idx|
|
32
|
+
puts format % [idx+1, pass.name, pass.description]
|
33
|
+
end
|
34
|
+
puts "- finalization"
|
35
|
+
ConfigurationPassQueue.new(:finalization).each_with_index do |pass, idx|
|
36
|
+
puts format % [idx+1, pass.name, pass.description]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def command_descriptions
|
41
|
+
descriptions = []
|
42
|
+
GM::Command.commands.each do |name, cmd|
|
43
|
+
descriptions << [name.to_s, cmd.description]
|
44
|
+
end
|
45
|
+
descriptions.sort { |a,b| a.first <=> b.first }
|
46
|
+
descriptions.collect do |(name, desc)|
|
47
|
+
puts "%- 17s %s" % [name, desc]
|
51
48
|
end
|
52
|
-
|
53
49
|
end
|
54
50
|
|
55
51
|
end
|
@@ -1,17 +1,13 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
class InstallCommand < Command
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
def run
|
9
|
-
Command.run(:build)
|
10
|
-
|
11
|
-
app.info "Installing your gem..."
|
12
|
-
system("sudo gem install pkg/#{app.gem_file_name}")
|
13
|
-
end
|
4
|
+
desc "Install the gem localy"
|
5
|
+
|
6
|
+
def run
|
7
|
+
Command.run(:build)
|
14
8
|
|
9
|
+
app.info "Installing your gem..."
|
10
|
+
sh("sudo gem install pkg/#{app.gem_file_name}")
|
15
11
|
end
|
16
12
|
|
17
13
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
class PublishCommand < Command
|
3
|
+
|
4
|
+
desc "Publish your gems to a network"
|
5
|
+
|
6
|
+
def run
|
7
|
+
app.build_gemspec
|
8
|
+
|
9
|
+
networks = argv.collect do |network|
|
10
|
+
begin
|
11
|
+
name = network.underscore.to_sym
|
12
|
+
GM::Network.networks[name].new
|
13
|
+
rescue
|
14
|
+
nil
|
15
|
+
end
|
16
|
+
end.compact
|
17
|
+
|
18
|
+
version = configatron.general.version
|
19
|
+
networks.each do |network|
|
20
|
+
if network.has_version? version
|
21
|
+
GM.app.log "Skipping #{network.class.name} (version already present)"
|
22
|
+
else
|
23
|
+
network.publish
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
data/gm_commands/spec_command.rb
CHANGED
@@ -1,18 +1,14 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
class SpecCommand < Command
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
app.
|
11
|
-
File.open("#{app.gemspec.name}.gemspec", 'w+') do |f|
|
12
|
-
f.write app.gemspec.to_ruby
|
13
|
-
end
|
4
|
+
desc "Dump the gemspec file."
|
5
|
+
|
6
|
+
def run
|
7
|
+
app.build_gemspec
|
8
|
+
app.info "Writing your gemspec..."
|
9
|
+
File.open("#{app.gemspec.name}.gemspec", 'w+') do |f|
|
10
|
+
f.write app.gemspec.to_ruby
|
14
11
|
end
|
15
|
-
|
16
12
|
end
|
17
13
|
|
18
14
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
class GithubNetwork < Network
|
3
|
+
|
4
|
+
desc "push new releases to GitHub"
|
5
|
+
|
6
|
+
def publish
|
7
|
+
commit_gemspec
|
8
|
+
make_tag
|
9
|
+
push_to_github
|
10
|
+
end
|
11
|
+
|
12
|
+
def published_versions
|
13
|
+
versions = %x[ git tag -l ].split(/\n/)
|
14
|
+
versions = versions.select do |version|
|
15
|
+
version =~ /v\d+\.\d+\.\d+/
|
16
|
+
end
|
17
|
+
versions.collect! do |version|
|
18
|
+
version.strip.sub(/^v/, '')
|
19
|
+
end
|
20
|
+
versions
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def make_tag
|
26
|
+
version = configatron.general.version
|
27
|
+
key = configatron.gpg.key
|
28
|
+
sh %{ git tag -m "Version #{version}" -u '#{key}' 'v#{version}' HEAD }
|
29
|
+
end
|
30
|
+
|
31
|
+
def commit_gemspec
|
32
|
+
version = configatron.general.version
|
33
|
+
GM::Command.run(:spec)
|
34
|
+
sh %{ git ci -m "Bumped to version #{version}" -o "#{GM.app.gemspec.name}.gemspec" -o "Gmfile" }
|
35
|
+
end
|
36
|
+
|
37
|
+
def push_to_github
|
38
|
+
sh %{ git push origin master },
|
39
|
+
%{ git push --tags }
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
data/gm_passes/configatron.rb
CHANGED
data/gm_passes/gm.rb
CHANGED
data/lib/gm/app.rb
CHANGED
@@ -5,7 +5,6 @@ module GM
|
|
5
5
|
include Singleton
|
6
6
|
|
7
7
|
attr_accessor :configuration_passes
|
8
|
-
attr_accessor :commands
|
9
8
|
attr_accessor :options
|
10
9
|
attr_accessor :gemspec
|
11
10
|
attr_accessor :emulate
|
@@ -18,7 +17,8 @@ module GM
|
|
18
17
|
# reset the app
|
19
18
|
def reset!
|
20
19
|
@configuration_passes = Hash.new { |h, k| h[k] = {} }
|
21
|
-
|
20
|
+
GM::Command.commands.clear
|
21
|
+
GM::Network.networks.clear
|
22
22
|
end
|
23
23
|
|
24
24
|
# exclude a pass from the configuration fase
|
@@ -36,6 +36,7 @@ module GM
|
|
36
36
|
def run
|
37
37
|
load_passes
|
38
38
|
load_commands
|
39
|
+
load_networks
|
39
40
|
Command.run
|
40
41
|
end
|
41
42
|
|
@@ -55,6 +56,10 @@ module GM
|
|
55
56
|
@gemspec.validate
|
56
57
|
end
|
57
58
|
|
59
|
+
def log(msg)
|
60
|
+
puts msg
|
61
|
+
end
|
62
|
+
|
58
63
|
def info(msg)
|
59
64
|
puts msg if ARGV.include? '-v' or @options.verbose?
|
60
65
|
end
|
@@ -72,6 +77,13 @@ module GM
|
|
72
77
|
end
|
73
78
|
end
|
74
79
|
|
80
|
+
# load all networks
|
81
|
+
def load_networks
|
82
|
+
Gem.find_recent_resources('gm_networks/*_network.rb').uniq.each do |path|
|
83
|
+
GM::Network.load_network path
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
75
87
|
# load all commands
|
76
88
|
def load_commands
|
77
89
|
Gem.find_recent_resources('gm_commands/*_command.rb').uniq.each do |path|
|
data/lib/gm/command.rb
CHANGED
@@ -7,31 +7,12 @@ module GM
|
|
7
7
|
attr_accessor :argv
|
8
8
|
attr_accessor :options
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
#{text.inspect}
|
14
|
-
end
|
15
|
-
}
|
16
|
-
end
|
10
|
+
include GM::Documentation
|
11
|
+
include GM::System
|
12
|
+
include GM::Loader
|
17
13
|
|
18
14
|
desc ""
|
19
|
-
|
20
|
-
# load a command from a file
|
21
|
-
def self.load_command(path)
|
22
|
-
return false unless File.exist?(path)
|
23
|
-
cmd_name = File.basename(path, '.rb')
|
24
|
-
cmd_name = cmd_name.gsub(/(^|_)([a-z])/i) { |m| $2.upcase }
|
25
|
-
|
26
|
-
mod = Module.new
|
27
|
-
mod.module_eval IO.read(path)
|
28
|
-
|
29
|
-
cmd_class = (mod.module_eval("GM::"+cmd_name) rescue nil)
|
30
|
-
|
31
|
-
return false if cmd_class.nil?
|
32
|
-
|
33
|
-
GM.app.commands[cmd_name.to_sym] = cmd_class
|
34
|
-
end
|
15
|
+
loads :commands, :extends => GM
|
35
16
|
|
36
17
|
# build a command
|
37
18
|
def self.run(cmd_name=nil, argv=ARGV)
|
@@ -65,9 +46,9 @@ module GM
|
|
65
46
|
argv.delete(cmd_name)
|
66
47
|
end
|
67
48
|
app = GM.app
|
68
|
-
cmd_name =
|
69
|
-
cmd_class =
|
70
|
-
cmd_class ||=
|
49
|
+
cmd_name = cmd_name.to_s.underscore.to_sym
|
50
|
+
cmd_class = GM::Command.commands[cmd_name]
|
51
|
+
cmd_class ||= GM::Command.commands[:help]
|
71
52
|
cmd_class.new
|
72
53
|
end
|
73
54
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
module GM
|
3
|
+
|
4
|
+
module Documentation
|
5
|
+
|
6
|
+
def self.included(base)
|
7
|
+
base.extend GM::Documentation::ClassMethods
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def desc(text)
|
12
|
+
module_eval %{
|
13
|
+
def self.description
|
14
|
+
#{text.inspect}
|
15
|
+
end
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/lib/gm/dsl.rb
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
module GM
|
3
3
|
|
4
4
|
module DSL
|
5
|
+
|
6
|
+
include GM::Loader
|
7
|
+
|
8
|
+
loads :passes, :extends => GM::DSL, :only_eval => true
|
9
|
+
|
5
10
|
def load_pass(path)
|
6
|
-
|
7
|
-
mod = Module.new
|
8
|
-
mod.send :extend, DSL
|
9
|
-
mod.module_eval IO.read(path)
|
10
|
-
end
|
11
|
+
GM::DSL.load_pass(path)
|
11
12
|
end
|
12
|
-
module_function :load_pass
|
13
13
|
|
14
14
|
def desc(msg)
|
15
15
|
@description = msg
|
data/lib/gm/loader.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
|
2
|
+
module GM
|
3
|
+
|
4
|
+
module Loader
|
5
|
+
|
6
|
+
def self.included(base)
|
7
|
+
base.extend GM::Loader::Macros
|
8
|
+
end
|
9
|
+
|
10
|
+
module Macros
|
11
|
+
|
12
|
+
def loads(name, options)
|
13
|
+
options.reverse_merge!(
|
14
|
+
:name => name.to_s.singularize.underscore,
|
15
|
+
:includes => [],
|
16
|
+
:extends => [],
|
17
|
+
:extention => ".rb",
|
18
|
+
:collection => name.to_s.pluralize.underscore,
|
19
|
+
:only_eval => false
|
20
|
+
)
|
21
|
+
options[:extends] = [options[:extends]].flatten
|
22
|
+
options[:includes] = [options[:includes]].flatten
|
23
|
+
unless options[:only_eval]
|
24
|
+
module_eval %{
|
25
|
+
extend GM::Loader::ClassMethods
|
26
|
+
def self.load_#{options[:name]}(path)
|
27
|
+
klass = load(path, #{options.inspect})
|
28
|
+
#{options[:collection]}[klass.name] = klass
|
29
|
+
klass
|
30
|
+
end
|
31
|
+
def self.name
|
32
|
+
@name ||= self.to_s.gsub(/^GM[:]{2}(.+)#{options[:name].camelize}$/, '\\1').underscore.to_sym
|
33
|
+
end
|
34
|
+
def self.#{options[:collection]}
|
35
|
+
@#{options[:collection]} ||= {}
|
36
|
+
end
|
37
|
+
}
|
38
|
+
else
|
39
|
+
module_eval %{
|
40
|
+
extend GM::Loader::ClassMethods
|
41
|
+
def self.load_#{options[:name]}(path)
|
42
|
+
load(path, #{options.inspect})
|
43
|
+
true
|
44
|
+
end
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
module ClassMethods
|
52
|
+
|
53
|
+
def load(path, options={})
|
54
|
+
raise LoadError, "file missing at path: #{path}" unless File.exist?(path)
|
55
|
+
cmd_name = File.basename(path, '.rb')
|
56
|
+
cmd_name = cmd_name.camelize
|
57
|
+
|
58
|
+
mod = Module.new
|
59
|
+
options[:includes].each do |mod|
|
60
|
+
mod.send :include, mod
|
61
|
+
end
|
62
|
+
options[:extends].each do |mod|
|
63
|
+
mod.send :extend, mod
|
64
|
+
end
|
65
|
+
mod.module_eval IO.read(path)
|
66
|
+
|
67
|
+
unless options[:only_eval]
|
68
|
+
cmd_class = (mod.module_eval(cmd_name) rescue nil)
|
69
|
+
|
70
|
+
raise LoadError, "Expected file to define #{cmd_name} (#{path})" if cmd_class.nil?
|
71
|
+
|
72
|
+
cmd_class
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
data/lib/gm/network.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
module GM
|
3
|
+
|
4
|
+
class Network
|
5
|
+
|
6
|
+
include GM::Documentation
|
7
|
+
include GM::System
|
8
|
+
include GM::Loader
|
9
|
+
|
10
|
+
desc ""
|
11
|
+
loads :networks, :extends => GM
|
12
|
+
|
13
|
+
def publish
|
14
|
+
end
|
15
|
+
|
16
|
+
def published_versions
|
17
|
+
end
|
18
|
+
|
19
|
+
def has_version?(version)
|
20
|
+
published_versions.include? version
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/lib/gm/system.rb
ADDED
data/lib/gm.rb
CHANGED
@@ -18,8 +18,12 @@ module GM
|
|
18
18
|
end
|
19
19
|
|
20
20
|
require File.dirname(__FILE__)+'/extentions/gem'
|
21
|
+
require File.dirname(__FILE__)+'/gm/loader'
|
22
|
+
require File.dirname(__FILE__)+'/gm/system'
|
23
|
+
require File.dirname(__FILE__)+'/gm/documentation'
|
21
24
|
require File.dirname(__FILE__)+'/gm/app'
|
22
25
|
require File.dirname(__FILE__)+'/gm/command'
|
23
26
|
require File.dirname(__FILE__)+'/gm/configuration_pass'
|
24
27
|
require File.dirname(__FILE__)+'/gm/configuration_pass_queue'
|
25
28
|
require File.dirname(__FILE__)+'/gm/dsl'
|
29
|
+
require File.dirname(__FILE__)+'/gm/network'
|
data/test/command_test.rb
CHANGED
@@ -11,22 +11,21 @@ class CommandTest < Test::Unit::TestCase
|
|
11
11
|
should "return klass" do
|
12
12
|
File.expects(:exist?).with('path/to/my_command.rb').returns(true)
|
13
13
|
IO.expects(:read).with('path/to/my_command.rb').returns(%{
|
14
|
-
module GM
|
15
14
|
class MyCommand ; end
|
16
|
-
|
15
|
+
})
|
17
16
|
klass = GM::Command.load_command('path/to/my_command.rb')
|
18
|
-
assert_equal "
|
17
|
+
assert_equal "MyCommand", klass.to_s.split('::', 2).last
|
19
18
|
end
|
20
19
|
|
21
20
|
should "return false when file doen't exist" do
|
22
21
|
File.expects(:exist?).with('path/to/my_command.rb').returns(false)
|
23
|
-
|
22
|
+
assert_raise(LoadError) { GM::Command.load_command('path/to/my_command.rb') }
|
24
23
|
end
|
25
24
|
|
26
25
|
should "return false when file doen't contain command" do
|
27
26
|
File.expects(:exist?).with('path/to/my_command.rb').returns(true)
|
28
27
|
IO.expects(:read).with('path/to/my_command.rb').returns(%{})
|
29
|
-
|
28
|
+
assert_raise(LoadError) { GM::Command.load_command('path/to/my_command.rb') }
|
30
29
|
end
|
31
30
|
|
32
31
|
end
|
@@ -37,7 +36,7 @@ class CommandTest < Test::Unit::TestCase
|
|
37
36
|
help_cmd = mock
|
38
37
|
help_cmd_class = mock
|
39
38
|
help_cmd_class.expects(:new).returns(help_cmd)
|
40
|
-
GM.
|
39
|
+
GM::Command.commands[:'GM::HelloCommand'] = help_cmd_class
|
41
40
|
cmd = GM::Command.build(:hello)
|
42
41
|
assert_equal help_cmd, cmd
|
43
42
|
end
|
@@ -46,7 +45,7 @@ class CommandTest < Test::Unit::TestCase
|
|
46
45
|
hello_cmd = mock
|
47
46
|
hello_cmd_class = mock
|
48
47
|
hello_cmd_class.expects(:new).returns(hello_cmd)
|
49
|
-
GM.
|
48
|
+
GM::Command.commands[:'GM::HelloCommand'] = hello_cmd_class
|
50
49
|
cmd = GM::Command.build(:hello)
|
51
50
|
assert_equal hello_cmd, cmd
|
52
51
|
end
|
@@ -56,7 +55,7 @@ class CommandTest < Test::Unit::TestCase
|
|
56
55
|
hello_cmd = mock
|
57
56
|
hello_cmd_class = mock
|
58
57
|
hello_cmd_class.expects(:new).returns(hello_cmd)
|
59
|
-
GM.
|
58
|
+
GM::Command.commands[:'GM::HelloCommand'] = hello_cmd_class
|
60
59
|
cmd = GM::Command.build(argv)
|
61
60
|
assert_equal hello_cmd, cmd
|
62
61
|
end
|
@@ -77,7 +76,7 @@ class CommandTest < Test::Unit::TestCase
|
|
77
76
|
hello_cmd_class = mock('hello_command_class') do
|
78
77
|
expects(:new).returns(hello_cmd)
|
79
78
|
end
|
80
|
-
GM.
|
79
|
+
GM::Command.commands[:'GM::HelloCommand'] = hello_cmd_class
|
81
80
|
assert_equal %w( p ), GM::Command.run(:hello, argv)
|
82
81
|
end
|
83
82
|
|
@@ -93,7 +92,7 @@ class CommandTest < Test::Unit::TestCase
|
|
93
92
|
hello_cmd_class = mock('hello_command_class') do
|
94
93
|
expects(:new).returns(hello_cmd)
|
95
94
|
end
|
96
|
-
GM.
|
95
|
+
GM::Command.commands[:'GM::HelloCommand'] = hello_cmd_class
|
97
96
|
assert_equal %w( p ), GM::Command.run(argv)
|
98
97
|
end
|
99
98
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simonmenke-gm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Menke
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-01-
|
12
|
+
date: 2009-01-21 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -49,6 +49,34 @@ extensions: []
|
|
49
49
|
extra_rdoc_files: []
|
50
50
|
|
51
51
|
files:
|
52
|
+
- gm_generators/bin/bin_generator.rb
|
53
|
+
- gm_generators/bin/templates/bin/bin.rb
|
54
|
+
- gm_generators/gem/gem_generator.rb
|
55
|
+
- gm_generators/gem/templates/Gmfile
|
56
|
+
- gm_generators/gem/templates/lib/module.rb
|
57
|
+
- gm_generators/gem/templates/README.textile
|
58
|
+
- gm_generators/mit_license/mit_license_generator.rb
|
59
|
+
- gm_generators/mit_license/templates/LICENSE.txt
|
60
|
+
- gm_generators/rails/rails_generator.rb
|
61
|
+
- gm_generators/rails/templates/rails/init.rb
|
62
|
+
- gm_generators/test/templates/test_case.rb.erb
|
63
|
+
- gm_generators/test/templates/test_helper.rb.erb
|
64
|
+
- gm_generators/test/test_generator.rb
|
65
|
+
- bin/gm
|
66
|
+
- bin/gmm
|
67
|
+
- lib/autotest/discover.rb
|
68
|
+
- lib/autotest/gm.rb
|
69
|
+
- lib/extentions/gem.rb
|
70
|
+
- lib/gm/app.rb
|
71
|
+
- lib/gm/command.rb
|
72
|
+
- lib/gm/configuration_pass.rb
|
73
|
+
- lib/gm/configuration_pass_queue.rb
|
74
|
+
- lib/gm/documentation.rb
|
75
|
+
- lib/gm/dsl.rb
|
76
|
+
- lib/gm/loader.rb
|
77
|
+
- lib/gm/network.rb
|
78
|
+
- lib/gm/system.rb
|
79
|
+
- lib/gm.rb
|
52
80
|
- gm_commands/build_command.rb
|
53
81
|
- gm_commands/clean_command.rb
|
54
82
|
- gm_commands/config_command.rb
|
@@ -56,6 +84,7 @@ files:
|
|
56
84
|
- gm_commands/gen_command.rb
|
57
85
|
- gm_commands/help_command.rb
|
58
86
|
- gm_commands/install_command.rb
|
87
|
+
- gm_commands/publish_command.rb
|
59
88
|
- gm_commands/spec_command.rb
|
60
89
|
- gm_passes/clean_file_list.rb
|
61
90
|
- gm_passes/configatron.rb
|
@@ -68,32 +97,20 @@ files:
|
|
68
97
|
- gm_passes/rubigen.rb
|
69
98
|
- gm_passes/specs.rb
|
70
99
|
- gm_passes/test.rb
|
100
|
+
- gm_networks/github_network.rb
|
71
101
|
- gm_generators/bin
|
72
|
-
- gm_generators/bin/bin_generator.rb
|
73
102
|
- gm_generators/bin/templates
|
74
103
|
- gm_generators/bin/templates/bin
|
75
|
-
- gm_generators/bin/templates/bin/bin.rb
|
76
104
|
- gm_generators/gem
|
77
|
-
- gm_generators/gem/gem_generator.rb
|
78
105
|
- gm_generators/gem/templates
|
79
|
-
- gm_generators/gem/templates/Gmfile
|
80
|
-
- gm_generators/gem/templates/README.textile
|
81
106
|
- gm_generators/gem/templates/lib
|
82
|
-
- gm_generators/gem/templates/lib/module.rb
|
83
107
|
- gm_generators/mit_license
|
84
|
-
- gm_generators/mit_license/mit_license_generator.rb
|
85
108
|
- gm_generators/mit_license/templates
|
86
|
-
- gm_generators/mit_license/templates/LICENSE.txt
|
87
109
|
- gm_generators/rails
|
88
|
-
- gm_generators/rails/rails_generator.rb
|
89
110
|
- gm_generators/rails/templates
|
90
111
|
- gm_generators/rails/templates/rails
|
91
|
-
- gm_generators/rails/templates/rails/init.rb
|
92
112
|
- gm_generators/test
|
93
113
|
- gm_generators/test/templates
|
94
|
-
- gm_generators/test/templates/test_case.rb.erb
|
95
|
-
- gm_generators/test/templates/test_helper.rb.erb
|
96
|
-
- gm_generators/test/test_generator.rb
|
97
114
|
- test/command_test.rb
|
98
115
|
- test/configuration_pass_queue_test.rb
|
99
116
|
- test/configuration_pass_test.rb
|
@@ -101,17 +118,6 @@ files:
|
|
101
118
|
- test/test_helper.rb
|
102
119
|
- LICENSE.txt
|
103
120
|
- README.textile
|
104
|
-
- bin/gm
|
105
|
-
- bin/gmm
|
106
|
-
- lib/autotest/discover.rb
|
107
|
-
- lib/autotest/gm.rb
|
108
|
-
- lib/extentions/gem.rb
|
109
|
-
- lib/gm/app.rb
|
110
|
-
- lib/gm/command.rb
|
111
|
-
- lib/gm/configuration_pass.rb
|
112
|
-
- lib/gm/configuration_pass_queue.rb
|
113
|
-
- lib/gm/dsl.rb
|
114
|
-
- lib/gm.rb
|
115
121
|
has_rdoc: true
|
116
122
|
homepage: http://github.com/simonmenke/gm
|
117
123
|
post_install_message:
|