appscrolls 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/.rspec +2 -0
- data/.travis.yml +6 -0
- data/ChangeLog.md +63 -0
- data/Gemfile +3 -0
- data/Guardfile +18 -0
- data/MIT_LICENSE +20 -0
- data/README.md +154 -0
- data/Rakefile +78 -0
- data/appscrolls.gemspec +32 -0
- data/bin/appscrolls +7 -0
- data/features/step_definitions/common_steps.rb +211 -0
- data/features/support/common.rb +51 -0
- data/features/support/env.rb +18 -0
- data/lib/appscrolls.rb +10 -0
- data/lib/appscrolls/command.rb +85 -0
- data/lib/appscrolls/config.rb +86 -0
- data/lib/appscrolls/scroll.rb +106 -0
- data/lib/appscrolls/scrolls.rb +38 -0
- data/lib/appscrolls/template.rb +67 -0
- data/lib/rails/generators/.DS_Store +0 -0
- data/lib/rails/generators/run_template/USAGE +13 -0
- data/lib/rails/generators/run_template/run_template_generator.rb +13 -0
- data/sample.rb +75 -0
- data/scrolls/active_admin.rb +19 -0
- data/scrolls/capybara.rb +34 -0
- data/scrolls/cucumber.rb +21 -0
- data/scrolls/delayed_job.rb +94 -0
- data/scrolls/env_yaml.rb +53 -0
- data/scrolls/eycloud.rb +72 -0
- data/scrolls/eycloud_recipes_on_deploy.rb +20 -0
- data/scrolls/git.rb +17 -0
- data/scrolls/github.rb +38 -0
- data/scrolls/guard.rb +75 -0
- data/scrolls/jquery.rb +11 -0
- data/scrolls/mysql.rb +51 -0
- data/scrolls/passenger.rb +11 -0
- data/scrolls/postgresql.rb +54 -0
- data/scrolls/prototype.rb +21 -0
- data/scrolls/puma.rb +11 -0
- data/scrolls/rails_basics.rb +54 -0
- data/scrolls/redis.rb +19 -0
- data/scrolls/resque.rb +59 -0
- data/scrolls/rspec.rb +21 -0
- data/scrolls/simple_form.rb +19 -0
- data/scrolls/split.rb +35 -0
- data/scrolls/spork.rb +19 -0
- data/scrolls/sqlite3.rb +10 -0
- data/scrolls/test_unit.rb +11 -0
- data/scrolls/thin.rb +10 -0
- data/scrolls/twitter_bootstrap.rb +41 -0
- data/scrolls/unicorn.rb +10 -0
- data/scrolls/zzz/activerecord.rb +69 -0
- data/scrolls/zzz/cancan.rb +16 -0
- data/scrolls/zzz/carrierwave.rb +42 -0
- data/scrolls/zzz/carrierwave_direct.rb +13 -0
- data/scrolls/zzz/cartographer.rb +33 -0
- data/scrolls/zzz/devise.rb +52 -0
- data/scrolls/zzz/devise_invitable.rb +23 -0
- data/scrolls/zzz/event_calendar.rb +12 -0
- data/scrolls/zzz/factory_girl.rb +38 -0
- data/scrolls/zzz/ffaker.rb +22 -0
- data/scrolls/zzz/fixture_builder.rb +35 -0
- data/scrolls/zzz/forgery.rb +15 -0
- data/scrolls/zzz/haml.rb +11 -0
- data/scrolls/zzz/heroku.rb +58 -0
- data/scrolls/zzz/hoptoad.rb +34 -0
- data/scrolls/zzz/inherited_resources.rb +12 -0
- data/scrolls/zzz/intercom.rb +35 -0
- data/scrolls/zzz/jammit.rb +43 -0
- data/scrolls/zzz/jasmine.rb +12 -0
- data/scrolls/zzz/mini_magick.rb +13 -0
- data/scrolls/zzz/mongo_mapper.rb +20 -0
- data/scrolls/zzz/mongohq.rb +61 -0
- data/scrolls/zzz/mongoid.rb +20 -0
- data/scrolls/zzz/mootools.rb +23 -0
- data/scrolls/zzz/newrelic.rb +11 -0
- data/scrolls/zzz/nifty_generators.rb +21 -0
- data/scrolls/zzz/oa_oauth.rb +12 -0
- data/scrolls/zzz/omniauth.rb +55 -0
- data/scrolls/zzz/paper_trail.rb +17 -0
- data/scrolls/zzz/pow.rb +12 -0
- data/scrolls/zzz/rails_admin.rb +22 -0
- data/scrolls/zzz/rails_dev_tweaks.rb +10 -0
- data/scrolls/zzz/rails_erd.rb +9 -0
- data/scrolls/zzz/rails_footnotes.rb +14 -0
- data/scrolls/zzz/ransack.rb +32 -0
- data/scrolls/zzz/rmagick.rb +13 -0
- data/scrolls/zzz/sass.rb +13 -0
- data/scrolls/zzz/sequel.rb +13 -0
- data/scrolls/zzz/settingslogic.rb +43 -0
- data/scrolls/zzz/shoulda_matchers.rb +11 -0
- data/scrolls/zzz/sidekiq.rb +23 -0
- data/scrolls/zzz/slim.rb +11 -0
- data/scrolls/zzz/thinking_sphinx.rb +14 -0
- data/scrolls/zzz/vanity.rb +35 -0
- data/spec/appscrolls/config_spec.rb +99 -0
- data/spec/appscrolls/scroll_spec.rb +103 -0
- data/spec/appscrolls/scrolls/sanity_spec.rb +30 -0
- data/spec/appscrolls/scrolls_spec.rb +24 -0
- data/spec/appscrolls/template_spec.rb +57 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/support/rails_directory.rb +17 -0
- data/spec/support/template_runner.rb +28 -0
- data/templates/helpers.erb +45 -0
- data/templates/layout.erb +44 -0
- data/templates/new_scroll.erb +28 -0
- data/templates/scroll.erb +10 -0
- data/version.rb +3 -0
- metadata +297 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/ChangeLog.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# ChangeLog
|
2
|
+
|
3
|
+
New
|
4
|
+
|
5
|
+
* `split` - AB testing promoed in RailsCasts
|
6
|
+
* `spork` - clean running of tests
|
7
|
+
* `resque` - always includes admin dashboard
|
8
|
+
|
9
|
+
Fixed
|
10
|
+
|
11
|
+
* `cucumber` - creates databases before running installer
|
12
|
+
|
13
|
+
Internal
|
14
|
+
|
15
|
+
* Replace ZenTest with Guard
|
16
|
+
* Add 'rake list:categories' task
|
17
|
+
|
18
|
+
## v0.6
|
19
|
+
|
20
|
+
* `twitter_bootstrap` - automatically includes `simple_form`; includes flash msg
|
21
|
+
* `github` - asks for a new repo name if cannot create a repository
|
22
|
+
* `rails_basics` - default flash message
|
23
|
+
* `jquery` & `prototype` - former is already default in Rails 3.1+ now
|
24
|
+
|
25
|
+
New
|
26
|
+
* `guard` - guard support for all supported scrolls
|
27
|
+
* `postgresql`
|
28
|
+
* All untested scrolls moved into scrolls/zzz
|
29
|
+
|
30
|
+
## v0.5
|
31
|
+
|
32
|
+
* `twitter_bootstrap` - based on public RailsCast
|
33
|
+
* `eycloud` - now using `ey_cli` to create/boot environments
|
34
|
+
|
35
|
+
## v0.4
|
36
|
+
|
37
|
+
* SCROLLS ARE IN, "recipes" are out. Wizards use scrolls. Alchemists use recipes.
|
38
|
+
* Scrolls have no dependencies on `eycloud` or `eycloud_recipes_on_deploy`; these are optional
|
39
|
+
* `github` - GitHub repository creation
|
40
|
+
* `resque` + `delayed_job` can install their admin consoles
|
41
|
+
* `sidekiq` - high performance, low cost alternative to `resque` or `delayed_job`
|
42
|
+
|
43
|
+
## v0.3
|
44
|
+
|
45
|
+
* Engine Yard support - Resque
|
46
|
+
* Removed a bunch of recipes that didn't see useful/common
|
47
|
+
|
48
|
+
### v0.3.1
|
49
|
+
|
50
|
+
* Resque recipe works a treat.
|
51
|
+
|
52
|
+
Try this on EY Cloud! `appscrolls new demomysql -r sqlite3 mysql resque rails_basics git`
|
53
|
+
|
54
|
+
## v0.2
|
55
|
+
|
56
|
+
Merged lots of branches/forks
|
57
|
+
|
58
|
+
## v0.2.1
|
59
|
+
|
60
|
+
* Cleaned up many recipes
|
61
|
+
* Added :website attribute to recipes
|
62
|
+
* Convert all recipes to use supported categories
|
63
|
+
|
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
guard 'cucumber' do
|
2
|
+
watch(%r{^features/.+\.feature$})
|
3
|
+
watch(%r{^features/support/.+$}) { 'features' }
|
4
|
+
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
|
5
|
+
end
|
6
|
+
|
7
|
+
guard 'rspec', :version => 2 do
|
8
|
+
watch(%r{^spec/.+_spec\.rb$})
|
9
|
+
watch(%r{^scrolls/(.+)\.rb$}) { |m| "spec/appscrolls/scrolls/sanity_spec.rb" }
|
10
|
+
watch(%r{^lib/appscrolls/(.+)\.rb$}) { |m| "spec/appscrolls/#{m[1]}_spec.rb" }
|
11
|
+
watch('spec/spec_helper.rb') { "spec" }
|
12
|
+
end
|
13
|
+
|
14
|
+
guard 'bundler' do
|
15
|
+
watch('Gemfile')
|
16
|
+
watch(/^.+\.gemspec/)
|
17
|
+
end
|
18
|
+
|
data/MIT_LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Dr Nic Williams and Engine Yard LLC
|
2
|
+
Copyright (c) 2010 Michael Bleigh and Intridea, Inc.
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
6
|
+
in the Software without restriction, including without limitation the rights
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
9
|
+
furnished to do so, subject to the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
12
|
+
all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
# The App Scrolls for creating and transforming Rails apps
|
2
|
+
|
3
|
+
```
|
4
|
+
___ ____ ____
|
5
|
+
/ _ | ___ ___ / __/__________ / / /__
|
6
|
+
/ __ |/ _ \/ _ \ _\ \/ __/ __/ _ \/ / (_-<
|
7
|
+
/_/ |_/ .__/ .__/ /___/\__/_/ \___/_/_/___/
|
8
|
+
/_/ /_/
|
9
|
+
```
|
10
|
+
|
11
|
+
The App Scrolls is a magical tool to generate new Rails and modify existing Rails applications (coming) to include your favourite, powerful magic. Authentication, testing, persistence, javascript, css, deployment, and templating - there's a magical scroll for you.
|
12
|
+
|
13
|
+
* Follow on twitter [@appscrolls][9]
|
14
|
+
|
15
|
+
An example application that was built by the App Scrolls is at [https://github.com/drnic/mydemoapp][14]. The generated README shows all the scrolls that were included.
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
Installation is simple:
|
20
|
+
|
21
|
+
gem install appscrolls
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
The primary usage of the `appscrolls` gem is to utilize its interactive terminal command to build a new Rails application. To get started, you can simply run the command thusly:
|
26
|
+
|
27
|
+
appscrolls new APP_NAME
|
28
|
+
|
29
|
+
Where `APP_NAME` is the directory in which you wish to create the app (it mirrors the Rails creation syntax). You will then be guided through the scroll selection process and subsequently the Rails app generator will automatically run with the template and all appropriate command line options included.
|
30
|
+
|
31
|
+
To transform an existing Rails app, you ... wait, that's not implemented yet. But since the "apply template" feature of `rails new APP_NAME -m template.rb` is implemented in Thor, I mean, how hard could it be?*
|
32
|
+
|
33
|
+
### Specifying Scrolls
|
34
|
+
|
35
|
+
If you wish to skip the interactive scroll selector, you may provide instead a list of scrolls with the `-s` or `--scrolls` option:
|
36
|
+
|
37
|
+
appscrolls new APP_NAME -s twitter_bootstrap mysql resque
|
38
|
+
appscrolls new APP_NAME --scrolls postgresql github eycloud
|
39
|
+
|
40
|
+
This will automatically generate a Rails template with the provided scrolls and begin the app generator.
|
41
|
+
|
42
|
+
### Listing Scrolls
|
43
|
+
|
44
|
+
You can also print out a simple list of scrolls:
|
45
|
+
|
46
|
+
appscrolls list
|
47
|
+
|
48
|
+
Or print out a list of scrolls for a specific category:
|
49
|
+
|
50
|
+
appscrolls list persistence
|
51
|
+
|
52
|
+
## Deployment Support
|
53
|
+
|
54
|
+
Web applications are boring if they aren't running proudly on the internet. The App Scrolls make this automatic for your favourite providers!
|
55
|
+
|
56
|
+
### Engine Yard
|
57
|
+
|
58
|
+
Scroll: `eycloud`
|
59
|
+
|
60
|
+
If you choose the `eycloud` scroll, your application will be automatically deployed to [Engine Yard Cloud][6]. Your code will also be automatically stored on a private/public GitHub repository.
|
61
|
+
|
62
|
+
The `eycloud` scroll magically transforms many other scrolls to work specifically for [Engine Yard Cloud][6]. For example:
|
63
|
+
|
64
|
+
* `postgresql` - the environment will have PostgreSQL selected instead of MySQL
|
65
|
+
* `resque` - the environment will have Resque and Redis
|
66
|
+
|
67
|
+
### Heroku
|
68
|
+
|
69
|
+
The App Scrolls needs a Heroku Master to support Heroku for the App Scrolls.
|
70
|
+
|
71
|
+
There is some initial work in the [current scrolls][11] and the [archived/unsupported scrolls][12]
|
72
|
+
|
73
|
+
### CloudFoundry
|
74
|
+
|
75
|
+
The App Scrolls needs a CloudFoundry Master to support CloudFoundry for the App Scrolls.
|
76
|
+
|
77
|
+
## Authoring Scrolls of Magical Mystery
|
78
|
+
|
79
|
+
Create new scrolls using:
|
80
|
+
|
81
|
+
rake new NAME=scroll-name
|
82
|
+
|
83
|
+
Submitting a scroll is actually a very straightforward process. Scrolls are made of up **template code** and **YAML back-matter** stored in a ruby file. The `__END__` parsing convention is used so that each scroll is actually a valid, parseable Ruby file. The structure of a scroll looks something like this:
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
gem 'supergem'
|
87
|
+
|
88
|
+
after_bundler do
|
89
|
+
generate "supergem:install"
|
90
|
+
end
|
91
|
+
|
92
|
+
__END__
|
93
|
+
|
94
|
+
category: templating
|
95
|
+
name: SuperGem
|
96
|
+
description: Installs SuperGem which is useful for things
|
97
|
+
author: mbleigh
|
98
|
+
```
|
99
|
+
|
100
|
+
It's really that simple. The gem has RSpec tests that automatically validate each scroll in the repository, so you should run `rake spec` as a basic sanity check before submitting a pull request. Note that these don't verify that your scroll code itself works, just that App Scrolls could properly parse and understand your scroll file.
|
101
|
+
|
102
|
+
## History
|
103
|
+
|
104
|
+
This project is an old fashioned fork of [Michael Bleigh][5]'s [Rails Wizard][4]. A new name, new project, and new purpose.
|
105
|
+
|
106
|
+
This project wouldn't exist without Michael having created [Rails Wizard][4] during Rails Rumble and maintaining and upgrading it for a long time. Sadly support dropped off, several recipes did not work with Rails 3.1+,
|
107
|
+
|
108
|
+
[Dr Nic][7] originally worked on [Rails Wizard][4] to provide [Engine Yard Cloud][6] support, his employer and his favourite hosting platform. He also merged in a lot of recipes from other forks, and added new recipes for modern projects.
|
109
|
+
|
110
|
+
Support for Engine Yard Cloud meant integration with Chef Recipes. This meant confusing language - Rails Wizard Recipes and Chef Recipes. He decided that wizards don't use recipes - they use scrolls. Alchemists use recipes. And screw alchemists and their dinky potions. Recipes became Scrolls.
|
111
|
+
|
112
|
+
## Future
|
113
|
+
|
114
|
+
* Automatically setup Continuous Integration for new applications - branches "jenkins"
|
115
|
+
* Interactive mode is a wizard by categories "pick A, B, C or none"
|
116
|
+
* Apply scrolls to existing Rails applications - branch "[apply_scrolls][13]"*
|
117
|
+
* Scrolls work or fail fast on Heroku
|
118
|
+
* Scrolls work or fail fast on CloudFoundry
|
119
|
+
* Scrolls generate their own README - branch "readmes"
|
120
|
+
* 3rd party services/add-ons enabled within deployment platform or directly with service
|
121
|
+
* Padrino / Sinatra applications
|
122
|
+
* Non-Ruby applications (Lithium for PHP, etc)
|
123
|
+
|
124
|
+
Missing scrolls
|
125
|
+
|
126
|
+
* MongoDB - branch "mongodb"
|
127
|
+
* OmniAuth - branch "omniauth"
|
128
|
+
* Sidekiq - branch "sidekiq"
|
129
|
+
|
130
|
+
How hard could it be?
|
131
|
+
|
132
|
+
* `*` 'How hard could it be to transform applications?' - pretty hard. Scrolls need to be aware of the current code base, rather than merely the list of other scrolls being used to create a new app. Scrolls also need to know about versions of Rails rather than just latest rails.
|
133
|
+
|
134
|
+
## Thanks
|
135
|
+
|
136
|
+
ASCII banner - http://www.network-science.de/ascii/ using 'smslant' font.
|
137
|
+
|
138
|
+
## License
|
139
|
+
|
140
|
+
App Scrolls and its scrolls are distributed under the MIT License. See [MIT_LICENSE][10] for the actual words.
|
141
|
+
|
142
|
+
[1]:http://appscrolls.org/
|
143
|
+
[2]:https://github.com/drnic/appscrolls
|
144
|
+
[2]:https://github.com/drnic/appscrolls/tree/master/scrolls
|
145
|
+
[4]:https://github.com/intridea/rails_wizard
|
146
|
+
[5]:https://github.com/mbleigh
|
147
|
+
[6]:http://www.engineyard.com/products/cloud
|
148
|
+
[7]:http://drnicwilliams.com
|
149
|
+
[9]:https://twitter.com/elderscrolls
|
150
|
+
[10]:https://github.com/drnic/appscrolls/blob/master/MIT_LICENSE
|
151
|
+
[11]:https://github.com/drnic/appscrolls/tree/master/scrolls
|
152
|
+
[12]:https://github.com/drnic/appscrolls/tree/master/scrolls/zzz
|
153
|
+
[13]:https://github.com/drnic/appscrolls/tree/apply_scrolls
|
154
|
+
[14]:https://github.com/drnic/mydemoapp
|
data/Rakefile
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
5
|
+
desc "run specs"
|
6
|
+
RSpec::Core::RakeTask.new
|
7
|
+
|
8
|
+
task :default => :spec
|
9
|
+
|
10
|
+
|
11
|
+
desc "Remove the test_run Rails app (if it's there)"
|
12
|
+
task :clean do
|
13
|
+
system 'rm -rf test_run'
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Execute a test run with the specified scrolls."
|
17
|
+
task :run => :clean do
|
18
|
+
scrolls = ENV['SCROLLS'].split(',')
|
19
|
+
|
20
|
+
require 'tempfile'
|
21
|
+
require 'appscrolls'
|
22
|
+
|
23
|
+
template = AppScrollsScrolls::Template.new(scrolls)
|
24
|
+
|
25
|
+
begin
|
26
|
+
dir = Dir.mktmpdir "rails_template"
|
27
|
+
Dir.chdir(dir) do
|
28
|
+
file = File.open('template.rb', 'w')
|
29
|
+
file.write template.compile
|
30
|
+
file.close
|
31
|
+
|
32
|
+
system "rails new test_run -m template.rb #{template.args.join(' ')}"
|
33
|
+
|
34
|
+
puts "\n\n cd #{dir} # look at the app"
|
35
|
+
puts "#{ENV['EDITOR']} #{dir} # edit the app"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
desc "Prints out a template from the provided scrolls."
|
41
|
+
task :print do
|
42
|
+
require 'appscrolls'
|
43
|
+
|
44
|
+
scrolls = ENV['SCROLLS'].split(',')
|
45
|
+
puts AppScrollsScrolls::Template.new(scrolls).compile
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "Create a new scroll"
|
49
|
+
task :new do
|
50
|
+
unless (name = ENV['NAME']) && name.size > 0
|
51
|
+
$stderr.puts "USAGE: rake new NAME=scroll-name"
|
52
|
+
exit 1
|
53
|
+
end
|
54
|
+
require 'active_support/inflector'
|
55
|
+
require 'erb'
|
56
|
+
require 'appscrolls/template'
|
57
|
+
scroll = AppScrollsScrolls::Template.render("new_scroll", binding)
|
58
|
+
scroll_path = "scrolls/#{name}.rb"
|
59
|
+
File.open(scroll_path, "w") { |file| file << scroll }
|
60
|
+
`open #{scroll_path}`
|
61
|
+
end
|
62
|
+
|
63
|
+
namespace :list do
|
64
|
+
desc "Display scrolls by category"
|
65
|
+
task :categories do
|
66
|
+
require 'appscrolls'
|
67
|
+
categories = AppScrollsScrolls::Scrolls.categories.sort
|
68
|
+
categories = (categories - ["other"]) + ["other"]
|
69
|
+
categories.each do |category|
|
70
|
+
puts "#{category}: #{AppScrollsScrolls::Scrolls.for(category).join(", ")}"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# desc "Display scrolls by exclusion"
|
75
|
+
# task :exclusions do
|
76
|
+
#
|
77
|
+
# end
|
78
|
+
end
|
data/appscrolls.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require File.dirname(__FILE__) + "/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "appscrolls"
|
7
|
+
s.version = AppScrollsScrolls::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Michael Bleigh", "Dr Nic Williams"]
|
10
|
+
s.email = ["michael@intridea.com", "drnicwilliams@gmail.com"]
|
11
|
+
s.homepage = "http://appscrolls.org/"
|
12
|
+
s.summary = %q{The App Scrolls is a magical tool to generate new Rails and modify existing Rails applications (coming) to include your favourite, powerful magic. }
|
13
|
+
s.description = %q{The App Scrolls is a magical tool to generate new Rails and modify existing Rails applications (coming) to include your favourite, powerful magic. }
|
14
|
+
|
15
|
+
s.add_dependency "i18n"
|
16
|
+
s.add_dependency "json", "1.6.5"
|
17
|
+
s.add_dependency "activesupport", "~> 3.0"
|
18
|
+
s.add_dependency "thor"
|
19
|
+
s.add_development_dependency "rspec", "~> 2.5.0"
|
20
|
+
s.add_development_dependency "guard-rspec"
|
21
|
+
s.add_development_dependency "cucumber"
|
22
|
+
s.add_development_dependency "guard-cucumber"
|
23
|
+
s.add_development_dependency "bundler", "~> 1.1.0"
|
24
|
+
s.add_development_dependency "guard-bundler"
|
25
|
+
s.add_development_dependency "rails", "~> 3.0"
|
26
|
+
|
27
|
+
s.files = `git ls-files`.split("\n")
|
28
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
29
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
30
|
+
s.require_paths = ["lib"]
|
31
|
+
end
|
32
|
+
|
data/bin/appscrolls
ADDED
@@ -0,0 +1,211 @@
|
|
1
|
+
Given /^this project is active project folder/ do
|
2
|
+
@active_project_folder = File.expand_path(File.dirname(__FILE__) + "/../..")
|
3
|
+
end
|
4
|
+
|
5
|
+
Given /^env variable \$([\w_]+) set to( project path|) "(.*)"/ do |env_var, path, value|
|
6
|
+
in_project_folder {
|
7
|
+
value = File.expand_path(value)
|
8
|
+
} unless path.empty?
|
9
|
+
ENV[env_var] = value
|
10
|
+
end
|
11
|
+
|
12
|
+
Given /"(.*)" folder is deleted/ do |folder|
|
13
|
+
in_project_folder { FileUtils.rm_rf folder }
|
14
|
+
end
|
15
|
+
|
16
|
+
When /^I invoke "(.*)" generator with arguments "(.*)"$/ do |generator, arguments|
|
17
|
+
@stdout = StringIO.new
|
18
|
+
in_project_folder do
|
19
|
+
if Object.const_defined?("APP_ROOT")
|
20
|
+
APP_ROOT.replace(FileUtils.pwd)
|
21
|
+
else
|
22
|
+
APP_ROOT = FileUtils.pwd
|
23
|
+
end
|
24
|
+
run_generator(generator, arguments.split(' '), SOURCES, :stdout => @stdout)
|
25
|
+
end
|
26
|
+
File.open(File.join(@tmp_root, "generator.out"), "w") do |f|
|
27
|
+
@stdout.rewind
|
28
|
+
f << @stdout.read
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
When /^I run executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
33
|
+
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
34
|
+
in_project_folder do
|
35
|
+
system "#{executable.inspect} #{arguments} > #{@stdout.inspect} 2> #{@stdout.inspect}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
When /^I run project executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
40
|
+
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
41
|
+
in_project_folder do
|
42
|
+
system "ruby -rubygems #{executable.inspect} #{arguments} > #{@stdout.inspect} 2> #{@stdout.inspect}"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
When /^I run local executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
47
|
+
if executable == "appscrolls"
|
48
|
+
require 'appscrolls'
|
49
|
+
require 'appscrolls/command'
|
50
|
+
in_project_folder do
|
51
|
+
stdout, stderr = capture_stdios do
|
52
|
+
Engineyard::Jenkins::CLI.start(arguments.split(/ /))
|
53
|
+
end
|
54
|
+
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
55
|
+
File.open(@stdout, "w") {|f| f << stdout; f << stderr}
|
56
|
+
end
|
57
|
+
else
|
58
|
+
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
59
|
+
executable = File.expand_path(File.join(File.dirname(__FILE__), "/../../bin", executable))
|
60
|
+
in_project_folder do
|
61
|
+
system "ruby -rubygems #{executable.inspect} #{arguments} > #{@stdout.inspect} 2> #{@stdout.inspect}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
When /^I invoke task "rake (.*)"/ do |task|
|
67
|
+
@stdout = File.expand_path(File.join(@tmp_root, "tests.out"))
|
68
|
+
in_project_folder do
|
69
|
+
system "bundle exec rake #{task} --trace > #{@stdout.inspect} 2> #{@stdout.inspect}"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
Then /^folder "(.*)" (is|is not) created/ do |folder, is|
|
74
|
+
in_project_folder do
|
75
|
+
File.exists?(folder).should(is == 'is' ? be_true : be_false)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
Then /^file "(.*)" (is|is not) created/ do |file, is|
|
80
|
+
in_project_folder do
|
81
|
+
File.exists?(file).should(is == 'is' ? be_true : be_false)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
Then /^file with name matching "(.*)" is created/ do |pattern|
|
86
|
+
in_project_folder do
|
87
|
+
Dir[pattern].should_not be_empty
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
Then /^file "(.*)" contents (does|does not) match \/(.*)\// do |file, does, regex|
|
92
|
+
in_project_folder do
|
93
|
+
actual_output = File.read(file)
|
94
|
+
(does == 'does') ?
|
95
|
+
actual_output.should(match(/#{regex}/)) :
|
96
|
+
actual_output.should_not(match(/#{regex}/))
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
Then /^file "([^"]*)" contains "([^"]*)"$/ do |file, text|
|
101
|
+
in_project_folder do
|
102
|
+
actual_output = File.read(file)
|
103
|
+
actual_output.should contain(text)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
Then /gem file "(.*)" and generated file "(.*)" should be the same/ do |gem_file, project_file|
|
109
|
+
File.exists?(gem_file).should be_true
|
110
|
+
File.exists?(project_file).should be_true
|
111
|
+
gem_file_contents = File.read(File.dirname(__FILE__) + "/../../#{gem_file}")
|
112
|
+
project_file_contents = File.read(File.join(@active_project_folder, project_file))
|
113
|
+
project_file_contents.should == gem_file_contents
|
114
|
+
end
|
115
|
+
|
116
|
+
Then /^(does|does not) invoke generator "(.*)"$/ do |does_invoke, generator|
|
117
|
+
actual_output = get_command_output
|
118
|
+
does_invoke == "does" ?
|
119
|
+
actual_output.should(match(/dependency\s+#{generator}/)) :
|
120
|
+
actual_output.should_not(match(/dependency\s+#{generator}/))
|
121
|
+
end
|
122
|
+
|
123
|
+
Then /help options "(.*)" and "(.*)" are displayed/ do |opt1, opt2|
|
124
|
+
actual_output = get_command_output
|
125
|
+
actual_output.should match(/#{opt1}/)
|
126
|
+
actual_output.should match(/#{opt2}/)
|
127
|
+
end
|
128
|
+
|
129
|
+
Then /^I should see "([^\"]*)"$/ do |text|
|
130
|
+
actual_output = get_command_output
|
131
|
+
actual_output.should contain(text)
|
132
|
+
end
|
133
|
+
|
134
|
+
Then /^I should not see "([^\"]*)"$/ do |text|
|
135
|
+
actual_output =
|
136
|
+
actual_output.should_not contain(text)
|
137
|
+
end
|
138
|
+
|
139
|
+
Then /^I should see$/ do |text|
|
140
|
+
actual_output = get_command_output
|
141
|
+
actual_output.should contain(text)
|
142
|
+
end
|
143
|
+
|
144
|
+
Then /^I should not see$/ do |text|
|
145
|
+
actual_output = get_command_output
|
146
|
+
actual_output.should_not contain(text)
|
147
|
+
end
|
148
|
+
|
149
|
+
Then /^I should see exactly$/ do |text|
|
150
|
+
actual_output = get_command_output
|
151
|
+
actual_output.should == text
|
152
|
+
end
|
153
|
+
|
154
|
+
Then /^I should see all (\d+) tests pass/ do |expected_test_count|
|
155
|
+
expected = %r{^#{expected_test_count} tests, \d+ assertions, 0 failures, 0 errors}
|
156
|
+
actual_output = get_command_output
|
157
|
+
actual_output.should match(expected)
|
158
|
+
end
|
159
|
+
|
160
|
+
Then /^I should see all (\d+) examples pass/ do |expected_test_count|
|
161
|
+
expected = %r{^#{expected_test_count} examples?, 0 failures}
|
162
|
+
actual_output = get_command_output
|
163
|
+
actual_output.should match(expected)
|
164
|
+
end
|
165
|
+
|
166
|
+
Then /^yaml file "(.*)" contains (\{.*\})/ do |file, yaml|
|
167
|
+
in_project_folder do
|
168
|
+
yaml = eval yaml
|
169
|
+
YAML.load(File.read(file)).should == yaml
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
Then /^Rakefile can display tasks successfully/ do
|
174
|
+
@stdout = File.expand_path(File.join(@tmp_root, "rakefile.out"))
|
175
|
+
in_project_folder do
|
176
|
+
system "rake -T > #{@stdout.inspect} 2> #{@stdout.inspect}"
|
177
|
+
end
|
178
|
+
actual_output = get_command_output
|
179
|
+
actual_output.should match(/^rake\s+\w+\s+#\s.*/)
|
180
|
+
end
|
181
|
+
|
182
|
+
Then /^task "rake (.*)" is executed successfully/ do |task|
|
183
|
+
@stdout.should_not be_nil
|
184
|
+
actual_output = get_command_output
|
185
|
+
actual_output.should_not match(/^Don't know how to build task '#{task}'/)
|
186
|
+
actual_output.should_not match(/Error/i)
|
187
|
+
end
|
188
|
+
|
189
|
+
Then /^gem spec key "(.*)" contains \/(.*)\// do |key, regex|
|
190
|
+
in_project_folder do
|
191
|
+
gem_file = Dir["pkg/*.gem"].first
|
192
|
+
gem_spec = Gem::Specification.from_yaml(`gem spec #{gem_file}`)
|
193
|
+
spec_value = gem_spec.send(key.to_sym)
|
194
|
+
spec_value.to_s.should match(/#{regex}/)
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
Then /^the file "([^\"]*)" is a valid gemspec$/ do |filename|
|
199
|
+
spec = eval(File.read(filename))
|
200
|
+
spec.validate
|
201
|
+
end
|
202
|
+
|
203
|
+
When /^I create a new node with the following options on "http:\/\/(.+?):(\d+)":$/ do |host, port, table|
|
204
|
+
options = table.raw.inject({}) do |options, (key, value)|
|
205
|
+
options[(key.to_sym rescue key) || key] = value
|
206
|
+
options
|
207
|
+
end
|
208
|
+
|
209
|
+
Jenkins::Api.setup_base_url(:host => host, :port => port.to_i)
|
210
|
+
Jenkins::Api.add_node(options)
|
211
|
+
end
|