newjs 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,10 @@
1
+ == 1.0.2 2008-02-15
2
+
3
+ * newjs:
4
+ * rake release VERSION=X.Y.Z to push dist+pkg to rubyforge
5
+ * website:
6
+ * added 'how to configure website upload'
7
+
1
8
  == 1.0.1 2008-02-15
2
9
 
3
10
  * 1 major bugfix:
@@ -16,6 +16,7 @@ app_generators/newjs/templates/script/js_autotest
16
16
  app_generators/newjs/templates/script/rstakeout
17
17
  app_generators/newjs/templates/src/HEADER.erb
18
18
  app_generators/newjs/templates/src/library.js.erb
19
+ app_generators/newjs/templates/tasks/deploy.rake
19
20
  app_generators/newjs/templates/tasks/environment.rake
20
21
  app_generators/newjs/templates/tasks/javascript_test_autotest_tasks.rake
21
22
  app_generators/newjs/templates/test/assets/prototype.js
@@ -37,7 +37,7 @@ class NewjsGenerator < RubiGen::Base
37
37
  # m.template "template.rb", "some_file_after_erb.rb"
38
38
  # m.file "file", "some_file_copied"
39
39
  m.file_copy_each %w[unittest.css unittest.js prototype.js], "test/assets"
40
- m.file_copy_each %w[javascript_test_autotest_tasks.rake environment.rake], "tasks"
40
+ m.file_copy_each %w[javascript_test_autotest_tasks.rake environment.rake deploy.rake], "tasks"
41
41
  m.file_copy_each %w[javascript_test_autotest.yml.sample], "config"
42
42
  m.file_copy_each %w[protodoc.rb jstest.rb], "lib"
43
43
  m.file_copy_each %w[README.txt]
@@ -12,11 +12,15 @@ require 'rake/packagetask'
12
12
 
13
13
  $:.unshift File.dirname(__FILE__) + "/lib"
14
14
 
15
+ APP_VERSION = '<%= version_str %>'
16
+ APP_NAME = '<%= name %>'
17
+ RUBYFORGE_PROJECT = APP_NAME
18
+ APP_FILE_NAME= "#{APP_NAME}.js"
19
+
15
20
  APP_ROOT = File.expand_path(File.dirname(__FILE__))
16
21
  APP_SRC_DIR = File.join(APP_ROOT, 'src')
17
22
  APP_DIST_DIR = File.join(APP_ROOT, 'dist')
18
23
  APP_PKG_DIR = File.join(APP_ROOT, 'pkg')
19
- APP_VERSION = '<%= version_str %>'
20
24
 
21
25
 
22
26
  unless ENV['rakefile_just_config']
@@ -29,21 +33,24 @@ task :dist do
29
33
  require 'protodoc'
30
34
  require 'fileutils'
31
35
  FileUtils.mkdir_p APP_DIST_DIR
32
-
36
+
33
37
  Dir.chdir(APP_SRC_DIR) do
34
- File.open(File.join(APP_DIST_DIR, '<%= name %>.js'), 'w+') do |dist|
35
- dist << Protodoc::Preprocessor.new('<%= name %>.js')
38
+ File.open(File.join(APP_DIST_DIR, APP_FILE_NAME), 'w+') do |dist|
39
+ dist << Protodoc::Preprocessor.new(APP_FILE_NAME)
36
40
  end
37
41
  end
42
+ Dir.chdir(APP_DIST_DIR) do
43
+ FileUtils.copy_file APP_FILE_NAME, "#{APP_NAME}-#{APP_VERSION}.js"
44
+ end
38
45
  end
39
46
 
40
- Rake::PackageTask.new('<%= name %>', APP_VERSION) do |package|
47
+ Rake::PackageTask.new(APP_NAME, APP_VERSION) do |package|
41
48
  package.need_tar_gz = true
42
49
  package.package_dir = APP_PKG_DIR
