gm 0.1.6 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gm/rubygems_plugin.rb +131 -0
- data/lib/rubygems_plugin.rb +1 -0
- metadata +17 -186
- 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
@@ -1,17 +0,0 @@
|
|
1
|
-
|
2
|
-
class InstallCommand < GM::Command
|
3
|
-
|
4
|
-
desc "Install the gem localy"
|
5
|
-
banner "install"
|
6
|
-
doc <<-DOC
|
7
|
-
Build and install the gem localy.
|
8
|
-
DOC
|
9
|
-
|
10
|
-
def run
|
11
|
-
GM::Command.run(:build)
|
12
|
-
|
13
|
-
app.info "Installing your gem..."
|
14
|
-
sh("sudo gem install pkg/#{gem_file_name}")
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
|
2
|
-
class PublishCommand < GM::Command
|
3
|
-
|
4
|
-
desc "Publish your gems to a network"
|
5
|
-
banner "publish network..."
|
6
|
-
doc <<-DOC
|
7
|
-
This command will publish your gem through the provided networks.
|
8
|
-
</p><p>
|
9
|
-
<%= GM::Network.networks.keys.collect{|n|
|
10
|
-
%{<a href="#network_\#{n}">\#{n}</a>} }.join(', ') %>
|
11
|
-
DOC
|
12
|
-
|
13
|
-
def run
|
14
|
-
|
15
|
-
networks = argv.collect do |network|
|
16
|
-
app.reset_spec!
|
17
|
-
GM::Command.run(:build_gemspec, ['-E'])
|
18
|
-
name = network.underscore.to_sym
|
19
|
-
klass = GM::Network.networks[name]
|
20
|
-
klass.new unless klass.nil?
|
21
|
-
end.compact
|
22
|
-
|
23
|
-
version = config[:general][:version]
|
24
|
-
networks.each do |network|
|
25
|
-
if network.has_version? version
|
26
|
-
GM.app.log "Skipping #{network.class.name} (version #{version} already present)"
|
27
|
-
else
|
28
|
-
network.publish
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
data/gm_commands/spec_command.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
|
2
|
-
class SpecCommand < GM::Command
|
3
|
-
|
4
|
-
desc "Dump the gemspec file."
|
5
|
-
|
6
|
-
def run
|
7
|
-
GM::Command.run(:build_gemspec, ['-E'])
|
8
|
-
app.info "Writing your gemspec..."
|
9
|
-
File.open("#{app.spec.name}.gemspec", 'w+') do |f|
|
10
|
-
f.write app.spec.to_ruby
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
|
2
|
-
class BinGenerator < RubiGen::Base
|
3
|
-
|
4
|
-
attr_reader :bin_name
|
5
|
-
|
6
|
-
def initialize(runtime_args, runtime_options = {})
|
7
|
-
super
|
8
|
-
@destination_root = '.'
|
9
|
-
@bin_name = args.shift
|
10
|
-
end
|
11
|
-
|
12
|
-
def manifest
|
13
|
-
record do |m|
|
14
|
-
|
15
|
-
m.directory ''
|
16
|
-
%w( bin ).each { |path| m.directory path }
|
17
|
-
|
18
|
-
m.template "bin/bin.rb", "bin/#{@bin_name}"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
|
2
|
-
class GemGenerator < RubiGen::Base
|
3
|
-
|
4
|
-
attr_reader :app_name, :module_name
|
5
|
-
|
6
|
-
def initialize(runtime_args, runtime_options = {})
|
7
|
-
super
|
8
|
-
usage if args.empty?
|
9
|
-
@destination_root = args.shift
|
10
|
-
@app_name = File.basename(File.expand_path(@destination_root))
|
11
|
-
@module_name = app_name.camelize
|
12
|
-
end
|
13
|
-
|
14
|
-
def manifest
|
15
|
-
record do |m|
|
16
|
-
|
17
|
-
# Root directory and all subdirectories.
|
18
|
-
m.directory ''
|
19
|
-
%w( lib ).each { |path| m.directory path }
|
20
|
-
|
21
|
-
# Root
|
22
|
-
m.template_copy_each %w( Gmfile )
|
23
|
-
m.file_copy_each %w( README.textile )
|
24
|
-
|
25
|
-
m.template "lib/module.rb", "lib/#{app_name}.rb"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
protected
|
30
|
-
|
31
|
-
def banner
|
32
|
-
<<-EOS
|
33
|
-
Create a stub gem for #{File.basename $0} to get started.
|
34
|
-
|
35
|
-
Usage: #{File.basename $0} gen gm /path/to/your/gem"
|
36
|
-
EOS
|
37
|
-
end
|
38
|
-
end
|
File without changes
|
@@ -1,17 +0,0 @@
|
|
1
|
-
|
2
|
-
class MitLicenseGenerator < RubiGen::Base
|
3
|
-
|
4
|
-
def initialize(runtime_args, runtime_options = {})
|
5
|
-
super
|
6
|
-
@destination_root = '.'
|
7
|
-
end
|
8
|
-
|
9
|
-
def manifest
|
10
|
-
record do |m|
|
11
|
-
m.directory ''
|
12
|
-
|
13
|
-
m.template "LICENSE.txt", "LICENSE.txt"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) <%= DateTime.now.year %> <%= EC.store.config[:author][:name] %>
|
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,18 +0,0 @@
|
|
1
|
-
|
2
|
-
class RailsGenerator < RubiGen::Base
|
3
|
-
|
4
|
-
def initialize(runtime_args, runtime_options = {})
|
5
|
-
super
|
6
|
-
@destination_root = '.'
|
7
|
-
end
|
8
|
-
|
9
|
-
def manifest
|
10
|
-
record do |m|
|
11
|
-
m.directory ''
|
12
|
-
m.directory 'rails'
|
13
|
-
|
14
|
-
m.template "rails/init.rb", "rails/init.rb"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
# initialize your rails plugin here
|
@@ -1,26 +0,0 @@
|
|
1
|
-
if defined?(RubiGen::Base)
|
2
|
-
|
3
|
-
class TestGenerator < RubiGen::Base
|
4
|
-
|
5
|
-
attr_reader :file_name, :test_case_name
|
6
|
-
|
7
|
-
def initialize(runtime_args, runtime_options = {})
|
8
|
-
super
|
9
|
-
@destination_root = '.'
|
10
|
-
@file_name = args.shift
|
11
|
-
@test_case_name = file_name.camelize unless @file_name.nil?
|
12
|
-
end
|
13
|
-
|
14
|
-
def manifest
|
15
|
-
record do |m|
|
16
|
-
m.directory ''
|
17
|
-
%w( test ).each { |path| m.directory path }
|
18
|
-
|
19
|
-
m.template "test_helper.rb.erb", "test/test_helper.rb" unless File.exist? "test/test_helper.rb"
|
20
|
-
m.template "test_case.rb.erb", "test/#{@file_name}_test.rb" unless @file_name.nil?
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
end # if defined?(RubiGen::Base)
|
@@ -1,72 +0,0 @@
|
|
1
|
-
|
2
|
-
class GithubNetwork < GM::Network
|
3
|
-
|
4
|
-
desc "push new releases to GitHub"
|
5
|
-
doc <<-DOC
|
6
|
-
This will dump the .gemspec file, create a new (optonaly signed) tag and push the master branch to github.
|
7
|
-
DOC
|
8
|
-
|
9
|
-
specify_conf do |root|
|
10
|
-
|
11
|
-
root.map :github do |github|
|
12
|
-
|
13
|
-
github.conf(:emulate) do |s|
|
14
|
-
end
|
15
|
-
|
16
|
-
github.conf(:project) do |s|
|
17
|
-
s.should_be_a String
|
18
|
-
s.should_not_be_empty
|
19
|
-
end
|
20
|
-
|
21
|
-
github.conf(:username) do |s|
|
22
|
-
s.should_be_present
|
23
|
-
s.should_be_a String
|
24
|
-
s.should_not_be_empty
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
def publish
|
32
|
-
commit_gemspec
|
33
|
-
make_tag
|
34
|
-
push_to_github
|
35
|
-
end
|
36
|
-
|
37
|
-
def published_versions
|
38
|
-
versions = %x[ git tag -l ].split(/\n/)
|
39
|
-
versions = versions.select do |version|
|
40
|
-
version =~ /v\d+\.\d+\.\d+/
|
41
|
-
end
|
42
|
-
versions.collect! do |version|
|
43
|
-
version.strip.sub(/^v/, '')
|
44
|
-
end
|
45
|
-
versions
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
def make_tag
|
51
|
-
version = config[:general][:version]
|
52
|
-
key = config[:gpg][:key] if config[:gpg]
|
53
|
-
signing_options = if key.nil?
|
54
|
-
"-a"
|
55
|
-
else
|
56
|
-
"-u '#{key}'"
|
57
|
-
end
|
58
|
-
sh %{ git tag -m "Version #{version}" #{signing_options} 'v#{version}' HEAD }
|
59
|
-
end
|
60
|
-
|
61
|
-
def commit_gemspec
|
62
|
-
version = config[:general][:version]
|
63
|
-
GM::Command.run(:spec)
|
64
|
-
sh %{ git ci -m "Bumped to version #{version}" -o "#{app.spec.name}.gemspec" -o "Gmfile" }
|
65
|
-
end
|
66
|
-
|
67
|
-
def push_to_github
|
68
|
-
sh %{ git push origin master },
|
69
|
-
%{ git push --tags }
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
|
2
|
-
class RubyforgeNetwork < GM::Network
|
3
|
-
|
4
|
-
specify_conf do |root|
|
5
|
-
|
6
|
-
root.map :rubyforge do |rubyforge|
|
7
|
-
|
8
|
-
rubyforge.conf(:project) do |s|
|
9
|
-
s.should_be_present
|
10
|
-
s.should_be_a String
|
11
|
-
s.should_not_be_empty
|
12
|
-
end
|
13
|
-
|
14
|
-
rubyforge.conf(:package) do |s|
|
15
|
-
s.should_be_a String
|
16
|
-
s.should_not_be_empty
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
def publish
|
24
|
-
prepare
|
25
|
-
version = config[:general][:version]
|
26
|
-
GM::Command.run(:build, ['-E'])
|
27
|
-
sh "rubyforge add_release #{group_id} #{package_id} #{version} pkg/#{gem_file_name}"
|
28
|
-
end
|
29
|
-
|
30
|
-
def published_versions
|
31
|
-
prepare
|
32
|
-
if rubyforge_info['release_ids'][package_name]
|
33
|
-
rubyforge_info['release_ids'][package_name].keys
|
34
|
-
else
|
35
|
-
[]
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
def rubyforge_info(reset=false)
|
42
|
-
@rubyforge_info = nil if reset
|
43
|
-
@rubyforge_info ||= YAML.load_file(File.expand_path('~/.rubyforge/auto-config.yml'))
|
44
|
-
end
|
45
|
-
|
46
|
-
def project_name
|
47
|
-
if config[:rubyforge]
|
48
|
-
config[:rubyforge][:project]
|
49
|
-
else
|
50
|
-
config[:general][:name]
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def package_name
|
55
|
-
if config[:rubyforge] and config[:rubyforge][:package]
|
56
|
-
config[:rubyforge][:package]
|
57
|
-
else
|
58
|
-
config[:general][:name]
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def group_id
|
63
|
-
@group_id ||= rubyforge_info['group_ids'][project_name]
|
64
|
-
end
|
65
|
-
|
66
|
-
def package_id
|
67
|
-
@package_id ||= rubyforge_info['package_ids'][package_name]
|
68
|
-
end
|
69
|
-
|
70
|
-
def prepare
|
71
|
-
unless @prepared
|
72
|
-
login
|
73
|
-
create_package
|
74
|
-
@prepared = true
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def login
|
79
|
-
sh "rubyforge login",
|
80
|
-
"rubyforge config"
|
81
|
-
end
|
82
|
-
|
83
|
-
def create_package
|
84
|
-
unless rubyforge_info['package_ids'].include? package_name
|
85
|
-
sh "rubyforge create_package #{group_id} #{package_name}"
|
86
|
-
rubyforge_info(true)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
end
|
data/lib/autotest/discover.rb
DELETED
data/lib/autotest/gm.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'autotest'
|
2
|
-
|
3
|
-
class Autotest # :nodoc:
|
4
|
-
|
5
|
-
class Gm < Autotest # :nodoc:
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
super
|
9
|
-
|
10
|
-
add_exception %r%^\./(?:doc|pkg)%
|
11
|
-
|
12
|
-
clear_mappings
|
13
|
-
|
14
|
-
self.add_mapping(/^lib\/.*\.rb$/) do |filename, _|
|
15
|
-
impl = File.basename(filename, '.rb')
|
16
|
-
files_matching %r%^test/#{impl}_test.rb$%
|
17
|
-
end
|
18
|
-
|
19
|
-
add_mapping %r%^test/.*rb$% do |filename, _|
|
20
|
-
filename
|
21
|
-
end
|
22
|
-
|
23
|
-
add_mapping %r%^test/test_helper.rb% do
|
24
|
-
files_matching %r%^test/.*_test\.rb$%
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def path_to_classname(s)
|
29
|
-
sep = File::SEPARATOR
|
30
|
-
f = s.sub(/^test#{sep}/, '').sub(/\.rb$/, '').split(sep)
|
31
|
-
f = f.map { |path| path.split(/_/).map { |seg| seg.capitalize }.join }
|
32
|
-
f = f.map { |path| path =~ /Test$/ ? path : "#{path}Test" }
|
33
|
-
f.join('::')
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|