tog-tog 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,13 +1,18 @@
1
1
  Edge
2
2
  ----
3
+ * Changed the list_specs based on files by one based on classes
4
+ * togify: Use github's tarballs instead of a git clone to a) remove git dependecy on togify and b) use a tagged release of tog plugins instead of the edge
5
+
6
+ 0.3.0
7
+ ----
3
8
  * Rubigen dependency added to gemspec.
9
+
4
10
  0.2.1
5
11
  ----
6
12
  * [#89 status:resolved] From now tog:plugins:copy_resources don't copy .svn dirs to app's public directory...
7
13
  * tog-desert dependency added.
8
14
  * New `--development` flag on togify. This'll clone the tog core plugins from `git@github.com:tog/#{plugin}.git` instead of `git://github.com/tog/#{plugin}.git` allowing developers to change tog plugins inside a togified app.
9
15
 
10
-
11
16
  0.2.0
12
17
  -----
13
18
  * Initial public code release
@@ -1,3 +1,6 @@
1
+ require 'tog'
2
+ require 'zip/zip'
3
+
1
4
  class TogifyGenerator < RubiGen::Base
2
5
 
3
6
  DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
@@ -106,12 +109,59 @@ EOS
106
109
  end
107
110
 
108
111
  def checkout_code(plugin_path, plugin)
109
- repository = options[:development] ? "git@github.com:tog/#{plugin}.git": "git://github.com/tog/#{plugin}.git"
112
+ options[:development] ? clone_repo(plugin_path, plugin): tarball_repo(plugin_path, plugin)
113
+ end
114
+ # "vendor/plugins/tog_core", "tog_core"
115
+ def tarball_repo(plugin_path, plugin)
116
+ uri = "http://github.com/tog/#{plugin}/zipball/v#{Tog::Version::STRING}"
117
+ zip = tarball_fetch(uri)
118
+ tarball_unpack(zip, plugin)
119
+ end
120
+
121
+ def tarball_fetch(uri, redirect_limit = 10)
122
+ raise ArgumentError, "HTTP redirect too deep trying to get #{uri}" if redirect_limit == 0
123
+ response = Net::HTTP.get_response(URI.parse(uri))
124
+ case response
125
+ when Net::HTTPSuccess
126
+ temp_zip = Time.now.to_i.to_s
127
+ open(temp_zip, "wb") { |file|
128
+ file.write(response.read_body)
129
+ }
130
+ temp_zip
131
+ when Net::HTTPRedirection then tarball_fetch(response['location'], redirect_limit - 1)
132
+ else
133
+ tarball_fetch(uri, redirect_limit - 1)
134
+ end
135
+ end
136
+
137
+ def tarball_unpack(file, plugin)
138
+ destination = "#{destination_root}/vendor/plugins"
139
+ begin
140
+ Zip::ZipFile.open(file) { |zip_file|
141
+ zip_file.each { |f|
142
+ f_path=File.join(destination, f.name)
143
+ FileUtils.mkdir_p(File.dirname(f_path))
144
+ zip_file.extract(f, f_path) unless File.exist?(f_path)
145
+ }
146
+ }
147
+ temp = Dir.glob(File.join(destination, "tog-#{plugin}*")).first
148
+ FileUtils.mv temp, File.join(destination, plugin)
149
+ FileUtils.rm_rf file
150
+
151
+ rescue Exception => e
152
+ logger.error "There has been a problem trying to unpack the #{plugin} tarball downloaded from github. Remove the changes made on your app by togify and try again. Sorry for the inconveniences."
153
+ exit -1
154
+ end
155
+ end
156
+
157
+ def clone_repo(plugin_path, plugin)
158
+ repository = "git@github.com:tog/#{plugin}.git"
110
159
  revision = "head"
111
-
112
160
  FileUtils.rm_rf(plugin_path)
113
161
  system("git clone #{repository} #{plugin_path}")
114
162
  end
163
+
164
+
115
165
  def current_migration_number(plugin_path)
116
166
  Dir.glob("#{plugin_path}/db/migrate/*.rb").inject(0) do |max, file_path|
117
167
  n = File.basename(file_path).split('_', 2).first.to_i
data/bin/togify CHANGED
@@ -5,7 +5,7 @@ require 'rubigen'
5
5
 
6
6
  if %w(-v --version).include? ARGV.first
7
7
  require 'tog/version'
8
- puts "#{File.basename($0)} #{Tog::VERSION::STRING}"
8
+ puts "#{File.basename($0)} #{Tog::Version::STRING}"
9
9
  exit(0)
10
10
  end
11
11
 
data/config/hoe.rb CHANGED
@@ -10,13 +10,15 @@ GEM_NAME = 'tog'
10
10
  EXTRA_DEPENDENCIES = [
11
11
  ['mislav-will_paginate', '>= 2.3.2'],
12
12
  ['rubigen', '>= 1.3.2'],
13
- ['tog-desert', '>= 0.3.4']
13
+ ['tog-desert', '>= 0.3.4'],
14
+ ['RedCloth', '>= 3.0.4'],
15
+ ['rubyzip', '>= 0.9.1']
14
16
  ]
15
17
 
16
18
  REV = nil
17
19
  # UNCOMMENT IF REQUIRED:
18
20
  # REV = YAML.load(`svn info`)['Revision']
19
- VERS = Tog::VERSION::STRING + (REV ? ".#{REV}" : "")
21
+ VERS = Tog::Version::STRING + (REV ? ".#{REV}" : "")
20
22
 
21
23
  class Hoe
22
24
  def extra_deps
@@ -1,6 +1,6 @@
1
1
  namespace :tog do
2
2
  namespace :plugins do
3
-
3
+
4
4
  desc "Update the tog plugins on this app. This will pull the changes on the HEAD of every tog plugins on your app. Use PLUGIN=plugin_name to update a specific plugin."
5
5
  task :update do
6
6
  plugin_roots(ENV["PLUGIN"]).each do |directory|
@@ -10,7 +10,7 @@ namespace :tog do
10
10
  end
11
11
  end
12
12
  end
13
-
13
+
14
14
  desc "Install a new tog plugin. Use PLUGIN parameter to specify the plugin to install e.g. PLUGIN=tog_vault. Use FORCE=true to overwrite the plugin if it's currently installed."
15
15
  task :install do
16
16
  plugin = ENV["PLUGIN"]
@@ -20,7 +20,7 @@ namespace :tog do
20
20
  cmd << " --force" if force
21
21
  output = %x{#{cmd}}
22
22
  puts "Generating migration to integrate #{plugin} in the app"
23
-
23
+
24
24
  to_version=Dir.glob("#{RAILS_ROOT}/vendor/plugins/#{plugin}/db/migrate/*.rb").inject(0) do |max, file_path|
25
25
  n = File.basename(file_path).split('_', 2).first.to_i
26
26
  if n > max then n else max end
@@ -28,13 +28,13 @@ namespace :tog do
28
28
  from_version=0
29
29
  cmd = "script/generate tog_migration Integrate#{plugin.classify}Version#{to_version}From#{from_version}"
30
30
  output = %x{#{cmd}}
31
-
31
+
32
32
  end
33
33
 
34
34
  desc "Copy the public resources stored on the /public folder of every tog plugin on the app's public folder with the plugin name used as prefix. Pass PLUGIN=plugin_name to copy the resources of a single plugin."
35
35
  task :copy_resources do
36
36
  plugin_roots(ENV["PLUGIN"]).each do |directory|
37
- plugin_name = File.basename(directory)
37
+ plugin_name = File.basename(directory)
38
38
  dest_public_dir = File.join(RAILS_ROOT, "public", plugin_name)
39
39
  orig_public_dir = File.join(directory, "public")
40
40
  if File.exists?(orig_public_dir)
@@ -68,7 +68,7 @@ namespace :tog do
68
68
  require 'test/unit'
69
69
  require 'rubygems'
70
70
  require 'active_support'
71
-
71
+
72
72
  # bug in test unit. Set to true to stop from running.
73
73
  Test::Unit.run = true
74
74
 
@@ -78,7 +78,7 @@ namespace :tog do
78
78
  test_files = Dir.glob(File.join('test', '**', '*_test.rb'))
79
79
  test_files.each do |file|
80
80
  load file
81
- klass = File.basename(file, '.rb').classify.constantize
81
+ klass = File.read(file)[/class\s(.*Test)\s</, 1].constantize
82
82
 
83
83
  puts klass.name.gsub('Test', '')
84
84
 
data/lib/tog/version.rb CHANGED
@@ -1,18 +1,19 @@
1
1
  module Tog
2
- module VERSION #:nodoc:
3
- MAJOR = 0
4
- MINOR = 2
5
- TINY = 1
6
- # http://en.wikipedia.org/wiki/Moons_of_Jupiter
7
- CODENAME = 'Adrastea'
8
- STRING = [MAJOR, MINOR, TINY].join('.')
9
-
10
- class << self
11
- def to_s
12
- "#{CODENAME} #{STRING}"
13
- end
14
- alias :to_str :to_s
2
+ module Version
3
+ MAJOR = 0
4
+ MINOR = 3
5
+ TINY = 0
6
+ MODULE = "Amalthea"
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
+
9
+ class << self
10
+ def to_s
11
+ STRING
15
12
  end
16
-
13
+ def full_version
14
+ "#{MODULE} #{STRING}"
15
+ end
16
+ alias :to_str :to_s
17
17
  end
18
+ end
18
19
  end
data/tog.gemspec CHANGED
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{tog}
3
- s.version = "0.2.1"
3
+ s.version = "0.3.0"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Aitor Garc\303\255a", "Alberto Molpeceres", "Roberto Salicio"]
7
- s.date = %q{2008-09-27}
7
+ s.date = %q{2008-10-15}
8
8
  s.default_executable = %q{togify}
9
9
  s.description = %q{extensible open source social network platform}
10
10
  s.email = ["aitor@linkingpaths.com", "alberto@linkingpaths.com", "roberto@linkingpaths.com"]
@@ -32,17 +32,20 @@ For more information on tog, see https://github.com/tog/tog
32
32
  s.add_runtime_dependency(%q<mislav-will_paginate>, [">= 2.3.2"])
33
33
  s.add_runtime_dependency(%q<rubigen>, [">= 1.3.2"])
34
34
  s.add_runtime_dependency(%q<tog-desert>, [">= 0.3.4"])
35
+ s.add_runtime_dependency(%q<RedCloth>, [">= 3.0.4"])
35
36
  s.add_development_dependency(%q<hoe>, [">= 1.7.0"])
36
37
  else
37
38
  s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.2"])
38
39
  s.add_dependency(%q<rubigen>, [">= 1.3.2"])
39
40
  s.add_dependency(%q<tog-desert>, [">= 0.3.4"])
41
+ s.add_dependency(%q<RedCloth>, [">= 3.0.4"])
40
42
  s.add_dependency(%q<hoe>, [">= 1.7.0"])
41
43
  end
42
44
  else
43
45
  s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.2"])
44
46
  s.add_dependency(%q<rubigen>, [">= 1.3.2"])
45
47
  s.add_dependency(%q<tog-desert>, [">= 0.3.4"])
48
+ s.add_dependency(%q<RedCloth>, [">= 3.0.4"])
46
49
  s.add_dependency(%q<hoe>, [">= 1.7.0"])
47
50
  end
48
- end
51
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tog-tog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Aitor Garc\xC3\xADa"
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2008-09-27 00:00:00 -07:00
14
+ date: 2008-10-15 00:00:00 -07:00
15
15
  default_executable: togify
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
@@ -41,6 +41,15 @@ dependencies:
41
41
  - !ruby/object:Gem::Version
42
42
  version: 0.3.4
43
43
  version:
44
+ - !ruby/object:Gem::Dependency
45
+ name: RedCloth
46
+ version_requirement:
47
+ version_requirements: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: 3.0.4
52
+ version:
44
53
  - !ruby/object:Gem::Dependency
45
54
  name: hoe
46
55
  version_requirement: