launchy 0.4.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/.autotest +28 -0
  2. data/HISTORY +15 -0
  3. data/LICENSE +1 -1
  4. data/NOTES +1 -0
  5. data/README +6 -6
  6. data/Rakefile +47 -51
  7. data/bin/launchy +2 -10
  8. data/lib/launchy.rb +96 -30
  9. data/lib/launchy/application.rb +55 -152
  10. data/lib/launchy/applications/browser.rb +68 -0
  11. data/lib/launchy/cli.rb +70 -0
  12. data/lib/launchy/descendant_tracker.rb +49 -0
  13. data/lib/launchy/detect.rb +10 -0
  14. data/lib/launchy/detect/host_os.rb +31 -0
  15. data/lib/launchy/detect/host_os_family.rb +71 -0
  16. data/lib/launchy/detect/nix_desktop_environment.rb +60 -0
  17. data/lib/launchy/detect/ruby_engine.rb +78 -0
  18. data/lib/launchy/detect/runner.rb +96 -0
  19. data/lib/launchy/error.rb +4 -0
  20. data/lib/launchy/os_family.rb +8 -0
  21. data/lib/launchy/version.rb +8 -7
  22. data/spec/application_spec.rb +26 -47
  23. data/spec/detect/host_os_family_spec.rb +40 -0
  24. data/spec/detect/host_os_spec.rb +19 -0
  25. data/spec/detect/nix_desktop_environment_spec.rb +13 -0
  26. data/spec/detect/ruby_engine_spec.rb +37 -0
  27. data/spec/launchy_spec.rb +29 -5
  28. data/spec/mock_scheme.rb +5 -0
  29. data/spec/spec_helper.rb +3 -3
  30. data/spec/{tattle-host-os.yml → tattle-host-os.yaml} +0 -0
  31. data/spec/version_spec.rb +4 -5
  32. metadata +67 -78
  33. data/gemspec.rb +0 -46
  34. data/lib/launchy/browser.rb +0 -98
  35. data/lib/launchy/command_line.rb +0 -48
  36. data/lib/launchy/paths.rb +0 -53
  37. data/spec/browser_spec.rb +0 -62
  38. data/spec/paths_spec.rb +0 -15
  39. data/tasks/announce.rake +0 -39
  40. data/tasks/config.rb +0 -107
  41. data/tasks/distribution.rake +0 -46
  42. data/tasks/documentation.rake +0 -32
  43. data/tasks/rspec.rake +0 -25
  44. data/tasks/rubyforge.rake +0 -52
  45. data/tasks/utils.rb +0 -80
