appsta 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,18 +3,20 @@ Manifest.txt
3
3
  PostInstall.txt
4
4
  README.rdoc
5
5
  Rakefile
6
- bin/appsta
7
6
  lib/appsta.rb
7
+ lib/appsta/default_files.rb
8
8
  lib/appsta/heroku.rb
9
9
  lib/appsta/github.rb
10
10
  lib/appsta/git.rb
11
- lib/template.rb
11
+ lib/appsta/jquery.rb
12
12
  resources/README.erb
13
13
  resources/index.html.erb
14
14
  script/console
15
15
  script/destroy
16
16
  script/generate
17
+ test/test_default_files.rb
17
18
  test/test_heroku.rb
18
19
  test/test_github.rb
19
20
  test/test_git.rb
20
21
  test/test_helper.rb
22
+ test/test_jquery.rb
@@ -1,7 +1,7 @@
1
1
  = appsta
2
2
 
3
3
  * http://appsta.com
4
- * http://github.com/edraper/appsta
4
+ * http://github.com/ejdraper/appsta
5
5
 
6
6
  == DESCRIPTION:
7
7
 
@@ -10,23 +10,19 @@
10
10
  == FEATURES:
11
11
 
12
12
  * It provides a helper library for writing Rails templates, to quickly setup your projects on Heroku, GitHub, and other things to get your app up and running quickly.
13
- * It also provides a command line tool to quickly create applications using a default template that uses the Appsta helper library to get you up to speed nice and quickly.
14
13
 
15
14
  == SYNOPSIS:
16
15
 
17
- * You can create a new applicaion using the default Appsta template by running the following from the command line:
18
-
19
- appsta <app_name>
20
-
21
- * You can also use the Appsta helper methods in your own templates, by requiring the Appsta library and loading it within the template:
16
+ * You can use the Appsta helper methods in your own templates, by requiring the Appsta library and loading it within the template:
22
17
 
23
18
  require "appsta"
24
19
  Appsta.load
25
20
 
26
- * For an idea of the functionality available within the template helpers, look at the default template that the Appsta command line tool uses.
21
+ * For an idea of the functionality available within the template helpers, please review the helpers defined in lib/appsta, or take a look at the docs on GitHub.
27
22
 
28
23
  == REQUIREMENTS:
29
24
 
25
+ * rails (v2.3 and above)
30
26
  * heroku
31
27
  * rest_client
32
28
 
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'rubygems' unless ENV['NO_RUBYGEMS']
2
- %w[rake rake/clean fileutils newgem rubigen].each { |f| require f }
2
+ %w[rake rake/clean fileutils newgem rubigen hoe].each { |f| require f }
3
3
  require File.dirname(__FILE__) + '/lib/appsta'
4
4
 
5
5
  # Generate all the Rake tasks
@@ -14,7 +14,8 @@ $hoe = Hoe.new('appsta', Appsta::VERSION) do |p|
14
14
  ]
15
15
  p.extra_dev_deps = [
16
16
  ['newgem', ">= #{::Newgem::VERSION}"]
17
- ]
17
+ ]
18
+ p.summary = "Appsta is designed to make bootstrapping new Rails applications much easier."
18
19
 
19
20
  p.clean_globs |= %w[**/.DS_Store tmp *.log]
20
21
  path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
@@ -1,13 +1,17 @@
1
+ require File.join(File.dirname(__FILE__), "appsta", "default_files")
1
2
  require File.join(File.dirname(__FILE__), "appsta", "heroku")
2
3
  require File.join(File.dirname(__FILE__), "appsta", "github")
3
4
  require File.join(File.dirname(__FILE__), "appsta", "git")
5
+ require File.join(File.dirname(__FILE__), "appsta", "jquery")
4
6
 
5
7
  module Appsta
6
- VERSION = "1.0.0"
7
-
8
+ VERSION = "1.1.0"
9
+
10
+ include Appsta::DefaultFiles
8
11
  include Appsta::Heroku
9
12
  include Appsta::GitHub
10
13
  include Appsta::Git
14
+ include Appsta::JQuery
11
15
 
12
16
  class << self
13
17
  # This loads Appsta so that it's methods are available to the template runner
@@ -0,0 +1,10 @@
1
+ module Appsta
2
+ module DefaultFiles
3
+ # This removes some of the default files that we don't really need for a fresh Rails app
4
+ def remove_default_files
5
+ ["README", "public/index.html", "public/favicon.ico"].each do |path|
6
+ run "rm -f #{path}"
7
+ end
8
+ end
9
+ end
10
+ end
@@ -6,5 +6,12 @@ module Appsta
6
6
  git(:add => ".")
7
7
  git(:commit => "-a -m '#{message}'")
8
8
  end
