You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/about/getting_started.markdown
+28-3Lines changed: 28 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,7 @@ After that you should be able to check your directory list in fog or your filesy
65
65
66
66
## Next Steps
67
67
68
-
Using the same interface you can also practice working against a real provider (such as Amazon S3). Rather than worrying about signing up for an account right away though, we can use mocks to simulate S3 while we practice.
68
+
Using the same interface you can also practice working against a real provider (such as Amazon S3). Rather than worrying about signing up for an account right away though, we can use mocks to simulate S3 while we practice.
69
69
70
70
This time we will turn on mocking and then, just like before, we will need to make a connection.
71
71
@@ -76,8 +76,33 @@ This time we will turn on mocking and then, just like before, we will need to ma
76
76
:provider => 'AWS'
77
77
})
78
78
79
-
You may notice that we used bogus credentials, this is fine since we are just simulating things. To use real S3 you can simply omit `Fog.mock!` and swap in your real credentials.
79
+
You may notice that we used bogus credentials, this is fine since we are just simulating things. To use real S3 you can simply omit Fog.mock! and swap in your real credentials.
80
80
81
-
Once you have your connection you can go through all the steps you did before, only now you will be working against a real cloud service (or at least a simulated one).
81
+
If you'd like to turn off mocking after turning it on, you can do it at any time and every subsequent connection will be a real connection.
82
+
83
+
# Turn on mocking
84
+
Fog.mock!
85
+
86
+
# Create a mock connection to S3
87
+
storage = Fog::Storage.new({
88
+
:aws_access_key_id => "asdf",
89
+
:aws_secret_access_key => "asdf",
90
+
:provider => "AWS"
91
+
})
92
+
93
+
# Turn off mocking
94
+
Fog.unmock!
95
+
96
+
# Create a real connection to S3
97
+
storage = Fog::Storage.new({
98
+
:aws_access_key_id => "asdf",
99
+
:aws_secret_access_key => "asdf",
100
+
:provider => "AWS"
101
+
})
102
+
103
+
Don't worry about your losing mock data, it stays around until you reset it or until your process exits.
104
+
105
+
# Reset all mock data
106
+
Fog::Mock.reset
82
107
83
108
Congratulations and welcome to the cloud! Continue your journey at [fog.io](http://fog.io)
0 commit comments