43
50
  package.package_files.include(
44
51
  '[A-Z]*',
45
52
  'config/*.sample',
46
- 'dist/<%= name %>.js',
53
+ "dist/#{APP_FILE_NAME}",
47
54
  'lib/**',
48
55
  'src/**',
49
56
  'script/**',
@@ -62,24 +69,24 @@ JavaScriptTestTask.new(:test_units) do |t|
62
69
  testcases = ENV['TESTCASES']
63
70
  tests_to_run = ENV['TESTS'] && ENV['TESTS'].split(',')
64
71
  browsers_to_test = ENV['BROWSERS'] && ENV['BROWSERS'].split(',')
65
-
72
+
66
73
  t.mount("/dist")
67
74
  t.mount("/src")
68
75
  t.mount("/test")
69
-
76
+
70
77
  Dir["test/*_test.html"].sort.each do |test_file|
71
78
  tests = testcases ? { :url => "/#{test_file}", :testcases => testcases } : "/#{test_file}"
72
79
  test_filename = test_file[/.*\/(.+?)\.html/, 1]
73
80
  t.run(tests) unless tests_to_run && !tests_to_run.include?(test_filename)
74
81
  end
75
-
82
+
76
83
  %w( safari firefox ie konqueror opera ).each do |browser|
77
84
  t.browser(browser.to_sym) unless browsers_to_test && !browsers_to_test.include?(browser)
78
85
  end
79
86
  end
80
87
 
81
88
  task :clean_package_source do
82
- rm_rf File.join(APP_PKG_DIR, "'<%= name %>'-#{APP_VERSION}")
89
+ rm_rf File.join(APP_PKG_DIR, "#{APP_NAME}-#{APP_VERSION}")
83
90
  end
84
91
 
85
92
  Dir['tasks/**/*.rake'].each { |rake| load rake }
@@ -0,0 +1,29 @@
1
+ desc 'Package and upload the release to rubyforge.'
2
+ task :release => [:clean, :dist, :package] do |t|
3
+ require 'rubyforge'
4
+ version = APP_VERSION
5
+ name = APP_NAME
6
+ rubyforge_name = RUBYFORGE_PROJECT
7
+ v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
8
+ abort "Versions don't match #{v} vs #{version}" if v != version
9
+ pkg = "pkg/#{name}-#{version}"
10
+
11
+ if $DEBUG then
12
+ puts "release_id = rf.add_release #{rubyforge_name.inspect}, #{name.inspect}, #{version.inspect}, \"#{pkg}.tgz\""
13
+ puts "rf.add_file #{rubyforge_name.inspect}, #{name.inspect}, release_id, \"#{pkg}.gem\""
14
+ end
15
+
16
+ rf = RubyForge.new
17
+ puts "Logging in"
18
+ rf.login
19
+
20
+ c = rf.userconfig
21
+ c["release_notes"] = APP_DESCRIPTION if Object.const_defined?("APP_DESCRIPTION")
22
+ c["release_changes"] = APP_CHANGES if Object.const_defined?("APP_CHANGES")
23
+ c["preformatted"] = true
24
+
25
+ files = ["#{pkg}.tar.gz", "dist/#{name}-#{version}.js"].compact
26
+
27
+ puts "Releasing #{name} v. #{version}"
28
+ rf.add_release rubyforge_name, name, version, *files
29
+ end
@@ -2,7 +2,7 @@ module Newjs #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -44,6 +44,7 @@ class TestNewjsGenerator < Test::Unit::TestCase
44
44
  assert_generated_file "script/js_autotest"
45
45
  assert_generated_file "tasks/javascript_test_autotest_tasks.rake"
46
46
  assert_generated_file "tasks/environment.rake"
47
+ assert_generated_file "tasks/deploy.rake"
47
48
  assert_generated_file "config/javascript_test_autotest.yml.sample"
48
49
  assert_generated_file "src/myproject.js"
49
50
  assert_generated_file "src/HEADER"
@@ -33,7 +33,7 @@
33
33
  <h1>JavaScript Project Generator</h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/newjs"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/newjs" class="numbers">1.0.1</a>
36
+ <a href="http://rubyforge.org/projects/newjs" class="numbers">1.0.2</a>
37
37
  </div>
38
38
  <h1>&#x2192; &#8216;newjs&#8217;</h1>
39
39
 
@@ -220,15 +220,53 @@ The project&#8217;s version number is automatically inserted into the page
220
220
  (change version numbers via <code>APP_VERSION</code> in <code>Rakefile</code>).</p>
221
221
 
222
222
 
223
+ <h3>Configuration of website upload</h3>
224
+
225
+
226
+ <p>It is assumed you will upload your website files to rubyforge.org server.
227
+ To push files to an alternate server, modify the <code>tasks/website.rake</code> file.</p>
228
+
229
+
230
+ <p>To configure which rubyforge project to upload to, create <code>config/website.yml</code>.
231
+ There is an example in <code>code/website.yml.sample</code>.</p>
232
+
233
+
234
+ <p>An example might be:</p>
235
+
236
+
237
+ <pre>host: nicwilliams@rubyforge.org
238
+ remote_dir: /var/www/gforge-projects/drnicutilities/drnic_js_test_helpers
239
+ </pre>
240
+
241
+ <p>Here, the files will be uploaded into the <code>drnicutilities</code> rubyforge
242
+ project, under a sub-directory <code>drnic_js_test_helpers</code>. This site
243
+ would be visible at <a href="http://drnicutilities.rubyforge.org/drnic_js_test_helpers">http://drnicutilities.rubyforge.org/drnic_js_test_helpers</a></p>
244
+
245
+
246
+ <p>If your website lives in its own rubyforge project, then just specify the project
247
+ name, and the website will be uploaded into the root folder.</p>
248
+
249
+
250
+ <p>For example, the website would be available at <a href="http://drnicutilities.rubyforge.org/">http://drnicutilities.rubyforge.org/</a> if your
251
+ configuration was:</p>
252
+
253
+
254
+ <pre>host: nicwilliams@rubyforge.org
255
+ remote_dir: /var/www/gforge-projects/drnicutilities
256
+ </pre>
257
+
258
+ <h3>Uploading website to server</h3>
259
+
260
+
223
261
  <p>To upload the website (and its <span class="caps">CSS</span> etc) run:</p>
224
262
 
225
263
 
226
- <pre>rake website</pre>
264
+ <pre>rake website_upload</pre>
265
+
266
+ <p>More commonly, to generate and upload the website:</p>
227
267
 
228
- <p>The default <code>tasks/website.rake</code> file pushes the files
229
- to a <a href="http://rubyforge.org">rubyforge.org</a> project account. Modify it
230
- to rsync files elsewhere.</p>
231
268
 
269
+ <pre>rake website</pre>
232
270
 
233
271
  <h2>Screencast coming soon</h2>
234
272
 
@@ -241,6 +279,17 @@ and you&#8217;ll love every minute of it.</p>
241
279
  <p>Subscribe to PeepCode&#8217;s blog for announcement details.</p>
242
280
 
243
281
 
282
+ <h2>Examples</h2>
283
+
284
+
285
+ <p>The development of <code>newjs</code> was done in parallel with
286
+ <a href="http://drnicutilities.rubyforge.org/drnic_js_test_helpers/">Dr Nic&#8217;s JavaScript Test Helpers</a>
287
+ (source: <a href="http://github.com/drnic/drnic_js_test_helpers/tree/master">git</a>).</p>
288
+
289
+
290
+ <p>Checkout this project to see examples of unit tests, configuration etc.</p>
291
+
292
+
244
293
  <h2>Forum</h2>
245
294
 
246
295
 
@@ -150,13 +150,43 @@ And open <code>website/index.html</code> in your browser to preview.
150
150
  The project's version number is automatically inserted into the page
151
151
  (change version numbers via <code>APP_VERSION</code> in <code>Rakefile</code>).
152
152
 
153
+ h3. Configuration of website upload
154
+
155
+ It is assumed you will upload your website files to rubyforge.org server.
156
+ To push files to an alternate server, modify the <code>tasks/website.rake</code> file.
157
+
158
+ To configure which rubyforge project to upload to, create <code>config/website.yml</code>.
159
+ There is an example in <code>code/website.yml.sample</code>.
160
+
161
+ An example might be:
162
+
163
+ <pre>host: nicwilliams@rubyforge.org
164
+ remote_dir: /var/www/gforge-projects/drnicutilities/drnic_js_test_helpers
165
+ </pre>
166
+
167
+ Here, the files will be uploaded into the <code>drnicutilities</code> rubyforge
168
+ project, under a sub-directory <code>drnic_js_test_helpers</code>. This site
169
+ would be visible at "http://drnicutilities.rubyforge.org/drnic_js_test_helpers":http://drnicutilities.rubyforge.org/drnic_js_test_helpers
170
+
171
+ If your website lives in its own rubyforge project, then just specify the project
172
+ name, and the website will be uploaded into the root folder.
173
+
174
+ For example, the website would be available at "http://drnicutilities.rubyforge.org/":http://drnicutilities.rubyforge.org/ if your
175
+ configuration was:
176
+
177
+ <pre>host: nicwilliams@rubyforge.org
178
+ remote_dir: /var/www/gforge-projects/drnicutilities
179
+ </pre>
180
+
181
+ h3. Uploading website to server
182
+
153
183
  To upload the website (and its CSS etc) run:
154
184
 
155
- <pre>rake website</pre>
185
+ <pre>rake website_upload</pre>
156
186
 
157
- The default <code>tasks/website.rake</code> file pushes the files
158
- to a "rubyforge.org":http://rubyforge.org project account. Modify it
159
- to rsync files elsewhere.
187
+ More commonly, to generate and upload the website:
188
+
189
+ <pre>rake website</pre>
160
190
 
161
191
  h2. Screencast coming soon
162
192
 
@@ -166,6 +196,14 @@ and you'll love every minute of it.
166
196
 
167
197
  Subscribe to PeepCode's blog for announcement details.
168
198
 
199
+ h2. Examples
200
+
201
+ The development of <code>newjs</code> was done in parallel with
202
+ "Dr Nic's JavaScript Test Helpers":http://drnicutilities.rubyforge.org/drnic_js_test_helpers/
203
+ (source: "git":http://github.com/drnic/drnic_js_test_helpers/tree/master).
204
+
205
+ Checkout this project to see examples of unit tests, configuration etc.
206
+
169
207
  h2. Forum
170
208
 
171
209
  "http://groups.google.com/group/javascript-project-generator":http://groups.google.com/group/javascript-project-generator
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newjs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dr Nic Williams
@@ -82,6 +82,7 @@ files:
82
82
  - app_generators/newjs/templates/script/rstakeout
83
83
  - app_generators/newjs/templates/src/HEADER.erb
84
84
  - app_generators/newjs/templates/src/library.js.erb
85
+ - app_generators/newjs/templates/tasks/deploy.rake
85
86
  - app_generators/newjs/templates/tasks/environment.rake
86
87
  - app_generators/newjs/templates/tasks/javascript_test_autotest_tasks.rake
87
88
  - app_generators/newjs/templates/test/assets/prototype.js