launchy 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,80 @@
1
+ require 'launchy/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(/^(?=== Version)/).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} #{Launchy::VERSION} Released",
73
+ :title => "#{cfg.name} version #{Launchy::VERSION} has been released.",
74
+ :urls => "#{cfg.homepage}",
75
+ :description => "#{cfg.description.rstrip}",
76
+ :release_notes => Utils.release_notes_from(cfg.history)[Launchy::VERSION].rstrip
77
+ }
78
+ end
79
+ end
80
+ end # << self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: launchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Hinegardner
@@ -9,37 +9,71 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-21 00:00:00 -06:00
13
- default_executable: launchy
14
- dependencies: []
15
-
16
- description: Launchy is helper class for launching cross-platform applications in a fire and forget manner. There are application concepts (browser, email client, etc) that are common across all platforms, and they may be launched differently on each platform. Launchy is here to make a common approach to launching external application from within ruby programs.
17
- email: jeremy@hinegardner.org
12
+ date: 2009-02-19 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rake
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.8.1
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: configuration
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.5
34
+ version:
35
+ description: Launchy is helper class for launching cross-platform applications in a fire and forget manner. There are application concepts (browser, email client, etc) that are common across all platforms, and they may be launched differently on each platform. Launchy is here to make a common approach to launching external application from within ruby programs.
36
+ email: jeremy@copiousfreetime.org
18
37
  executables:
19
38
  - launchy
20
39
  extensions: []
21
40
 
22
41
  extra_rdoc_files:
23
- - CHANGES
24
- - LICENSE
25
42
  - README
26
- files:
27
- - spec/application_spec.rb
28
- - spec/browser_spec.rb
29
- - spec/launchy_spec.rb
30
- - spec/spec_helper.rb
31
- - spec/version_spec.rb
32
- - CHANGES
43
+ - HISTORY
33
44
  - LICENSE
34
- - README
35
45
  - lib/launchy/application.rb
36
46
  - lib/launchy/browser.rb
37
47
  - lib/launchy/command_line.rb
38
- - lib/launchy/gemspec.rb
39
- - lib/launchy/specification.rb
48
+ - lib/launchy/paths.rb
40
49
  - lib/launchy/version.rb
41
50
  - lib/launchy.rb
51
+ files:
42
52
  - bin/launchy
53
+ - lib/launchy/application.rb
54
+ - lib/launchy/browser.rb
55
+ - lib/launchy/command_line.rb
56
+ - lib/launchy/paths.rb
57
+ - lib/launchy/version.rb
58
+ - lib/launchy.rb
59
+ - spec/application_spec.rb
60
+ - spec/browser_spec.rb
61
+ - spec/launchy_spec.rb
62
+ - spec/paths_spec.rb
63
+ - spec/spec_helper.rb
64
+ - spec/version_spec.rb
65
+ - README
66
+ - HISTORY
67
+ - LICENSE
68
+ - tasks/announce.rake
69
+ - tasks/distribution.rake
70
+ - tasks/documentation.rake
71
+ - tasks/rspec.rake
72
+ - tasks/rubyforge.rake
73
+ - tasks/config.rb
74
+ - tasks/utils.rb
75
+ - Rakefile
76
+ - gemspec.rb
43
77
  has_rdoc: true
44
78
  homepage: http://copiousfreetime.rubyforge.org/launchy/
45
79
  post_install_message:
@@ -48,15 +82,13 @@ rdoc_options:
48
82
  - --inline-source
49
83
  - --main
50
84
  - README
51
- - --title
52
- - "'launchy -- A helper to launch apps from within ruby programs.'"
53
85
  require_paths:
54
86
  - lib
55
87
  required_ruby_version: !ruby/object:Gem::Requirement
56
88
  requirements:
57
89
  - - ">="
58
90
  - !ruby/object:Gem::Version
59
- version: 1.8.5
91
+ version: "0"
60
92
  version:
61
93
  required_rubygems_version: !ruby/object:Gem::Requirement
62
94
  requirements:
@@ -67,13 +99,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
99
  requirements: []
68
100
 
69
101
  rubyforge_project: copiousfreetime
70
- rubygems_version: 1.1.1
102
+ rubygems_version: 1.3.1
71
103
  signing_key:
72
104
  specification_version: 2
