simonmenke-gm 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/gm_behaviors/author_behavior.rb +29 -0
- data/gm_behaviors/bin_files_behavior.rb +10 -0
- data/gm_behaviors/dependencies_behavior.rb +22 -0
- data/gm_behaviors/executables_behavior.rb +13 -0
- data/gm_behaviors/general_behavior.rb +41 -0
- data/gm_behaviors/github_behavior.rb +11 -0
- data/gm_behaviors/gm_files_behavior.rb +13 -0
- data/gm_behaviors/lib_files_behavior.rb +10 -0
- data/gm_behaviors/rails_behavior.rb +11 -0
- data/gm_behaviors/rdoc_behavior.rb +34 -0
- data/gm_behaviors/rspec_behavior.rb +10 -0
- data/gm_behaviors/rubigen_behavior.rb +13 -0
- data/gm_behaviors/rubyforge_behavior.rb +12 -0
- data/gm_behaviors/test_behavior.rb +10 -0
- data/gm_behaviors/text_files_behavior.rb +10 -0
- data/gm_commands/build_command.rb +1 -1
- data/gm_commands/build_gemspec_command.rb +30 -0
- data/gm_commands/config_command.rb +2 -2
- data/gm_commands/gen_command.rb +1 -1
- data/gm_commands/publish_command.rb +2 -2
- data/gm_commands/spec_command.rb +1 -1
- data/gm_generators/mit_license/templates/LICENSE.txt +1 -1
- data/gm_networks/github_network.rb +25 -3
- data/gm_networks/rubyforge_network.rb +18 -0
- data/lib/extentions/gem.rb +0 -11
- data/lib/gm.rb +4 -5
- data/lib/gm/app.rb +29 -18
- data/lib/gm/behavior.rb +23 -0
- data/lib/gm/command.rb +3 -7
- data/lib/gm/configuration.rb +20 -0
- data/lib/gm/helpers.rb +20 -0
- data/lib/gm/loader.rb +1 -1
- data/lib/gm/network.rb +2 -6
- data/test/gem_extentions_test.rb +0 -15
- metadata +45 -46
- data/gm_passes/clean_file_list.rb +0 -15
- data/gm_passes/configatron.rb +0 -92
- data/gm_passes/defaults.rb +0 -10
- data/gm_passes/executables.rb +0 -10
- data/gm_passes/files.rb +0 -15
- data/gm_passes/github.rb +0 -9
- data/gm_passes/gm.rb +0 -10
- data/gm_passes/rails.rb +0 -8
- data/gm_passes/rubigen.rb +0 -10
- data/gm_passes/specs.rb +0 -7
- data/gm_passes/test.rb +0 -7
- data/lib/extentions/configatron.rb +0 -17
- data/lib/gm/configuration_pass.rb +0 -58
- data/lib/gm/configuration_pass_queue.rb +0 -70
- data/lib/gm/dsl.rb +0 -45
- data/test/configatron_test.rb +0 -15
- data/test/configuration_pass_queue_test.rb +0 -56
- data/test/configuration_pass_test.rb +0 -24
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
class AuthorBehavior < GM::Behavior
|
3
|
+
|
4
|
+
specify_conf do |root|
|
5
|
+
|
6
|
+
root.map :author do |author|
|
7
|
+
author.should_be_present
|
8
|
+
|
9
|
+
author.conf(:name) do |name|
|
10
|
+
name.should_be_present
|
11
|
+
name.should_be_a String
|
12
|
+
name.should_not_be_empty
|
13
|
+
end
|
14
|
+
|
15
|
+
author.conf(:email) do |email|
|
16
|
+
email.should_be_present
|
17
|
+
email.should_be_a String
|
18
|
+
email.should_not_be_empty
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def run
|
25
|
+
spec.author = config[:author][:name]
|
26
|
+
spec.email = config[:author][:email]
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
class DependenciesBehavior < GM::Behavior
|
3
|
+
|
4
|
+
specify_conf do |root|
|
5
|
+
|
6
|
+
# root.list :dependencies do |dependency|
|
7
|
+
# dependency.conf do |c|
|
8
|
+
# c.should_be_a String
|
9
|
+
# c.should_not_be_empty
|
10
|
+
# end
|
11
|
+
# end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
def run
|
16
|
+
(config[:dependencies] || []).each do |dependency|
|
17
|
+
gem, requirement = dependency.strip.split(/\s+/, 2)
|
18
|
+
spec.add_dependency gem.strip, requirement.strip
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
class GeneralBehavior < GM::Behavior
|
3
|
+
|
4
|
+
specify_conf do |root|
|
5
|
+
|
6
|
+
root.map :general do |general|
|
7
|
+
general.should_be_present
|
8
|
+
|
9
|
+
general.conf(:name) do |s|
|
10
|
+
s.should_be_present
|
11
|
+
s.should_be_a String
|
12
|
+
s.should_not_be_empty
|
13
|
+
end
|
14
|
+
|
15
|
+
general.conf(:version) do |s|
|
16
|
+
s.should_be_present
|
17
|
+
s.should_be_a String
|
18
|
+
s.should_not_be_empty
|
19
|
+
end
|
20
|
+
|
21
|
+
general.conf(:summary) do |s|
|
22
|
+
s.should_be_a String
|
23
|
+
s.should_not_be_empty
|
24
|
+
end
|
25
|
+
|
26
|
+
general.conf(:homepage) do |s|
|
27
|
+
s.should_be_a String
|
28
|
+
s.should_not_be_empty
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def run
|
35
|
+
spec.name ||= config[:general][:name]
|
36
|
+
spec.version = config[:general][:version]
|
37
|
+
spec.summary = config[:general][:summary]
|
38
|
+
spec.homepage = config[:general][:homepage]
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
class GmFilesBehavior < GM::Behavior
|
3
|
+
|
4
|
+
desc "Collect all GM related files (generators, commands, networks, behaviors)"
|
5
|
+
|
6
|
+
def run
|
7
|
+
spec.files += Dir.glob('gm_commands/*_command.rb')
|
8
|
+
spec.files += Dir.glob('gm_behaviors/*_behavior.rb')
|
9
|
+
spec.files += Dir.glob('gm_networks/*_network.rb')
|
10
|
+
spec.files += Dir.glob('gm_generators/**/*')
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
class RdocBehavior < GM::Behavior
|
3
|
+
|
4
|
+
specify_conf do |root|
|
5
|
+
|
6
|
+
root.map :rdoc do |rdoc|
|
7
|
+
|
8
|
+
rdoc.conf(:enabled) do |s|
|
9
|
+
s.should_be_present
|
10
|
+
end
|
11
|
+
|
12
|
+
rdoc.conf(:extra_files) do |s|
|
13
|
+
end
|
14
|
+
|
15
|
+
rdoc.conf(:options) do |s|
|
16
|
+
s.should_be_a String
|
17
|
+
s.should_not_be_empty
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def run
|
25
|
+
if config[:rdoc] and config[:rdoc][:enabled]
|
26
|
+
spec.has_rdoc = true
|
27
|
+
spec.extra_rdoc_files = config[:rdoc][:extra_files]
|
28
|
+
spec.rdoc_options = config[:rdoc][:options]
|
29
|
+
else
|
30
|
+
spec.has_rdoc = false
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
class RubigenBehavior < GM::Behavior
|
3
|
+
|
4
|
+
desc "Collect rubigen files"
|
5
|
+
|
6
|
+
def run
|
7
|
+
paths = Dir.glob('*generators/**/*')
|
8
|
+
paths.reject! { |path| File.directory? path }
|
9
|
+
paths.reject! { |path| File.basename(path)[0,1] == "." }
|
10
|
+
spec.files += paths
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
class BuildGemspecCommand < GM::Command
|
3
|
+
|
4
|
+
def run
|
5
|
+
app.info "Generating your gemspec..."
|
6
|
+
app.gemspec = Gem::Specification.new
|
7
|
+
|
8
|
+
GM::Behavior.behaviors.each do |name,klass|
|
9
|
+
behavior = klass.new
|
10
|
+
behavior.run
|
11
|
+
end
|
12
|
+
|
13
|
+
clean_file_list
|
14
|
+
spec.validate
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def clean_file_list
|
20
|
+
spec.files.reject! { |path| File.directory? path }
|
21
|
+
spec.files.reject! { |path| File.basename(path) == '.DS_Store' }
|
22
|
+
spec.files.reject! { |path| File.basename(path) == '.gitignore' }
|
23
|
+
spec.files.reject! { |path| path.include? '/.svn' }
|
24
|
+
spec.files.reject! { |path| path.include? '/.git' }
|
25
|
+
spec.files.uniq!
|
26
|
+
spec.files.compact!
|
27
|
+
spec.files.sort!
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/gm_commands/gen_command.rb
CHANGED
@@ -11,7 +11,7 @@ class PublishCommand < GM::Command
|
|
11
11
|
DOC
|
12
12
|
|
13
13
|
def run
|
14
|
-
|
14
|
+
GM::Command.run(:build_gemspec)
|
15
15
|
|
16
16
|
networks = argv.collect do |network|
|
17
17
|
name = network.underscore.to_sym
|
@@ -19,7 +19,7 @@ class PublishCommand < GM::Command
|
|
19
19
|
klass.new unless klass.nil?
|
20
20
|
end.compact
|
21
21
|
|
22
|
-
version =
|
22
|
+
version = config[:general][:version]
|
23
23
|
networks.each do |network|
|
24
24
|
if network.has_version? version
|
25
25
|
GM.app.log "Skipping #{network.class.name} (version #{version} already present)"
|
data/gm_commands/spec_command.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) <%= DateTime.now.year %> <%=
|
1
|
+
Copyright (c) <%= DateTime.now.year %> <%= EC.store.config[:author][:name] %>
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person
|
4
4
|
obtaining a copy of this software and associated documentation
|
@@ -6,6 +6,28 @@ class GithubNetwork < GM::Network
|
|
6
6
|
This will dump the .gemspec file, create a new (optonaly signed) tag and push the master branch to github.
|
7
7
|
DOC
|
8
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
|
+
|
9
31
|
def publish
|
10
32
|
commit_gemspec
|
11
33
|
make_tag
|
@@ -26,8 +48,8 @@ class GithubNetwork < GM::Network
|
|
26
48
|
private
|
27
49
|
|
28
50
|
def make_tag
|
29
|
-
version =
|
30
|
-
key =
|
51
|
+
version = config[:general][:version]
|
52
|
+
key = config[:gpg][:key] if config[:gpg]
|
31
53
|
signing_options = if key.nil?
|
32
54
|
"-a"
|
33
55
|
else
|
@@ -37,7 +59,7 @@ class GithubNetwork < GM::Network
|
|
37
59
|
end
|
38
60
|
|
39
61
|
def commit_gemspec
|
40
|
-
version =
|
62
|
+
version = config[:general][:version]
|
41
63
|
GM::Command.run(:spec)
|
42
64
|
sh %{ git ci -m "Bumped to version #{version}" -o "#{app.gemspec.name}.gemspec" -o "Gmfile" }
|
43
65
|
end
|
@@ -0,0 +1,18 @@
|
|
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
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|