laravel 0.2.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +10 -7
- data/bin/commands/config.rb +33 -0
- data/bin/commands/install.rb +32 -0
- data/bin/commands/new.rb +45 -0
- data/bin/laravel +39 -64
- data/features/S_1_new.feature +13 -13
- data/features/S_2_generate_key.feature +3 -4
- data/features/S_3_update_index.feature +3 -3
- data/features/S_4_generator.feature +5 -5
- data/features/step_definitions/laravel.rb +66 -48
- data/features/support/env.rb +1 -0
- data/features/support/laravel_helpers.rb +70 -31
- data/laravel.gemspec +1 -1
- data/lib/laravel.rb +4 -4
- data/lib/laravel/app.rb +95 -0
- data/lib/laravel/app_support.rb +282 -0
- data/lib/laravel/configuration.rb +119 -0
- data/lib/laravel/installer.rb +61 -0
- data/lib/laravel/version.rb +1 -1
- metadata +11 -9
- data/lib/laravel/create.rb +0 -121
- data/lib/laravel/helpers.rb +0 -59
- data/lib/laravel/info.rb +0 -45
- data/lib/laravel/manage.rb +0 -89
- data/repositories/.gitkeep +0 -0
data/lib/laravel/manage.rb
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
module Laravel
|
2
|
-
class Manage
|
3
|
-
# modify the Application Index for application
|
4
|
-
#
|
5
|
-
# * *Args* :
|
6
|
-
# - +new_index+ -> the new Application Index
|
7
|
-
# - +app_directory+ -> the directory of the Laravel app, defaults to current working directory
|
8
|
-
#
|
9
|
-
def self.update_index(new_index, app_directory = nil)
|
10
|
-
if change_configuration(/'index' => '.*'/, "'index' => '#{new_index}'", app_directory)
|
11
|
-
Laravel::say_success "Changed Application Index."
|
12
|
-
else
|
13
|
-
Laravel::say_failed "Could not change Application Index!"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
# generates a new key for the application
|
18
|
-
#
|
19
|
-
# * *Args* :
|
20
|
-
# - +app_directory+ -> the directory of the Laravel app, defaults to current working directory
|
21
|
-
#
|
22
|
-
def self.generate_key(app_directory = nil)
|
23
|
-
# 32 char long md5-ed hash
|
24
|
-
new_key = (0...32).map{ ('a'..'z').to_a[rand(26)] }.join
|
25
|
-
new_key = Laravel::crypted_name(new_key)
|
26
|
-
|
27
|
-
# show an appropriate message to the user.
|
28
|
-
if change_configuration(/'key' => '.*'/, "'key' => '#{new_key}'", app_directory)
|
29
|
-
Laravel::say_success "Generated a new key."
|
30
|
-
else
|
31
|
-
Laravel::say_failed "Could not generate a new key!"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# download the Laravel Generator by Jeffrey Way
|
36
|
-
#
|
37
|
-
# * *Args* :
|
38
|
-
# - +app_directory+ -> the directory of the Laravel app, defaults to current working directory
|
39
|
-
#
|
40
|
-
def self.get_generator(app_directory = nil)
|
41
|
-
# default to current working directory if path is not specified
|
42
|
-
app_directory ||= Dir.pwd
|
43
|
-
|
44
|
-
# get the path to the tasks folder
|
45
|
-
tasks_directory = File.expand_path(File.join(app_directory, %w[ application tasks ]))
|
46
|
-
|
47
|
-
# download the Laravel Generator
|
48
|
-
generator_url = "https://raw.github.com/JeffreyWay/Laravel-Generator/master/generate.php"
|
49
|
-
generator_file = File.join(tasks_directory, "generate.php")
|
50
|
-
success = case
|
51
|
-
when `which curl` then system("curl -s #{generator_url} > #{generator_file}")
|
52
|
-
when `which wget` then system("wget -s #{generator_url} -O #{generator_file}")
|
53
|
-
else false
|
54
|
-
end
|
55
|
-
|
56
|
-
# display appropriate output to the user
|
57
|
-
if success
|
58
|
-
Laravel::say_success "Downloaded Laravel Generator by Jeffrey Way"
|
59
|
-
else
|
60
|
-
Laravel::say_failed "Could not download Laravel Generator"
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
private
|
65
|
-
|
66
|
-
def self.change_configuration(match, replace, app_directory = nil)
|
67
|
-
# default to current working directory if path is not specified
|
68
|
-
app_directory ||= Dir.pwd
|
69
|
-
|
70
|
-
# try to change configuration only if this is a Laravel application
|
71
|
-
if Laravel::has_laravel? app_directory
|
72
|
-
# file path to the configuration file
|
73
|
-
config_file = %w[ application config application.php ]
|
74
|
-
config_file = File.expand_path(File.join(app_directory, config_file))
|
75
|
-
|
76
|
-
# perform substitution
|
77
|
-
text = File.read config_file
|
78
|
-
text = text.gsub(match, replace)
|
79
|
-
File.open(config_file, "w") {|file| file.puts text}
|
80
|
-
|
81
|
-
# check to ensure we were able to update configuration
|
82
|
-
File.readlines(config_file).grep(/#{replace}/).any?
|
83
|
-
else
|
84
|
-
Laravel::say_error "Is this a valid Laravel application?"
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
89
|
-
end
|
data/repositories/.gitkeep
DELETED
File without changes
|