firefox 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,23 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+ .document
21
+
22
+ ## PROJECT::SPECIFIC
23
+
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 wynst
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,23 @@
1
+ = firefox
2
+
3
+ Helper gem for Mozilla Firefox.
4
+
5
+ == Usage
6
+
7
+ require 'firefox'
8
+ Firefox::Profile.path
9
+
10
+ == Note on Patches/Pull Requests
11
+
12
+ * Fork the project.
13
+ * Make your feature addition or bug fix.
14
+ * Add tests for it. This is important so I don't break it in a
15
+ future version unintentionally.
16
+ * Commit, do not mess with rakefile, version, or history.
17
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
18
+ * Send me a pull request. Bonus points for topic branches.
19
+
20
+ == Copyright
21
+
22
+ Copyright (c) 2010 wynst. See LICENSE for details.
23
+
@@ -0,0 +1,55 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "firefox"
8
+ gem.summary = %Q{Helper gem for Mozilla Firefox.}
9
+ gem.description = %Q{Helper gem for Mozilla Firefox.}
10
+ gem.email = "wynst.uei@gmail.com"
11
+ gem.homepage = "http://github.com/wynst/firefox"
12
+ gem.authors = ["wynst"]
13
+ gem.add_development_dependency "shoulda", ">= 0"
14
+ gem.add_dependency "inifile", ">= 0"
15
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
+ end
17
+ Jeweler::GemcutterTasks.new
18
+ rescue LoadError
19
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
20
+ end
21
+
22
+ require 'rake/testtask'
23
+ Rake::TestTask.new(:test) do |test|
24
+ test.libs << 'lib' << 'test'
25
+ test.pattern = 'test/**/test_*.rb'
26
+ test.verbose = true
27
+ end
28
+
29
+ begin
30
+ require 'rcov/rcovtask'
31
+ Rcov::RcovTask.new do |test|
32
+ test.libs << 'test'
33
+ test.pattern = 'test/**/test_*.rb'
34
+ test.verbose = true
35
+ end
36
+ rescue LoadError
37
+ task :rcov do
38
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
39
+ end
40
+ end
41
+
42
+ task :test => :check_dependencies
43
+
44
+ task :default => :test
45
+
46
+ require 'rake/rdoctask'
47
+ Rake::RDocTask.new do |rdoc|
48
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
49
+
50
+ rdoc.rdoc_dir = 'rdoc'
51
+ rdoc.title = "firefox #{version}"
52
+ rdoc.rdoc_files.include('README*')
53
+ rdoc.rdoc_files.include('lib/**/*.rb')
54
+ end
55
+
data/VERSION ADDED
@@ -0,0 +1,2 @@
1
+ 0.1.0
2
+
@@ -0,0 +1,59 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{firefox}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["wynst"]
12
+ s.date = %q{2010-07-26}
13
+ s.description = %q{Helper gem for Mozilla Firefox.}
14
+ s.email = %q{wynst.uei@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".gitignore",
21
+ "LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "firefox.gemspec",
26
+ "lib/firefox.rb",
27
+ "lib/firefox/profile.rb",
28
+ "test/fixtures/many-profile.ini",
29
+ "test/fixtures/single-profile.ini",
30
+ "test/helper.rb",
31
+ "test/test_firefox.rb"
32
+ ]
33
+ s.homepage = %q{http://github.com/wynst/firefox}
34
+ s.rdoc_options = ["--charset=UTF-8"]
35
+ s.require_paths = ["lib"]
36
+ s.rubygems_version = %q{1.3.7}
37
+ s.summary = %q{Helper gem for Mozilla Firefox.}
38
+ s.test_files = [
39
+ "test/test_firefox.rb",
40
+ "test/helper.rb"
41
+ ]
42
+
43
+ if s.respond_to? :specification_version then
44
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
45
+ s.specification_version = 3
46
+
47
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
49
+ s.add_runtime_dependency(%q<inifile>, [">= 0"])
50
+ else
51
+ s.add_dependency(%q<shoulda>, [">= 0"])
52
+ s.add_dependency(%q<inifile>, [">= 0"])
53
+ end
54
+ else
55
+ s.add_dependency(%q<shoulda>, [">= 0"])
56
+ s.add_dependency(%q<inifile>, [">= 0"])
57
+ end
58
+ end
59
+
@@ -0,0 +1,2 @@
1
+ require 'firefox/profile'
2
+
@@ -0,0 +1,50 @@
1
+ require 'inifile'
2
+
3
+ module Firefox
4
+ module Profile
5
+ def self.path(profile = nil, inifile = nil)
6
+ # TODO: Add path for other OS
7
+ base_path = File.expand_path('~/.mozilla/firefox')
8
+
9
+ unless inifile
10
+ inifile = File.join(base_path, 'profiles.ini')
11
+ end
12
+
13
+ ini = IniFile.new(inifile)
14
+
15
+ sections = ini.sections.grep(/Profile/)
16
+ subpath = nil
17
+
18
+ if profile
19
+ sections.each do |section|
20
+ h = ini[section]
21
+
22
+ if h["Name"] == profile
23
+ subpath = h['Path']
24
+ break
25
+ end
26
+ end
27
+ # default profile
28
+ else
29
+ # if only has 1 profile, no Default parameter in section
30
+ if sections.length == 1
31
+ subpath = ini[sections.first]['Path']
32
+ elsif sections.length > 1
33
+ sections.each do |section|
34
+ h = ini[section]
35
+
36
+ if h.include?('Default') && h['Default'] == "1"
37
+ subpath = h['Path']
38
+ break
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+ subpath = (subpath.nil? ? '' : subpath)
45
+
46
+ File.join(base_path, subpath)
47
+ end
48
+ end
49
+ end
50
+
@@ -0,0 +1,14 @@
1
+ [General]
2
+ StartWithLastProfile=1
3
+
4
+ [Profile0]
5
+ Name=default
6
+ IsRelative=1
7
+ Path=2dpu5gr6.default
8
+ Default=1
9
+
10
+ [Profile1]
11
+ Name=develop
12
+ IsRelative=1
13
+ Path=dnsdm9go.develop
14
+
@@ -0,0 +1,8 @@
1
+ [General]
2
+ StartWithLastProfile=1
3
+
4
+ [Profile0]
5
+ Name=default
6
+ IsRelative=1
7
+ Path=2dpu5gr6.default
8
+
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'firefox'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,18 @@
1
+ require 'helper'
2
+
3
+ class TestFirefox < Test::Unit::TestCase
4
+
5
+ context "Single profile in profiles.ini" do
6
+ should "return profile path" do
7
+ assert_equal(File.expand_path('~/.mozilla/firefox/2dpu5gr6.default'), Firefox::Profile.path(nil, 'test/fixtures/single-profile.ini'))
8
+ end
9
+ end
10
+
11
+ context "Many profile in profiles.ini" do
12
+ should "return profile path" do
13
+ assert_equal(File.expand_path('~/.mozilla/firefox/2dpu5gr6.default'), Firefox::Profile.path(nil, 'test/fixtures/many-profile.ini'))
14
+ assert_equal(File.expand_path('~/.mozilla/firefox/dnsdm9go.develop'), Firefox::Profile.path('develop', 'test/fixtures/many-profile.ini'))
15
+ end
16
+ end
17
+ end
18
+
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: firefox
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - wynst
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-07-26 00:00:00 +07:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: shoulda
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :development
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: inifile
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ version: "0"
44
+ type: :runtime
45
+ version_requirements: *id002
46
+ description: Helper gem for Mozilla Firefox.
47
+ email: wynst.uei@gmail.com
48
+ executables: []
49
+
50
+ extensions: []
51
+
52
+ extra_rdoc_files:
53
+ - LICENSE
54
+ - README.rdoc
55
+ files:
56
+ - .gitignore
57
+ - LICENSE
58
+ - README.rdoc
59
+ - Rakefile
60
+ - VERSION
61
+ - firefox.gemspec
62
+ - lib/firefox.rb
63
+ - lib/firefox/profile.rb
64
+ - test/fixtures/many-profile.ini
65
+ - test/fixtures/single-profile.ini
66
+ - test/helper.rb
67
+ - test/test_firefox.rb
68
+ has_rdoc: true
69
+ homepage: http://github.com/wynst/firefox
70
+ licenses: []
71
+
72
+ post_install_message:
73
+ rdoc_options:
74
+ - --charset=UTF-8
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ segments:
83
+ - 0
84
+ version: "0"
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ segments:
91
+ - 0
92
+ version: "0"
93
+ requirements: []
94
+
95
+ rubyforge_project:
96
+ rubygems_version: 1.3.7
97
+ signing_key:
98
+ specification_version: 3
99
+ summary: Helper gem for Mozilla Firefox.
100
+ test_files:
101
+ - test/test_firefox.rb
102
+ - test/helper.rb