@@ -1,46 +0,0 @@
1
- require 'tasks/config'
2
-
3
- #-------------------------------------------------------------------------------
4
- # Distribution and Packaging
5
- #-------------------------------------------------------------------------------
6
- if pkg_config = Configuration.for_if_exist?("packaging") then
7
-
8
- require 'gemspec'
9
- require 'rake/gempackagetask'
10
- require 'rake/contrib/sshpublisher'
11
-
12
- namespace :dist do
13
-
14
- Rake::GemPackageTask.new(Launchy::GEM_SPEC) do |pkg|
15
- pkg.need_tar = pkg_config.formats.tgz
16
- pkg.need_zip = pkg_config.formats.zip
17
- end
18
-
19
- desc "Install as a gem"
20
- task :install => [:clobber, :package] do
21
- sh "sudo gem install pkg/#{Launchy::GEM_SPEC.full_name}.gem"
22
- end
23
-
24
- desc "Uninstall gem"
25
- task :uninstall do
26
- sh "sudo gem uninstall -x #{Launchy::GEM_SPEC.name}"
27
- end
28
-
29
- desc "dump gemspec"
30
- task :gemspec do
31
- puts Launchy::GEM_SPEC.to_ruby
32
- end
33
-
34
- desc "reinstall gem"
35
- task :reinstall => [:uninstall, :repackage, :install]
36
-
37
- desc "distribute copiously"
38
- task :copious => :package do
39
- gems = [ "#{Launchy::GEM_SPEC.full_name}.gem" ]
40
- Rake::SshFilePublisher.new('jeremy@copiousfreetime.org',
41
- '/var/www/vhosts/www.copiousfreetime.org/htdocs/gems/gems',
42
- 'pkg', *gems).upload
43
- sh "ssh jeremy@copiousfreetime.org rake -f /var/www/vhosts/www.copiousfreetime.org/htdocs/gems/Rakefile"
44
- end
45
- end
46
- end
@@ -1,32 +0,0 @@
1
- require 'tasks/config'
2
-
3
- #-----------------------------------------------------------------------
4
- # Documentation
5
- #-----------------------------------------------------------------------
6
-
7
- if rdoc_config = Configuration.for_if_exist?('rdoc') then
8
-
9
- namespace :doc do
10
-
11
- require 'rdoc'
12
- require 'rake/rdoctask'
13
-
14
- # generating documentation locally
15
- Rake::RDocTask.new do |rdoc|
16
- rdoc.rdoc_dir = rdoc_config.output_dir
17
- rdoc.options = rdoc_config.options
18
- rdoc.rdoc_files = rdoc_config.files.sort
19
- rdoc.title = rdoc_config.title
20
- rdoc.main = rdoc_config.main_page
21
- end
22
-
23
- if rubyforge_config = Configuration.for_if_exist?('rubyforge') then
24
- desc "Deploy the RDoc documentation to #{rubyforge_config.rdoc_location}"
25
- task :deploy => :rerdoc do
26
- sh "rsync -zav --delete #{rdoc_config.output_dir}/ #{rubyforge_config.rdoc_location}"
27
- end
28
- end
29
-
30
- end
31
- end
32
-
@@ -1,25 +0,0 @@
1
-
2
- require 'tasks/config'
3
-
4
- #--------------------------------------------------------------------------------
5
- # configuration for running rspec. This shows up as the test:default task
6
- #--------------------------------------------------------------------------------
7
- if spec_config = Configuration.for_if_exist?("test") then
8
- if spec_config.mode == "spec" then
9
- namespace :test do
10
-
11
- task :default => :spec
12
-
13
- require 'rspec/core/rake_task'
14
- rs = RSpec::Core::RakeTask.new do |r|
15
- r.ruby_opts = spec_config.ruby_opts
16
- r.rspec_opts = spec_config.options
17
-
18
- if rcov_config = Configuration.for_if_exist?('rcov') then
19
- r.rcov = false
20
- r.rcov_opts = rcov_config.rcov_opts
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,52 +0,0 @@
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)[Launchy::VERSION]
21
- config["Prefomatted"] = true
22
-
23
-
24
- rubyforge.configure config
25
-
26
- # make sure this release doesn't already exist
27
- releases = rubyforge.autoconfig['release_ids']
28
- if releases.has_key?(Launchy::GEM_SPEC.name) and releases[Launchy::GEM_SPEC.name][Launchy::VERSION] then
29
- abort("Release #{Launchy::VERSION} already exists! Unable to release.")
30
- end
31
-
32
- puts "Uploading to rubyforge..."
33
- files = FileList[File.join("pkg","#{Launchy::GEM_SPEC.name}-#{Launchy::VERSION}*.*")].to_a
34
- rubyforge.login
35
- rubyforge.add_release(Launchy::GEM_SPEC.rubyforge_project, Launchy::GEM_SPEC.name, Launchy::VERSION, *files)
36
- puts "done."
37
- end
38
- end
39
-
40
- namespace :announce do
41
- desc "Post news of #{proj_conf.name} to #{rf_conf.project} on rubyforge"
42
- task :rubyforge do
43
- info = Utils.announcement
44
- rubyforge = RubyForge.new
45
- rubyforge.configure
46
- rubyforge.login
47
- rubyforge.post_news(rf_conf.project, info[:subject], "#{info[:title]}\n\n#{info[:urls]}\n\n#{info[:release_notes]}")
48
- puts "Posted to rubyforge"
49
- end
50
-
51
- end
52
- end
@@ -1,80 +0,0 @@
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