9
+
10
+ # This pushes to the remotes specified
11
+ def git_push(*remotes)
12
+ remotes.each do |remote|
13
+ git(:push => "#{remote} master")
14
+ end
15
+ end
9
16
  end
10
17
  end
@@ -0,0 +1,9 @@
1
+ module Appsta
2
+ module JQuery
3
+ # This removes existing built-in JS and switches to jQuery for your Rails app
4
+ def use_jquery(version = "1.3.2")
5
+ run "rm -f public/javascripts/*"
6
+ run "curl -s -L http://jqueryjs.googlecode.com/files/jquery-#{version}.min.js > public/javascripts/jquery.js"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,19 @@
1
+ require File.join(File.dirname(__FILE__), "test_helper")
2
+
3
+ class RunDefaultFiles
4
+ include Appsta::DefaultFiles
5
+ end
6
+
7
+ class TestDefaultFiles < Test::Unit::TestCase
8
+ context "Removing default files" do
9
+ setup do
10
+ RunDefaultFiles.any_instance.expects(:run).with("rm -f README")
11
+ RunDefaultFiles.any_instance.expects(:run).with("rm -f public/index.html")
12
+ RunDefaultFiles.any_instance.expects(:run).with("rm -f public/favicon.ico")
13
+ end
14
+
15
+ should "not fail" do
16
+ assert true, RunDefaultFiles.new.remove_default_files
17
+ end
18
+ end
19
+ end
@@ -28,6 +28,20 @@ class TestGit < Test::Unit::TestCase
28
28
  assert true, RunGit.new.git_setup(CUSTOM_MESSAGE)
29
29
  end
30
30
  end
31
+
32
+ context "Pushing Git" do
33
+ should "not fail to a single remote" do
34
+ RunGit.any_instance.expects(:git).with(:push => "origin master")
35
+ assert true, RunGit.new.git_push(:origin)
36
+ end
37
+
38
+ should "not fail to multiple remotes" do
39
+ RunGit.any_instance.expects(:git).with(:push => "origin master")
40
+ RunGit.any_instance.expects(:git).with(:push => "staging master")
41
+ RunGit.any_instance.expects(:git).with(:push => "production master")
42
+ assert true, RunGit.new.git_push(:origin, :staging, :production)
43
+ end
44
+ end
31
45
 
32
46
  # This sets up the mocks common to all contexts
33
47
  def setup_base_mocks
@@ -0,0 +1,23 @@
1
+ require File.join(File.dirname(__FILE__), "test_helper")
2
+
3
+ class RunJQuery
4
+ include Appsta::JQuery
5
+ end
6
+
7
+ class TestJQuery < Test::Unit::TestCase
8
+ context "Switching to jQuery" do
9
+ setup do
10
+ RunJQuery.any_instance.expects(:run).with("rm -f public/javascripts/*")
11
+ end
12
+
13
+ should "not fail" do
14
+ RunJQuery.any_instance.expects(:run).with("curl -s -L http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js > public/javascripts/jquery.js")
15
+ assert true, RunJQuery.new.use_jquery
16
+ end
17
+
18
+ should "not fail for a specific version of jQuery" do
19
+ RunJQuery.any_instance.expects(:run).with("curl -s -L http://jqueryjs.googlecode.com/files/jquery-1.3.3.min.js > public/javascripts/jquery.js")
20
+ assert true, RunJQuery.new.use_jquery("1.3.3")
21
+ end
22
+ end
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsta
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliott Draper
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-13 00:00:00 +01:00
12
+ date: 2009-12-21 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 1.4.1
43
+ version: 1.5.2
44
44
  version:
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: hoe
@@ -50,49 +50,50 @@ dependencies:
50
50
  requirements:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: 1.8.0
53
+ version: 2.3.2
54
54
  version:
55
- description: "* Appsta is designed to make bootstrapping new Rails applications much easier."
55
+ description: ""
56
56
  email:
57
57
  - el@ejdraper.com
58
- executables:
59
- - appsta
58
+ executables: []
59
+
60
60
  extensions: []
61
61
 
62
62
  extra_rdoc_files:
63
63
  - History.txt
64
64
  - Manifest.txt
65
65
  - PostInstall.txt
66
- - README.rdoc
67
66
  files:
68
67
  - History.txt
69
68
  - Manifest.txt
70
69
  - PostInstall.txt
71
70
  - README.rdoc
72
71
  - Rakefile
73
- - bin/appsta
74
72
  - lib/appsta.rb
73
+ - lib/appsta/default_files.rb
75
74
  - lib/appsta/heroku.rb
76
75
  - lib/appsta/github.rb
77
76
  - lib/appsta/git.rb
78
- - lib/template.rb
77
+ - lib/appsta/jquery.rb
79
78
  - resources/README.erb
