smartermeter 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0 (March 14th, 2011)
4
+ * Added a Windows version of SmarterMeter which runs from the taskbar
5
+ and provides a wizard for easy configuration.
6
+ * Upgraded Mechanize to the latest released version.
7
+
3
8
  ## 0.2.1 (January 25th, 2011)
4
9
  * Fixed bugs in the sample parser
5
10
 
data/Gemfile CHANGED
@@ -3,3 +3,4 @@ gemspec
3
3
 
4
4
  # Used only in the Java client, which isn't distributed as a gem
5
5
  gem "profligacy"
6
+ gem "jruby-openssl"
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2009 - 2011: Matt Colyer
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -35,17 +35,18 @@ PowerMeter.
35
35
  :token: "your-token"
36
36
  :variable: "your-path-with.d1-appended"
37
37
 
38
- To Build
38
+ To Build the Windows Installer
39
39
  --------
40
40
 
41
- In order to build the self contained binaries, you'll need a working jruby interpreter.
41
+ In order to build the self contained binaries, you'll need Java 1.6 and
42
+ (NSIS)[1], both are available as packages in Ubuntu.
42
43
 
43
44
  git clone git://github.com/mcolyer/smartermeter.git
44
45
  cd smartermeter
45
- rake rawr:prepare
46
- rake rawr:bundle:exe # builds a windows executable
47
- rake rawr:bundle:app # builds an OSX executable
48
- rake build # builds a ruby gem
46
+ bundle install --path vendor/gems --without test
47
+ rake package
48
+
49
+ The installer will be generated in pkg/
49
50
 
50
51
  Questions
51
52
  ---------
@@ -63,3 +64,13 @@ Questions
63
64
  * How can I help?
64
65
 
65
66
  Make sure it works, make cool things with it or send me git pull requests.
67
+
68
+ Sponsorship
69
+ -----------
70
+
71
+ I would like to thank [Brighter Planet][2] for including SmarterMeter as part
72
+ of their [Fellowship Program][3]
73
+
74
+ [1]: http://nsis.sourceforge.net/
75
+ [2]: http://brighterplanet.com/
76
+ [3]: http://brighterplanet.github.com/fellowship.html
data/Rakefile CHANGED
@@ -48,7 +48,7 @@ task :default => :test
48
48
  require 'rake/testtask'
49
49
  Rake::TestTask.new(:test) do |test|
50
50
  test.libs << 'lib' << 'test'
51
- test.pattern = 'specs/*_spec.rb'
51
+ test.pattern = 'specs/**/*_spec.rb'
52
52
  test.verbose = true
53
53
  end
54
54
 
@@ -79,41 +79,90 @@ end
79
79
  #
80
80
  #############################################################################
81
81
 
82
- require 'rawr'
83
-
84
- namespace :rawr do
85
- task :prepare do
86
- dir = File.join(File.dirname(__FILE__), "vendor", "gems")
87
- FileUtils.rm_rf(dir)
88
- FileUtils.mkdir_p(dir)
89
- ["nokogiri", "mechanize", "crypt", "profligacy"].each do |gem|
90
- `gem unpack -t "#{dir}" #{gem}`
91
- end
92
-
93
- # Rawr can't handle folders with dashes in the name, so we'll remove the
94
- # version numbers from the gems.
95
- Dir.glob(File.join(dir, "*-*")).each do |gem|
96
- no_version = File.basename(gem).split("-")[0] + ".old"
97
- FileUtils.mv(gem, File.join(dir, no_version))
98
- end
99
-
100
- Dir.glob(File.join(dir, "nokogiri.old", "lib", "*")).each do |file|
101
- FileUtils.mv(file, File.join(dir))
102
- end
103
- Dir.glob(File.join(dir, "profligacy.old", "lib", "*")).each do |file|
104
- FileUtils.mv(file, File.join(dir))
105
- end
106
- FileUtils.mv(File.join(dir, "crypt.old", "crypt"), File.join(dir, "crypt"))
107
- Dir.glob(File.join(dir, "mechanize.old", "lib", "*")).each do |file|
108
- FileUtils.mv(file, File.join(dir))
109
- end
110
-
111
- Dir.glob(File.join(dir, "*.old")).each do |gem|
112
- FileUtils.rm_rf(gem)
113
- end
82
+ task :fetch_jruby do
83
+ require 'net/http'
84
+ require 'uri'
85
+
86
+ dir = File.join(File.dirname(__FILE__), "pkg", "base")
87
+ jar_file = File.join(dir, "jruby-complete.jar")
88
+ FileUtils.mkdir_p(dir)
89
+ unless File.exists?(jar_file)
90
+ jruby_url = "http://jruby.org.s3.amazonaws.com/downloads/1.6.0.RC2/jruby-complete-1.6.0.RC2.jar"
91
+ puts "Fetching JRuby"
92
+ File.open(jar_file, "wb") { |f| f.write(Net::HTTP.get(URI.parse(jruby_url))) }
93
+ puts "Fetched JRuby"
114
94
  end