73
- summary: A helper to launch apps from within ruby programs.
74
- test_files:
75
- - spec/application_spec.rb
76
- - spec/browser_spec.rb
77
- - spec/launchy_spec.rb
78
- - spec/spec_helper.rb
79
- - spec/version_spec.rb
105
+ summary: Launchy is helper class for launching cross-platform applications in a fire and forget manner
106
+ test_files: []
107
+
@@ -1,53 +0,0 @@
1
- require 'rubygems'
2
- require 'launchy/specification'
3
- require 'launchy/version'
4
- require 'rake'
5
-
6
- # The Gem Specification plus some extras for launchy.
7
- module Launchy
8
- SPEC = Launchy::Specification.new do |spec|
9
- spec.name = "launchy"
10
- spec.version = Launchy::VERSION
11
- spec.rubyforge_project = "copiousfreetime"
12
- spec.author = "Jeremy Hinegardner"
13
- spec.email = "jeremy@hinegardner.org"
14
- spec.homepage = "http://copiousfreetime.rubyforge.org/launchy/"
15
-
16
- spec.summary = "A helper to launch apps from within ruby programs."
17
- spec.description = <<-DESC
18
- Launchy is helper class for launching cross-platform applications in a
19
- fire and forget manner.
20
-
21
- There are application concepts (browser, email client, etc) that are common
22
- across all platforms, and they may be launched differently on each
23
- platform. Launchy is here to make a common approach to launching
24
- external application from within ruby programs.
25
-
26
- DESC
27
-
28
- spec.extra_rdoc_files = FileList["CHANGES", "LICENSE", "README"]
29
- spec.has_rdoc = true
30
- spec.rdoc_main = "README"
31
- spec.rdoc_options = [ "--line-numbers" , "--inline-source" ]
32
-
33
- spec.test_files = FileList["spec/**/*.rb", "test/**/*.rb"]
34
- spec.files = spec.test_files + spec.extra_rdoc_files +
35
- FileList["lib/**/*.rb", "resources/**/*"]
36
-
37
- spec.executable = spec.name
38
-
39
- spec.platform = Gem::Platform::RUBY
40
- spec.required_ruby_version = ">= 1.8.5"
41
-
42
- spec.local_rdoc_dir = "doc/rdoc"
43
- spec.remote_rdoc_dir = ""
44
- spec.local_coverage_dir = "doc/coverage"
45
- spec.remote_coverage_dir= "coverage"
46
-
47
- spec.remote_user = "jjh"
48
- spec.remote_site_dir = "#{spec.name}/"
49
-
50
- end
51
- end
52
-
53
-
@@ -1,133 +0,0 @@
1
- require 'rubygems'
2
- require 'rubygems/specification'
3
- require 'rake'
4
-
5
- module Launchy
6
- # Add some additional items to Gem::Specification
7
- # A Launchy::Specification adds additional pieces of information the
8
- # typical gem specification
9
- class Specification
10
-
11
- RUBYFORGE_ROOT = "/var/www/gforge-projects/"
12
-
13
- # user that accesses remote site
14
- attr_accessor :remote_user
15
-
16
- # remote host, default 'rubyforge.org'
17
- attr_accessor :remote_host
18
-
19
- # name the rdoc main
20
- attr_accessor :rdoc_main
21
-
22
- # local directory in development holding the generated rdoc
23
- # default 'doc'
24
- attr_accessor :local_rdoc_dir
25
-
26
- # remote directory for storing rdoc, default 'doc'
27
- attr_accessor :remote_rdoc_dir
28
-
29
- # local directory for coverage report
30
- attr_accessor :local_coverage_dir
31
-
32
- # remote directory for storing coverage reports
33
- # This defaults to 'coverage'
34
- attr_accessor :remote_coverage_dir
35
-
36
- # local directory for generated website, default +site/public+
37
- attr_accessor :local_site_dir
38
-
39
- # remote directory relative to +remote_root+ for the website.
40
- # website.
41
- attr_accessor :remote_site_dir
42
-
43
- # is a .tgz to be created?, default 'true'
44
- attr_accessor :need_tar
45
-
46
- # is a .zip to be created, default 'true'
47
- attr_accessor :need_zip
48
-
49
-
50
- def initialize
51
- @remote_user = nil
52
- @remote_host = "rubyforge.org"
53
-
54
- @rdoc_main = "README"
55
- @local_rdoc_dir = "doc"
56
- @remote_rdoc_dir = "doc"
57
- @local_coverage_dir = "coverage"
58
- @remote_coverage_dir = "coverage"
59
- @local_site_dir = "site/public"
60
- @remote_site_dir = "."
61
-
62
- @need_tar = true
63
- @need_zip = true
64
-
65
- @spec = Gem::Specification.new
66
-
67
- yield self if block_given?
68
-
69
- # update rdoc options to take care of the rdoc_main if it is
70
- # there, and add a default title if one is not given
71
- if not @spec.rdoc_options.include?("--main") then
72
- @spec.rdoc_options.concat(["--main", rdoc_main])
73
- end
74
-
75
- if not @spec.rdoc_options.include?("--title") then
76
- @spec.rdoc_options.concat(["--title","'#{name} -- #{summary}'"])
77
- end
78
- end
79
-
80
- # if this gets set then it overwrites what would be the
81
- # rubyforge default. If rubyforge project is not set then use
82
- # name. If rubyforge project and name are set, but they are
83
- # different then assume that name is a subproject of the
84
- # rubyforge project
85
- def remote_root
86
- if rubyforge_project.nil? or
87
- rubyforge_project == name then
88
- return RUBYFORGE_ROOT + "#{name}/"
89
- else
90
- return RUBYFORGE_ROOT + "#{rubyforge_project}/#{name}/"
91
- end
92
- end
93
-
94
- # rdoc files is the same as what would be generated during gem
95
- # installation. That is, everything in the require paths plus
96
- # the rdoc_extra_files
97
- #
98
- def rdoc_files
99
- flist = extra_rdoc_files.dup
100
- @spec.require_paths.each do |rp|
101
- flist << FileList["#{rp}/**/*.rb"]
102
- end
103
- flist.flatten.uniq
104
- end
105
-
106
- # calculate the remote directories
107
- def remote_root_location
108
- "#{remote_user}@#{remote_host}:#{remote_root}"
109
- end
110
-
111
- def remote_rdoc_location
112
- remote_root_location + @remote_rdoc_dir
113
- end
114
-
115
- def remote_coverage_location
116
- remote_root_loation + @remote_coverage_dir
117
- end
118
-
119
- def remote_site_location
120
- remote_root_location + @remote_site_dir
121
- end
122
-
123
- # we delegate any other calls to spec
124
- def method_missing(method_id,*params,&block)
125
- @spec.send method_id, *params, &block
126
- end
127
-
128
- # deep copy for duplication
129
- def dup
130
- Marshal.load(Marshal.dump(self))
131
- end
132
- end
133
- end