80
79
  - resources/index.html.erb
81
80
  - script/console
82
81
  - script/destroy
83
82
  - script/generate
83
+ - test/test_default_files.rb
84
84
  - test/test_heroku.rb
85
85
  - test/test_github.rb
86
86
  - test/test_git.rb
87
87
  - test/test_helper.rb
88
+ - test/test_jquery.rb
88
89
  has_rdoc: true
89
- homepage: http://appsta.com
90
+ homepage:
90
91
  licenses: []
91
92
 
92
93
  post_install_message: PostInstall.txt
93
94
  rdoc_options:
94
95
  - --main
95
- - README.rdoc
96
+ - README.txt
96
97
  require_paths:
97
98
  - lib
98
99
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -110,13 +111,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
111
  requirements: []
111
112
 
112
113
  rubyforge_project: appsta
113
- rubygems_version: 1.3.2
114
+ rubygems_version: 1.3.5
114
115
  signing_key:
115
116
  specification_version: 3
116
- summary: "* Appsta is designed to make bootstrapping new Rails applications much easier."
117
+ summary: Appsta is designed to make bootstrapping new Rails applications much easier.
117
118
  test_files:
118
119
  - test/test_appsta.rb
120
+ - test/test_default_files.rb
119
121
  - test/test_git.rb
120
122
  - test/test_github.rb
121
123
  - test/test_helper.rb
122
124
  - test/test_heroku.rb
125
+ - test/test_jquery.rb
data/bin/appsta DELETED
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # Load what we need
4
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
5
- require "rubygems"
6
- require "appsta"
7
-
8
- # Display the Appsta version
9
- def display_version
10
- puts "Appsta (#{Appsta::VERSION})"
11
- end
12
-
13
- # Handle the help command, also display it when no arguments are specified
14
- if ARGV.empty? || ARGV[0] == "-h" || ARGV[0] == "--help"
15
- display_version
16
- puts " -h, --help : display this help message"
17
- puts " -v, --version : display the Appsta version"
18
- puts " appsta <name> : create a Rails application using Appsta with the specified name"
19
- puts ""
20
- puts "By default, Appsta will initialize a local Git repository, setup your application"
21
- puts "on Heroku with two environments (production and staging) and will also setup your"
22
- puts "project repository on GitHub. It will also setup some useful gems and libraries."
23
- elsif ARGV[0] == "-v" || ARGV[0] == "--version"
24
- # This displays the Appsta version
25
- display_version
26
- elsif ARGV[0][0...1] == "-"
27
- # This handles unknown commands
28
- display_version
29
- puts "Unknown command #{ARGV[0]}"
30
- else
31
- # This actually creates the application specified
32
- display_version
33
- puts "Creating application #{ARGV[0]}"
34
- Kernel.system "rails -m #{File.join(File.dirname(__FILE__), "..", "lib", "template.rb")} #{ARGV[0]}"
35
- end
@@ -1,45 +0,0 @@
1
- require "appsta"
2
- Appsta.load
3
-
4
- # This works out the name of the app
5
- name = File.basename(Dir.pwd)
6
-
7
- # Remove certain files
8
- ["README", "public/index.html", "public/favicon.ico", "public/javascripts/*"].each do |path|
9
- run "rm -f #{path}"
10
- end
11
-
12
- # Grab jQuery for use in the app
13
- run "curl -s -L http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js > public/javascripts/jquery.js"
14
-
15
- # Setup the gems we want, including the creation of the Heroku gem manifest
16
- gems = [
17
- {:name => "thoughtbot-shoulda", :lib => "shoulda", :source => "http://gems.github.com"},
18
- {:name => "mocha"},
19
- {:name => "cucumber"},
20
- {:name => "hpricot"},
21
- {:name => "authlogic"}
22
- ]
23
- heroku_gems gems
24
-
25
- # Install all the gems we need
26
- rake "gems:install", :sudo => true
27
-
28
- # Setup the Git repo
29
- git_setup
30
-
31
- # Setup the app on Heroku
32
- heroku_urls = []
33
- [:production, :staging].each { |env| heroku_urls << heroku(env) }
34
-
35
- # Setup the project repo on GitHub
36
- github_url = github
37
-
38
- # Setup the index.html and README files that Appsta auto-generates
39
- file "README", ERB.new(File.read(File.join(Appsta.resources_path, "README.erb"))).result(binding)
40
- file "public/index.html", ERB.new(File.read(File.join(Appsta.resources_path, "index.html.erb"))).result(binding)
41
-
42
- # Update the git repo with our changes and push them
43
- git :add => "."
44
- git :commit => "-a -m 'added README and public/index.html'"
45
- [:origin, :production, :staging].each { |remote| git(:push => "#{remote} master") }