115
95
  end
116
96
 
97
+ task :fetch_launch4j do
98
+ require 'net/http'
99
+ require 'uri'
100
+ require 'zlib'
101
+ require 'bundler'
102
+ Bundler.setup
103
+ require 'archive/tar/minitar'
104
+
105
+ dir = File.join(File.dirname(__FILE__), "installer")
106
+ tgz_file = File.join(dir, "launch4j-3.0.2-linux.tgz")
107
+ FileUtils.mkdir_p(dir)
108
+ unless File.exists?(tgz_file)
109
+ launch4j_url = "http://softlayer.dl.sourceforge.net/project/launch4j/launch4j-3/3.0.2/launch4j-3.0.2-linux.tgz"
110
+ puts "Fetching Launch4J"
111
+ File.open(tgz_file, "wb") { |f| f.write(Net::HTTP.get(URI.parse(launch4j_url))) }
112
+ puts "Fetched Launch4J"
113
+ puts "Extracting Launch4J"
114
+ tgz = Zlib::GzipReader.new(File.open(tgz_file, 'rb'))
115
+ Archive::Tar::Minitar.unpack(tgz, dir)
116
+ puts "Extracted Launch4J"
117
+ end
118
+ end
119
+
120
+ task :package_gems do
121
+ specifications = Dir.glob(File.join(File.dirname(__FILE__), "vendor", "gems", "jruby", "1.8", "specifications", "*"))
122
+ specifications.reject! { |s| s.include? "rspec" }
123
+ dest_dir = File.join(File.dirname(__FILE__), "pkg", "base", "gems", "specifications")
124
+ FileUtils.rm_rf(dest_dir)
125
+ FileUtils.mkdir_p(dest_dir)
126
+ FileUtils.cp_r(specifications, dest_dir)
127
+
128
+ gems = Dir.glob(File.join(File.dirname(__FILE__), "vendor", "gems", "jruby", "1.8", "gems", "*"))
129
+ gems.reject! { |s| s.include? "rspec" }
130
+ dest_dir = File.join(File.dirname(__FILE__), "pkg", "base", "gems", "gems")
131
+ FileUtils.rm_rf(dest_dir)
132
+ FileUtils.mkdir_p(dest_dir)
133
+ FileUtils.cp_r(gems, dest_dir)
134
+ end
135
+
136
+ task :create_launcher do
137
+ configuration = File.join(File.dirname(__FILE__), "installer", "launch4j.xml")
138
+ `installer/launch4j/launch4j #{configuration}`
139
+ end
140
+
141
+ task :copy_smartermeter do
142
+ src_dir = File.join(File.dirname(__FILE__), "lib")
143
+ dest_dir = File.join(File.dirname(__FILE__), "pkg", "base", "gems", "gems", "smartermeter-#{version}")
144
+ FileUtils.mkdir_p(dest_dir)
145
+ FileUtils.cp_r(src_dir, dest_dir)
146
+
147
+ dest = File.join(File.dirname(__FILE__), "pkg", "base", "gems", "specifications", "smartermeter-#{version}.gemspec")
148
+ FileUtils.cp(File.join(File.dirname(__FILE__), "smartermeter.gemspec"), dest)
149
+
150
+ dest_dir = File.join(File.dirname(__FILE__), "pkg", "base")
151
+ FileUtils.cp(File.join(File.dirname(__FILE__), "installer", "main.rb"), dest_dir)
152
+
153
+ dest_dir = File.join(File.dirname(__FILE__), "pkg", "base", "icons")
154
+ FileUtils.mkdir_p(dest_dir)
155
+ FileUtils.cp(Dir.glob(File.join(File.dirname(__FILE__), "icons", "*.png")), dest_dir)
156
+ end
157
+
158
+ task :nsis_installer do
159
+ nsis_file = File.join(File.dirname(__FILE__), "installer", "nsis.nsi")
160
+ `makensis -DVERSION=#{version} #{nsis_file}`
161
+ end
162
+
163
+ desc "Package all required files into pkg/base"
164
+ task :package => [:fetch_jruby, :fetch_launch4j, :package_gems, :create_launcher, :copy_smartermeter, :nsis_installer]
165
+
117
166
  #############################################################################
118
167
  #
119
168
  # Packaging tasks
@@ -159,7 +208,6 @@ task :gemspec => :validate do
159
208
  sort.
160
209
  reject { |file| file =~ /^\./ }.
161
210
  reject { |file| file =~ /^(rdoc|pkg)/ }.
162
- reject { |file| file =~ /^rawr/ }.
163
211
  reject { |file| file =~ /\.jar$/ }.
164
212
  map { |file| " #{file}" }.
165
213
  join("\n")
Binary file
Binary file
Binary file