stickler 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,51 @@
1
+ require 'tasks/config'
2
+
3
+ #-----------------------------------------------------------------------
4
+ # Rubyforge additions to the task library
5
+ #-----------------------------------------------------------------------
6
+ if rf_conf = Configuration.for_if_exist?("rubyforge") then
7
+
8
+ abort("rubyforge gem not installed 'gem install rubyforge'") unless Utils.try_require('rubyforge')
9
+
10
+ proj_conf = Configuration.for('project')
11
+
12
+ namespace :dist do
13
+ desc "Release files to rubyforge"
14
+ task :rubyforge => [:clean, :package] do
15
+
16
+ rubyforge = RubyForge.new
17
+
18
+ config = {}
19
+ config["release_notes"] = proj_conf.description
20
+ config["release_changes"] = Utils.release_notes_from(proj_conf.history)[Stickler::VERSION]
21
+ config["Prefomatted"] = true
22
+
23
+ rubyforge.configure
24
+
25
+ # make sure this release doesn't already exist
26
+ releases = rubyforge.autoconfig['release_ids']
27
+ if releases.has_key?(Stickler::GEM_SPEC.name) and releases[Stickler::GEM_SPEC.name][Stickler::VERSION] then
28
+ abort("Release #{Stickler::VERSION} already exists! Unable to release.")
29
+ end
30
+
31
+ puts "Uploading to rubyforge..."
32
+ files = FileList[File.join("pkg","#{Stickler::GEM_SPEC.name}-#{Stickler::VERSION}*.*")].to_a
33
+ rubyforge.login
34
+ rubyforge.add_release(Stickler::GEM_SPEC.rubyforge_project, Stickler::GEM_SPEC.name, Stickler::VERSION, *files)
35
+ puts "done."
36
+ end
37
+ end
38
+
39
+ namespace :announce do
40
+ desc "Post news of #{proj_conf.name} to #{rf_conf.project} on rubyforge"
41
+ task :rubyforge do
42
+ info = Utils.announcement
43
+ rubyforge = RubyForge.new
44
+ rubyforge.configure
45
+ rubyforge.login
46
+ rubyforge.post_news(rf_conf.project, info[:subject], "#{info[:title]}\n\n#{info[:urls]}\n\n#{info[:release_notes]}")
47
+ puts "Posted to rubyforge"
48
+ end
49
+
50
+ end
51
+ end
data/tasks/utils.rb ADDED
@@ -0,0 +1,80 @@
1
+ require 'stickler/version'
2
+
3
+ #-------------------------------------------------------------------------------
4
+ # Additions to the Configuration class that are useful
5
+ #-------------------------------------------------------------------------------
6
+ class Configuration
7
+ class << self
8
+ def exist?( name )
9
+ Configuration::Table.has_key?( name )
10
+ end
11
+
12
+ def for_if_exist?( name )
13
+ if self.exist?( name ) then
14
+ self.for( name )
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ #-------------------------------------------------------------------------------
21
+ # some useful utilitiy methods for the tasks
22
+ #-------------------------------------------------------------------------------
23
+ module Utils
24
+ class << self
25
+
26
+ # Try to load the given _library_ using the built-in require, but do not
27
+ # raise a LoadError if unsuccessful. Returns +true+ if the _library_ was
28
+ # successfully loaded; returns +false+ otherwise.
29
+ #
30
+ def try_require( lib )
31
+ require lib
32
+ true
33
+ rescue LoadError
34
+ false
35
+ end
36
+
37
+ # partition an rdoc file into sections, and return the text of the section
38
+ # given.
39
+ def section_of(file, section_name)
40
+ File.read(file).split(/^(?==)/).each do |section|
41
+ lines = section.split("\n")
42
+ return lines[1..-1].join("\n").strip if lines.first =~ /#{section_name}/i
43
+ end
44
+ nil
45
+ end
46
+
47
+ # Get an array of all the changes in the application for a particular
48
+ # release. This is done by looking in the history file and grabbing the
49
+ # information for the most recent release. The history file is assumed to
50
+ # be in RDoc format and version release are 2nd tier sections separated by
51
+ # '== Version X.Y.Z'
52
+ #
53
+ # returns:: A hash of notes keyed by version number
54
+ #
55
+ def release_notes_from(history_file)
56
+ releases = {}
57
+ File.read(history_file).split(/^(?==)/).each do |section|
58
+ lines = section.split("\n")
59
+ md = %r{Version ((\w+\.)+\w+)}.match(lines.first)
60
+ next unless md
61
+ releases[md[1]] = lines[1..-1].join("\n").strip
62
+ end
63
+ return releases
64
+ end
65
+
66
+ # return a hash of useful information for the latest release
67
+ # urls, subject, title, description and latest release notes
68
+ #
69
+ def announcement
70
+ cfg = Configuration.for("project")
71
+ {
72
+ :subject => "#{cfg.name} #{Stickler::VERSION} Released",
73
+ :title => "#{cfg.name} version #{Stickler::VERSION} has been released.",
74
+ :urls => "#{cfg.homepage}",
75
+ :description => "#{cfg.description.rstrip}",
76
+ :release_notes => Utils.release_notes_from(cfg.history)[Stickler::VERSION].rstrip
77
+ }
78
+ end
79
+ end
80
+ end # << self
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stickler
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jeremy Hinegardner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-10-09 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: highline
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: "1.4"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: logging
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: "0.9"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: main
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: "2.8"
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: rake
47
+ type: :development
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: "0.8"
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ type: :development
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ~>
62
+ - !ruby/object:Gem::Version
63
+ version: "1.1"
64
+ version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: configuration
67
+ type: :development
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ~>
72
+ - !ruby/object:Gem::Version
73
+ version: "0.0"
74
+ version:
75
+ description: Stickler is a tool to organize and maintain an internal gem distribution. At times it is useful to have complete control over the availability of the gems for you testing, staging and production environments. In these cases you probably do not want to accidentally type 'gem update' and get a new untested version of a gem installed on your machines. This is where Stickler helps. Configure stickler with the the names and versions of the gems you require for your deployment and it will organize and setup everything that is necessary for a standard web server to function as your internal gem distribution server.
76
+ email: jeremy at copiousfreetime dot org
77
+ executables:
78
+ - stickler
79
+ extensions: []
80
+
81
+ extra_rdoc_files:
82
+ - README
83
+ - HISTORY
84
+ - LICENSE
85
+ - COPYING
86
+ - lib/stickler/cli.rb
87
+ - lib/stickler/configuration.rb
88
+ - lib/stickler/console.rb
89
+ - lib/stickler/paths.rb
90
+ - lib/stickler/repository.rb
91
+ - lib/stickler/source.rb
92
+ - lib/stickler/source_group.rb
93
+ - lib/stickler/spec_lite.rb
94
+ - lib/stickler/version.rb
95
+ - lib/stickler.rb
96
+ files:
97
+ - bin/stickler
98
+ - lib/stickler/cli.rb
99
+ - lib/stickler/configuration.rb
100
+ - lib/stickler/console.rb
101
+ - lib/stickler/paths.rb
102
+ - lib/stickler/repository.rb
103
+ - lib/stickler/source.rb
104
+ - lib/stickler/source_group.rb
105
+ - lib/stickler/spec_lite.rb
106
+ - lib/stickler/version.rb
107
+ - lib/stickler.rb
108
+ - spec/configuration_spec.rb
109
+ - spec/paths_spec.rb
110
+ - spec/repository_spec.rb
111
+ - spec/spec_helper.rb
112
+ - spec/version_spec.rb
113
+ - data/stickler.yml
114
+ - README
115
+ - HISTORY
116
+ - LICENSE
117
+ - COPYING
118
+ - tasks/announce.rake
119
+ - tasks/distribution.rake
120
+ - tasks/documentation.rake
121
+ - tasks/rspec.rake
122
+ - tasks/rubyforge.rake
123
+ - tasks/config.rb
124
+ - tasks/utils.rb
125
+ - gemspec.rb
126
+ has_rdoc: true
127
+ homepage: http://copiousfreetime.rubyforge.org/stickler
128
+ post_install_message: " ============================================================\n \n Thank you for installing Stickler!\n\n * Create a new stickler repository:\n stickler setup /path/to/repo\n\n * Look at the help:\n stickler help\n\n ============================================================\n"
129
+ rdoc_options:
130
+ - --line-numbers
131
+ - --inline-source
132
+ - --main
133
+ - README
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: "0"
141
+ version:
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: 1.2.0
147
+ version:
148
+ requirements: []
149
+
150
+ rubyforge_project: copiousfreetime
151
+ rubygems_version: 1.2.0
152
+ signing_key:
153
+ specification_version: 2
154
+ summary: Stickler is a tool to organize and maintain an internal gem distribution
155
+ test_files: []
156
+